Skip to content

Commit

Permalink
Merge pull request #145 from Kudo/merge_for_upstream
Browse files Browse the repository at this point in the history
Merge changes from @kudo-ci/jsc-android@250230.2.1
  • Loading branch information
Kudo authored Mar 19, 2021
2 parents 15f648b + 6926235 commit 618a23f
Show file tree
Hide file tree
Showing 73 changed files with 6,540 additions and 2,636 deletions.
84 changes: 0 additions & 84 deletions .circleci/config.yml

This file was deleted.

89 changes: 89 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build jsc-android and test

on: [push]

jobs:
build:
runs-on: ubuntu-latest
container: reactnativecommunity/react-native-android:2019-9-4

steps:
- uses: actions/checkout@v1

- name: Install packages
run: |
apt-get update
apt-get install coreutils realpath curl git subversion python3.5 python3.5-dev ruby gperf -y
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> "${HOME}/.bashrc"
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "${HOME}/.bashrc"
source "${HOME}/.bashrc"
nvm install 10
nvm use 10
nvm alias default 10
shell: bash

- name: Install Android packages
run: |
sdkmanager \
"lldb;3.0" \
"cmake;3.10.2.4988404"
shell: bash
- name: Build
run: |
yarn clean
yarn download
yarn start
shell: bash

- name: Archive
run: |
mkdir -p archive
mv dist archive/
mv dist.unstripped archive/
shell: bash

- uses: actions/upload-artifact@master
with:
name: archive
path: archive


test:
needs: build
runs-on: macOS-latest

steps:
- uses: actions/checkout@v1

- uses: actions/download-artifact@master
with:
name: archive
path: archive

- name: Launch AVD
run: |
source scripts/android-setup.sh
export PATH="${ANDROID_HOME}/emulator:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:${PATH}"
export AVD_PACKAGES="system-images;android-${ANDROID_SDK_TARGET_API_LEVEL};google_apis;${AVD_ABI}"
sdkmanager "${AVD_PACKAGES}"
createAVD
launchAVD &
shell: bash

- name: Wait AVD
run: |
export PATH="${ANDROID_HOME}/emulator:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:${PATH}"
source scripts/android-setup.sh
set +e +o pipefail
waitForAVD
shell: bash

