Socket
Socket
Sign inDemoInstall

jsc-android

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsc-android - npm Package Compare versions

Comparing version 216113.0.3 to 224109.0.0

dist/org/webkit/android-jsc-intl/maven-metadata.xml

25

package.json
{
"name": "jsc-android",
"version": "216113.0.3",
"version": "224109.0.0",
"description": "Pre-build version of JavaScriptCore to be used by React Native apps",
"repository": {
"type": "git",
"url": "git+https://github.com/SoftwareMansion/jsc-android-buildscripts.git"
"url": "git+https://github.com/react-community/jsc-android-buildscripts.git"
},

@@ -14,10 +14,21 @@ "keywords": [

],
"files": [
"android/"
],
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/SoftwareMansion/jsc-android-buildscripts/issues"
"url": "https://github.com/react-community/jsc-android-buildscripts/issues"
},
"homepage": "https://github.com/SoftwareMansion/jsc-android-buildscripts#readme"
"homepage": "https://github.com/react-community/jsc-android-buildscripts#readme",
"files": [
"/dist"
],
"scripts": {
"info": "./scripts/info.sh",
"download": "./scripts/download.sh",
"prep": "./scripts/prep.sh",
"start": "./scripts/start.sh"
},
"config": {
"webkitGTK": "2.18.2",
"androidICU": "8.0.0_r34",
"i18n": true
}
}
# JSC build scripts for Android
The aim of this project is to provide maintainable build scripts for the [JavaScriptCore](https://www.webkit.org) JavaScript engine and allow the [React Native](https://github.com/facebook/react-native) community to incorporate up-to-date releases of JSC into the framework on Android.
The aim of this project is to provide maintainable build scripts for the [JavaScriptCore](https://www.webkit.org) JavaScript engine and allow the [React Native](https://github.com/facebook/react-native) project to incorporate up-to-date releases of JSC into the framework on Android.

@@ -9,33 +9,25 @@ This project is based on [facebook/android-jsc](https://github.com/facebook/android-jsc) but instead of rewriting JSC's build scripts into BUCK files, it relies on CMake build scripts maintained in a GTK branch of WebKit maintained by the WebKitGTK team (great work btw!). Thanks to that, with just a small amount of work we should be able to build not only current but also future releases of JSC. An obvious benefit for everyone using React Native is that this will allow us to update JSC for React Native on Android much more often than before (note that [facebook/android-jsc](https://github.com/facebook/android-jsc) uses JSC version from Nov 2014), which is especially helpful since React Native on iOS uses the built-in copy of JSC that is updated with each major iOS release (see [this](https://opensource.apple.com/) as a reference).

There is a huge list of requirements that need to be installed on your system in order to be able to cross-compile JSC for Android. To simplify the process of setting up the environment we provide a Docker image that comes with everything you will need. If you decide to use our Docker image, the only thing you need to do is to prefix each command with this:
```sh
docker run -v `pwd`:/bitrise/src --rm swmansion/jsc-android-buildscripts
```
* Homebrew (https://brew.sh/)
* GNU coreutils `brew install coreutils`
* Node `brew install node`
* Gradle: `brew install gradle`
* Java 8: `brew tap caskroom/versions && brew cask install java8`
* Android SDK: `brew cask install android-sdk`
* Run `sdkmanager --list` and install all platforms, tools, cmake, ndk (android images are not needed)
* Set `$ANDROID_HOME` to the correct path (in ~/.bashrc or similar)
* Set `export ANDROID_NDK=$ANDROID_HOME/ndk-bundle`
* Set `export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin`
* Make sure you have Ruby (>2.3), Python (>2.7), Git, SVN, gperf
##### Example:
```sh
docker run -v `pwd`:/bitrise/src --rm swmansion/jsc-android-buildscripts ./fetch_sources.sh
```
#### Don't want to use Docker
As mentioned the list of dependencies is huge, we tried to list everything that is needed below:
- Android SDK & NDK
- Ruby (2.3), Python (2.7), Node (7.x), Git, SVN, gperf
- CMake installed via Android SDK manager
## Build instructions
> **IMPORTANT:** Remember to prefix each command with the appropriate Docker command given above when using our Docker image
1. Clone this repo
1. Update the config section under `package.json` to the desired build configuration
2. `npm run download`: downloads all needed sources
3. `npm run prep`: copies downloaded sources and prepares for compilation
4. `npm run start`: builds jsc (this might take some time...)
1. `git clone https://github.com/SoftwareMansion/jsc-android-buildscripts.git .`
2. `./fetch_sources.sh`
3. `./icu-prep.sh`
4. `./jsc-prep.sh`
5. `./all.sh`
6. `./gradlew lib:installArchives libIntl:installArchives` (add `-w /bitrise/src/lib` to `docker run` args)
The zipfile containing the android-jsc AAR will be available at `/dist`.
The library is packaged as a local Maven repository containing AAR files that include the binaries.
The Maven repo containing the android-jsc AAR will be available at `./lib/android`.
## Distribution

@@ -54,3 +46,3 @@

dependencies {
+ "jsc-android": "^216113.0.0",
+ "jsc-android": "224109.x.x",
```

@@ -60,3 +52,3 @@

2. Modify `andorid/build.gradle` file to add new local maven repository packaged in the `jsc-android` package to the search path:
2. Modify `android/build.gradle` file to add new local maven repository packaged in the `jsc-android` package to the search path:
```diff

@@ -73,3 +65,3 @@ allprojects {

+ // Local Maven repo containing AARs with JSC library built for Android
+ url "$rootDir/../node_modules/jsc-android/android"
+ url "$rootDir/../node_modules/jsc-android/dist"
+ }

@@ -87,3 +79,3 @@ }

+ resolutionStrategy {
+ force 'org.webkit:android-jsc:r216113'
+ force 'org.webkit:android-jsc:r224109'
+ }

@@ -98,62 +90,26 @@ +}

## Testing
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. 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, cold start has been measured on rather large React Native app with minified bundle of size at around 3M:
See **[Measurements](/measure)** page that contains synthetic perf test results for the most notable versions of JSC we have tried.
| | android-jsc (r174650) | new JSC (r216113) |
| -------------------- |----------------------:| -----------------:|
| cold start time | 2530 ms | 2150 ms (-15%) |
| binary size (armv7) | 1.8 MiB | 4.3 MiB |
| binary size (x86) | 4.4 MiB | 7.4 MiB |
| binary size (arm64) | N/A | 6.5 MiB |
| binary size (x86_64) | N/A | 7.2 MiB |
## Resources
- [WebkitGTK Sources](https://svn.webkit.org/repository/webkit/releases/WebKitGTK/)
- [ICU Sources](https://android.googlesource.com/platform/external/icu/)
- [Info about Webkit Revisions](https://trac.webkit.org/browser/webkit/releases/WebKitGTK)
- [Info about JSC version used on iOS](https://opensource.apple.com/release/ios-110.html)
## Credits
## International variant
Check [the list of contributors here](https://github.com/react-community/jsc-android-buildscripts/graphs/contributors). This project is supported by:
Starting with 216113.0.0 version, we provide two build variants which differ in i18n support.
### Default variant
[![expo](https://avatars2.githubusercontent.com/u/12504344?v=3&s=100 "Expo.io")](https://expo.io)
[Expo.io](https://expo.io)
By default we ship with no international support. Methods like `Date.toLocaleString` will act as `Date.toString`. `String.localeCompare` will just compare each character's byte value.
### International variant
[![swm](https://avatars1.githubusercontent.com/u/6952717?v=3&s=100 "Software Mansion")](https://swmansion.com)
[Software Mansion](https://swmansion.com)
International variant includes ICU i18n library and necessary data allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that give correct results when using with locales other than `en-US`. Note that this variant is about 6MiB larger per architecture than default.
To use this variant instead replace patch from the third installation step with:
```diff
}
+configurations.all {
+ resolutionStrategy {
+ eachDependency { DependencyResolveDetails details ->
+ if (details.requested.name == 'android-jsc') {
+ details.useTarget group: details.requested.group, name: 'android-jsc-intl', version: 'r216113'
+ }
+ }
+ }
+}
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
```
Note that using variant with i18n support will have some significant impact on the binary size as the ICU library will need to be distributed along with ICU-data library which contains data helpful with localizing numbers/dates/collation/etc for all possible locales. Here is the summary of all the libraries sizes (including JSC) when using i18n variant.
| | new JSC intl variant (r216113) |
| -------------------- |-------------------------------:|
| binary size (armv7) | 11.2 MiB |
| binary size (x86) | 15.6 MiB |
| binary size (arm64) | 14.4 MiB |
| binary size (x86_64) | 15.2 MiB |
## Credits
This project has been built in cooperation between [Expo.io](https://expo.io) and [Software Mansion](https://swmansion.com)
[![expo](https://avatars2.githubusercontent.com/u/12504344?v=3&s=100 "Expo.io")](https://expo.io)
[![swm](https://avatars1.githubusercontent.com/u/6952717?v=3&s=100 "Software Mansion")](https://swmansion.com)
[![wix](https://avatars3.githubusercontent.com/u/686511?s=200&v=4&s=100 "Wix")](https://www.wix.engineering)
[Wix](https://www.wix.engineering)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc