Create task to run kotlin scripts and use it to strip metadata.
This commit is contained in:
+29
-1
@@ -2,12 +2,13 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = "1.1-SNAPSHOT"
|
||||
ext.kotlin_language_version = "1.1"
|
||||
ext.kotlin_gradle_plugin_version = "1.1.1"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.1"
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_gradle_plugin_version}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +30,15 @@ subprojects {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
configurations {
|
||||
scriptCompile
|
||||
scriptRuntime.extendsFrom(scriptCompile)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
scriptCompile "org.jetbrains.kotlin:kotlin-compiler-embeddable:${kotlin_gradle_plugin_version}"
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile) {
|
||||
compilerJarFile = bootstrapCompilerFile
|
||||
}
|
||||
@@ -125,3 +135,21 @@ def createPreprocessorTask(Project project, def name, def sourceDir, def targetD
|
||||
args = [sourceDir, targetDir, profile]
|
||||
}
|
||||
}
|
||||
|
||||
static def createScriptTask(Project project, def name, Closure<JavaExec> configureClosure = null) {
|
||||
JavaExec task = project.tasks.create(name, JavaExec)
|
||||
return project.configure(task) {
|
||||
classpath = project.configurations.scriptCompile
|
||||
main = "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"
|
||||
args = [
|
||||
"-script",
|
||||
"-version",
|
||||
"-no-stdlib",
|
||||
"-cp", project.configurations.scriptRuntime.asPath]
|
||||
|
||||
if (configureClosure != null) {
|
||||
configureClosure.delegate = it
|
||||
configureClosure.call()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user