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") {
|
project.build("build") {
|
||||||
assertSuccessful()
|
assertSuccessful()
|
||||||
assertFileExists("build/classes/main/kotlin2JsNoOutputFileProject_main.js")
|
assertFileExists("build/classes/main/kotlin2JsNoOutputFileProject_main.js")
|
||||||
|
assertFileExists("build/classes/test/kotlin2JsNoOutputFileProject_test.js")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
package example
|
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")
|
get() = File(destinationDir, "$moduleName.js")
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
val outputFile: String?
|
val outputFile: String
|
||||||
get() = kotlinOptions.outputFile
|
get() = kotlinOptions.outputFile ?: defaultOutputFile.canonicalPath
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@Suppress("LeakingThis")
|
@Suppress("LeakingThis")
|
||||||
@@ -330,6 +330,8 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
|
|||||||
|
|
||||||
override fun populateCompilerArguments(): K2JSCompilerArguments {
|
override fun populateCompilerArguments(): K2JSCompilerArguments {
|
||||||
val args = K2JSCompilerArguments().apply { fillDefaultValues() }
|
val args = K2JSCompilerArguments().apply { fillDefaultValues() }
|
||||||
|
args.outputFile = outputFile
|
||||||
|
|
||||||
val friendDependency = friendTaskName
|
val friendDependency = friendTaskName
|
||||||
?.let { project.getTasksByName(it, false).singleOrNull() as? Kotlin2JsCompile }
|
?.let { project.getTasksByName(it, false).singleOrNull() as? Kotlin2JsCompile }
|
||||||
?.outputFile
|
?.outputFile
|
||||||
@@ -359,10 +361,6 @@ open class Kotlin2JsCompile() : AbstractKotlinCompile<K2JSCompilerArguments>(),
|
|||||||
destinationDir.mkdirs()
|
destinationDir.mkdirs()
|
||||||
args.freeArgs = args.freeArgs + sourceRoots.kotlinSourceFiles.map { it.absolutePath }
|
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)}")
|
logger.kotlinDebug("compiling with args ${ArgumentUtils.convertArgumentsToStringList(args)}")
|
||||||
|
|
||||||
val gradleVersion = getGradleVersion()
|
val gradleVersion = getGradleVersion()
|
||||||
|
|||||||
Reference in New Issue
Block a user