- name: Run test
run: |
mv archive/dist .
cd test
yarn
cd android && ./gradlew assembleDebug assembleAndroidTest connectedAndroidTest
shell: bash
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![npm version](https://badge.fury.io/js/jsc-android.svg)](https://badge.fury.io/js/jsc-android)
[![CircleCI](https://circleci.com/gh/react-native-community/jsc-android-buildscripts.svg?style=svg)](https://circleci.com/gh/react-native-community/jsc-android-buildscripts)
![GitHub Actions CI](https://github.com/react-native-community/jsc-android-buildscripts/workflows/Build%20jsc-android%20and%20test/badge.svg)

# JSC build scripts for Android

Expand All @@ -17,8 +17,8 @@ This project is based on [facebook/android-jsc](https://github.com/facebook/andr
* Run `sdkmanager --list` and install all platforms, tools, buildtool v28.0.3, cmake (android images are not needed)
* Set `$ANDROID_HOME` to the correct path (in ~/.bashrc or similar)
* Set `export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin`
* Android NDK r17c: download from [NDK Archives](https://developer.android.com/ndk/downloads/older_releases.html)
* Set `export ANDROID_NDK=/path/to/android-ndk-r17c`
* Android NDK r19c: download from [NDK Archives](https://developer.android.com/ndk/downloads/older_releases.html)
* Set `export ANDROID_NDK=/path/to/android-ndk-r19c`
* Make sure you have Ruby (>2.3), Python (>2.7), Git, SVN, gperf

## Build instructions
Expand Down Expand Up @@ -54,21 +54,23 @@ Follow steps below in order for your React Native app to use new version of JSC
yarn add jsc-android
# Or if you would like to try latest version
# yarn add 'jsc-android@canary`
# yarn add 'jsc-android@next'
```

2. You're done, rebuild your app and enjoy updated version of JSC on android!

### For React Native version 0.59

1. Add `jsc-android` to the "dependencies" section in your `package.json`:
```diff
dependencies {
+ "jsc-android": "241213.x.x",
1. Add `jsc-android`:

```
yarn add jsc-android
then run `npm install` or `yarn` (depending on which npm client you use) in order for the new dependency to be installed in `node_modules`
# Or if you would like to try latest version
# yarn add 'jsc-android@next'
```

2. Modify `android/build.gradle` file to add the new local maven repository packaged in the `jsc-android` package to the search path:
```diff
Expand All @@ -94,7 +96,7 @@ allprojects {

dependencies {
+ // Make sure to put android-jsc at the top
+ implementation "org.webkit:android-jsc:r241213"
+ implementation "org.webkit:android-jsc:+"
+
compile fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
Expand All @@ -118,13 +120,15 @@ android {

### For React Native version 0.58 below

1. Add `jsc-android` to the "dependencies" section in your `package.json`:
```diff
dependencies {
+ "jsc-android": "241213.x.x",
1. Add `jsc-android`:

```
yarn add jsc-android
then run `npm install` or `yarn` (depending which npm client you use) in order for the new dependency to be installed in `node_modules`
# Or if you would like to try latest version
# yarn add 'jsc-android@next'
```

2. Modify `android/build.gradle` file to add new local maven repository packaged in the `jsc-android` package to the search path:
```diff
Expand All @@ -151,7 +155,7 @@ allprojects {

+configurations.all {
+ resolutionStrategy {
+ force 'org.webkit:android-jsc:r241213'
+ force 'org.webkit:android-jsc:+'
+ }
+}

Expand Down Expand Up @@ -189,7 +193,7 @@ For React Native version 0.59, replace original artifact id with `android-jsc-in

dependencies {
+ // Make sure to put android-jsc at the the first
+ implementation "org.webkit:android-jsc-intl:r241213"
+ implementation "org.webkit:android-jsc-intl:+"
+
compile fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
Expand Down
22 changes: 11 additions & 11 deletions lib/android-jsc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
apply plugin: 'com.android.library'

def distDir = project.findProperty("distDir") ?: ""
def jniLibsDir = project.findProperty("jniLibsDir") ?: ""
def revision = project.findProperty("revision") ?: "".replaceAll("\\s", "")
def i18n = project.findProperty("i18n") ?: ""

if (!distDir) throw new RuntimeException("expecting --project-prop distDir=??? but was empty")
if (!jniLibsDir) throw new RuntimeException("expecting --project-prop jniLibsDir=??? but was empty")
if (!revision) throw new RuntimeException("expecting --project-prop revision=??? but was empty")
if (!i18n) throw new RuntimeException("expecting --project-prop i18n=??? but was empty")

android {
compileSdkVersion 28

Expand All @@ -12,7 +22,7 @@ android {

sourceSets {
main {
jniLibs.srcDirs = ["${rootDir}/../build/compiled"]
jniLibs.srcDirs = ["${jniLibsDir}"]
}
}

Expand All @@ -26,16 +36,6 @@ dependencies {}
apply plugin: 'maven'

task createAAR(type: Upload) {
def distDir = "${rootDir}/../dist"

def revision = project.findProperty("revision") ?: "".replaceAll("\\s", "")
def i18n = project.findProperty("i18n") ?: ""

doFirst {
if (!revision) throw new RuntimeException("expecting --project-prop revision=??? but was empty")
if (!i18n) throw new RuntimeException("expecting --project-prop i18n=??? but was empty")
}

project.group = "org.webkit"
def artifactName = Boolean.valueOf(i18n) ? "android-jsc-intl" : "android-jsc"
project.version = "r${revision}"
Expand Down
18 changes: 9 additions & 9 deletions lib/cppruntime/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
apply plugin: 'com.android.library'

def distDir = project.findProperty("distDir") ?: ""
def jniLibsDir = project.findProperty("jniLibsDir") ?: ""
def revision = project.findProperty("revision") ?: "".replaceAll("\\s", "")

if (!distDir) throw new RuntimeException("expecting --project-prop distDir=??? but was empty")
if (!jniLibsDir) throw new RuntimeException("expecting --project-prop jniLibsDir=??? but was empty")
if (!revision) throw new RuntimeException("expecting --project-prop revision=??? but was empty")

android {
compileSdkVersion 28

Expand All @@ -12,7 +20,7 @@ android {

sourceSets {
main {
jniLibs.srcDirs = ["${rootDir}/../build/cppruntime"]
jniLibs.srcDirs = ["${jniLibsDir}"]
}
}
}
Expand All @@ -22,14 +30,6 @@ dependencies {}
apply plugin: 'maven'

task createAAR(type: Upload) {
def distDir = "${rootDir}/../dist"

def revision = project.findProperty("revision") ?: "".replaceAll("\\s", "")

doFirst {
if (!revision) throw new RuntimeException("expecting --project-prop revision=??? but was empty")
}

project.group = "org.webkit"
project.version = "r${revision}"

Expand Down
15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "jsc-android",
"version": "245459.0.0",
"version": "250230.2.1",
"description": "Pre-build version of JavaScriptCore to be used by React Native apps",
"repository": {
"type": "git",
"url": "git+https://github.com/react-community/jsc-android-buildscripts.git"
"url": "git+https://github.com/react-native-community/jsc-android-buildscripts.git"
},
"keywords": [
"react-native",
Expand All @@ -13,9 +13,9 @@
],
"license": "BSD-2-Clause",
"bugs": {
"url": "https://github.com/react-community/jsc-android-buildscripts/issues"
"url": "https://github.com/react-native-community/jsc-android-buildscripts/issues"
},
"homepage": "https://github.com/react-community/jsc-android-buildscripts#readme",
"homepage": "https://github.com/react-native-community/jsc-android-buildscripts#readme",
"files": [
"/dist"
],
Expand All @@ -26,7 +26,12 @@
"start": "./scripts/start.sh"
},
"config": {
"webkitGTK": "2.24.2",
"webkitGTK": "2.26.1",
"chromiumICUCommit": "64e5d7d43a1ff205e3787ab6150bbc1a1837332b"
},
"devDependencies": {
"commander": "^4.0.1",
"rimraf": "^3.0.0",
"semver": "^6.3.0"
}
}
Loading

0 comments on commit 618a23f

Please sign in to comment.