Fix JS compiler jar search
#KT-15127 fixed
This commit is contained in:
+2
-1
@@ -3,6 +3,7 @@ package org.jetbrains.kotlin.gradle
|
|||||||
import org.jetbrains.kotlin.gradle.util.getFileByName
|
import org.jetbrains.kotlin.gradle.util.getFileByName
|
||||||
import org.jetbrains.kotlin.gradle.util.modify
|
import org.jetbrains.kotlin.gradle.util.modify
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
||||||
@Test
|
@Test
|
||||||
@@ -79,7 +80,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
|||||||
val project = Project("kotlinBuiltins", "3.2")
|
val project = Project("kotlinBuiltins", "3.2")
|
||||||
|
|
||||||
project.setupWorkingDir()
|
project.setupWorkingDir()
|
||||||
val buildGradle = project.projectDir.getFileByName("build.gradle")
|
val buildGradle = File(project.projectDir, "app").getFileByName("build.gradle")
|
||||||
buildGradle.modify {
|
buildGradle.modify {
|
||||||
it.replace("apply plugin: \"kotlin\"", "apply plugin: \"kotlin2js\"") +
|
it.replace("apply plugin: \"kotlin\"", "apply plugin: \"kotlin2js\"") +
|
||||||
"\ncompileKotlin2Js.kotlinOptions.outputFile = \"out/out.js\""
|
"\ncompileKotlin2Js.kotlinOptions.outputFile = \"out/out.js\""
|
||||||
|
|||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
apply plugin: "kotlin"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
}
|
||||||
-10
@@ -6,13 +6,3 @@ buildscript {
|
|||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: "kotlin"
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
||||||
}
|
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
include ':app'
|
||||||
+9
-2
@@ -35,9 +35,16 @@ private fun findKotlinCompilerJar(project: Project, compilerClassName: String):
|
|||||||
|
|
||||||
val entryToFind = compilerClassName.replace(".", "/") + ".class"
|
val entryToFind = compilerClassName.replace(".", "/") + ".class"
|
||||||
val jarFromClasspath = project.classpathJars().firstOrNull { it.hasEntry(entryToFind) }
|
val jarFromClasspath = project.classpathJars().firstOrNull { it.hasEntry(entryToFind) }
|
||||||
val compilerJar = jarFromClasspath
|
|
||||||
|
|
||||||
return compilerJar
|
return when {
|
||||||
|
jarFromClasspath != null ->
|
||||||
|
jarFromClasspath
|
||||||
|
project.parent != null ->
|
||||||
|
findKotlinCompilerJar(project.parent, compilerClassName)
|
||||||
|
else ->
|
||||||
|
null
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun File.hasEntry(entryToFind: String): Boolean {
|
private fun File.hasEntry(entryToFind: String): Boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user