Skip to content

Commit 0970d85

Browse files
authored
Merge pull request #57 from icerockdev/develop
Release 0.13.0
2 parents cf56e90 + ee0b877 commit 0970d85

File tree

7 files changed

+53
-21
lines changed

7 files changed

+53
-21
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ repositories {
1313
}
1414

1515
dependencies {
16-
implementation("dev.icerock:mobile-multiplatform:0.12.0")
17-
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21")
18-
implementation("com.android.tools.build:gradle:4.2.1")
16+
implementation("dev.icerock:mobile-multiplatform:0.13.0")
17+
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
18+
implementation("com.android.tools.build:gradle:7.0.4")
1919
}
2020
```
2121

@@ -40,9 +40,10 @@ into `gradle.properties` line:
4040
mobile.multiplatform.useIosShortcut=false
4141
```
4242

43-
To disable warning about used ios targets add into `gradle.properties` line:
43+
Also by default `iosSimulatorArm64` target will be created (with connection to `iosMain` and
44+
`iosTest` if was used ios shortcut. To disable it add into `gradle.properties` line:
4445
```
45-
mobile.multiplatform.iosTargetWarning=false
46+
mobile.multiplatform.withoutIosSimulatorArm64=false
4647
```
4748

4849
### Setup AndroidManifest.xml in androidMain sourceSet

gradle.properties

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@ org.gradle.configureondemand=false
33
org.gradle.parallel=true
44

55
kotlin.code.style=official
6-
7-
# Workaround for Bintray treating .sha512 files as artifacts
8-
# https://github.com/gradle/gradle/issues/11412
9-
systemProp.org.gradle.internal.publish.checksums.insecure=true

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[versions]
2-
kotlinVersion = "1.5.21"
3-
androidGradlePluginVerison = "4.2.1"
2+
kotlinVersion = "1.6.10"
3+
androidGradlePluginVerison = "7.0.4"
44
publishPluginVersion = "0.15.0"
5-
mobileMultiplatformGradlePluginVersion = "0.12.0"
5+
mobileMultiplatformGradlePluginVersion = "0.13.0"
66

77
[libraries]
88
androidGradlePlugin = { module = "com.android.tools.build:gradle", version.ref = "androidGradlePluginVerison" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/kotlin/MultiPlatformLibrary.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ data class MultiPlatformLibrary(
1313
val iosX64: String? = null,
1414
val iosArm32: String? = null,
1515
val iosArm64: String? = null,
16+
val iosSimulatorArm64: String? = null,
1617
val macosX64: String? = null,
18+
val macosArm64: String? = null,
1719
val tvosX64: String? = null,
1820
val tvosArm64: String? = null,
21+
val tvosSimulatorArm64: String? = null,
1922
val watchosX86: String? = null,
2023
val watchosX64: String? = null,
2124
val watchosArm32: String? = null,
22-
val watchosArm64: String? = null
25+
val watchosArm64: String? = null,
26+
val watchosSimulatorArm64: String? = null,
2327
) : KotlinNativeExportable {
2428

2529
override fun export(project: Project, framework: Framework) {
@@ -28,13 +32,17 @@ data class MultiPlatformLibrary(
2832
KonanTarget.IOS_X64 -> iosX64
2933
KonanTarget.IOS_ARM32 -> iosArm32
3034
KonanTarget.IOS_ARM64 -> iosArm64
35+
KonanTarget.IOS_SIMULATOR_ARM64 -> iosSimulatorArm64
3136
KonanTarget.MACOS_X64 -> macosX64
37+
KonanTarget.MACOS_ARM64 -> macosArm64
3238
KonanTarget.TVOS_ARM64 -> tvosArm64
3339
KonanTarget.TVOS_X64 -> tvosX64
40+
KonanTarget.TVOS_SIMULATOR_ARM64 -> tvosSimulatorArm64
3441
KonanTarget.WATCHOS_X86 -> watchosX86
3542
KonanTarget.WATCHOS_X64 -> watchosX64
3643
KonanTarget.WATCHOS_ARM32 -> watchosArm32
3744
KonanTarget.WATCHOS_ARM64 -> watchosArm64
45+
KonanTarget.WATCHOS_SIMULATOR_ARM64 -> watchosSimulatorArm64
3846
else -> return
3947
}
4048
exportArtifact?.let { framework.export(it) }
@@ -47,17 +55,21 @@ fun DependencyHandlerScope.mppLibrary(configuration: String, library: MultiPlatf
4755
// ios
4856
library.iosArm32?.let { "iosArm32$configuration"(it) }
4957
library.iosArm64?.let { "iosArm64$configuration"(it) }
58+
library.iosSimulatorArm64?.let { "iosSimulatorArm64$configuration"(it) }
5059
library.iosX64?.let { "iosX64$configuration"(it) }
5160
// macos
5261
library.macosX64?.let { "macosX64$configuration"(it) }
62+
library.macosArm64?.let { "macosArm64$configuration"(it) }
5363
// tvos
5464
library.tvosArm64?.let { "tvosArm64$configuration"(it) }
5565
library.tvosX64?.let { "tvosX64$configuration"(it) }
66+
library.tvosSimulatorArm64?.let { "tvosSimulatorArm64$configuration"(it) }
5667
// watchos
5768
library.watchosX86?.let { "watchosX86$configuration"(it) }
5869
library.watchosX64?.let { "watchosX64$configuration"(it) }
5970
library.watchosArm32?.let { "watchosArm32$configuration"(it) }
6071
library.watchosArm64?.let { "watchosArm64$configuration"(it) }
72+
library.watchosSimulatorArm64?.let { "watchosSimulatorArm64$configuration"(it) }
6173
}
6274

6375
fun DependencyHandlerScope.mppLibrary(library: MultiPlatformLibrary) {
@@ -83,11 +95,15 @@ fun String.defaultMPL(
8395
iosX64 = if (ios) commonToPlatformArtifact(this, "iosx64") else null,
8496
iosArm32 = if (ios) commonToPlatformArtifact(this, "iosarm32") else null,
8597
iosArm64 = if (ios) commonToPlatformArtifact(this, "iosarm64") else null,
98+
iosSimulatorArm64 = if (ios) commonToPlatformArtifact(this, "iosSimulatorArm64") else null,
8699
macosX64 = if (macos) commonToPlatformArtifact(this, "macosx64") else null,
100+
macosArm64 = if (macos) commonToPlatformArtifact(this, "macosArm64") else null,
87101
tvosX64 = if (tvos) commonToPlatformArtifact(this, "tvosx64") else null,
88102
tvosArm64 = if (tvos) commonToPlatformArtifact(this, "tvosarm64") else null,
103+
tvosSimulatorArm64 = if (ios) commonToPlatformArtifact(this, "tvosSimulatorArm64") else null,
89104
watchosArm32 = if (watchos) commonToPlatformArtifact(this, "watchosarm32") else null,
90105
watchosArm64 = if (watchos) commonToPlatformArtifact(this, "watchosarm64") else null,
106+
watchosSimulatorArm64 = if (ios) commonToPlatformArtifact(this, "watchosSimulatorArm64") else null,
91107
watchosX86 = if (watchos) commonToPlatformArtifact(this, "watchosx86") else null,
92108
watchosX64 = if (watchos) commonToPlatformArtifact(this, "watchosx64") else null
93109
)

src/main/kotlin/dev/icerock/gradle/CocoapodsPlugin.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class CocoapodsPlugin : Plugin<Project> {
121121
val (sdk, arch) = when (kotlinNativeTarget.konanTarget) {
122122
KonanTarget.IOS_ARM64 -> "iphoneos" to "arm64"
123123
KonanTarget.IOS_X64 -> "iphonesimulator" to "x86_64"
124+
KonanTarget.IOS_SIMULATOR_ARM64 -> "iphonesimulator" to "arm64"
124125
else -> throw IllegalArgumentException("${kotlinNativeTarget.konanTarget} is unsupported")
125126
}
126127
val taskName = generateCompileCocoaPodTaskName(kotlinNativeTarget, pod)
@@ -146,6 +147,7 @@ class CocoapodsPlugin : Plugin<Project> {
146147
val (sdk, arch) = when (kotlinNativeTarget.konanTarget) {
147148
KonanTarget.IOS_ARM64 -> "iphoneos" to "arm64"
148149
KonanTarget.IOS_X64 -> "iphonesimulator" to "x86_64"
150+
KonanTarget.IOS_SIMULATOR_ARM64 -> "iphonesimulator" to "arm64"
149151
else -> throw IllegalArgumentException("${kotlinNativeTarget.konanTarget} is unsupported")
150152
}
151153
val capitalizedPodName = pod.capitalizedModule

src/main/kotlin/dev/icerock/gradle/MobileTargetsPlugin.kt

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ package dev.icerock.gradle
66

77
import org.gradle.api.Plugin
88
import org.gradle.api.Project
9+
import org.gradle.kotlin.dsl.get
910
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
11+
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
1012

1113
class MobileTargetsPlugin : Plugin<Project> {
1214
private val androidManifestPlugin = AndroidManifestPlugin()
@@ -29,25 +31,40 @@ class MobileTargetsPlugin : Plugin<Project> {
2931
kmpExtension: KotlinMultiplatformExtension,
3032
project: Project
3133
) {
32-
val logTargetTypeStr = project.findProperty(PROPERTY_IOS_WARNING) as? String
33-
val logTargetType = logTargetTypeStr?.toLowerCase() != "false"
3434
kmpExtension.apply {
3535
android()
36-
val useShortcutStr = project.findProperty(PROPERTY_USE_IOS_SHORTCUT) as? String
37-
val useShortcut = useShortcutStr?.toLowerCase() != "false"
36+
val useShortcut = project.boolProperty(PROPERTY_USE_IOS_SHORTCUT) ?: true
37+
val useIosSimulatorArm64 =
38+
project.boolProperty(PROPERTY_WITHOUT_IOS_SIMULATOR_ARM64) ?: true
3839
if (useShortcut) {
39-
if (logTargetType) project.logger.warn("used new ios() shortcut target")
4040
ios()
4141
} else {
42-
if (logTargetType) project.logger.warn("used old iosArm64() and iosX64() targets")
4342
iosArm64()
4443
iosX64()
4544
}
45+
if (useIosSimulatorArm64) {
46+
iosSimulatorArm64()
47+
if (useShortcut) {
48+
val iosMain: KotlinSourceSet = sourceSets["iosMain"]
49+
val iosSimulatorArm64Main: KotlinSourceSet = sourceSets["iosSimulatorArm64Main"]
50+
iosSimulatorArm64Main.dependsOn(iosMain)
51+
52+
val iosTest: KotlinSourceSet = sourceSets["iosTest"]
53+
val iosSimulatorArm64Test: KotlinSourceSet = sourceSets["iosSimulatorArm64Test"]
54+
iosSimulatorArm64Test.dependsOn(iosTest)
55+
}
56+
}
4657
}
4758
}
4859

60+
private fun Project.boolProperty(name: String): Boolean? {
61+
val valueString: String = project.findProperty(name) as? String ?: return null
62+
return valueString.toLowerCase() == "true"
63+
}
64+
4965
private companion object {
50-
const val PROPERTY_IOS_WARNING = "mobile.multiplatform.iosTargetWarning"
5166
const val PROPERTY_USE_IOS_SHORTCUT = "mobile.multiplatform.useIosShortcut"
67+
const val PROPERTY_WITHOUT_IOS_SIMULATOR_ARM64 =
68+
"mobile.multiplatform.withoutIosSimulatorArm64"
5269
}
5370
}

0 commit comments

Comments
 (0)