Skip to content

Commit 0e95b89

Browse files
authored
fix(build): pack phonemis submodule sources in npm tarball (#1182)
## Description Init the phonemis git submodule in `create-package.sh` so its sources are present in the published npm tarball. Previously the submodule was empty at pack time, so the podspec's `third-party/common/phonemis/src/**/*.{cpp,hpp,h}` source-files glob found nothing and TTS-using apps could not build from the npm package. `data/`, `scripts/`, `test/`, and `requirements.txt` are trimmed in the script (working-tree trim, restored on exit via `trap`) rather than via the `package.json` `files` field, because the submodule's own `.gitignore` re-includes `scripts/build*` via `!scripts/build*` and `npm-packlist` honors that rule against `files` exclusions. ### Introduces a breaking change? - [ ] Yes - [x] No ### Type of change - [x] Bug fix (change which fixes an issue) - [ ] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [ ] Other (chores, tests, code style improvements etc.) ### Tested on - [x] iOS - [x] Android ### Testing instructions 1. From `packages/react-native-executorch`, run `./scripts/create-package.sh`. 2. `tar tzf react-native-executorch-*.tgz | grep phonemis/src | wc -l` → 87 source files. 3. `tar tzf react-native-executorch-*.tgz | grep -E "phonemis/(data|test|requirements)"` → empty. 4. Install the tarball into a fresh RN/Expo app, run `pod install` + iOS/Android build; phonemis should compile cleanly into `libreact-native-executorch.{a,so}`. ### Screenshots ### Related issues ### Checklist - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [x] My changes generate no new warnings ### Additional notes
1 parent ed3d972 commit 0e95b89

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

packages/react-native-executorch/scripts/create-package.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
#!/bin/bash
22

3+
# Phonemis is a git submodule whose sources the podspec compiles directly
4+
# (see third-party/common/phonemis/src in react-native-executorch.podspec).
5+
# Init it explicitly so the files are present in the packed tarball.
6+
# Run from repo root so the submodule path resolves regardless of cwd.
7+
git -C "$(git rev-parse --show-toplevel)" submodule update --init --recursive \
8+
packages/react-native-executorch/third-party/common/phonemis
9+
10+
# Trim phonemis to what consumers need at build time. Done here (not via
11+
# package.json "files") because the submodule's own .gitignore has
12+
# `!scripts/build*` which npm-packlist honors and re-includes those files
13+
# despite our exclusion rules. Restore on exit so the working tree stays clean.
14+
PHONEMIS_DIR="third-party/common/phonemis"
15+
restore_phonemis() {
16+
git -C "$PHONEMIS_DIR" checkout -- data test scripts requirements.txt 2>/dev/null || true
17+
}
18+
trap restore_phonemis EXIT
19+
rm -rf "$PHONEMIS_DIR/data" "$PHONEMIS_DIR/test" "$PHONEMIS_DIR/scripts"
20+
rm -f "$PHONEMIS_DIR/requirements.txt"
21+
322
yarn install --immutable
423

524
if [ $# -ge 1 ] && [ "$1" = "generate_nightly_version" ]; then

0 commit comments

Comments
 (0)