From eb7d2466b0e4af03fd9f552887fcb6cd0b711b7d Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 16 Nov 2022 19:44:05 +0900 Subject: [PATCH 1/4] Add output file to swiftlint build phase --- WooCommerce/WooCommerce.xcodeproj/project.pbxproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj index ff8fd50f05e..e261c03aa1a 100644 --- a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj +++ b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj @@ -9530,10 +9530,11 @@ outputFileListPaths = ( ); outputPaths = ( + "$(DERIVED_FILE_DIR)/swiftlint-output.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "$SRCROOT/../Scripts/build-phases/swiftlint.sh\n"; + shellScript = "$SRCROOT/../Scripts/build-phases/swiftlint.sh\n\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; }; 5F0CE4E06C2CFA36FC2FD62B /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; From d41bbc5192bba60a1c734bb71c5a86f8249df679 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 16 Nov 2022 19:46:35 +0900 Subject: [PATCH 2/4] Add output to nested framework check build phase --- WooCommerce/WooCommerce.xcodeproj/project.pbxproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj index e261c03aa1a..7cf04f5800f 100644 --- a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj +++ b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj @@ -9491,10 +9491,11 @@ outputFileListPaths = ( ); outputPaths = ( + "$(DERIVED_FILE_DIR)/check-for-nested-frameworks.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = "/bin/sh -euo pipefail"; - shellScript = "${PROJECT_DIR}/../Scripts/check-nested-frameworks.sh\n"; + shellScript = "${PROJECT_DIR}/../Scripts/check-nested-frameworks.sh\n\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 3F50FE4528CAEE9F00C89201 /* Enforce AppLocalizedString usages */ = { From dc4cfd59adb463c0e29ebf63b2d444bb379a1168 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 23 Nov 2022 12:16:09 +0900 Subject: [PATCH 3/4] Revert swiftlint phase output changes --- WooCommerce/WooCommerce.xcodeproj/project.pbxproj | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj index 7cf04f5800f..73783162767 100644 --- a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj +++ b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj @@ -9531,11 +9531,10 @@ outputFileListPaths = ( ); outputPaths = ( - "$(DERIVED_FILE_DIR)/swiftlint-output.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "$SRCROOT/../Scripts/build-phases/swiftlint.sh\n\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "$SRCROOT/../Scripts/build-phases/swiftlint.sh\n"; }; 5F0CE4E06C2CFA36FC2FD62B /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; From ab50cc106e2b10da8dd7ee9f5ee1f9934d403ab4 Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Wed, 23 Nov 2022 12:22:39 +0900 Subject: [PATCH 4/4] =?UTF-8?q?Remove=20=E2=80=9CCheck=20for=20nested=20fr?= =?UTF-8?q?ameworks=E2=80=9D=20build=20phase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/check-nested-frameworks.sh | 25 ------------------- .../WooCommerce.xcodeproj/project.pbxproj | 21 ---------------- 2 files changed, 46 deletions(-) delete mode 100755 Scripts/check-nested-frameworks.sh diff --git a/Scripts/check-nested-frameworks.sh b/Scripts/check-nested-frameworks.sh deleted file mode 100755 index dfc2e6c7732..00000000000 --- a/Scripts/check-nested-frameworks.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -euo pipefail - -# Nested frameworks (i.e. having a Frameworks/ folder inside *.app/Frameworks/.framework) is invalid and will make the build be rejected during TestFlight validation. -# This can happen especially due to an Xcode 12.4 UI bug when linking binary frameworks to the project which always embed the binary (and if you try to change to Do Not Embed it also removes it from linked libraries) -# This is a bug in Xcode 12.4 UI that is fixed in Xcode 12.5, so fixing nested frameworks to "Do Not Embed" can be fixed using Xcode 12.5, while still continue using Xcode 12.4 for development after the fix. - -# This script is intended to be used as a Build Phase on the main app target, as the very last build phase (and especially after the "Embed Frameworks" phase) - -NESTED_FMKS_DIRS=$(find "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" -name Frameworks -depth 2) -if [ -z "$NESTED_FMKS_DIRS" ]; then - echo "✅ No nested framework found, you're good to go!" -else - echo "❌ Found nested \`Frameworks\` folder inside frameworks of final bundle." - for fmk_dir in $NESTED_FMKS_DIRS; do - # Extract the name of the parent framework containing the nested ones - parent_fmk=$(basename $(dirname $fmk_dir) .framework) - # Extract the list of frameworks nested inside that parent framework. In the next command: - # * `-depth 1` is to avoid logging cases of "C nested in B itself nested in A" (2+ levels of nesting), since C nested in B will already be logged when looping on fmk_dir=B, so no need to log it during fmk_dir=A too. - # * The `sed` command removes the leading `./` in the paths returned by `find`, then quote the results in backticks for nicer formatting in final message. - # * The `tr` command joins all the lines (= found frameworks) with a `,`. Note that this will result in an extra comma at the end of the list too, but we'll get rid of that in the final message using ${nested_fmks%,} bash substitution. - nested_fmks=$(cd "${fmk_dir}" && find . -name '*.framework' -depth 1 | sed "s:^./\(.*\)$:\`\1\`:" | tr '\n' ',') - echo "error: Found nested frameworks in ${fmk_dir} -- Such a configuration is invalid and will be rejected by TestFlight. Please fix by choosing 'Do Not Embed' for the nested framework(s) ${nested_fmks%,} within the \`${parent_fmk}\` Xcode project which links to them. You might need to use Xcode 12.5 to fix this, due to an Xcode 12.4 bug – see paNNhX-ee-p2" - done - exit 1 -fi diff --git a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj index 73783162767..7ddf5bbad89 100644 --- a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj +++ b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj @@ -8970,7 +8970,6 @@ B56DB3C42049BFAA00D4AA8E /* Resources */, B5650B1020A4CD7F009702D0 /* Embed Frameworks */, B7A94351C1ADC31EA528B895 /* [CP] Embed Pods Frameworks */, - 095040D72655531C001D08FA /* Check for nested frameworks */, 3F1FA85028B60126009E246C /* Embed Foundation Extensions */, ); buildRules = ( @@ -9478,26 +9477,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 095040D72655531C001D08FA /* Check for nested frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = "Check for nested frameworks"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/check-for-nested-frameworks.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = "/bin/sh -euo pipefail"; - shellScript = "${PROJECT_DIR}/../Scripts/check-nested-frameworks.sh\n\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; 3F50FE4528CAEE9F00C89201 /* Enforce AppLocalizedString usages */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1;