Skip to content

Commit

Permalink
Changes required for using MacOS ARM agents instead of x86 (#998)
Browse files Browse the repository at this point in the history
  • Loading branch information
eymar authored Oct 29, 2024
1 parent bbfaf62 commit d0b681d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ fun SkikoProjectContext.createSkikoJvmJarTask(os: OS, arch: Arch, commonJar: Tas
val createChecksums2 = createChecksumsTask(os, altArch, nativeLib2)
nativeFiles.add(nativeLib2)
nativeFiles.add(createChecksums2.map { it.outputs.files.singleFile })
allJvmRuntimeJars[os to altArch] = skikoJvmRuntimeJarTask(os, altArch, commonJar, nativeFiles)
}
val skikoJvmRuntimeJar = skikoJvmRuntimeJarTask(os, arch, commonJar, nativeFiles)
allJvmRuntimeJars[os to arch] = skikoJvmRuntimeJar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ fun String.withSuffix(isUikitSim: Boolean = false) =
fun KotlinTarget.isUikitSimulator() =
name.contains("Simulator", ignoreCase = true) || name == "tvosX64" // x64 tvOS is implicitly a simulator

fun Project.findXcodeSdkRoot(): String {
val defaultPath = "/Applications/Xcode.app/Contents/Developer/Platforms"
if (File(defaultPath).exists()) {
return defaultPath.also {
println("findXcodeSdkRoot = $it")
}
}

return (project.property("skiko.ci.xcodehome") as? String)?.let {
val sdkPath = it + "/Platforms"
println("findXcodeSdkRoot = $sdkPath")
sdkPath
} ?: error("gradle property `skiko.ci.xcodehome` is not set")
}

fun SkikoProjectContext.compileNativeBridgesTask(
os: OS, arch: Arch, isUikitSim: Boolean
): TaskProvider<CompileSkikoCppTask> = with (this.project) {
Expand All @@ -52,7 +67,7 @@ fun SkikoProjectContext.compileNativeBridgesTask(

when (os) {
OS.IOS -> {
val sdkRoot = "/Applications/Xcode.app/Contents/Developer/Platforms"
val sdkRoot = findXcodeSdkRoot()
val iphoneOsSdk = "$sdkRoot/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
val iphoneSimSdk = "$sdkRoot/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"
val iosArchFlags = when (arch) {
Expand All @@ -76,7 +91,7 @@ fun SkikoProjectContext.compileNativeBridgesTask(
))
}
OS.TVOS -> {
val sdkRoot = "/Applications/Xcode.app/Contents/Developer/Platforms"
val sdkRoot = findXcodeSdkRoot()
val tvOsSdk = "$sdkRoot/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk"
val tvSimSdk = "$sdkRoot/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk"
val tvosArchFlags = when (arch) {
Expand Down

0 comments on commit d0b681d

Please sign in to comment.