Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
Merge pull request #13 from jonasbark/master
Browse files Browse the repository at this point in the history
Fix CFBundleSupportedPlatforms logic
  • Loading branch information
Alec Strong authored Jan 30, 2019
2 parents 896be40 + c58179a commit 595030c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,11 @@ open class CocoapodsCompileTask : DefaultTask() {
exec.args = listOf("-c", "Delete :CFBundleSupportedPlatforms:0", plistPath)
}.rethrowFailure().assertNormalExitValue()

compilations.map { it.binary.target.konanTarget.supportedPlatform() }.distinct()
.forEachIndexed { index, platform ->
project.exec { exec ->
exec.executable = "/usr/libexec/PlistBuddy"
exec.args = listOf("-c", "Add :CFBundleSupportedPlatforms:$index string $platform", plistPath)
}.rethrowFailure().assertNormalExitValue()
}
// only add iPhoneOS as supported platform
project.exec { exec ->
exec.executable = "/usr/libexec/PlistBuddy"
exec.args = listOf("-c", "Add :CFBundleSupportedPlatforms:0 string iPhoneOS", plistPath)
}.rethrowFailure().assertNormalExitValue()
}
}

private fun KonanTarget.supportedPlatform(): String = when (this) {
IOS_X64 -> "iPhoneOS"
IOS_ARM64, IOS_ARM32 -> "iPhoneSimulator"
else -> throw AssertionError()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class PluginTest {
assertThat(plist.exists()).isTrue()

assertThat(plist.readText()).apply {
contains("iPhoneSimulator")
contains("iPhoneOS")
}

Expand Down Expand Up @@ -96,7 +95,6 @@ class PluginTest {
assertThat(plist.exists()).isTrue()

assertThat(plist.readText()).apply {
contains("iPhoneSimulator")
contains("iPhoneOS")
doesNotContain("UIRequiredDeviceCapabilities")
}
Expand Down

0 comments on commit 595030c

Please sign in to comment.