Add a way to customize compiler file in build.gradle

This commit is contained in:
Alexey Tsvetkov
2016-11-17 17:13:01 +03:00
parent 75133bdfb9
commit 5082e8f236
5 changed files with 53 additions and 58 deletions
@@ -308,6 +308,23 @@ class KotlinGradleIT: BaseGradleIT() {
}
}
@Test
fun testCustomCompilerFile() {
val project = Project("customCompilerFile", GRADLE_VERSION)
project.setupWorkingDir()
// copy compiler embeddable to project dir using custom name
val classpath = System.getProperty("java.class.path").split(File.pathSeparator)
val kotlinEmbeddableJar = File(classpath.find { it.contains("kotlin-compiler-embeddable") })
val compilerJar = File(project.projectDir, "compiler.jar")
kotlinEmbeddableJar.copyTo(compilerJar)
project.build("build") {
assertSuccessful()
assertContains("Using kotlin compiler jar: $compilerJar")
}
}
@Test
fun testMultiplatformCompile() {
@@ -0,0 +1,22 @@
buildscript {
repositories {
mavenLocal()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: "kotlin"
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
compileKotlin.compilerJarFile = project.file("compiler.jar")