Skip to content

Commit 73bf2e8

Browse files
committed
drop second target - use one target and configure from parameters
1 parent e7ada4b commit 73bf2e8

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

SharedCode/build.gradle

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
apply plugin: 'kotlin-multiplatform'
22

3+
34
kotlin {
45
targets {
5-
fromPreset(presets.jvm, 'android')
6+
def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") ? presets.iosArm64 : presets.iosX64
67

7-
fromPreset(presets.iosArm64, 'iOS') {
8+
fromPreset(iOSTarget, 'iOS') {
89
compilations.main.outputKinds('FRAMEWORK')
910
}
1011

11-
fromPreset(presets.iosX64, 'iOSx64') {
12-
compilations.main.outputKinds('FRAMEWORK')
13-
}
12+
fromPreset(presets.jvm, 'android')
1413
}
1514

1615
sourceSets {
@@ -21,8 +20,6 @@ kotlin {
2120
androidMain.dependencies {
2221
api 'org.jetbrains.kotlin:kotlin-stdlib'
2322
}
24-
25-
iOSx64Main.dependsOn iOSMain
2623
}
2724
}
2825

@@ -33,13 +30,11 @@ configurations {
3330
task packForXCode(type: Sync) {
3431
final File frameworkDir = new File(buildDir, "xcode-frameworks")
3532
final String mode = System.getenv('CONFIGURATION')?.toUpperCase() ?: 'DEBUG'
36-
final String target = System.getenv('SDK_NAME')?.startsWith("iphoneos") ? 'iOS' : 'iOSx64'
3733

38-
inputs.property "target", target
3934
inputs.property "mode", mode
40-
dependsOn kotlin.targets."$target".compilations.main.linkTaskName("FRAMEWORK", mode)
35+
dependsOn kotlin.targets.iOS.compilations.main.linkTaskName("FRAMEWORK", mode)
4136

42-
from { kotlin.targets."$target".compilations.main.getBinary("FRAMEWORK", mode).parentFile }
37+
from { kotlin.targets.iOS.compilations.main.getBinary("FRAMEWORK", mode).parentFile }
4338
into frameworkDir
4439

4540
doLast {

0 commit comments

Comments
 (0)