KScript - Convenient kotlin script wrapper for JVM.

Overview

Last Version Hits-of-Code

KScript

Convenient kotlin script wrapper for JVM.

How it works

Base class

(arguments = arrayOf("test")) }.eval() ">
open class Test(val test: String) // this class will be super class of script.

KScript("println(test)").apply {
    configuration.addClasspath(classpathFromClassOrException(Test::class))
    configuration.setBaseClass<Test>(arguments = arrayOf("test"))
}.eval()

External dependencies

By default, library uses KScriptMavenResolver, but we can change it:

val script = """...""".toKScript()
script.configuration.externalResolvers.mavenResolver = KScriptMavenResolver() // one of the default implementations.
script.eval()

Also, we can cache it:

script.configuration.externalResolver = KScriptCacheableMavenResolver(File("path_to_cache_folder"))

Build caching

val script = "...".toKScript()
script.configuration.buildCacheDirectory = File(path)
script.eval()

Caching depends on the code (based on it, md5 is generated with a cache build) and in order to update the cache, you will need to delete the cache file / folder or update something in the script.

External Scripts

Library provides API to add external scripts into your script runtime. You can do it by includeScript:

val script = text.toKScript()
script.includeScript(other.toKScriptSource())

Or directly in script using @ImportFile annotation:

@file:ImportFile("other.kts")
// ...
// ...
funFromOtherScript()

Implementation

For now not everything is implemented, but it will be available upon request.

repositories {
    maven("https://maven.kotlingang.fun")
}
dependencies {
    implementation("fun.kotlingang.kscript:kscript:$version")
}
You might also like...
Implement a Casper Kotlin SDK to interact with the Casper network.
Implement a Casper Kotlin SDK to interact with the Casper network.

CSPR-Kotlin-SDK Kotlin SDK library for interacting with a CSPR node. What is CSPR-Kotlin-SDK? SDK to streamline the 3rd party Kotlin client integratio

Java/Kotlin WE contract SDK.

we-contract-sdk Java/Kotlin contract SDK used for building Docker smart contracts. All transaction handling is done via methods of a single class mark

Android Word/Letter Tracing SDK is a complet solution to build apps for kids learning in pure kotlin
Android Word/Letter Tracing SDK is a complet solution to build apps for kids learning in pure kotlin

Android Word/Letter Tracing SDK is a complet solution to build apps for kids learning in pure kotlin. It supports all kind of shapes and all language letters e.g. english, arabic, Urdu, hindi etc.

Convenient kotlin script runner

