Skip to content

Provides Gradle KtsExec task to run Kotlin scripts

License

Notifications You must be signed in to change notification settings

Tapchicoma/ktsexec-gradle

Repository files navigation

KtsExec Gradle task

Project provides KtsExec Gradle task that runs Kotlin scripts.

CircleCI ktlint Download

Gradle setup

No-op plugin

You can add no-op plugin, that automatically adds KtsExec task type and does nothing more:

plugins {
    id("by.egorr.gradle.ktsexec-plugin") version "1.1.0"
}

repositories {
    // Required for KtsExec task dependencies
    jcenter()
}

Adding task directly

Alternatively, you can add following block to your root build.gradle.kts to get KtsExec task type:

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath("by.egorr.gradle:ktsexec-task:1.1.0")
    }
}

repositories {
    // Required for KtsExec task dependencies
    jcenter()
}

Usage

Start adding tasks, similar to JavaExec:

tasks.create("runSomeScript", by.egorr.gradle.ktsexec.KtsExec::class.java) {
    group = "Scripts"
    script.set(file("scripts/awesome_script.kts"))
}

Check also sample/ directory that provides sample Gradle project.

Script limitations

Current version supports only simple Kotlin scripts, without any advanced use-cases (like external dependencies).

Useful links

About

Provides Gradle KtsExec task to run Kotlin scripts

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages