Add integration tests for new K/N library DSL.
This commit is contained in:
committed by
TeamCityServer
parent
2e86fbd2b5
commit
3dd27b9b1f
+90
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle
|
||||
|
||||
import org.jetbrains.kotlin.konan.target.HostManager
|
||||
import org.junit.Assume
|
||||
import kotlin.test.Test
|
||||
|
||||
class NativeLibraryDslIT : BaseGradleIT() {
|
||||
override val defaultGradleVersion = GradleVersionRequired.FOR_MPP_SUPPORT
|
||||
|
||||
@Test
|
||||
fun `check registered gradle tasks`() {
|
||||
with(Project("new-kn-library-dsl")) {
|
||||
build(":shared:tasks") {
|
||||
assertSuccessful()
|
||||
assertTasksRegistered(
|
||||
":shared:assembleMylibDebugSharedLibraryLinuxX64",
|
||||
":shared:assembleMyslibDebugSharedLibraryLinuxX64",
|
||||
":shared:assembleMylibReleaseSharedLibraryLinuxX64",
|
||||
":shared:assembleMylibSharedLibrary",
|
||||
":shared:assembleMyslibSharedLibrary"
|
||||
)
|
||||
assertTasksNotRegistered(
|
||||
":shared:assembleMyslibReleaseSharedLibraryLinuxX64"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `link shared library from two gradle modules`() {
|
||||
with(Project("new-kn-library-dsl")) {
|
||||
build(":shared:assembleMyslibDebugSharedLibraryLinuxX64") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(
|
||||
":lib:compileKotlinLinuxX64",
|
||||
":shared:compileKotlinLinuxX64",
|
||||
":shared:assembleMyslibDebugSharedLibraryLinuxX64"
|
||||
)
|
||||
assertFileExists("/shared/build/out/dynamic/linux_x64/debug/libmyslib.so")
|
||||
assertFileExists("/shared/build/out/dynamic/linux_x64/debug/libmyslib_api.h")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `link shared library from single gradle module`() {
|
||||
with(Project("new-kn-library-dsl")) {
|
||||
build(":shared:assembleMylibDebugSharedLibraryLinuxX64") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(
|
||||
":shared:compileKotlinLinuxX64",
|
||||
":shared:assembleMylibDebugSharedLibraryLinuxX64"
|
||||
)
|
||||
assertTasksNotExecuted(
|
||||
":lib:compileKotlinLinuxX64"
|
||||
)
|
||||
assertFileExists("/shared/build/out/dynamic/linux_x64/debug/libmylib.so")
|
||||
assertFileExists("/shared/build/out/dynamic/linux_x64/debug/libmylib_api.h")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `link release XCFramework from two gradle modules`() {
|
||||
Assume.assumeTrue(HostManager.hostIsMac)
|
||||
with(Project("new-kn-library-dsl")) {
|
||||
build(":shared:assembleSharedReleaseXCFramework") {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(
|
||||
":shared:compileKotlinIosX64",
|
||||
":shared:compileKotlinIosArm64",
|
||||
":shared:compileKotlinIosSimulatorArm64",
|
||||
":lib:compileKotlinIosX64",
|
||||
":lib:compileKotlinIosArm64",
|
||||
":lib:compileKotlinIosSimulatorArm64",
|
||||
":shared:assembleSharedReleaseXCFramework"
|
||||
)
|
||||
assertTasksNotExecuted(
|
||||
":shared:assembleSharedDebugXCFramework"
|
||||
)
|
||||
assertFileExists("/shared/build/out/xcframework/release/shared.xcframework")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||
kotlin.native.enableDependencyPropagation=false
|
||||
kotlin.mpp.enableCInteropCommonization=true
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
linuxX64()
|
||||
iosX64()
|
||||
iosArm64()
|
||||
iosSimulatorArm64()
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package org.my.sam
|
||||
|
||||
class Greeting {
|
||||
fun greeting() = "Hello, lib!"
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
}
|
||||
resolutionStrategy {
|
||||
val kotlin_version: String by settings
|
||||
eachPlugin {
|
||||
when (requested.id.id) {
|
||||
"org.jetbrains.kotlin.multiplatform" -> useVersion(kotlin_version)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
include(":shared")
|
||||
include(":lib")
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeBuildType
|
||||
import org.jetbrains.kotlin.gradle.targets.native.tasks.artifact.*
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget.*
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
linuxX64()
|
||||
iosX64()
|
||||
iosArm64()
|
||||
iosSimulatorArm64()
|
||||
}
|
||||
|
||||
kotlinArtifact("mylib", Library) {
|
||||
target = LINUX_X64
|
||||
}
|
||||
|
||||
kotlinArtifact("myslib", Library) {
|
||||
target = LINUX_X64
|
||||
modes = setOf(NativeBuildType.DEBUG)
|
||||
addModule(project(":lib"))
|
||||
}
|
||||
|
||||
kotlinArtifact(XCFramework) {
|
||||
targets = setOf(IOS_X64, IOS_ARM64, IOS_SIMULATOR_ARM64)
|
||||
setModules(
|
||||
project(":shared"),
|
||||
project(":lib")
|
||||
)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package org.sample.application
|
||||
|
||||
class Greeting {
|
||||
fun greeting() = "Hello, new DSL!"
|
||||
}
|
||||
Reference in New Issue
Block a user