Skip to content

Commit 0042803

Browse files
authored
Merge pull request #58706 from callstack-internal/feat/remote-builds
feat: cli setup to enable remote builds for ios and android using RNEF
2 parents 10dad74 + 10ae87d commit 0042803

File tree

13 files changed

+1254
-17
lines changed

13 files changed

+1254
-17
lines changed

.github/scripts/verifyPodfile.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ if ! SPEC_DIRS=$(yq '.["EXTERNAL SOURCES"].[].":path" | select( . == "*node_modu
6464
fi
6565

6666
# Retrieve a list of podspec paths from react-native config
67-
if ! read_lines_into_array PODSPEC_PATHS < <(npx react-native config | jq --raw-output '.dependencies[].platforms.ios.podspecPath | select ( . != null)'); then
67+
if ! read_lines_into_array PODSPEC_PATHS < <(npx rnef config -p ios | jq --raw-output '.dependencies[].platforms.ios.podspecPath | select ( . != null)'); then
6868
error "Error: could not parse podspec paths from react-native config command"
6969
cleanupAndExit 1
7070
fi

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,6 @@ docs/.bundle
147147

148148
# Output of react compiler healthcheck dev script
149149
react-compiler-output.txt
150+
151+
# React Native Enterprise Framework
152+
.rnef/

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ react {
6666
autolinkLibrariesWithApp()
6767
// Added by install-expo-modules
6868
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", rootDir.getAbsoluteFile().getParentFile().getAbsolutePath(), "android", "absolute"].execute(null, rootDir).text.trim())
69-
cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim())
70-
bundleCommand = "export:embed"
69+
cliFile = file("../../node_modules/@rnef/cli/dist/src/bin.js")
70+
bundleCommand = "bundle"
7171
}
7272

7373
project.ext.envConfigFiles = [

android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
22
plugins { id("com.facebook.react.settings") }
3-
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
3+
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand(['npx', 'rnef', 'config', '-p', 'android']) }
44
rootProject.name = 'NewExpensify'
55
include ':react-native-webview'
66
project(':react-native-webview').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-webview/android')

contributingGuides/HYBRID_APP.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,6 @@ If you'd like to build HybridApp in `release` configuration you need to adjust o
186186
### How to see native logs in Android Studio?
187187
The easiest way to see native logs is to use Logcat. In order to find it go to: `View` > `Tool windows` > `Logcat`
188188
## iOS
189-
### Error: `undefined method [] for nil`
190-
It's an error that you may encounter while executing `npm run pod-install`. Unfortunately it's very generic, and indicates an error in some React Native CLI script. In order to debug it, you have to get deeper into JS script files of the `@react-native-community/cli` package. If you haven't changed anything in the `Podfile`, or haven't bumped `react-native` the best thing to do is to remove and reinstall `node_modules` and make sure all patches were applied correctly.
191-
192189
### Error: `"xcodebuild" exited with error code '65'`
193190
This is a very common error that may appear during an iOS build, it's especially annoying when it appears after executing `npm run ios`, because it doesn't give any additional information that may be useful for debugging. In order to see the real error you need to open XCode and rerun the build from there. When the build fails, pick `Errors Only` in the main panel, and extend the error by pressing an icon with 4 parallel lines on the right hand side. On the very bottom you should see the real error.
194191

ios/NewExpensify.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@
528528
);
529529
runOnlyForDeploymentPostprocessing = 0;
530530
shellPath = /bin/sh;
531-
shellScript = "if [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios relative | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli')\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"`\n";
531+
shellScript = "bash -l -c \"${PROJECT_DIR}/bundle-react-native-code-and-images.sh\"\n";
532532
};
533533
0B960DEC1F581E1EB7F1342F /* [CP] Check Pods Manifest.lock */ = {
534534
isa = PBXShellScriptBuildPhase;

ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ target 'NewExpensify' do
8686
'ReleaseProduction' => :release,
8787
'Debug' => :debug
8888

89-
config = use_native_modules!
89+
config = use_native_modules!(['npx', 'rnef', 'config', '-p', 'ios'])
9090

9191
# Flags change depending on the env values.
9292
flags = get_default_flags()

ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3478,6 +3478,6 @@ SPEC CHECKSUMS:
34783478
VisionCamera: c95a8ad535f527562be1fb05fb2fd324578e769c
34793479
Yoga: 1fd059161b449018342943b095a6d4e69bcaa719
34803480

3481-
PODFILE CHECKSUM: 5b2f0a75a0848d964701b52fb6ab7e9602040f3e
3481+
PODFILE CHECKSUM: e1af24debf4226877e7b4ae9da7137bd4361db9d
34823482

34833483
COCOAPODS: 1.15.2
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
if [[ -f "$PODS_ROOT/../.xcode.env" ]]; then
4+
source "$PODS_ROOT/../.xcode.env"
5+
fi
6+
if [[ -f "$PODS_ROOT/../.xcode.env.local" ]]; then
7+
source "$PODS_ROOT/../.xcode.env.local"
8+
fi
9+
10+
# The project root by default is one level up from the ios directory
11+
export PROJECT_ROOT="$PROJECT_DIR/.."
12+
13+
if [[ "$CONFIGURATION" = *Debug* ]]; then
14+
export SKIP_BUNDLING=1
15+
fi
16+
if [[ -z "$ENTRY_FILE" ]]; then
17+
# Set the entry JS file using the bundler's entry resolution.
18+
ENTRY_FILE="$("$NODE_BINARY" -e "require('expo/scripts/resolveAppEntry')" "$PROJECT_ROOT" ios relative | tail -n 1)"
19+
export ENTRY_FILE
20+
fi
21+
22+
if [[ -z "$CLI_PATH" ]]; then
23+
export CONFIG_CMD="dummy-workaround-value"
24+
CLI_PATH="$("$NODE_BINARY" --print "require('path').dirname(require.resolve('@rnef/cli/package.json')) + '/dist/src/bin.js'")"
25+
export CLI_PATH
26+
fi
27+
if [[ -z "$BUNDLE_COMMAND" ]]; then
28+
# CLI command for bundling
29+
export BUNDLE_COMMAND="bundle"
30+
fi
31+
32+
"$NODE_BINARY" --print "require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'"

0 commit comments

Comments
 (0)