-
Notifications
You must be signed in to change notification settings - Fork 7
MacOS test app and fix hermes vendoring from react-native-macos
#297
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
Changes from all commits
1adf988
97c5c36
f83c5c5
f509d4a
02ae255
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "react-native-node-api": patch | ||
| --- | ||
|
|
||
| Detects "pod install" from React Native MacOS apps and vendors Hermes accordingly |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,6 +107,39 @@ jobs: | |
| # TODO: Enable release mode when it works | ||
| # run: npm run test:ios -- --mode Release | ||
| working-directory: apps/test-app | ||
| test-macos: | ||
| # Disabling this on main for now, as initializing the template takes a long time and | ||
| # we don't have macOS-specific code yet | ||
| if: contains(github.event.pull_request.labels.*.name, 'MacOS 💻') | ||
| name: Test app (macOS) | ||
| runs-on: macos-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: lts/jod | ||
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| java-version: "17" | ||
| distribution: "temurin" | ||
| # Install CMake 3 since 4.x may have compatibility issues with Hermes build system | ||
| - name: Install compatible CMake version | ||
| uses: jwlawson/actions-setup-cmake@v2 | ||
| with: | ||
| cmake-version: "3.31.2" | ||
| - run: rustup target add x86_64-apple-darwin | ||
| - run: npm ci | ||
| - run: npm run bootstrap | ||
| env: | ||
| CMAKE_RN_TRIPLETS: arm64;x86_64-apple-darwin | ||
| FERRIC_TARGETS: aarch64-apple-darwin,x86_64-apple-darwin | ||
| - run: npm run init-macos-test-app | ||
| - run: pod install --project-directory=macos | ||
| working-directory: apps/macos-test-app | ||
| - name: Run MacOS test app | ||
| run: npm run test:allTests -- --mode Release | ||
| working-directory: apps/macos-test-app | ||
| test-android: | ||
| if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Android 🤖') | ||
| name: Test app (Android) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,6 @@ node_modules/ | |
| dist/ | ||
|
|
||
| *.tsbuildinfo | ||
|
|
||
| # Treading the MacOS app as ephemeral | ||
| apps/macos-test-app | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,8 @@ | |
| "test": "npm test --workspace react-native-node-api --workspace cmake-rn --workspace gyp-to-cmake --workspace node-addon-examples", | ||
| "bootstrap": "node --run build && npm run bootstrap --workspaces --if-present", | ||
| "prerelease": "node --run build && npm run prerelease --workspaces --if-present", | ||
| "release": "changeset publish" | ||
| "release": "changeset publish", | ||
| "init-macos-test-app": "node scripts/init-macos-test-app.ts" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Fix TypeScript entrypoint in macOS test scriptThe new script "init-macos-test-app" runs a TypeScript file with plain Node ("node scripts/init-macos-test-app.ts"). Node cannot execute .ts files without a loader/transpiler (e.g., tsx). This will fail at runtime, and the CI step "npm run init-macos-test-app" in the new macOS workflow will break. Use "tsx scripts/init-macos-test-app.ts" or provide a compiled JS entrypoint. |
||
| }, | ||
| "author": { | ||
| "name": "Callstack", | ||
|
|
@@ -64,6 +65,7 @@ | |
| "globals": "^16.0.0", | ||
| "prettier": "^3.6.2", | ||
| "react-native": "0.81.4", | ||
| "read-pkg": "^9.0.1", | ||
| "tsx": "^4.20.5", | ||
| "typescript": "^5.8.0", | ||
| "typescript-eslint": "^8.38.0" | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,8 +4,18 @@ | |||||
| raise "React Native Node-API cannot reliably patch JSI when React Native Core is prebuilt." | ||||||
| end | ||||||
|
|
||||||
| def get_react_native_package | ||||||
| if caller.any? { |frame| frame.include?("node_modules/react-native-macos/") } | ||||||
| return "react-native-macos" | ||||||
| elsif caller.any? { |frame| frame.include?("node_modules/react-native/") } | ||||||
| return "react-native" | ||||||
| else | ||||||
| raise "Unable to determine React Native package from call stack." | ||||||
| end | ||||||
| end | ||||||
|
|
||||||
| if ENV['REACT_NATIVE_OVERRIDE_HERMES_DIR'].nil? | ||||||
| VENDORED_HERMES_DIR ||= `npx react-native-node-api vendor-hermes --silent '#{Pod::Config.instance.installation_root}'`.strip | ||||||
| VENDORED_HERMES_DIR ||= `npx react-native-node-api vendor-hermes --react-native-package '#{get_react_native_package()}' --silent '#{Pod::Config.instance.installation_root}'`.strip | ||||||
|
||||||
| VENDORED_HERMES_DIR ||= `npx react-native-node-api vendor-hermes --react-native-package '#{get_react_native_package()}' --silent '#{Pod::Config.instance.installation_root}'`.strip | |
| VENDORED_HERMES_DIR ||= `npx react-native-node-api vendor-hermes --react-native-package '#{get_react_native_package}' --silent '#{Pod::Config.instance.installation_root}'`.strip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'jod' to 'iron'. The Node.js LTS codename should be 'iron'.