[Gradle, K/N] Move NativeBinaryTypes from kotlin-gradle-plugin to kotlin-gradle-plugin-api
This commit is contained in:
@@ -42,7 +42,6 @@ dependencies {
|
||||
|
||||
compile(kotlinStdlib())
|
||||
compile(project(":kotlin-util-klib"))
|
||||
compileOnly(project(":native:kotlin-native-utils"))
|
||||
compileOnly(project(":kotlin-reflect-api"))
|
||||
compileOnly(project(":kotlin-android-extensions"))
|
||||
compileOnly(project(":kotlin-build-common"))
|
||||
|
||||
-11
@@ -270,17 +270,6 @@ class Framework(
|
||||
*/
|
||||
var isStatic = false
|
||||
|
||||
enum class BitcodeEmbeddingMode {
|
||||
/** Don't embed LLVM IR bitcode. */
|
||||
DISABLE,
|
||||
|
||||
/** Embed LLVM IR bitcode as data. */
|
||||
BITCODE,
|
||||
|
||||
/** Embed placeholder LLVM IR data as a marker. */
|
||||
MARKER,
|
||||
}
|
||||
|
||||
companion object {
|
||||
val frameworkTargets = Attribute.of(
|
||||
"org.jetbrains.kotlin.native.framework.targets",
|
||||
|
||||
-74
@@ -1,74 +0,0 @@
|
||||
@file:Suppress("PackageDirectoryMismatch") // Old package for compatibility
|
||||
package org.jetbrains.kotlin.gradle.plugin.mpp
|
||||
|
||||
import org.gradle.api.Named
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.Framework.BitcodeEmbeddingMode
|
||||
import org.jetbrains.kotlin.konan.target.Architecture.ARM32
|
||||
import org.jetbrains.kotlin.konan.target.Architecture.ARM64
|
||||
import org.jetbrains.kotlin.konan.target.CompilerOutputKind
|
||||
import org.jetbrains.kotlin.konan.target.Family.*
|
||||
import org.jetbrains.kotlin.konan.target.KonanTarget
|
||||
|
||||
enum class NativeBuildType(
|
||||
val optimized: Boolean,
|
||||
val debuggable: Boolean,
|
||||
private val embedBitcodeForAppleDevices: BitcodeEmbeddingMode
|
||||
) : Named {
|
||||
RELEASE(true, false, BitcodeEmbeddingMode.BITCODE),
|
||||
DEBUG(false, true, BitcodeEmbeddingMode.MARKER);
|
||||
|
||||
override fun getName(): String = name.toLowerCase()
|
||||
|
||||
fun embedBitcode(target: KonanTarget) = with(target) {
|
||||
if (family in listOf(IOS, WATCHOS, TVOS) && architecture in listOf(ARM32, ARM64)) {
|
||||
embedBitcodeForAppleDevices
|
||||
} else {
|
||||
BitcodeEmbeddingMode.DISABLE
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
val DEFAULT_BUILD_TYPES = setOf(DEBUG, RELEASE)
|
||||
}
|
||||
}
|
||||
|
||||
enum class NativeOutputKind(
|
||||
val compilerOutputKind: CompilerOutputKind,
|
||||
val taskNameClassifier: String,
|
||||
val description: String = taskNameClassifier
|
||||
) {
|
||||
EXECUTABLE(
|
||||
CompilerOutputKind.PROGRAM,
|
||||
"executable",
|
||||
description = "an executable"
|
||||
),
|
||||
TEST(
|
||||
CompilerOutputKind.PROGRAM,
|
||||
"test",
|
||||
description = "a test executable"
|
||||
),
|
||||
DYNAMIC(
|
||||
CompilerOutputKind.DYNAMIC,
|
||||
"shared",
|
||||
description = "a dynamic library"
|
||||
) {
|
||||
override fun availableFor(target: KonanTarget) = target != KonanTarget.WASM32
|
||||
},
|
||||
STATIC(
|
||||
CompilerOutputKind.STATIC,
|
||||
"static",
|
||||
description = "a static library"
|
||||
) {
|
||||
override fun availableFor(target: KonanTarget) = target != KonanTarget.WASM32
|
||||
},
|
||||
FRAMEWORK(
|
||||
CompilerOutputKind.FRAMEWORK,
|
||||
"framework",
|
||||
description = "a framework"
|
||||
) {
|
||||
override fun availableFor(target: KonanTarget) =
|
||||
target.family.isAppleFamily
|
||||
};
|
||||
|
||||
open fun availableFor(target: KonanTarget) = true
|
||||
}
|
||||
+4
-4
@@ -578,8 +578,8 @@ open class KotlinNativeLink : AbstractKotlinNativeCompile<KotlinCommonToolOption
|
||||
}
|
||||
|
||||
@get:Input
|
||||
val embedBitcode: Framework.BitcodeEmbeddingMode by project.provider {
|
||||
(binary as? Framework)?.embedBitcode ?: Framework.BitcodeEmbeddingMode.DISABLE
|
||||
val embedBitcode: BitcodeEmbeddingMode by project.provider {
|
||||
(binary as? Framework)?.embedBitcode ?: BitcodeEmbeddingMode.DISABLE
|
||||
}
|
||||
|
||||
override fun buildCompilerArgs(): List<String> = mutableListOf<String>().apply {
|
||||
@@ -590,8 +590,8 @@ open class KotlinNativeLink : AbstractKotlinNativeCompile<KotlinCommonToolOption
|
||||
addKey("-tr", processTests)
|
||||
addArgIfNotNull("-entry", entryPoint)
|
||||
when (embedBitcode) {
|
||||
Framework.BitcodeEmbeddingMode.MARKER -> add("-Xembed-bitcode-marker")
|
||||
Framework.BitcodeEmbeddingMode.BITCODE -> add("-Xembed-bitcode")
|
||||
BitcodeEmbeddingMode.MARKER -> add("-Xembed-bitcode-marker")
|
||||
BitcodeEmbeddingMode.BITCODE -> add("-Xembed-bitcode")
|
||||
else -> { /* Do nothing. */
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user