Add new native targets. (#2538)
This commit is contained in:
@@ -32,11 +32,16 @@ enum class Architecture(val bitness: Int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sealed class KonanTarget(override val name: String, val family: Family, val architecture: Architecture) : Named {
|
sealed class KonanTarget(override val name: String, val family: Family, val architecture: Architecture) : Named {
|
||||||
|
object ANDROID_X64 : KonanTarget( "android_x64", Family.ANDROID, Architecture.X64)
|
||||||
object ANDROID_ARM32 : KonanTarget( "android_arm32", Family.ANDROID, Architecture.ARM32)
|
object ANDROID_ARM32 : KonanTarget( "android_arm32", Family.ANDROID, Architecture.ARM32)
|
||||||
object ANDROID_ARM64 : KonanTarget( "android_arm64", Family.ANDROID, Architecture.ARM64)
|
object ANDROID_ARM64 : KonanTarget( "android_arm64", Family.ANDROID, Architecture.ARM64)
|
||||||
object IOS_ARM32 : KonanTarget( "ios_arm32", Family.IOS, Architecture.ARM32)
|
object IOS_ARM32 : KonanTarget( "ios_arm32", Family.IOS, Architecture.ARM32)
|
||||||
object IOS_ARM64 : KonanTarget( "ios_arm64", Family.IOS, Architecture.ARM64)
|
object IOS_ARM64 : KonanTarget( "ios_arm64", Family.IOS, Architecture.ARM64)
|
||||||
object IOS_X64 : KonanTarget( "ios_x64", Family.IOS, Architecture.X64)
|
object IOS_X64 : KonanTarget( "ios_x64", Family.IOS, Architecture.X64)
|
||||||
|
object WATCHOS_ARM64 : KonanTarget( "watchos_arm64", Family.IOS, Architecture.ARM64)
|
||||||
|
object WATCHOS_X64 : KonanTarget( "watchos_x64", Family.IOS, Architecture.X64)
|
||||||
|
object TVOS_ARM64 : KonanTarget( "tvos_arm64", Family.IOS, Architecture.ARM64)
|
||||||
|
object TVOS_X64 : KonanTarget( "tvos_x64", Family.IOS, Architecture.X64)
|
||||||
object LINUX_X64 : KonanTarget( "linux_x64", Family.LINUX, Architecture.X64)
|
object LINUX_X64 : KonanTarget( "linux_x64", Family.LINUX, Architecture.X64)
|
||||||
object MINGW_X86 : KonanTarget( "mingw_x86", Family.MINGW, Architecture.X86)
|
object MINGW_X86 : KonanTarget( "mingw_x86", Family.MINGW, Architecture.X86)
|
||||||
object MINGW_X64 : KonanTarget( "mingw_x64", Family.MINGW, Architecture.X64)
|
object MINGW_X64 : KonanTarget( "mingw_x64", Family.MINGW, Architecture.X64)
|
||||||
@@ -122,9 +127,11 @@ open class HostManager(protected val distribution: Distribution = Distribution()
|
|||||||
|
|
||||||
// TODO: need a better way to enumerated predefined targets.
|
// TODO: need a better way to enumerated predefined targets.
|
||||||
private val predefinedTargets = listOf(
|
private val predefinedTargets = listOf(
|
||||||
ANDROID_ARM32, ANDROID_ARM64,
|
ANDROID_ARM32, ANDROID_ARM64, ANDROID_X64,
|
||||||
IOS_ARM32, IOS_ARM64, IOS_X64,
|
IOS_ARM32, IOS_ARM64, IOS_X64,
|
||||||
LINUX_X64, LINUX_ARM32_HFP, LINUX_ARM64, LINUX_MIPS32, LINUX_MIPSEL32,
|
WATCHOS_ARM64, WATCHOS_X64,
|
||||||
|
TVOS_ARM64, TVOS_X64,
|
||||||
|
LINUX_X64, LINUX_ARM32_HFP, LINUX_ARM64, LINUX_MIPS32, LINUX_MIPSEL32,
|
||||||
MINGW_X64, MINGW_X86,
|
MINGW_X64, MINGW_X86,
|
||||||
MACOS_X64,
|
MACOS_X64,
|
||||||
WASM32)
|
WASM32)
|
||||||
@@ -169,6 +176,7 @@ open class HostManager(protected val distribution: Distribution = Distribution()
|
|||||||
LINUX_ARM64,
|
LINUX_ARM64,
|
||||||
LINUX_MIPS32,
|
LINUX_MIPS32,
|
||||||
LINUX_MIPSEL32,
|
LINUX_MIPSEL32,
|
||||||
|
ANDROID_X64,
|
||||||
ANDROID_ARM32,
|
ANDROID_ARM32,
|
||||||
ANDROID_ARM64,
|
ANDROID_ARM64,
|
||||||
WASM32
|
WASM32
|
||||||
@@ -179,6 +187,7 @@ open class HostManager(protected val distribution: Distribution = Distribution()
|
|||||||
LINUX_X64,
|
LINUX_X64,
|
||||||
LINUX_ARM32_HFP,
|
LINUX_ARM32_HFP,
|
||||||
LINUX_ARM64,
|
LINUX_ARM64,
|
||||||
|
ANDROID_X64,
|
||||||
ANDROID_ARM32,
|
ANDROID_ARM32,
|
||||||
ANDROID_ARM64,
|
ANDROID_ARM64,
|
||||||
WASM32
|
WASM32
|
||||||
@@ -188,9 +197,14 @@ open class HostManager(protected val distribution: Distribution = Distribution()
|
|||||||
IOS_ARM32,
|
IOS_ARM32,
|
||||||
IOS_ARM64,
|
IOS_ARM64,
|
||||||
IOS_X64,
|
IOS_X64,
|
||||||
|
WATCHOS_ARM64,
|
||||||
|
WATCHOS_X64,
|
||||||
|
TVOS_ARM64,
|
||||||
|
TVOS_X64,
|
||||||
LINUX_X64,
|
LINUX_X64,
|
||||||
LINUX_ARM32_HFP,
|
LINUX_ARM32_HFP,
|
||||||
LINUX_ARM64,
|
LINUX_ARM64,
|
||||||
|
ANDROID_X64,
|
||||||
ANDROID_ARM32,
|
ANDROID_ARM32,
|
||||||
ANDROID_ARM64,
|
ANDROID_ARM64,
|
||||||
WASM32
|
WASM32
|
||||||
@@ -317,6 +331,7 @@ val KonanTarget.presetName: String
|
|||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
ANDROID_ARM32 -> "androidNativeArm32"
|
ANDROID_ARM32 -> "androidNativeArm32"
|
||||||
ANDROID_ARM64 -> "androidNativeArm64"
|
ANDROID_ARM64 -> "androidNativeArm64"
|
||||||
|
ANDROID_X64 -> "androidNativeX64"
|
||||||
else -> evaluatePresetName(this.name)
|
else -> evaluatePresetName(this.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+75
@@ -91,6 +91,21 @@ interface KotlinTargetContainerWithPresetFunctions : KotlinTargetsContainerWithP
|
|||||||
fun androidNativeArm64(name: String, configure: Closure<*>) = androidNativeArm64(name) { ConfigureUtil.configure(configure, this) }
|
fun androidNativeArm64(name: String, configure: Closure<*>) = androidNativeArm64(name) { ConfigureUtil.configure(configure, this) }
|
||||||
fun androidNativeArm64(configure: Closure<*>) = androidNativeArm64 { ConfigureUtil.configure(configure, this) }
|
fun androidNativeArm64(configure: Closure<*>) = androidNativeArm64 { ConfigureUtil.configure(configure, this) }
|
||||||
|
|
||||||
|
fun androidNativeX64(
|
||||||
|
name: String = "androidNativeX64",
|
||||||
|
configure: KotlinNativeTarget.() -> Unit = { }
|
||||||
|
): KotlinNativeTarget =
|
||||||
|
configureOrCreate(
|
||||||
|
name,
|
||||||
|
presets.getByName("androidNativeX64") as KotlinNativeTargetPreset,
|
||||||
|
configure
|
||||||
|
)
|
||||||
|
|
||||||
|
fun androidNativeX64() = androidNativeX64("androidNativeX64") { }
|
||||||
|
fun androidNativeX64(name: String) = androidNativeX64(name) { }
|
||||||
|
fun androidNativeX64(name: String, configure: Closure<*>) = androidNativeX64(name) { ConfigureUtil.configure(configure, this) }
|
||||||
|
fun androidNativeX64(configure: Closure<*>) = androidNativeX64 { ConfigureUtil.configure(configure, this) }
|
||||||
|
|
||||||
fun iosArm32(
|
fun iosArm32(
|
||||||
name: String = "iosArm32",
|
name: String = "iosArm32",
|
||||||
configure: KotlinNativeTarget.() -> Unit = { }
|
configure: KotlinNativeTarget.() -> Unit = { }
|
||||||
@@ -136,6 +151,66 @@ interface KotlinTargetContainerWithPresetFunctions : KotlinTargetsContainerWithP
|
|||||||
fun iosX64(name: String, configure: Closure<*>) = iosX64(name) { ConfigureUtil.configure(configure, this) }
|
fun iosX64(name: String, configure: Closure<*>) = iosX64(name) { ConfigureUtil.configure(configure, this) }
|
||||||
fun iosX64(configure: Closure<*>) = iosX64 { ConfigureUtil.configure(configure, this) }
|
fun iosX64(configure: Closure<*>) = iosX64 { ConfigureUtil.configure(configure, this) }
|
||||||
|
|
||||||
|
fun watchosArm64(
|
||||||
|
name: String = "watchosArm64",
|
||||||
|
configure: KotlinNativeTarget.() -> Unit = { }
|
||||||
|
): KotlinNativeTarget =
|
||||||
|
configureOrCreate(
|
||||||
|
name,
|
||||||
|
presets.getByName("watchosArm64") as KotlinNativeTargetPreset,
|
||||||
|
configure
|
||||||
|
)
|
||||||
|
|
||||||
|
fun watchosArm64() = watchosArm64("watchosArm64") { }
|
||||||
|
fun watchosArm64(name: String) = watchosArm64(name) { }
|
||||||
|
fun watchosArm64(name: String, configure: Closure<*>) = watchosArm64(name) { ConfigureUtil.configure(configure, this) }
|
||||||
|
fun watchosArm64(configure: Closure<*>) = watchosArm64 { ConfigureUtil.configure(configure, this) }
|
||||||
|
|
||||||
|
fun watchosX64(
|
||||||
|
name: String = "watchosX64",
|
||||||
|
configure: KotlinNativeTarget.() -> Unit = { }
|
||||||
|
): KotlinNativeTarget =
|
||||||
|
configureOrCreate(
|
||||||
|
name,
|
||||||
|
presets.getByName("watchosX64") as KotlinNativeTargetPreset,
|
||||||
|
configure
|
||||||
|
)
|
||||||
|
|
||||||
|
fun watchosX64() = watchosX64("watchosX64") { }
|
||||||
|
fun watchosX64(name: String) = watchosX64(name) { }
|
||||||
|
fun watchosX64(name: String, configure: Closure<*>) = watchosX64(name) { ConfigureUtil.configure(configure, this) }
|
||||||
|
fun watchosX64(configure: Closure<*>) = watchosX64 { ConfigureUtil.configure(configure, this) }
|
||||||
|
|
||||||
|
fun tvosArm64(
|
||||||
|
name: String = "tvosArm64",
|
||||||
|
configure: KotlinNativeTarget.() -> Unit = { }
|
||||||
|
): KotlinNativeTarget =
|
||||||
|
configureOrCreate(
|
||||||
|
name,
|
||||||
|
presets.getByName("tvosArm64") as KotlinNativeTargetPreset,
|
||||||
|
configure
|
||||||
|
)
|
||||||
|
|
||||||
|
fun tvosArm64() = tvosArm64("tvosArm64") { }
|
||||||
|
fun tvosArm64(name: String) = tvosArm64(name) { }
|
||||||
|
fun tvosArm64(name: String, configure: Closure<*>) = tvosArm64(name) { ConfigureUtil.configure(configure, this) }
|
||||||
|
fun tvosArm64(configure: Closure<*>) = tvosArm64 { ConfigureUtil.configure(configure, this) }
|
||||||
|
|
||||||
|
fun tvosX64(
|
||||||
|
name: String = "tvosX64",
|
||||||
|
configure: KotlinNativeTarget.() -> Unit = { }
|
||||||
|
): KotlinNativeTarget =
|
||||||
|
configureOrCreate(
|
||||||
|
name,
|
||||||
|
presets.getByName("tvosX64") as KotlinNativeTargetPreset,
|
||||||
|
configure
|
||||||
|
)
|
||||||
|
|
||||||
|
fun tvosX64() = tvosX64("tvosX64") { }
|
||||||
|
fun tvosX64(name: String) = tvosX64(name) { }
|
||||||
|
fun tvosX64(name: String, configure: Closure<*>) = tvosX64(name) { ConfigureUtil.configure(configure, this) }
|
||||||
|
fun tvosX64(configure: Closure<*>) = tvosX64 { ConfigureUtil.configure(configure, this) }
|
||||||
|
|
||||||
fun linuxX64(
|
fun linuxX64(
|
||||||
name: String = "linuxX64",
|
name: String = "linuxX64",
|
||||||
configure: KotlinNativeTarget.() -> Unit = { }
|
configure: KotlinNativeTarget.() -> Unit = { }
|
||||||
|
|||||||
+3
-2
@@ -133,8 +133,9 @@ open class KotlinCocoapodsPlugin: Plugin<Project> {
|
|||||||
val requestedBuildType = project.findProperty(CONFIGURATION_PROPERTY)?.toString()?.toUpperCase() ?: return@whenEvaluated
|
val requestedBuildType = project.findProperty(CONFIGURATION_PROPERTY)?.toString()?.toUpperCase() ?: return@whenEvaluated
|
||||||
|
|
||||||
if (requestedTargetName == KOTLIN_TARGET_FOR_DEVICE) {
|
if (requestedTargetName == KOTLIN_TARGET_FOR_DEVICE) {
|
||||||
// We create a fat framework only for device platforms: iosArm64 and iosArm32.
|
// We create a fat framework only for device platforms: iosArm64, iosArm32, watchosArm64 and tvosArm64.
|
||||||
val devicePlatforms = listOf(KonanTarget.IOS_ARM64, KonanTarget.IOS_ARM32)
|
val devicePlatforms = listOf(KonanTarget.IOS_ARM64, KonanTarget.IOS_ARM32,
|
||||||
|
KonanTarget.WATCHOS_ARM64, KonanTarget.TVOS_ARM64)
|
||||||
val deviceTargets = devicePlatforms.flatMap { kotlinExtension.targetsForPlatform(it) }
|
val deviceTargets = devicePlatforms.flatMap { kotlinExtension.targetsForPlatform(it) }
|
||||||
|
|
||||||
if (deviceTargets.size == 1) {
|
if (deviceTargets.size == 1) {
|
||||||
|
|||||||
+4
@@ -168,6 +168,10 @@ open class FatFrameworkTask: DefaultTask() {
|
|||||||
get() = when(target.konanTarget) {
|
get() = when(target.konanTarget) {
|
||||||
KonanTarget.IOS_ARM32, KonanTarget.IOS_ARM64 -> "iPhoneOS"
|
KonanTarget.IOS_ARM32, KonanTarget.IOS_ARM64 -> "iPhoneOS"
|
||||||
KonanTarget.IOS_X64 -> "iPhoneSimulator"
|
KonanTarget.IOS_X64 -> "iPhoneSimulator"
|
||||||
|
KonanTarget.TVOS_ARM64 -> "appletvos"
|
||||||
|
KonanTarget.TVOS_X64 -> "appletvsimulator"
|
||||||
|
KonanTarget.WATCHOS_ARM64 -> "watchos"
|
||||||
|
KonanTarget.WATCHOS_X64 -> "watchsimulator"
|
||||||
else -> error("Fat frameworks are not supported for target `${target.konanTarget.visibleName}`")
|
else -> error("Fat frameworks are not supported for target `${target.konanTarget.visibleName}`")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user