diff --git a/bin/generate-podspecs.sh b/bin/generate-podspecs.sh index 3c9daf1053..8f20c92423 100755 --- a/bin/generate-podspecs.sh +++ b/bin/generate-podspecs.sh @@ -17,8 +17,8 @@ function warn_missing_tag_commit() { } # Change to the expected directory. -cd "$( dirname "$0" )" -cd .. +pushd "$( dirname "$0" )" > /dev/null +popd > /dev/null WD=$(pwd) echo "Working directory: $WD" @@ -45,7 +45,7 @@ if [[ $PROMPT_RESPONSE_2 != "y" ]]; then exit 1 fi -mkdir $DEST +mkdir "$DEST" NODE_MODULES_DIR="gutenberg/node_modules" @@ -74,7 +74,7 @@ do echo "Generating podspec for $pod" pod ipc spec "$podspec" > "$DEST/$pod.podspec.json" - + # react-native-blur doesn't have a tag field in it's podspec if [[ "$pod" == "react-native-blur" ]]; then echo " ==> Patching $pod podspec" @@ -84,7 +84,7 @@ do jq '.source.tag = "v3.6.1" | .version = "3.6.1"' "$DEST/$pod.podspec.json" > "$TMP_RNBlurPodspec" mv "$TMP_RNBlurPodspec" "$DEST/$pod.podspec.json" fi - + # Add warning to bottom TMP_SPEC=$(mktemp) jq '. + {"__WARNING!__": "This file is autogenerated by generate-podspecs.sh script. Do not modify manually. Re-run the script if necessary."}' "$DEST/$pod.podspec.json" > "$TMP_SPEC" @@ -96,7 +96,7 @@ done # Generate the React Native podspecs # Change to the React Native directory to get relative paths for the RN podspecs -cd "$NODE_MODULES_DIR/react-native" +pushd "$NODE_MODULES_DIR/react-native" > /dev/null RN_DIR="./" SCRIPTS_PATH="./scripts/" @@ -195,4 +195,14 @@ do jq --arg COMMIT_HASH "$COMMIT_HASH" 'del(.script_phases) | del(.prepare_command) | del(.source.tag) | .source.git = "https://github.com/wordpress-mobile/gutenberg-mobile.git" | .source.commit = $COMMIT_HASH | .source.submodules = "true" | .source_files = "third-party-podspecs/FBReactNativeSpec/**/*.{c,h,m,mm,cpp}"' "$DEST/FBReactNativeSpec/FBReactNativeSpec.podspec.json" > "$TMP_FBReactNativeSpec" mv "$TMP_FBReactNativeSpec" "$DEST/FBReactNativeSpec/FBReactNativeSpec.podspec.json" fi -done \ No newline at end of file +done +popd > /dev/null + +# We are required to run this script twice to capture the correct target. +# 0 is the value set during the first script run to generate the podspecs. +if [[ "$COMMIT_HASH" != "0" ]]; then + echo 'Updating XCFramework Podfile.lock with these changes' + pushd ios-xcframework > /dev/null + bundle exec pod update + popd > /dev/null +fi