Skip to content

Commit

Permalink
Do not embed Hermes in the Gutenberg XCFramework (#5973)
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio authored Jul 20, 2023
2 parents c6fb2a5 + d2eab79 commit 378e233
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
16 changes: 0 additions & 16 deletions ios-xcframework/XCFrameworkScaffold.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
3F12365029F6B23300AF54A4 /* supported-blocks.json in Resources */ = {isa = PBXBuildFile; fileRef = 3F12364F29F6B23300AF54A4 /* supported-blocks.json */; };
3FA0C5812A1C8C9700600A9A /* App.js in Resources */ = {isa = PBXBuildFile; fileRef = 3FA0C5802A1C8C9700600A9A /* App.js */; };
3FC7862B2A53047D00A0DDAF /* hermes.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FC7862A2A53047D00A0DDAF /* hermes.xcframework */; };
3FC7862C2A53047D00A0DDAF /* hermes.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3FC7862A2A53047D00A0DDAF /* hermes.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3FE06AC329F3F61300F752AD /* Gutenberg.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FE06AC229F3F61300F752AD /* Gutenberg.h */; settings = {ATTRIBUTES = (Public, ); }; };
3FE06ACE29F3F6DA00F752AD /* Gutenberg-Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 3FE06AC829F3F6DA00F752AD /* Gutenberg-Debug.xcconfig */; };
3FE06ACF29F3F6DA00F752AD /* Gutenberg-Shared.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 3FE06AC929F3F6DA00F752AD /* Gutenberg-Shared.xcconfig */; };
Expand All @@ -38,20 +37,6 @@
612F325D13E652BF476ED672 /* Pods_Gutenberg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 432C8665181F3EC336B71D6C /* Pods_Gutenberg.framework */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
3FC7862D2A53047D00A0DDAF /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
3FC7862C2A53047D00A0DDAF /* hermes.xcframework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
3F1235FB29F680F900AF54A4 /* GutenbergBridgeDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GutenbergBridgeDelegate.swift; path = "../../gutenberg/packages/react-native-bridge/ios/GutenbergBridgeDelegate.swift"; sourceTree = "<group>"; };
3F1235FC29F680F900AF54A4 /* GutenbergBridgeDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GutenbergBridgeDataSource.swift; path = "../../gutenberg/packages/react-native-bridge/ios/GutenbergBridgeDataSource.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -209,7 +194,6 @@
3FE06ABC29F3F61300F752AD /* Frameworks */,
3FE06ABD29F3F61300F752AD /* Resources */,
33E2599260A73CF1DC26925F /* [CP] Copy Pods Resources */,
3FC7862D2A53047D00A0DDAF /* Embed Frameworks */,
);
buildRules = (
);
Expand Down
11 changes: 10 additions & 1 deletion ios-xcframework/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ function archive {
SKIP_INSTALL=NO
}

# Fail early if the expected Hermes XCFramework that should be bundled with React Native cannot be found
HERMES_XCFRAMEWORK=./Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework
if [ ! -d $HERMES_XCFRAMEWORK ]; then
log 'fail' "Could not file required Hermes XCFramework at path: $HERMES_XCFRAMEWORK"
exit 1
fi

BUILD_DIR=./build
DERIVED_DATA_PATH="$BUILD_DIR/derived_data"
ARCHIVES_ROOT="$BUILD_DIR/archives"
Expand Down Expand Up @@ -92,7 +99,7 @@ do
FRAMEWORK_RELATIVE_PATH="Products/Library/Frameworks/$CURRENT_FRAMEWORK_NAME.framework"

if [[ $CURRENT_FRAMEWORK_NAME = 'hermes' ]]; then
log 'no_good' "Skipping creating XCFramework for $CURRENT_FRAMEWORK_NAME"
log 'no_good' "Skipping creating XCFramework for $CURRENT_FRAMEWORK_NAME, we'll use the one bundled with React Native"
continue
fi

Expand Down Expand Up @@ -143,6 +150,8 @@ cp -r "$XCFRAMEWORKS_DIR/Gutenberg.xcframework" "$ARCHIVE_FRAMEWORKS_PATH"
cp -r "$XCFRAMEWORKS_DIR/React.xcframework" "$ARCHIVE_FRAMEWORKS_PATH"
cp -r "$XCFRAMEWORKS_DIR/RNTAztecView.xcframework" "$ARCHIVE_FRAMEWORKS_PATH"
cp -r "$XCFRAMEWORKS_DIR/yoga.xcframework" "$ARCHIVE_FRAMEWORKS_PATH"
# We don't want the Catalyst slice because 1) it's huge and 2) we don't need it at the moment
rsync -a "$HERMES_XCFRAMEWORK" "$ARCHIVE_FRAMEWORKS_PATH" --exclude '*-maccatalyst'

ARCHIVE_PATH="$XCFRAMEWORKS_DIR/$MAIN_FRAMEWORK_NAME.tar.gz"

Expand Down
3 changes: 2 additions & 1 deletion ios-xcframework/podspec.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Pod::Spec.new do |s|
'Frameworks/Gutenberg.xcframework',
'Frameworks/React.xcframework',
'Frameworks/RNTAztecView.xcframework',
'Frameworks/yoga.xcframework'
'Frameworks/yoga.xcframework',
'Frameworks/hermes.xcframework'
]
end

0 comments on commit 378e233

Please sign in to comment.