Wizard: temporary add ios shortcut target

Temporary as it will not be needed when HMPP wizard will be ready
This commit is contained in:
Ilya Kirillov
2020-07-23 22:54:02 +03:00
committed by Kirill Shmakov
parent f330cd3697
commit 63fa6674a3
5 changed files with 27 additions and 10 deletions
@@ -19,7 +19,7 @@ repositories {
} }
kotlin { kotlin {
android() android()
iosX64('ios') { ios {
binaries { binaries {
framework { framework {
baseName = 'shared' baseName = 'shared'
@@ -72,7 +72,9 @@ android {
task(packForXcode, type: Sync) { task(packForXcode, type: Sync) {
group = 'build' group = 'build'
def mode = System.getenv('CONFIGURATION') ?: 'DEBUG' def mode = System.getenv('CONFIGURATION') ?: 'DEBUG'
def framework = kotlin.targets.ios.binaries.getFramework(mode) def sdkName = System.getenv('SDK_NAME') ?: 'iphonesimulator'
def targetName = 'ios' + (sdkName.startsWith('iphoneos') ? 'Arm64' : 'X64')
def framework = kotlin.targets[targetName].binaries.getFramework(mode)
inputs.property('mode', mode) inputs.property('mode', mode)
dependsOn(framework.linkTask) dependsOn(framework.linkTask)
def targetDir = new File(buildDir, 'xcode-frameworks') def targetDir = new File(buildDir, 'xcode-frameworks')
@@ -19,7 +19,7 @@ repositories {
} }
kotlin { kotlin {
android() android()
iosX64("ios") { ios {
binaries { binaries {
framework { framework {
baseName = "shared" baseName = "shared"
@@ -66,7 +66,9 @@ android {
val packForXcode by tasks.creating(Sync::class) { val packForXcode by tasks.creating(Sync::class) {
group = "build" group = "build"
val mode = System.getenv("CONFIGURATION") ?: "DEBUG" val mode = System.getenv("CONFIGURATION") ?: "DEBUG"
val framework = kotlin.targets.getByName<KotlinNativeTarget>("ios").binaries.getFramework(mode) val sdkName = System.getenv("SDK_NAME") ?: "iphonesimulator"
val targetName = "ios" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64"
val framework = kotlin.targets.getByName<KotlinNativeTarget>(targetName).binaries.getFramework(mode)
inputs.property("mode", mode) inputs.property("mode", mode)
dependsOn(framework.linkTask) dependsOn(framework.linkTask)
val targetDir = File(buildDir, "xcode-frameworks") val targetDir = File(buildDir, "xcode-frameworks")
@@ -28,6 +28,7 @@ enum class ModuleSubType(val moduleType: ModuleType) {
android(ModuleType.android), android(ModuleType.android),
androidNativeArm32(ModuleType.native), androidNativeArm64(ModuleType.native), androidNativeArm32(ModuleType.native), androidNativeArm64(ModuleType.native),
iosArm32(ModuleType.native), iosArm64(ModuleType.native), iosX64(ModuleType.native), iosArm32(ModuleType.native), iosArm64(ModuleType.native), iosX64(ModuleType.native),
ios(ModuleType.native)/*TODO TEMPORARY TILL HMPP WIZARD PART IS MERGED*/,
linuxArm32Hfp(ModuleType.native), linuxMips32(ModuleType.native), linuxMipsel32(ModuleType.native), linuxArm32Hfp(ModuleType.native), linuxMips32(ModuleType.native), linuxMipsel32(ModuleType.native),
linuxX64(ModuleType.native), linuxX64(ModuleType.native),
macosX64(ModuleType.native), macosX64(ModuleType.native),
@@ -36,7 +37,7 @@ enum class ModuleSubType(val moduleType: ModuleType) {
} }
val ModuleSubType.isIOS: Boolean val ModuleSubType.isIOS: Boolean
get() = this in EnumSet.of(ModuleSubType.iosX64, ModuleSubType.iosArm32, ModuleSubType.iosArm64) get() = this in EnumSet.of(ModuleSubType.iosX64, ModuleSubType.iosArm32, ModuleSubType.iosArm64, ModuleSubType.ios)
val ModuleSubType.isNativeDesktop: Boolean val ModuleSubType.isNativeDesktop: Boolean
get() = this in EnumSet.of( get() = this in EnumSet.of(
@@ -323,7 +323,7 @@ object MultiplatformMobileApplicationProjectTemplate : ProjectTemplate() {
}, },
Module( Module(
"ios", "ios",
RealNativeTargetConfigurator.configuratorsByModuleType.getValue(ModuleSubType.iosX64), RealNativeTargetConfigurator.configuratorsByModuleType.getValue(ModuleSubType.ios),
null, null,
sourcesets = createDefaultSourcesets(), sourcesets = createDefaultSourcesets(),
subModules = emptyList() subModules = emptyList()
@@ -147,11 +147,23 @@ sealed class ModuleDependencyType(
"?:", "?:",
const("DEBUG") const("DEBUG")
) )
"framework" createValue raw { "sdkName" createValue GradleBinaryExpressionIR(
+"kotlin.targets." raw { +"System.getenv("; +"SDK_NAME".quotified; +")" },
"?:",
const("iphonesimulator")
)
"targetName" createValue raw {
+iosTargetName.quotified
when (dsl) { when (dsl) {
GradlePrinter.GradleDsl.KOTLIN -> +"""getByName<KotlinNativeTarget>("$iosTargetName")""" GradlePrinter.GradleDsl.KOTLIN -> +""" + if (sdkName.startsWith("iphoneos")) "Arm64" else "X64""""
GradlePrinter.GradleDsl.GROOVY -> +iosTargetName GradlePrinter.GradleDsl.GROOVY -> +""" + (sdkName.startsWith('iphoneos') ? 'Arm64' : 'X64')"""
}
}
"framework" createValue raw {
+"kotlin.targets"
when (dsl) {
GradlePrinter.GradleDsl.KOTLIN -> +""".getByName<KotlinNativeTarget>(targetName)"""
GradlePrinter.GradleDsl.GROOVY -> +"""[targetName]"""
} }
+".binaries.getFramework(mode)" +".binaries.getFramework(mode)"
}; };