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