KScript Convenient kotlin script running engine for JVM. Examples Base class: open class Test(val test: String) KScript("println(test)").apply {

Tools for Kotlin/Kscript to easy write shell command line in kotlin code

Kscript Tools Easy way to run shell command line in kotlin and other tools Usage Used in kscript: @file:DependsOn("com.sealwu:kscript-tools:1.0.2") Us

Elegant design and convenient to use RecyclerView adapter library based on Kotlin DSL.
Elegant design and convenient to use RecyclerView adapter library based on Kotlin DSL.

xAdapter: Kotlin DSL 风格的 Adapter 封装 1、简介 该项目是 KotlinDSL 风格的 Adapter 框架封装,用来简化 Adapter 调用,思想是采用工厂和构建者方式获取 Adapter 避免代码中定义大量的 Adapter 类。该项目在 BRVAH 的 Ada

Yaspeller-kt - Asynchronous Yandex.Speller API wrapper for Kotlin/JVM.

yaspeller-kt Asynchronous Yandex.Speller API wrapper for Kotlin/JVM. Installation repositories { maven { url 'https://jitpack.io' }

Asynchronous Spring Initializr API wrapper for Kotlin/JVM

initializr-kt Asynchronous Spring Initializr API wrapper for Kotlin/JVM. This library provides the simplest DSL for initializing Spring Boot projects

Asynchronous Yandex.Predictor API wrapper for Kotlin/JVM.

Asynchronous Yandex.Predictor API wrapper for Kotlin/JVM.

An amazing and convenient Android image slider.

Android Image Slider ![Gitter](https://badges.gitter.im/Join Chat.svg) This is an amazing image slider for the Android platform. I decided to open sou

RecyclerView Adapter Library with different models and different layouts as convenient as possible.
RecyclerView Adapter Library with different models and different layouts as convenient as possible.

RecyclerView Presenter Convenience library to handle different view types with different presenters in a single RecyclerView. How to install repositor

My compose experiments in one convenient location

Made with Compose I've started learning and experimenting with Compose during dev13 build. Since then, Compose first transitioned to alpha, then beta

Load the online comic content supported by any plug-in project to provide a convenient online comic viewing experience
Load the online comic content supported by any plug-in project to provide a convenient online comic viewing experience

kinoko Awesome manga reader. Download Description Load the online comic content supported by any plug-in project to provide a convenient online comic

Light-weighted, convenient implementation of expandable text view that supports expanding & collapsing animations for Android projects

ExpandableTextView Light-weighted, convenient implementation of expandable text view that supports expanding & collapsing animations for Android proje

A convenient library to show a shimmer effect while loading data
A convenient library to show a shimmer effect while loading data

A convenient library to show a shimmer effect while loading data. Easily convert your current view with a slick skeleton loading animation just by wrapping your view.

Android Studio's Vector Drawable conversion tool in convenient packaging.

Vector Drawable Tool This repository is simply a repackaging of the vector drawable tool from the Android Studio source code. The included Gradle file

A convenient BMI (Body Mass Index) calculator that is compatible with Android devices.
A convenient BMI (Body Mass Index) calculator that is compatible with Android devices.

🔖 BMI Calculator A convenient BMI (Body Mass Index) calculator that is compatible with Android devices. 🖥 Please feel free to compute your BMI using

Wynncraft API Wrapper - Simple wrapper to get Wynncraft Stats of a player or a guild and more in Java

WynncraftAPIWrapper Simple wrapper to get Wynncraft Stats of a player or a guild

Releases(0.0.6)
Owner
null
A Notion SDK for Any JVM Language

Notion SDK for Any JVM Language A simple and easy to use client for the Notion API Here is an Notion API SDK for any JVM language users ?? This projec

Kazuhiro Sera 91 Dec 31, 2022
Segmenkt - The SegmenKT Kotlin SDK is a Kotlin-first SDK for Segment

SegmenKT Kotlin SDK The SegmenKT Kotlin SDK is a Kotlin-first SDK for Segment. I

UNiDAYS 0 Nov 25, 2022
HubSpot Kotlin SDK 🧺 Implementation of HubSpot API for Java/Kotlin in tiny SDK

HubSpot Kotlin SDK ?? Implementation of HubSpot API for Java/Kotlin in tiny SDK

BOOM 3 Oct 27, 2022
Its measurement app made using kotlin with sceneform sdk by google

ARCORE MEASUREMENT This app is build using sceneform sdk for android using kotlin language It helps you measure the distance between multiple points i

Kashif Mehmood 39 Dec 9, 2022
Kotlin Multi Platform SDK

Xeon SDK (work-in-progress ?? ??️ ??‍♀️ ⛏ ) Development Version Release This Is Latest Release ~ In Development $version_release = ~ What's New?? * I

Frogobox 3 Oct 15, 2021
NextPay Kotlin SDK

Welcome to nextpay-kt ?? Connect to NextPay.ir payment gateway in easy way. ?? Homepage Setup Kotlin KTS 1- Add mavenCentral() to your repositories se

Farhad 5 Nov 6, 2021
WalletConnect Kotlin SDK v2

WalletConnect V2 - Kotlin Kotlin implementation of WalletConnect v2 protocol for Android applications. Requirements Android min SDK 21 Java 11 Install

WalletConnect Labs 11 Dec 22, 2021
Official Appwrite Kotlin SDK 💙🧡

Appwrite Kotlin SDK This SDK is compatible with Appwrite server version 0.11.x. For older versions, please check previous releases. This is the Kotlin

Appwrite 47 Nov 26, 2022
Log4j2 client protector for kotlin

log4j2-client-protector Minecraft Bungee&Bukkit防止Log4j2(CVE-2021-44228)漏洞入侵玩家客户端 本插件主要作用是在已修复Log4j2漏洞(升级log4j2版本)的服务器上防御其玩家客户端受到侵害 (理论上同时安装bc和bukkit在未

null 4 Jan 21, 2022
Streem Server SDK for Java & Kotlin

Streem Server SDK for Java & Kotlin Server-side JVM library for interacting with the Streem API, and generation of Streem Tokens for use in client SDK

Streem, Inc. 1 Dec 15, 2022