Skip to content

Commit 09c3f9f

Browse files
committed
Include RN install instructions + bump beta version.
1 parent 419ca54 commit 09c3f9f

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed

README.md

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,66 @@ The Maven repo containing the android-jsc AAR will be available at `./lib/androi
3939

4040
## Distribution
4141

42-
Pre-build version of the JSC library built using this project is distributed over npm: [npm/jsc-android](https://www.npmjs.com/package/jsc-android).
42+
JSC library built using this project is distributed over npm: [npm/jsc-android](https://www.npmjs.com/package/jsc-android).
43+
The library is packaged as a local Maven repository containing AAR files that include the binaries.
44+
Please refer to the section below in order to learn how your app can consume this format.
4345

44-
The library is packaged as a local Maven repository containing AAR files that include the binaries. In order for this format to be consumed by the React Native app one need to add `jsc-android` in `package.json` and also change `android/build.gradle` such that local Maven repo is added to the list of available repositories:
46+
## How to use it with my React Native app
47+
48+
Follow steps below in order for your React Native app to use new version of JSC VM on android:
49+
50+
1. Add `jsc-android` to the "dependencies" section in your `package.json`:
51+
```diff
52+
dependencies {
53+
+ "jsc-android": "^216113.0.0-beta.3",
54+
```
55+
56+
then run `npm install` or `yarn` (depending which npm client you use) in order for the new dependency to be installed in `node_modules`
57+
58+
2. Modify `andorid/build.gradle` file to add new local maven repository packaged in the `jsc-android` package to the search path:
4559
```diff
46-
+ maven {
47-
+ // Local Maven repo containing AARs with JSC library built for Android
48-
+ url "$rootDir/../node_modules/jsc-android/android"
60+
allprojects {
61+
repositories {
62+
mavenLocal()
63+
jcenter()
64+
maven {
65+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
66+
url "$rootDir/../node_modules/react-native/android"
67+
}
68+
+ maven {
69+
+ // Local Maven repo containing AARs with JSC library built for Android
70+
+ url "$rootDir/../node_modules/jsc-android/android"
71+
+ }
72+
}
73+
}
74+
```
75+
76+
3. Update your app's `build.gradle` file located in `android/app/build.gradle` to force app builds to use new version of the JSC library as opposed to the version specified in [react-native gradle module as a dependency](https://github.com/facebook/react-native/blob/e8df8d9fd579ff14224cacdb816f9ff07eef978d/ReactAndroid/build.gradle#L289):
77+
78+
```diff
79+
}
80+
81+
+configurations.all {
82+
+ resolutionStrategy {
83+
+ force 'org.webkit:android-jsc:r216113'
4984
+ }
85+
+}
86+
87+
dependencies {
88+
compile fileTree(dir: "libs", include: ["*.jar"])
5089
```
5190

52-
Once that's done Gradle during the build step should be able to locate `android-jsc` AAR installed under `node_modules/jsc-android` that is defined as a dependency of the react-native android module [here](https://github.com/facebook/react-native/blob/master/ReactAndroid/build.gradle#L289).
91+
4. You're done, rebuild your app and enjoy updated version of JSC on android!
5392

5493
## How to use it with React Native
5594

56-
We will be working on updating React Native to use a new version of JSC. Once that gets approved the only thing you will need to do is to update your RN version! Until then you can fork React Native and patch it with [this patch](./patches/react-native.patch).
95+
We will be working on updating React Native to use a new version of JSC. Once that gets approved the only thing you will need to do is to update your RN version!
5796

5897
## Testing
5998

6099
As a part of this project we provide a patch to the React Native source code that allows for measuring a React Native application's cold-start time. The methodology behind this test is to modify the part of the code that is responsible for loading JS bundles into the JS VM such that we measure and store the execution time, and to modify the process of instantiating the bridge so we can run it multiple times. To learn more about how the perf tests work and how to perform them, refer to [this document](./TESTING.md). Results for the Samsung Galaxy S4 are presented below:
61100

62-
| | android-jsc (r174650) | new JSC (r216995) |
101+
| | android-jsc (r174650) | new JSC (r216113) |
63102
| -------------------- |----------------------:| -----------------:|
64103
| cold start time | 427 ms | 443 ms |
65104
| binary size (armv7) | 1.8 MiB | 5.7 MiB |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsc-android",
3-
"version": "216995.0.0-beta.2",
3+
"version": "216113.0.0-beta.3",
44
"description": "Pre-build version of JavaScriptCore to be used by React Native apps",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)