New flag for KotlinNativeCompilation to enable endorsed libraries (#2618)

This commit is contained in:
LepilkinaElena
2019-09-25 10:28:09 +03:00
committed by GitHub
parent b8cce67d2e
commit 594f4a6f56
7 changed files with 123 additions and 19 deletions
@@ -691,6 +691,25 @@ class NewMultiplatformIT : BaseGradleIT() {
}
}
@Test
fun testEndorsedLibsController() {
with(
transformProjectWithPluginsDsl("new-mpp-native-endorsed", gradleVersion)
) {
setupWorkingDir()
build("build") {
assertSuccessful()
}
gradleBuildScript().modify {
it.replace("enableEndorsedLibs = true", "")
}
build("build") {
assertFailed()
}
}
}
@Test
fun testDependenciesOnMppLibraryPartsWithNoMetadata() {
val repoDir = with(Project("sample-lib", gradleVersion, "new-mpp-lib-and-app")) {
@@ -0,0 +1,41 @@
plugins {
id("org.jetbrains.kotlin.multiplatform").version("<pluginMarkerVersion>")
}
repositories {
mavenLocal()
jcenter()
maven { setUrl("https://dl.bintray.com/kotlin/kotlinx.html/") }
}
kotlin {
val macos = macosX64("macos64")
val linux = linuxX64("linux64")
val windows = mingwX64("mingw64")
sourceSets {
val commonNative by creating {}
windows.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()
}
}
}
@@ -0,0 +1,11 @@
pluginManagement {
repositories {
mavenLocal()
jcenter()
gradlePluginPortal()
}
}
enableFeaturePreview('GRADLE_METADATA')
rootProject.name = "native-endorsed"
@@ -0,0 +1,12 @@
import kotlinx.cli.*
fun main(args: Array<String>) {
val argParser = ArgParser("test")
val mode by argParser.option(
ArgType.Choice(listOf("video", "audio", "both")), shortName = "m", description = "Play mode")
.default("both")
val size by argParser.option(ArgType.Int, shortName = "s", description = "Required size of videoplayer window")
.delimiter(",")
val fileName by argParser.argument(ArgType.String, description = "File to play")
argParser.parse(args)
}