From 4828eea16437d95e59bbc29cfaa12bb23410860a Mon Sep 17 00:00:00 2001 From: Alexis Hildebrandt Date: Thu, 2 Nov 2017 16:49:51 -0700 Subject: [PATCH] ios: Update 'Prepare for Distribution script' to handle manual integration and integration via Cocoapods and Carthage. --- .../LinkDemo-ObjC.xcodeproj/project.pbxproj | 2 +- .../LinkDemo-Swift2.xcodeproj/project.pbxproj | 2 +- .../LinkDemo-Swift3.xcodeproj/project.pbxproj | 2 +- .../LinkDemo-Swift4.xcodeproj/project.pbxproj | 2 +- ios/README.md | 12 +++++++----- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ios/LinkDemo-ObjC/LinkDemo-ObjC.xcodeproj/project.pbxproj b/ios/LinkDemo-ObjC/LinkDemo-ObjC.xcodeproj/project.pbxproj index 37dd55ac..e03d5d46 100644 --- a/ios/LinkDemo-ObjC/LinkDemo-ObjC.xcodeproj/project.pbxproj +++ b/ios/LinkDemo-ObjC/LinkDemo-ObjC.xcodeproj/project.pbxproj @@ -179,7 +179,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cp \"${PROJECT_DIR}\"/../LinkKit.framework/prepare_for_distribution.sh \"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n\"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n"; + shellScript = "LINK_ROOT=${PODS_ROOT:+$PODS_ROOT/Plaid/ios}\ncp \"${LINK_ROOT:-$PROJECT_DIR/..}\"/LinkKit.framework/prepare_for_distribution.sh \"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n\"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/LinkDemo-Swift2/LinkDemo-Swift2.xcodeproj/project.pbxproj b/ios/LinkDemo-Swift2/LinkDemo-Swift2.xcodeproj/project.pbxproj index dffa93ab..2fbeff3c 100644 --- a/ios/LinkDemo-Swift2/LinkDemo-Swift2.xcodeproj/project.pbxproj +++ b/ios/LinkDemo-Swift2/LinkDemo-Swift2.xcodeproj/project.pbxproj @@ -165,7 +165,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cp \"${PROJECT_DIR}\"/../LinkKit.framework/prepare_for_distribution.sh \"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n\"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n"; + shellScript = "LINK_ROOT=${PODS_ROOT:+$PODS_ROOT/Plaid/ios}\ncp \"${LINK_ROOT:-$PROJECT_DIR/..}\"/LinkKit.framework/prepare_for_distribution.sh \"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n\"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/LinkDemo-Swift3/LinkDemo-Swift3.xcodeproj/project.pbxproj b/ios/LinkDemo-Swift3/LinkDemo-Swift3.xcodeproj/project.pbxproj index 0548273c..632cb99b 100644 --- a/ios/LinkDemo-Swift3/LinkDemo-Swift3.xcodeproj/project.pbxproj +++ b/ios/LinkDemo-Swift3/LinkDemo-Swift3.xcodeproj/project.pbxproj @@ -166,7 +166,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cp \"${PROJECT_DIR}\"/../LinkKit.framework/prepare_for_distribution.sh \"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n\"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n"; + shellScript = "LINK_ROOT=${PODS_ROOT:+$PODS_ROOT/Plaid/ios}\ncp \"${LINK_ROOT:-$PROJECT_DIR/..}\"/LinkKit.framework/prepare_for_distribution.sh \"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n\"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/LinkDemo-Swift4/LinkDemo-Swift4.xcodeproj/project.pbxproj b/ios/LinkDemo-Swift4/LinkDemo-Swift4.xcodeproj/project.pbxproj index dde74ba7..0b63249e 100644 --- a/ios/LinkDemo-Swift4/LinkDemo-Swift4.xcodeproj/project.pbxproj +++ b/ios/LinkDemo-Swift4/LinkDemo-Swift4.xcodeproj/project.pbxproj @@ -165,7 +165,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "cp \"${PROJECT_DIR}\"/../LinkKit.framework/prepare_for_distribution.sh \"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n\"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n"; + shellScript = "LINK_ROOT=${PODS_ROOT:+$PODS_ROOT/Plaid/ios}\ncp \"${LINK_ROOT:-$PROJECT_DIR/..}\"/LinkKit.framework/prepare_for_distribution.sh \"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n\"${CODESIGNING_FOLDER_PATH}\"/Frameworks/LinkKit.framework/prepare_for_distribution.sh\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ diff --git a/ios/README.md b/ios/README.md index 72085640..7a8b8418 100644 --- a/ios/README.md +++ b/ios/README.md @@ -95,7 +95,7 @@ pod 'Plaid' * Add a **Run Script Build Phase** (we recommend naming it `Prepare for Distribution`) with the [script below](#user-content-prepare-distribution-script). Be sure that the `Prepare for Distribution` build phase runs _after_ the `Embed - Frameworks` build phase. + Frameworks` (or `[CP] Embed Pods Frameworks` when using Cocoapods) build phase.
@@ -139,14 +139,16 @@ to `Carthage/Build/iOS/LinkKit.framework` -The scripts removes code from the framework, which included to support the iPhone Simulator, +The scripts removes code from the framework, which is included to support the iPhone Simulator, but which may not be distributed via the App Store. -Change the `${PROJECT_DIR}/LinkKit.framework` path in the example below according to your setup, -and be sure to quote the filepaths when they contain whitespace. +While the example below supports manual integration as well as integration via Cocoapods or +Carthage, be sure to change the path to `${LINK_ROOT:-$PROJECT_DIR}"/LinkKit.framework/prepare_for_distribution.sh` +according to your setup and quote the filepaths in case they contain whitespace. ```sh -cp "${PROJECT_DIR}"/LinkKit.framework/prepare_for_distribution.sh "${CODESIGNING_FOLDER_PATH}"/Frameworks/LinkKit.framework/prepare_for_distribution.sh +LINK_ROOT=${PODS_ROOT:+$PODS_ROOT/Plaid/ios} +cp "${LINK_ROOT:-$PROJECT_DIR}"/LinkKit.framework/prepare_for_distribution.sh "${CODESIGNING_FOLDER_PATH}"/Frameworks/LinkKit.framework/prepare_for_distribution.sh "${CODESIGNING_FOLDER_PATH}"/Frameworks/LinkKit.framework/prepare_for_distribution.sh ```