Gradle plugin: Enable missing mingw_x86 target for K/N

This commit is contained in:
Ilya Matveev
2019-04-01 19:18:52 +07:00
parent 4332ce9884
commit cb38f13399
11 changed files with 71 additions and 16 deletions
@@ -190,6 +190,7 @@ open class HostManager(subtargetProvider: SubTargetProvider = NoSubTargets()) {
) + zephyrSubtargets,
KonanTarget.MINGW_X64 to setOf(
KonanTarget.MINGW_X64,
KonanTarget.MINGW_X86,
KonanTarget.WASM32,
KonanTarget.LINUX_X64,
KonanTarget.LINUX_ARM32_HFP,
@@ -1109,25 +1109,35 @@ class NewMultiplatformIT : BaseGradleIT() {
""".trimIndent())
}
val host = nativeHostTargetName
val targetsToBuild = if (HostManager.hostIsMingw) {
listOf(nativeHostTargetName, "mingw86")
} else {
listOf(nativeHostTargetName)
}
val libraryCinteropTask = ":projectLibrary:cinteropStdio${host.capitalize()}"
val libraryCompileTask = ":projectLibrary:compileKotlin${host.capitalize()}"
val libraryCinteropTasks = targetsToBuild.map { ":projectLibrary:cinteropStdio${it.capitalize()}" }
val libraryCompileTasks = targetsToBuild.map { ":projectLibrary:compileKotlin${it.capitalize()}" }
build(":projectLibrary:build") {
assertSuccessful()
assertTasksExecuted(libraryCinteropTask)
assertTasksExecuted(libraryCinteropTasks)
assertTrue(output.contains("Project test"), "No test output found")
assertFileExists("projectLibrary/build/classes/kotlin/$host/main/projectLibrary-cinterop-stdio.klib")
targetsToBuild.forEach {
assertFileExists("projectLibrary/build/classes/kotlin/$it/main/projectLibrary-cinterop-stdio.klib")
}
}
build(":publishedLibrary:build", ":publishedLibrary:publish") {
assertSuccessful()
assertTasksExecuted(":publishedLibrary:cinteropStdio${host.capitalize()}")
assertTasksExecuted(
targetsToBuild.map { ":publishedLibrary:cinteropStdio${it.capitalize()}" }
)
assertTrue(output.contains("Published test"), "No test output found")
assertFileExists("publishedLibrary/build/classes/kotlin/$host/main/publishedLibrary-cinterop-stdio.klib")
assertFileExists("publishedLibrary/build/classes/kotlin/$host/test/test-cinterop-stdio.klib")
assertFileExists("repo/org/example/publishedLibrary-$host/1.0/publishedLibrary-$host-1.0-cinterop-stdio.klib")
targetsToBuild.forEach {
assertFileExists("publishedLibrary/build/classes/kotlin/$it/main/publishedLibrary-cinterop-stdio.klib")
assertFileExists("publishedLibrary/build/classes/kotlin/$it/test/test-cinterop-stdio.klib")
assertFileExists("repo/org/example/publishedLibrary-$it/1.0/publishedLibrary-$it-1.0-cinterop-stdio.klib")
}
}
build(":build") {
@@ -1137,14 +1147,18 @@ class NewMultiplatformIT : BaseGradleIT() {
}
// Check that changing the compiler version in properties causes interop reprocessing and source recompilation.
val hostLibraryTasks = listOf(
":projectLibrary:cinteropStdio${nativeHostTargetName.capitalize()}",
":projectLibrary:compileKotlin${nativeHostTargetName.capitalize()}"
)
build(":projectLibrary:build") {
assertSuccessful()
assertTasksUpToDate(libraryCinteropTask, libraryCompileTask)
assertTasksUpToDate(hostLibraryTasks)
}
build(libraryCinteropTask, libraryCompileTask, "-Porg.jetbrains.kotlin.native.version=1.1.0") {
build(*hostLibraryTasks.toTypedArray(), "-Porg.jetbrains.kotlin.native.version=1.1.0") {
assertSuccessful()
assertTasksExecuted(libraryCinteropTask, libraryCompileTask)
assertTasksExecuted(hostLibraryTasks)
}
}
}
@@ -1484,7 +1498,7 @@ class NewMultiplatformIT : BaseGradleIT() {
}
val expectedDefaultSourceSets = listOf(
"jvm6", "nodeJs", "wasm32", "mingw64", "linux64", "macos64"
"jvm6", "nodeJs", "wasm32", "mingw64", "mingw86", "linux64", "macos64"
).flatMapTo(mutableSetOf()) { target ->
listOf("main", "test").map { compilation ->
Triple(target, compilation, "$target${compilation.capitalize()}")
@@ -19,6 +19,9 @@ kotlin {
linuxX64("linux64")
mingwX64("mingw64")
macosX64("macos64")
// We use this library in the cinterop test which includes a Windows x86 target.
mingwX86("mingw86")
targets.all {
mavenPublication(Action<MavenPublication> {
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package com.example.lib
actual fun expectedFun(): Unit {
id(123)
}
@@ -31,6 +31,9 @@ kotlin {
fromPreset(presets.linuxX64, 'linux64')
fromPreset(presets.mingwX64, 'mingw64')
fromPreset(presets.macosX64, 'macos64')
// We use this library in the cinterop test which includes a Windows x86 target.
fromPreset(presets.mingwX86, 'mingw86')
// Check the DSL constructs in the Groovy DSL:
fromPreset(presets.jvm, 'jvm6') {
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package com.example.lib
actual fun expectedFun(): Unit {
id(123)
}
@@ -31,18 +31,22 @@ kotlin {
macos64Main { dependsOn sourceSets.allNative }
linux64Main { dependsOn sourceSets.allNative }
mingw64Main { dependsOn sourceSets.allNative }
mingw86Main { dependsOn sourceSets.allNative }
macos64Test { dependsOn sourceSets.nativeTest }
linux64Test { dependsOn sourceSets.nativeTest }
mingw64Test { dependsOn sourceSets.nativeTest }
mingw86Test { dependsOn sourceSets.nativeTest }
}
targets {
fromPreset(presets.macosX64, 'macos64')
fromPreset(presets.linuxX64, 'linux64')
fromPreset(presets.mingwX64, 'mingw64')
// Test building a 32-bit Windows binary.
fromPreset(presets.mingwX86, 'mingw86')
configure([macos64, linux64, mingw64]) {
configure([macos64, linux64, mingw64, mingw86]) {
compilations.main.outputKinds ['EXECUTABLE']
}
}
@@ -14,18 +14,22 @@ kotlin {
macos64Main { dependsOn sourceSets.allNative }
linux64Main { dependsOn sourceSets.allNative }
mingw64Main { dependsOn sourceSets.allNative }
mingw86Main { dependsOn sourceSets.allNative }
macos64Test { dependsOn sourceSets.nativeTest }
linux64Test { dependsOn sourceSets.nativeTest }
mingw64Test { dependsOn sourceSets.nativeTest }
mingw86Test { dependsOn sourceSets.nativeTest }
}
targets {
fromPreset(presets.macosX64, 'macos64')
fromPreset(presets.linuxX64, 'linux64')
fromPreset(presets.mingwX64, 'mingw64')
// Test building a 32-bit Windows binary.
fromPreset(presets.mingwX86, 'mingw86')
configure([macos64, linux64, mingw64]) {
configure([macos64, linux64, mingw64, mingw86]) {
compilations.main.cinterops {
stdio {
packageName 'example.cinterop.project.stdio'
@@ -22,18 +22,22 @@ kotlin {
macos64Main { dependsOn sourceSets.allNative }
linux64Main { dependsOn sourceSets.allNative }
mingw64Main { dependsOn sourceSets.allNative }
mingw86Main { dependsOn sourceSets.allNative }
macos64Test { dependsOn sourceSets.nativeTest }
linux64Test { dependsOn sourceSets.nativeTest }
mingw64Test { dependsOn sourceSets.nativeTest }
mingw86Test { dependsOn sourceSets.nativeTest }
}
targets {
fromPreset(presets.macosX64, 'macos64')
fromPreset(presets.linuxX64, 'linux64')
fromPreset(presets.mingwX64, 'mingw64')
// Test building a 32-bit Windows binary.
fromPreset(presets.mingwX86, 'mingw86')
configure([macos64, linux64, mingw64]) {
configure([macos64, linux64, mingw64, mingw86]) {
compilations.all {
// Add interop in the test compilation too as a regression test for KT-30290.
cinterops {