Skip to content

Commit

Permalink
Update XCFramework pods after running bin/generate-podspecs.sh (#5846)
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio authored Jun 26, 2023
2 parents 5914a38 + 99e37bd commit 5558db0
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions bin/generate-podspecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -45,7 +45,7 @@ if [[ $PROMPT_RESPONSE_2 != "y" ]]; then
exit 1
fi

mkdir $DEST
mkdir "$DEST"

NODE_MODULES_DIR="gutenberg/node_modules"

Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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/"
Expand Down Expand Up @@ -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
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

0 comments on commit 5558db0

Please sign in to comment.