Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract build phase to copy Gutenberg resources in script #20719

Merged
merged 1 commit into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Scripts/BuildPhases/CopyGutenbergJS.inputs.xcfilelist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$PODS_ROOT/Gutenberg/bundle/ios
2 changes: 2 additions & 0 deletions Scripts/BuildPhases/CopyGutenbergJS.outputs.xcfilelist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/main.jsbundle
$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/assets/
22 changes: 22 additions & 0 deletions Scripts/BuildPhases/CopyGutenbergJS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash -eux

# Update the matching .outputs.xcfilelist when changing this
DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH

if [[ "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then
IP=$(ipconfig getifaddr en0)
if [ -z "$IP" ]; then
IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | cut -d\ -f2 | awk 'NR==1{print $1}')
fi

echo "$IP" > "$DEST/ip.txt"
fi

# Update the matching .inputs.xcfilelist when changing this
PODS_BUNDLE_ROOT="$PODS_ROOT/Gutenberg/bundle/ios"

BUNDLE_FILE="$DEST/main.jsbundle"
cp "$PODS_BUNDLE_ROOT/App.js" "$BUNDLE_FILE"

BUNDLE_ASSETS="$DEST/assets/"
cp -r "$PODS_BUNDLE_ROOT/assets/" "$BUNDLE_ASSETS"
15 changes: 13 additions & 2 deletions WordPress/WordPress.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20456,13 +20456,18 @@
files = (
);
inputPaths = (
$SRCROOT/../Scripts/BuildPhases/CopyGutenbergJS.inputs.xcfilelist,
);
name = "Copy Gutenberg JS";
outputFileListPaths = (
$SRCROOT/../Scripts/BuildPhases/CopyGutenbergJS.outputs.xcfilelist,
);
outputPaths = (
"",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Print commands before executing them (useful for troubleshooting)\nset -x\nDEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH\n\nif [[ \"$CONFIGURATION\" = *Debug* && ! \"$PLATFORM_NAME\" == *simulator ]]; then\nIP=$(ipconfig getifaddr en0)\nif [ -z \"$IP\" ]; then\nIP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | cut -d\\ -f2 | awk 'NR==1{print $1}')\nfi\n\necho \"$IP\" > \"$DEST/ip.txt\"\nfi\n\nBUNDLE_FILE=\"$DEST/main.jsbundle\"\ncp ${PODS_ROOT}/Gutenberg/bundle/ios/App.js \"${BUNDLE_FILE}\"\n\nBUNDLE_ASSETS=\"$DEST/assets/\"\ncp -r ${PODS_ROOT}/Gutenberg/bundle/ios/assets/ \"${BUNDLE_ASSETS}\"\n";
shellScript = "\"$SRCROOT/../Scripts/BuildPhases/CopyGutenbergJS.sh\"\n";
};
EA14533C29AD874C001F3143 /* Set Up Simulator */ = {
isa = PBXShellScriptBuildPhase;
Expand Down Expand Up @@ -20669,14 +20674,20 @@
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
$SRCROOT/../Scripts/BuildPhases/CopyGutenbergJS.inputs.xcfilelist,
);
inputPaths = (
);
name = "Copy Gutenberg JS";
outputFileListPaths = (
$SRCROOT/../Scripts/BuildPhases/CopyGutenbergJS.outputs.xcfilelist,
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Print commands before executing them (useful for troubleshooting)\nset -x\nDEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH\n\nif [[ \"$CONFIGURATION\" = *Debug* && ! \"$PLATFORM_NAME\" == *simulator ]]; then\nIP=$(ipconfig getifaddr en0)\nif [ -z \"$IP\" ]; then\nIP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | cut -d\\ -f2 | awk 'NR==1{print $1}')\nfi\n\necho \"$IP\" > \"$DEST/ip.txt\"\nfi\n\nBUNDLE_FILE=\"$DEST/main.jsbundle\"\ncp ${PODS_ROOT}/Gutenberg/bundle/ios/App.js \"${BUNDLE_FILE}\"\n\nBUNDLE_ASSETS=\"$DEST/assets/\"\ncp -r ${PODS_ROOT}/Gutenberg/bundle/ios/assets/ \"${BUNDLE_ASSETS}\"\n";
shellScript = "\"$SRCROOT/../Scripts/BuildPhases/CopyGutenbergJS.sh\"\n";
};
FFA8E2301F94E3EF0002170F /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand Down