Skip to content
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

Android: Add guide for compile bundle to Hermes bytecode #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,44 @@ And then you can use the following command:
For convenience I recommend adding these thread building commands as npm scripts
to your project.

## Android: Compile bundle to bytecode of Hermes engine

```bash
OS="`uname`"
case $OS in
'Darwin')
OS_BIN='osx-bin'
;;
'Linux')
OS_BIN='linux64-bin'
;;
'WindowsNT')
OS_BIN='win64-bin'
;;
*) ;;

DIR=./android/app/src/main/assets/threads
BUNDLE=$DIR/index.thread.bundle
BUNDLE_PACKAGER_MAP=$DIR/index.thread.bundle.packager.map
BUNDLE_MAP=$DIR/index.thread.bundle.map

react-native bundle \
--dev false --assets-dest ./android/app/src/main/res/ \
--entry-file index.thread.js --platform android \
--bundle-output $BUNDLE \
--sourcemap-output $BUNDLE_PACKAGER_MAP

node_modules/hermes-engine/$OS_BIN/hermesc \
-emit-binary \
-out $BUNDLE_PATH $BUNDLE_PATH \
-O -output-source-map

node_modules/react-native/scripts/compose-source-maps.js $BUNDLE_PACKAGER_MAP $BUNDLE_MAP -o $BUNDLE_MAP
rm $BUNDLE_PACKAGER_MAP
```

This is taken from [`react-native/react.gradle`](https://github.com/facebook/react-native/blob/e8c1eeeb0630d73f106417684762f822ea980d91/react.gradle#L175-L218).

## Example App
Included in this repository is a simple example application demonstrating basic
usage of react-native-threads. Look at `examples/SimpleExample/README.md` for
Expand Down