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.modify
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
||||
@Test
|
||||
@@ -79,7 +80,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
||||
val project = Project("kotlinBuiltins", "3.2")
|
||||
|
||||
project.setupWorkingDir()
|
||||
val buildGradle = project.projectDir.getFileByName("build.gradle")
|
||||
val buildGradle = File(project.projectDir, "app").getFileByName("build.gradle")
|
||||
buildGradle.modify {
|
||||
it.replace("apply plugin: \"kotlin\"", "apply plugin: \"kotlin2js\"") +
|
||||
"\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
@@ -5,14 +5,4 @@ buildscript {
|
||||
dependencies {
|
||||
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 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 {
|
||||
|
||||
Reference in New Issue
Block a user