From 1a8a4a1f141bc797fee7ec4555976ca4e862d245 Mon Sep 17 00:00:00 2001 From: Jonas Bark Date: Wed, 30 Jan 2019 11:47:56 +0100 Subject: [PATCH 1/2] leave CFBundleSupportedPlatforms untouched because it would add iPhoneOS and iPhoneSimulator. Uploading an app to the App Store will then fail with: "Invalid Bundle - Info.plist should specify CFBundleSupportedPlatforms with an array containing a single platform" --- .../gradle/plugin/CocoapodsCompileTask.kt | 20 ------------------- .../cocoapods/gradle/plugin/PluginTest.kt | 2 -- 2 files changed, 22 deletions(-) diff --git a/gradle-plugin/src/main/kotlin/com/alecstrong/cocoapods/gradle/plugin/CocoapodsCompileTask.kt b/gradle-plugin/src/main/kotlin/com/alecstrong/cocoapods/gradle/plugin/CocoapodsCompileTask.kt index b0598c9..5298a30 100644 --- a/gradle-plugin/src/main/kotlin/com/alecstrong/cocoapods/gradle/plugin/CocoapodsCompileTask.kt +++ b/gradle-plugin/src/main/kotlin/com/alecstrong/cocoapods/gradle/plugin/CocoapodsCompileTask.kt @@ -90,26 +90,6 @@ open class CocoapodsCompileTask : DefaultTask() { exec.executable = "/usr/libexec/PlistBuddy" exec.args = listOf("-c", "Delete :UIRequiredDeviceCapabilities", plistPath) }.rethrowFailure().assertNormalExitValue().exitValue - - // Clear supported platforms - project.exec { exec -> - exec.executable = "/usr/libexec/PlistBuddy" - 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() - } } } - - private fun KonanTarget.supportedPlatform(): String = when (this) { - IOS_X64 -> "iPhoneOS" - IOS_ARM64, IOS_ARM32 -> "iPhoneSimulator" - else -> throw AssertionError() - } } \ No newline at end of file diff --git a/gradle-plugin/src/test/kotlin/com/alecstrong/cocoapods/gradle/plugin/PluginTest.kt b/gradle-plugin/src/test/kotlin/com/alecstrong/cocoapods/gradle/plugin/PluginTest.kt index 2c9c975..cf41dfb 100644 --- a/gradle-plugin/src/test/kotlin/com/alecstrong/cocoapods/gradle/plugin/PluginTest.kt +++ b/gradle-plugin/src/test/kotlin/com/alecstrong/cocoapods/gradle/plugin/PluginTest.kt @@ -67,7 +67,6 @@ class PluginTest { assertThat(plist.exists()).isTrue() assertThat(plist.readText()).apply { - contains("iPhoneSimulator") contains("iPhoneOS") } @@ -96,7 +95,6 @@ class PluginTest { assertThat(plist.exists()).isTrue() assertThat(plist.readText()).apply { - contains("iPhoneSimulator") contains("iPhoneOS") doesNotContain("UIRequiredDeviceCapabilities") } From c58179acb980e8c53373ca981cc5e3b920b72960 Mon Sep 17 00:00:00 2001 From: Jonas Bark Date: Wed, 30 Jan 2019 12:05:03 +0100 Subject: [PATCH 2/2] only iPhoneOS should be added to CFBundleSupportedPlatforms --- .../cocoapods/gradle/plugin/CocoapodsCompileTask.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gradle-plugin/src/main/kotlin/com/alecstrong/cocoapods/gradle/plugin/CocoapodsCompileTask.kt b/gradle-plugin/src/main/kotlin/com/alecstrong/cocoapods/gradle/plugin/CocoapodsCompileTask.kt index 5298a30..838b1c8 100644 --- a/gradle-plugin/src/main/kotlin/com/alecstrong/cocoapods/gradle/plugin/CocoapodsCompileTask.kt +++ b/gradle-plugin/src/main/kotlin/com/alecstrong/cocoapods/gradle/plugin/CocoapodsCompileTask.kt @@ -90,6 +90,18 @@ open class CocoapodsCompileTask : DefaultTask() { exec.executable = "/usr/libexec/PlistBuddy" exec.args = listOf("-c", "Delete :UIRequiredDeviceCapabilities", plistPath) }.rethrowFailure().assertNormalExitValue().exitValue + + // Clear supported platforms + project.exec { exec -> + exec.executable = "/usr/libexec/PlistBuddy" + exec.args = listOf("-c", "Delete :CFBundleSupportedPlatforms:0", 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() } } } \ No newline at end of file