Skip to content

Commit 4a89838

Browse files
authored
feat: build with ndk r27b on top of webkitgtk 2.26.4 (#184)
# Why to support android 16k page sizes and react-native 0.77 # How - migrate webkit repo from svn to git - update to webkitgtk 2.26.4 (previous we had 2.26.1). the main reason is that git repo don't have 2.26.1 tag but 2.26 branch. - change the version scheme. originally we use svn revision, but webkit team don't have revision anymore. the new version scheme will base on webkitgtk version. ```sh $ echo "2.26.4" | awk -F. '{printf "%d%03d%03d\n", $1, $2, $3}' 2026004 ``` - update ci, lib builder, and test projects - use ndk r27b - bump minSdkVersion to 24 - add `-Wl,-z,max-page-size=16384` linker flags
1 parent 61ac7a8 commit 4a89838

File tree

96 files changed

+3916
-8683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+3916
-8683
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# Copyright (c) 650 Industries.
3+
#
4+
5+
name: 'Cleanup GitHub Linux Runner Disk Space'
6+
description: 'Cleanup unused preinstalled packages on the GitHub Ubuntu runners'
7+
8+
runs:
9+
using: 'composite'
10+
steps:
11+
- name: '🧹 Cleanup preinstalled packages'
12+
shell: bash
13+
run: |
14+
echo 'Disk space before cleanup'
15+
df -aH
16+
sudo apt-get remove -y --purge '^mysql-.*' '^mongodb-.*' '^mssql-.*' '^postgresql-.*' '^aspnetcore-*' '^dotnet-.*' '^php.*-.*' 'mono-complete' '^llvm-.*' 'powershell' 'google-chrome-*' 'microsoft-edge-*' 'firefox' 'nginx' 'apache2'
17+
sudo apt-get autoremove -y
18+
sudo rm -rf /usr/share/dotnet
19+
echo 'Showing Android SDKs'
20+
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --list
21+
${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --uninstall 'ndk;24.0.8215888' 'ndk;25.2.9519653' 'ndk;26.2.11394342'
22+
echo 'Removing all Docker images'
23+
docker rmi -f $(docker images -aq)
24+
echo 'Disk space after cleanup'
25+
df -aH

.github/workflows/build_and_test.yml

+53-27
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,47 @@
11
name: Build jsc-android and test
22

33
on:
4+
workflow_dispatch: {}
45
push:
56
branches: [main]
67
pull_request:
78

89
jobs:
910
build:
1011
runs-on: ubuntu-latest
11-
container: reactnativecommunity/react-native-android:5.4
1212

1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v4
1515

16-
- name: 🔨 Use JDK 11
17-
uses: actions/setup-java@v3
16+
- name: 🔨 Use JDK 17
17+
uses: actions/setup-java@v4
1818
with:
1919
distribution: 'temurin'
20-
java-version: '11'
20+
java-version: '17'
21+
22+
- name: ⬢ Setup Node
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 22
2126

2227
- name: Install packages
2328
run: |
24-
apt-get update
25-
apt-get install coreutils curl git subversion wget python3 ruby gperf -y
26-
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
27-
echo 'export NVM_DIR="$HOME/.nvm"' >> "${HOME}/.bashrc"
28-
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "${HOME}/.bashrc"
29-
source "${HOME}/.bashrc"
30-
nvm install 16
31-
nvm use 16
32-
nvm alias default 16
29+
sudo apt-get update
30+
sudo apt-get install coreutils curl git wget python3 ruby gperf -y
3331
shell: bash
3432

3533
- name: Install Android packages
3634
run: |
35+
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
36+
yes | sdkmanager --licenses || true
3737
sdkmanager \
3838
"cmake;3.22.1" \
39-
"ndk;23.2.8568313"
39+
"ndk;27.1.12297006"
4040
# move out builtin icu headers from ndk and prevent icu build errors
41-
mv "${ANDROID_HOME}/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode" "${ANDROID_HOME}/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode2"
42-
echo "ANDROID_NDK=$ANDROID_HOME/ndk/23.2.8568313" >> $GITHUB_ENV
41+
mv "${ANDROID_HOME}/ndk/27.1.12297006/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode" "${ANDROID_HOME}/ndk/27.1.12297006/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode2"
42+
43+
echo "ANDROID_NDK=$ANDROID_HOME/ndk/27.1.12297006" >> $GITHUB_ENV
44+
echo "PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools" >> $GITHUB_ENV
4345
shell: bash
4446

4547
- name: Build
@@ -57,38 +59,62 @@ jobs:
5759
mv dist.unstripped archive/
5860
shell: bash
5961

60-
- uses: actions/upload-artifact@v2
62+
- uses: actions/upload-artifact@v4
6163
with:
6264
name: archive
6365
path: archive
6466

6567

6668
test:
6769
needs: build
68-
runs-on: macOS-latest
70+
runs-on: ubuntu-latest
6971

7072
steps:
71-
- uses: actions/checkout@v1
73+
- uses: actions/checkout@v4
74+
75+
- name: 🧹 Cleanup GitHub Linux runner disk space
76+
uses: ./.github/actions/cleanup-linux-disk-space
77+
78+
- name: ⬢ Setup Node
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: 22
7282

73-
- name: 🔨 Use JDK 11
74-
uses: actions/setup-java@v3
83+
- name: 🔨 Use JDK 17
84+
uses: actions/setup-java@v4
7585
with:
7686
distribution: 'temurin'
77-
java-version: '11'
87+
java-version: '17'
7888

79-
- uses: actions/download-artifact@v2
89+
- uses: actions/download-artifact@v4
8090
with:
8191
name: archive
8292
path: archive
8393

94+
- name: 🍺 Install Maestro
95+
run: |
96+
curl -Ls "https://get.maestro.mobile.dev" | bash
97+
echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
98+
8499
- name: Install node packages
85100
run: yarn install --frozen-lockfile
86101
working-directory: test
87102

103+
- name: ⚙️ Enable KVM for Android virtualization
104+
shell: bash
105+
run: |
106+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
107+
sudo udevadm control --reload-rules
108+
sudo udevadm trigger --name-match=kvm
109+
88110
- name: Run test
89111
uses: reactivecircus/android-emulator-runner@v2
90112
with:
91-
api-level: 21
113+
api-level: 24
92114
arch: x86_64
93-
disable-animations: false
94-
script: mv archive/dist . && cd test && yarn && cd android && ./gradlew :app:assembleRelease :app:assembleAndroidTest :app:connectedAndroidTest
115+
target: google_apis
116+
working-directory: test
117+
script: |
118+
mv ../archive/dist ../dist
119+
npx expo run:android --variant release --no-bundler
120+
maestro test maestro.yaml

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This project is based on [facebook/android-jsc](https://github.com/facebook/andr
1919
* Set `export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools/bin`
2020
* Android NDK r19c: download from [NDK Archives](https://developer.android.com/ndk/downloads/older_releases.html)
2121
* Set `export ANDROID_NDK=/path/to/android-ndk-r19c`
22-
* Make sure you have Ruby (>2.3), Python (>2.7), Git, SVN, gperf
22+
* Make sure you have Ruby (>2.3), Python (>2.7), Git, gperf
2323

2424
## Build instructions
2525

@@ -235,7 +235,7 @@ packagingOptions {
235235
```
236236

237237
## Resources
238-
- [WebkitGTK Sources](https://svn.webkit.org/repository/webkit/releases/WebKitGTK/)
238+
- [WebKit Sources](https://github.com/WebKit/WebKit)
239239
- [ICU Sources](https://android.googlesource.com/platform/external/icu/)
240240
- [Info about Webkit Revisions](https://trac.webkit.org/browser/webkit/releases/WebKitGTK)
241241
- [Info about JSC version used on iOS](https://trac.webkit.org/browser/webkit/releases/WebKitGTK/webkit-2.18.2/Source/WebCore/Configurations/Version.xcconfig)

lib/android-jsc/build.gradle

+39-26
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'maven-publish'
23

34
def distDir = project.findProperty("distDir") ?: ""
45
def jniLibsDir = project.findProperty("jniLibsDir") ?: ""
@@ -11,42 +12,54 @@ if (!revision) throw new RuntimeException("expecting --project-prop revision=???
1112
if (!i18n) throw new RuntimeException("expecting --project-prop i18n=??? but was empty")
1213

1314
android {
14-
compileSdkVersion 28
15+
namespace 'org.webkit.androidjsc'
16+
compileSdkVersion 35
1517

16-
defaultConfig {
17-
minSdkVersion 16
18-
targetSdkVersion 28
19-
versionCode 1
20-
versionName "1.0"
21-
}
18+
defaultConfig {
19+
minSdkVersion 24
20+
targetSdkVersion 34
21+
versionCode 1
22+
versionName "1.0"
23+
}
2224

23-
sourceSets {
24-
main {
25-
jniLibs.srcDirs = ["${jniLibsDir}"]
26-
}
25+
sourceSets {
26+
main {
27+
jniLibs.srcDirs = ["${jniLibsDir}"]
2728
}
29+
}
30+
31+
packagingOptions {
32+
doNotStrip "**/libjsc.so"
33+
}
2834

29-
packagingOptions {
30-
doNotStrip "**/libjsc.so"
35+
publishing {
36+
singleVariant("release") {
3137
}
38+
}
3239
}
3340

3441
dependencies {}
3542

36-
apply plugin: 'maven'
43+
project.group = "org.webkit"
44+
def artifactName = Boolean.valueOf(i18n) ? "android-jsc-intl" : "android-jsc"
45+
project.version = "r${revision}"
3746

38-
task createAAR(type: Upload) {
39-
project.group = "org.webkit"
40-
def artifactName = Boolean.valueOf(i18n) ? "android-jsc-intl" : "android-jsc"
41-
project.version = "r${revision}"
42-
43-
configuration = configurations.archives
44-
repositories.mavenDeployer {
45-
repository url: "file://${distDir}"
46-
pom.project {
47-
name "android-jsc"
48-
artifactId artifactName
49-
packaging "aar"
47+
afterEvaluate {
48+
publishing {
49+
publications {
50+
release(MavenPublication) {
51+
from components.release
52+
pom {
53+
name = "android-jsc"
54+
artifactId = artifactName
55+
packaging = "aar"
5056
}
57+
}
58+
}
59+
repositories {
60+
maven {
61+
url = "file://${distDir}"
62+
}
5163
}
64+
}
5265
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="org.webkit.androidjsc" />
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />

lib/build.gradle

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
buildscript {
44
repositories {
55
google()
6-
jcenter()
76
mavenCentral()
87
mavenLocal()
98
}
109
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.2.0'
10+
classpath 'com.android.tools.build:gradle:8.7.2'
1211

1312
// NOTE: Do not place your application dependencies here; they belong
1413
// in the individual module build.gradle files
@@ -18,7 +17,6 @@ buildscript {
1817
allprojects {
1918
repositories {
2019
google()
21-
jcenter()
2220
mavenCentral()
2321
mavenLocal()
2422
}

lib/cppruntime/build.gradle

+37-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'maven-publish'
23

34
def distDir = project.findProperty("distDir") ?: ""
45
def jniLibsDir = project.findProperty("jniLibsDir") ?: ""
@@ -9,37 +10,49 @@ if (!jniLibsDir) throw new RuntimeException("expecting --project-prop jniLibsDir
910
if (!revision) throw new RuntimeException("expecting --project-prop revision=??? but was empty")
1011

1112
android {
12-
compileSdkVersion 28
13-
14-
defaultConfig {
15-
minSdkVersion 16
16-
targetSdkVersion 28
17-
versionCode 1
18-
versionName "1.0"
13+
namespace 'org.webkit.androidjsc_cppruntime'
14+
compileSdkVersion 35
15+
16+
defaultConfig {
17+
minSdkVersion 24
18+
targetSdkVersion 34
19+
versionCode 1
20+
versionName "1.0"
21+
}
22+
23+
sourceSets {
24+
main {
25+
jniLibs.srcDirs = ["${jniLibsDir}"]
1926
}
27+
}
2028

21-
sourceSets {
22-
main {
23-
jniLibs.srcDirs = ["${jniLibsDir}"]
24-
}
29+
publishing {
30+
singleVariant("release") {
2531
}
32+
}
2633
}
2734

2835
dependencies {}
2936

30-
apply plugin: 'maven'
31-
32-
task createAAR(type: Upload) {
33-
project.group = "org.webkit"
34-
project.version = "r${revision}"
35-
36-
configuration = configurations.archives
37-
repositories.mavenDeployer {
38-
repository url: "file://${distDir}"
39-
pom.project {
40-
name "android-jsc"
41-
artifactId "android-jsc-cppruntime"
42-
packaging "aar"
37+
project.group = "org.webkit"
38+
project.version = "r${revision}"
39+
40+
afterEvaluate {
41+
publishing {
42+
publications {
43+
release(MavenPublication) {
44+
from components.release
45+
pom {
46+
name = "android-jsc"
47+
artifactId = "android-jsc-cppruntime"
48+
packaging = "aar"
4349
}
50+
}
51+
}
52+
repositories {
53+
maven {
54+
url = "file://${distDir}"
55+
}
4456
}
57+
}
4558
}
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="org.webkit.androidjsc_cppruntime" />
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />

lib/gradle/wrapper/gradle-wrapper.jar

-10.6 KB
Binary file not shown.

lib/gradle/wrapper/gradle-wrapper.properties

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#Tue May 15 12:33:24 IDT 2018
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip

0 commit comments

Comments
 (0)