Skip to content

Commit 1bd2be6

Browse files
committed
add Gradle task to prepare Framework for Xcode
1 parent bbc8ef4 commit 1bd2be6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

SharedCode/build.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,25 @@ kotlin {
2929
configurations {
3030
compileClasspath
3131
}
32+
33+
task packForXCode(type: Sync) {
34+
final File frameworkDir = new File(buildDir, "xcode-frameworks")
35+
final String mode = System.getenv('CONFIGURATION')?.toUpperCase() ?: 'DEBUG'
36+
final String target = System.getenv('SDK_NAME')?.startsWith("iphoneos") ? 'iOS' : 'iOSx64'
37+
38+
inputs.property "target", target
39+
inputs.property "mode", mode
40+
outputs.dir frameworkDir
41+
dependsOn kotlin.targets."$target".compilations.main.linkTaskName("FRAMEWORK", mode)
42+
43+
from { kotlin.targets."$target".compilations.main.getBinary("FRAMEWORK", mode).parentFile }
44+
into frameworkDir
45+
46+
doLast {
47+
new TreeMap(System.getenv()).forEach { k,v ->
48+
println " $k=$v"
49+
}
50+
}
51+
}
52+
53+
tasks.build.dependsOn packForXCode

0 commit comments

Comments
 (0)