forked from gengjiawen/android-jsc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Based on https://github.com/gengjiawen/android-jsc/tree/feature/abi_support and some enhancements: - Build by clang - NDK r17c - Keep app_platform (minSdkVersion) at API 16 for 32bits, follows original JSC & RN's spec. 64bits will be API 21. - Repack AAR with POM by gradle and publish into npm. Works referenced from https://github.com/react-community/jsc-android-buildscripts. This supports to use local maven repository directly from node_modules. - Docker build based on pure openjdk:8-jdk image. The docker builder referenced from https://github.com/gengjiawen/android-ndk. - All build steps are reproducible by Travis CI. Some tech notes: - patches/log2.patch fallback for log2() only defined in NDK after API 19. - Travis build process getting a little tricky. Travis limits one job cost at maximum 50 minutes and we cannot finish all build before 50 minutes. The workaround is to split whole process into differnt build stage, i.e. multiple build jobs. And I store the last build status into docker hub at https://hub.docker.com/r/kudojscbuilder/android-jsc. 1. Prepare build environment docker image. 2. Based on previous image, build only armv7/x86 binary and upload new image to docker hub. Note that I also store buck-out/* object files into docker image. So that we don't need to rebuild 32bits assets for next stage. 3. Based on previous image, do full build and deploy into npm. Migration Guide: 1. yarn add @kudo-ci/android-jsc 2. Use @kudo-ci/android-jsc local maven repository before jcenter() diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index a419728d77..cec9b33a7b 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -324,7 +314,7 @@ dependencies { api "com.squareup.okhttp3:okhttp:${OKHTTP_VERSION}" api "com.squareup.okhttp3:okhttp-urlconnection:${OKHTTP_VERSION}" api 'com.squareup.okio:okio:1.14.0' - compile project(':android-jsc') + compile 'org.webkit:android-jsc:r174650' diff --git a/build.gradle b/build.gradle index 08845e85fc..5339ff8981 100644 --- a/build.gradle +++ b/build.gradle @@ -20,10 +20,13 @@ buildscript { allprojects { repositories { + maven { + url "$rootDir/node_modules/@kudo-ci/android-jsc/dist" + } + google() jcenter() mavenLocal() - def androidSdk = System.getenv("ANDROID_SDK") maven { url "$androidSdk/extras/m2repository/"
- Loading branch information
Showing
21 changed files
with
540 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,13 +2,39 @@ dist: trusty | |
sudo: required | ||
env: | ||
global: | ||
- _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap" | ||
|
||
- _JAVA_OPTIONS="-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap" | ||
- DOCKER_IMAGE="$DOCKER_USERNAME/android-jsc:$TRAVIS_BRANCH-$TRAVIS_BUILD_NUMBER" | ||
- DOCKER_IMAGE_PARTIAL="$DOCKER_IMAGE-partial" | ||
language: c | ||
|
||
services: | ||
- docker | ||
|
||
script: | ||
- travis_wait 60 docker run --rm --name hei -v $PWD:/pwd -w /pwd gengjiawen/android-jsc:feature_abi_support /bin/sh -c "./fetch_sources.sh && buck build :android-jsc" | ||
|
||
jobs: | ||
include: | ||
- stage: Prepare docker builder | ||
script: | ||
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
- travis_wait 15 docker build -t $DOCKER_IMAGE_PARTIAL-builder . | ||
- docker push $DOCKER_IMAGE_PARTIAL-builder | ||
- exit 0 | ||
- stage: Build android-jsc armv7 x86 | ||
script: | ||
- travis_wait 50 docker run -v $PWD:/pwd -w /pwd $DOCKER_IMAGE_PARTIAL-builder /bin/sh -c "cp -Rf /pwd /android-jsc && cd /android-jsc && ./fetch_sources.sh && ./build.sh 32" | ||
- travis_wait 20 docker commit `docker ps -l -q` $DOCKER_IMAGE_PARTIAL-32bits | ||
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
- docker push $DOCKER_IMAGE_PARTIAL-32bits | ||
- stage: Build android-jsc arm64 x86_64 | ||
script: | ||
- travis_wait 50 docker run -v $PWD:/pwd -w /android-jsc $DOCKER_IMAGE_PARTIAL-32bits /bin/sh -c "./build.sh all && mkdir -p /pwd/build && cp -f buck-out/gen/android-jsc.aar /pwd/build/ && /pwd/repack.sh" | ||
# - travis_wait 20 docker commit `docker ps -l -q` $DOCKER_IMAGE | ||
# - mkdir -p outputs && echo 123 > outputs/123.txt | ||
# - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | ||
# - docker push $DOCKER_IMAGE | ||
deploy: | ||
provider: npm | ||
skip_cleanup: true | ||
email: [email protected] | ||
api_key: | ||
secure: tBSHAobh0mWzRQ6J63OTbgK0ySN1fQG2o4PpvQVBhZjI2mQRGp5z8NU3Q1j5pQR0n23JzIV32m5wbuCoif5STXG80yv2T0jIhk02ZqH08z/J6ibC5x04Nvueg6JXUh8pnyvawqTNf7xVyfeiM/pLtM00j5Dmjry0D2IFbaUZgn4cbvwIEq5ZvJLTYsiOkhwv9hY1Q4jQ64z5xhtiNVL1lrFQE+3akZZZPUeY8cRdXguBzFQiIiwavve1rCTiMCoebwxyFijayIiWXx9gBzHwVwU+P5k3NcWGYGQjZMGWzaxTclSWqhM07fVuRll/6+aaX2n1y7d4iV+CpGNXe2sVuahw4S+bd+LC8mM5YQu6xyT6CsdxugKmgDK914lvdtsYvxVhdSwBNeOZAMhqvCBKGZKbBtRrqxPRtKy1BxgNMVjWQXRLcz/+oe4WaCxAvcwhSjAl7ZgzJXYIn7YzKk6+KRz0chowk+bunDmTZItXIN0/gXNmVm+65hRjnHUBC5LPsSiHO/Kc0P0z6MX6iKlDXl11sk3L0Ap4TGU+r50fR91QD7H8126fI/z2WTXhT1O0BcHUN0UIGsAFf307TDbaqzskG/lBvBMPkdQfcxOaz8xtGoy6lKE3SK7WFvUlwxbpLhMXZtd7yF9fmru95Qn2rWQSE5I+171eq2p1CsYXsTY= | ||
on: | ||
repo: Kudo/android-jsc | ||
branch: clang |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,68 @@ | ||
FROM gengjiawen/android-ndk | ||
FROM openjdk:8-jdk | ||
|
||
ARG sdk_version=sdk-tools-linux-4333796.zip | ||
ARG android_home=/opt/android/sdk | ||
|
||
RUN apt-get update && \ | ||
apt-get install --yes \ | ||
xvfb clang unzip lib32z1 lib32stdc++6 build-essential > /dev/null | ||
|
||
# Download and install Android SDK | ||
RUN curl --silent --show-error --location --fail --retry 3 --output /tmp/${sdk_version} https://dl.google.com/android/repository/${sdk_version} && \ | ||
mkdir -p ${android_home} && \ | ||
unzip -q /tmp/${sdk_version} -d ${android_home} && \ | ||
rm /tmp/${sdk_version} | ||
|
||
# Set environmental variables | ||
ENV ANDROID_HOME ${android_home} | ||
ENV ANDROID_SDK_HOME ${android_home} | ||
ENV PATH=${ANDROID_HOME}/emulator:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:${PATH} | ||
ENV ADB_INSTALL_TIMEOUT 120 | ||
|
||
# Fix install warning | ||
RUN mkdir ~/.android && echo '### User Sources for Android SDK Manager' > ~/.android/repositories.cfg | ||
|
||
RUN yes | sdkmanager --licenses > /dev/null && sdkmanager --update > /dev/null | ||
|
||
# Update SDK manager and install system image, platform and build tools | ||
RUN sdkmanager \ | ||
"tools" \ | ||
"platform-tools" \ | ||
"emulator" \ | ||
"extras;android;m2repository" \ | ||
"extras;google;m2repository" \ | ||
"extras;google;google_play_services" > /dev/null 2>&1 | ||
|
||
RUN sdkmanager \ | ||
"build-tools;25.0.3" \ | ||
"build-tools;26.0.2" \ | ||
"build-tools;27.0.3" > /dev/null 2>&1 | ||
|
||
RUN sdkmanager "platforms;android-27" > /dev/null 2>&1 | ||
|
||
#install ndk | ||
RUN sdkmanager \ | ||
"lldb;3.0" \ | ||
"cmake;3.6.4111459" > /dev/null 2>&1 | ||
|
||
# use old ndk | ||
ENV ANDROID_NDK_HOME /opt/android-ndk | ||
ENV ANDROID_NDK /opt/android-ndk | ||
ENV NDK_HOME /opt/android-ndk | ||
ENV ANDROID_NDK_VERSION r10e | ||
RUN rm -rf ${ANDROID_HOME}/ndk-bundle | ||
ENV ANDROID_NDK_VERSION r17c | ||
ENV PATH ${ANDROID_NDK_HOME}:$PATH | ||
|
||
RUN mkdir /opt/android-ndk-tmp && \ | ||
cd /opt/android-ndk-tmp && \ | ||
wget -q https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \ | ||
unzip -q android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \ | ||
mv ./android-ndk-${ANDROID_NDK_VERSION} ${ANDROID_NDK_HOME} && \ | ||
cd ${ANDROID_NDK_HOME} && \ | ||
rm -rf /opt/android-ndk-tmp | ||
cd /opt/android-ndk-tmp && \ | ||
wget -q https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \ | ||
unzip -q android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \ | ||
mv ./android-ndk-${ANDROID_NDK_VERSION} ${ANDROID_NDK_HOME} && \ | ||
cd ${ANDROID_NDK_HOME} && \ | ||
rm -rf /opt/android-ndk-tmp | ||
|
||
ENV PATH ${ANDROID_NDK_HOME}:$PATH | ||
|
||
RUN apt-get install git ant python-dev ruby zip subversion -y | ||
RUN apt-get install git ant python-dev ruby zip subversion -y > /dev/null | ||
|
||
#install buck and checkout jsc | ||
RUN wget "https://github.com/facebook/buck/releases/download/v2018.03.26.01/buck_2018.03.26_all.deb" && \ | ||
dpkg -i buck_2018.03.26_all.deb && \ | ||
buck --version && \ | ||
svn export https://svn.webkit.org/repository/webkit/trunk/@174650 | ||
|
||
|
||
RUN wget "https://github.com/facebook/buck/releases/download/v2018.10.17.01/buck.2018.10.17.01_all.deb" > /dev/null 2>&1 && \ | ||
dpkg -i buck.2018.10.17.01_all.deb > /dev/null 2>&1 && \ | ||
buck --version && \ | ||
svn export https://svn.webkit.org/repository/webkit/trunk/@174650 > /dev/null |
Oops, something went wrong.