@vovkasm/jsc-android

0.0.2 • Public • Published

Differences with jsc-android-buildscripts

Current version is 0.0.1, it is unstable and work-in-progress

  • ICU and Webkit sources forked and embedded in repo
  • All sources built with -Oz and LTO
  • DFG JIT enabled
  • It use static libc++ and expose only C API, it makes used NDK maximally independed from other components. So please use latest NDK, if possible (tested with NDK 25.1.8937393).

Install

android/build.gradle

  maven {
      // Android JSC is installed from npm
      // Replace this:
      // url("$rootDir/../node_modules/jsc-android/dist")
      // to:
      url("$rootDir/../node_modules/@vovkasm/jsc-android/dist")
  }

  ...

  mavenCentral {
      // We don't want to fetch react-native from Maven Central as there are
      // older versions over there.
      content {
          excludeGroup "com.facebook.react"
          excludeGroup "org.webkit" // <--- add this line
      }
  }

android/app/build.gradle

    if (enableHermes) {
        //noinspection GradleDynamicVersion
        implementation("com.facebook.react:hermes-engine:+") { // From node_modules
            exclude group:'com.facebook.fbjni'
        }
    } else {
      //noinspection GradleDynamicVersion
        implementation 'org.webkit:android-jsc:+' // <--- use this!
    }

android/app/src/main/java/.../MainApplication.java

import org.webkit.androidjsc.JscManager; // <--- add this line

  public void onCreate() {
    super.onCreate();
    JscManager.init(this.getAssets()); // <--- add this line
    // If you opted-in for the New Architecture, we enable the TurboModule system
    ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
    SoLoader.init(this, /* native exopackage */ false);
  }

Building from source

Define ANDROID_NDK_HOME env var.

npm run clean
npm run native
npm run dist

Update Webkit

  1. Clone webkit repo
  2. Switch to required branch
  3. From jsc-android root directory: ./import-webkit.sh <path-to-webkit>
  4. (may be hard) Reapply all patches
  • git format-patch, then git am, or maybe rebase/cherry-pick

Package Sidebar

Install

npm i @vovkasm/jsc-android

Weekly Downloads

11

Version

0.0.2

License

BSD-2-Clause

Unpacked Size

31 MB

Total Files

30

Last publish

Collaborators

  • vovkasm