[Gradle, K/N] Reduce number of targets in tests

This commit is contained in:
Alexander.Likhachev
2020-09-19 08:56:03 +07:00
parent 8aa9ef5049
commit 4f8503dc30
9 changed files with 28 additions and 49 deletions
@@ -160,11 +160,8 @@ class NewMultiplatformIT : BaseGradleIT() {
assertFileExists("build/bin/wasm32/mainDebugExecutable/main.wasm.js")
assertFileExists("build/bin/wasm32/mainDebugExecutable/main.wasm")
assertFileExists("build/bin/wasm32/mainReleaseExecutable/main.wasm.js")
assertFileExists("build/bin/wasm32/mainReleaseExecutable/main.wasm")
val nativeExeName = if (isWindows) "main.exe" else "main.kexe"
assertFileExists("build/bin/$nativeHostTargetName/mainReleaseExecutable/$nativeExeName")
assertFileExists("build/bin/$nativeHostTargetName/mainDebugExecutable/$nativeExeName")
// Check that linker options were correctly passed to the K/N compiler.
@@ -102,6 +102,7 @@ class GeneralNativeIT : BaseGradleIT() {
with(
transformProjectWithPluginsDsl("native-endorsed")
) {
configureSingleNativeTarget()
setupWorkingDir()
build("build") {
@@ -126,21 +127,21 @@ class GeneralNativeIT : BaseGradleIT() {
val sharedSuffix = CompilerOutputKind.DYNAMIC.suffix(HostManager.host)
val sharedPaths = listOf(
"build/bin/host/debugShared/$sharedPrefix$baseName$sharedSuffix",
"build/bin/host/releaseShared/$sharedPrefix$baseName$sharedSuffix"
// "build/bin/host/releaseShared/$sharedPrefix$baseName$sharedSuffix"
)
val staticPrefix = CompilerOutputKind.STATIC.prefix(HostManager.host)
val staticSuffix = CompilerOutputKind.STATIC.suffix(HostManager.host)
val staticPaths = listOf(
"build/bin/host/debugStatic/$staticPrefix$baseName$staticSuffix",
"build/bin/host/releaseStatic/$staticPrefix$baseName$staticSuffix"
// "build/bin/host/releaseStatic/$staticPrefix$baseName$staticSuffix"
)
val headerPaths = listOf(
"build/bin/host/debugShared/$sharedPrefix${baseName}_api.h",
"build/bin/host/releaseShared/$sharedPrefix${baseName}_api.h",
// "build/bin/host/releaseShared/$sharedPrefix${baseName}_api.h",
"build/bin/host/debugStatic/$staticPrefix${baseName}_api.h",
"build/bin/host/releaseStatic/$staticPrefix${baseName}_api.h"
// "build/bin/host/releaseStatic/$staticPrefix${baseName}_api.h"
)
val klibPrefix = CompilerOutputKind.LIBRARY.prefix(HostManager.host)
@@ -149,9 +150,9 @@ class GeneralNativeIT : BaseGradleIT() {
val linkTasks = listOf(
":linkDebugSharedHost",
":linkReleaseSharedHost",
// ":linkReleaseSharedHost",
":linkDebugStaticHost",
":linkReleaseStaticHost"
// ":linkReleaseStaticHost"
)
val klibTask = ":compileKotlinHost"
@@ -198,15 +199,15 @@ class GeneralNativeIT : BaseGradleIT() {
val frameworkPaths = listOf(
"build/bin/host/mainDebugFramework/$frameworkPrefix$baseName$frameworkSuffix.dSYM",
"build/bin/host/mainDebugFramework/$frameworkPrefix$baseName$frameworkSuffix",
"build/bin/host/mainReleaseFramework/$frameworkPrefix$baseName$frameworkSuffix"
)
val headerPaths = listOf(
"build/bin/host/mainDebugFramework/$frameworkPrefix$baseName$frameworkSuffix/headers/$baseName.h",
"build/bin/host/mainReleaseFramework/$frameworkPrefix$baseName$frameworkSuffix/headers/$baseName.h",
)
val frameworkTasks = listOf(":linkMainDebugFrameworkHost", ":linkMainReleaseFrameworkHost")
val frameworkTasks = listOf(
":linkMainDebugFrameworkHost",
)
// Building
build("assemble") {
@@ -295,9 +296,8 @@ class GeneralNativeIT : BaseGradleIT() {
*/
@Test
@Ignore
fun testNativeBinaryKotlinDSL() = with(
transformProjectWithPluginsDsl("kotlin-dsl", directoryPrefix = "native-binaries")
transformProjectWithPluginsDsl("kotlin-dsl", directoryPrefix = "native-binaries-old")
) {
val hostSuffix = nativeHostTargetName.capitalize()
@@ -319,7 +319,7 @@ class GeneralNativeIT : BaseGradleIT() {
val prefix = outputKind.prefix(HostManager.host)
val suffix = outputKind.suffix(HostManager.host)
val fileName = "$prefix$fileBaseName$suffix"
name to "build/bin/host/$name/$fileName"
name to "build/bin/${nativeHostTargetName}/$name/$fileName"
}.toMap()
val runTasks = listOf(
@@ -17,7 +17,7 @@ kotlin {
<SingleNativeTarget>("host") {
binaries {
framework("main") {
framework("main", listOf(DEBUG)) {
export(project(":exported"))
}
}
@@ -17,13 +17,11 @@ kotlin {
<SingleNativeTarget>("host") {
binaries {
binaries {
sharedLib {
export(project(":exported"))
}
staticLib {
export(project(":exported"))
}
sharedLib(listOf(DEBUG)) {
export(project(":exported"))
}
staticLib(listOf(DEBUG)) {
export(project(":exported"))
}
}
}
@@ -5,37 +5,21 @@ plugins {
repositories {
mavenLocal()
jcenter()
maven { setUrl("https://dl.bintray.com/kotlin/kotlinx.html/") }
}
kotlin {
val commonNative by sourceSets.creating {}
val macos = macosX64("macos64")
val linux = linuxX64("linux64")
val windows = mingwX64("mingw64")
sourceSets {
val commonNative by creating {}
windows.compilations["main"].defaultSourceSet {
<SingleNativeTarget>("host") {
compilations["main"].defaultSourceSet {
dependsOn(commonNative)
}
linux.compilations["main"].defaultSourceSet {
dependsOn(commonNative)
}
macos.compilations["main"].defaultSourceSet {
dependsOn(commonNative)
}
}
configure(listOf(macos, linux, windows)) {
compilations.all {
kotlinOptions.verbose = true
enableEndorsedLibs = true
}
binaries {
executable()
executable(listOf(DEBUG))
}
}
}
@@ -22,7 +22,7 @@ repositories {
kotlin {
targets {
fromPreset(presets.macosX64, 'macos64') {
binaries.framework("main")
binaries.framework("main", [DEBUG])
}
fromPreset(presets.linuxX64, 'linux64')
@@ -30,8 +30,8 @@ kotlin {
configure([linux64, mingw64, macos64]) {
binaries {
sharedLib("main")
staticLib("main")
sharedLib("main", [DEBUG])
staticLib("main", [DEBUG])
}
}
}
@@ -96,7 +96,7 @@ kotlin {
getByName("integration") {
binaries {
test("integration") {
test("integration", [DEBUG]) {
compilation = compilations["integrationTest"]
}
}
@@ -27,7 +27,7 @@ kotlin {
val macos64 = macosX64("macos64")
configure(listOf(wasm32, linux64, mingw64, macos64)) {
binaries.executable("main") {
binaries.executable("main", listOf(DEBUG)) {
entryPoint = "com.example.app.native.main"
}
@@ -68,7 +68,7 @@ kotlin {
fromPreset(presets.macosX64, 'macos64')
configure([wasm32, linux64, mingw64, macos64]) {
binaries.executable("main") {
binaries.executable("main", [DEBUG]) {
entryPoint = "com.example.app.native.main"
}