Skip to content

Commit 45ec2cb

Browse files
committed
[RNE Rewrite] refactor: provision headers via download, not git
Drop the committed third-party/include header set (~200K LOC of vendored ExecuTorch/c10/torch/opencv headers). Headers are now downloaded like the binaries: a platform-independent headers.tar.gz fetched by download-libs.js and produced by package-release-artifacts.sh. Keeps the rewrite's 'no third-party in git' philosophy and avoids churn on ExecuTorch bumps.
1 parent fd3ac2e commit 45ec2cb

5 files changed

Lines changed: 24 additions & 6 deletions

File tree

‎packages/react-native-executorch/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
"cpp",
2323
"scripts",
2424
"*.podspec",
25-
"third-party/include",
2625
"third-party",
26+
"!third-party/include",
2727
"!third-party/android/jniLibs",
2828
"!third-party/android/libs",
2929
"!third-party/ios/Frameworks",

‎packages/react-native-executorch/scripts/download-libs.js‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
*
88
* Artifact layout on GitHub Releases (per version tag, e.g. v0.9.0):
99
*
10+
* headers.tar.gz -- ExecuTorch + c10 + torch + tokenizers + opencv
11+
* headers (platform-independent; always downloaded)
1012
* core-android-arm64-v8a.tar.gz -- executorch, pthreadpool, cpuinfo for arm64
1113
* core-android-x86_64.tar.gz -- executorch for x86_64
1214
* core-ios.tar.gz -- ExecutorchLib.xcframework (without xnnpack/coreml)
@@ -269,6 +271,11 @@ function detectTargets() {
269271
function getArtifacts(targets, { backends, libs }) {
270272
const artifacts = [];
271273

274+
// Headers (ExecuTorch + c10 + torch + tokenizers + opencv) are
275+
// platform-independent and always needed at build time. The tarball contains
276+
// an `include/` dir, so it extracts to third-party/include/.
277+
artifacts.push(makeArtifact('headers', THIRD_PARTY_DIR));
278+
272279
for (const target of targets) {
273280
const destDir = target.startsWith('android')
274281
? path.join(THIRD_PARTY_DIR, 'android', 'libs')

‎packages/react-native-executorch/scripts/package-release-artifacts.sh‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ ANDROID_LIBS="$PACKAGE_ROOT/third-party/android/libs"
5454
IOS_DIR="$PACKAGE_ROOT/third-party/ios"
5555
OUT="$PACKAGE_ROOT/dist-artifacts"
5656

57+
INCLUDE_DIR="$PACKAGE_ROOT/third-party/include"
5758
VERSION=$(node -p "require('$PACKAGE_ROOT/package.json').version")
5859

5960
echo "Packaging release artifacts for v$VERSION"
@@ -137,6 +138,16 @@ package_merged() {
137138
rm -rf "$tmp"
138139
}
139140

141+
# ---- Headers ----------------------------------------------------------------
142+
# Platform-independent ExecuTorch + c10 + torch + tokenizers + opencv headers.
143+
# Staged under include/ so the tarball extracts to third-party/include/.
144+
145+
echo ""
146+
echo "Headers:"
147+
148+
package_merged "headers" \
149+
"include" "$INCLUDE_DIR"
150+
140151
# ---- Android ----------------------------------------------------------------
141152

142153
echo ""

‎packages/react-native-executorch/third-party/.gitignore‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
# Committed here (source, not per-build binaries):
55
# - README.md, this .gitignore
66
# - common/ (phonemis submodule, built from source)
7-
# - include/ (ExecuTorch + c10 + tokenizer headers — matches main)
87
# - ios/ExecutorchLib/ (xcodeproj wrapper that builds ExecutorchLib.xcframework)
98

9+
# --- Headers (ExecuTorch + c10 + tokenizer + opencv) — downloaded, not committed ---
10+
/include/
11+
1012
# --- Android: downloaded per-ABI binaries ---
1113
/android/jniLibs/
1214
/android/libs/executorch/

‎packages/react-native-executorch/third-party/README.md‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ Native ExecuTorch artifacts are split into **committed source** and
55

66
## Committed to git
77

8-
- `include/` — ExecuTorch + c10 + torch headers, including the `pytorch/tokenizers`
9-
headers under `include/executorch/extension/llm/tokenizers/include` (used by the
10-
nlp/tokenizer extension; the `tokenizers::HFTokenizer` symbols resolve from
11-
`libexecutorch`, which is built with the llm/tokenizers extension).
128
- `ios/ExecutorchLib/` — the Xcode project that wraps the prebuilt ExecuTorch
139
static archives into `ExecutorchLib.xcframework` (used only when (re)building
1410
the iOS release artifacts).
@@ -25,6 +21,8 @@ read to gate `RNE_ENABLE_*` and link only the requested backends.
2521

2622
Extracted layout the podspec / `android/CMakeLists.txt` expect:
2723

24+
- `include/` — ExecuTorch + c10 + torch + `pytorch/tokenizers` + opencv headers
25+
(from `headers.tar.gz`, always downloaded; platform-independent)
2826
- `android/libs/executorch/<abi>/libexecutorch.so` (+ `libxnnpack_executorch_backend.so`,
2927
`libvulkan_executorch_backend.so` when those backends are enabled)
3028
- `android/libs/opencv/<abi>/*.a`, `android/libs/opencv-third-party/<abi>/libkleidicv*.a`

0 commit comments

Comments
 (0)