Skip to content

Commit 492e09c

Browse files
committed
Ensure RCT_USE_PREBUILT_RNCORE is never enabled
1 parent f83e327 commit 492e09c

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

packages/host/scripts/patch-hermes.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
Pod::UI.warn "!!! PATCHING HERMES WITH NODE-API SUPPORT !!!"
22

3+
if ENV['RCT_USE_PREBUILT_RNCORE'] == '1'
4+
raise "React Native Node-API cannot reliably patch JSI when React Native Core is prebuilt."
5+
end
6+
37
VENDORED_HERMES_DIR ||= `npx react-native-node-api vendor-hermes --silent '#{Pod::Config.instance.installation_root}'`.strip
48
if Dir.exist?(VENDORED_HERMES_DIR)
59
Pod::UI.info "Hermes vendored into #{VENDORED_HERMES_DIR.inspect}"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import assert from "node:assert/strict";
2+
import { describe, it } from "node:test";
3+
import cp from "node:child_process";
4+
5+
describe("Podspec", () => {
6+
// We cannot support prebuilds of React Native Core since we're patching JSI
7+
it(
8+
"should error when RCT_USE_PREBUILT_RNCORE is set",
9+
// We cannot call `pod` on non-macOS systems
10+
{ skip: process.platform !== "darwin" },
11+
() => {
12+
const { status, stdout } = cp.spawnSync("pod", ["spec", "lint"], {
13+
env: { ...process.env, RCT_USE_PREBUILT_RNCORE: "1" },
14+
encoding: "utf-8",
15+
});
16+
17+
assert.notEqual(status, 0);
18+
assert.match(
19+
stdout,
20+
/React Native Node-API cannot reliably patch JSI when React Native Core is prebuilt/,
21+
);
22+
},
23+
);
24+
});

0 commit comments

Comments
 (0)