Fix references from test to main in Gradle JS plugin with default output file
This commit is contained in:
+1
@@ -72,6 +72,7 @@ class Kotlin2JsGradlePluginIT : BaseGradleIT() {
|
||||
project.build("build") {
|
||||
assertSuccessful()
|
||||
assertFileExists("build/classes/main/kotlin2JsNoOutputFileProject_main.js")
|
||||
assertFileExists("build/classes/test/kotlin2JsNoOutputFileProject_test.js")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
package example
|
||||
|
||||
class Dummy {}
|
||||
class Dummy {
|
||||
fun f() {}
|
||||
}
|
||||
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package example
|
||||
|
||||
class DummyTest {
|
||||
fun test() {
|
||||
Dummy().f()
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -320,8 +320,8 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
|
||||
get() = File(destinationDir, "$moduleName.js")
|
||||
|
||||
@Suppress("unused")
|
||||
val outputFile: String?
|
||||
get() = kotlinOptions.outputFile
|
||||
val outputFile: String
|
||||
get() = kotlinOptions.outputFile ?: defaultOutputFile.canonicalPath
|
||||
|
||||
init {
|
||||
@Suppress("LeakingThis")
|
||||
@@ -330,6 +330,8 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
|
||||
|
||||
override fun populateCompilerArguments(): K2JSCompilerArguments {
|
||||
val args = K2JSCompilerArguments().apply { fillDefaultValues() }
|
||||
args.outputFile = outputFile
|
||||
|
||||
val friendDependency = friendTaskName
|
||||
?.let { project.getTasksByName(it, false).singleOrNull() as? Kotlin2JsCompile }
|
||||
?.outputFile
|
||||
@@ -359,10 +361,6 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
|
||||
destinationDir.mkdirs()
|
||||
args.freeArgs = args.freeArgs + sourceRoots.kotlinSourceFiles.map { it.absolutePath }
|
||||
|
||||
if (args.outputFile == null) {
|
||||
args.outputFile = defaultOutputFile.canonicalPath
|
||||
}
|
||||
|
||||
logger.kotlinDebug("compiling with args ${ArgumentUtils.convertArgumentsToStringList(args)}")
|
||||
|
||||
val gradleVersion = getGradleVersion()
|
||||
|
||||
Reference in New Issue
Block a user