Gradle, native: Propagate compilation free args to link tasks

The free args DSL may be changed in 1.3.70 for all platforms. So it
was decided to preserve the old behaviour here to avoid making
similar changes in two releases in a row.
This commit is contained in:
Ilya Matveev
2019-09-05 19:08:33 +07:00
parent 20332ae231
commit 7122a9d819
5 changed files with 27 additions and 8 deletions
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.gradle.util.*
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
import org.jetbrains.kotlin.konan.target.HostManager
import org.junit.Assert
import org.junit.Ignore
import org.junit.Test
import java.util.jar.JarFile
import java.util.zip.ZipFile
@@ -1037,6 +1038,9 @@ class NewMultiplatformIT : BaseGradleIT() {
assertTrue(it.contains("-Xtime"))
// Check that kotlinOptions of the compilation don't affect the binary.
assertFalse(it.contains("-verbose"))
// Check that free args are still propagated to the binary (unlike other kotlinOptions, see KT-33717).
// TODO: Reverse this check when the args are fully separated.
assertTrue(it.contains("-nowarn"))
}
assertTrue(output.contains("tests.foo"))
}
@@ -1141,6 +1145,9 @@ class NewMultiplatformIT : BaseGradleIT() {
}
}
// We propagate compilation args to link tasks for now (see KT-33717).
// TODO: Reenable the test when the args are separated.
@Ignore
@Test
fun testNativeFreeArgsWarning() = with(transformProjectWithPluginsDsl("kotlin-dsl", gradleVersion, "new-mpp-native-binaries")) {
gradleBuildScript().appendText(
@@ -37,7 +37,8 @@ kotlin {
mingwX64("mingw64")
configure([macos64, linux64, mingw64]) {
compilations.main.kotlinOptions.verbose = true
compilations.all { kotlinOptions.verbose = true }
compilations.test.kotlinOptions.freeCompilerArgs += "-nowarn"
binaries {
executable() // Executable with default name.
@@ -27,7 +27,8 @@ kotlin {
val windows = mingwX64("mingw64")
configure(listOf(macos, linux, windows)) {
compilations["main"].kotlinOptions.verbose = true
compilations.all { kotlinOptions.verbose = true }
compilations["test"].kotlinOptions.freeCompilerArgs += "-nowarn"
binaries {
executable() // Executable with default name.