Skip to content

Commit 3951b75

Browse files
committed
nointl build was broken due to incorrect codepoint comparison that was lost when rebasing the existing patch stack on the new JSC. efault collator lazy-property is now wrapped in #if ENABLE(INTL) so the no-intl flavor never tries to instantiate ICU
machinery it does not ship. BabylonNative needs Inspector APIs to be available, and SharedArrayBuffer is now enabled for efficient communication via N-API native modules. add a small smoketest binary for NDK 28 and NDK 29 validation in Android simulator outside of the React Native-mandated NDK 27. we now have a way to validate runtime effectiveness of all NDK variant compiles within CI.
1 parent 940c071 commit 3951b75

15 files changed

+672
-38
lines changed

.github/workflows/build_and_test.yml

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }}
2828
NDK_VERSION_27: '27.1.12297006'
2929
NDK_VERSION_28: '28.2.13676358'
30+
NDK_VERSION_29: '29.0.14206865'
3031
BUILD_CACHE_VERSION: v1
3132

3233
steps:
@@ -85,9 +86,9 @@ jobs:
8586
uses: actions/cache@v4
8687
with:
8788
path: ~/.cache/ccache
88-
key: ccache-${{ env.BUILD_CACHE_VERSION }}-${{ runner.os }}-${{ env.NDK_VERSION_27 }}-${{ steps.build-hash.outputs.hash }}
89+
key: ccache-${{ env.BUILD_CACHE_VERSION }}-${{ runner.os }}-${{ env.NDK_VERSION_27 }}-${{ env.NDK_VERSION_28 }}-${{ env.NDK_VERSION_29 }}-${{ steps.build-hash.outputs.hash }}
8990
restore-keys: |
90-
ccache-${{ env.BUILD_CACHE_VERSION }}-${{ runner.os }}-${{ env.NDK_VERSION_27 }}-
91+
ccache-${{ env.BUILD_CACHE_VERSION }}-${{ runner.os }}-${{ env.NDK_VERSION_27 }}-${{ env.NDK_VERSION_28 }}-${{ env.NDK_VERSION_29 }}-
9192
9293
- name: Configure ccache
9394
run: |
@@ -105,18 +106,37 @@ jobs:
105106
path: ${{ env.ANDROID_HOME }}/ndk/${{ env.NDK_VERSION_27 }}
106107
key: android-ndk-${{ runner.os }}-${{ env.NDK_VERSION_27 }}
107108

109+
- name: Cache Android NDK r28
110+
id: cache-ndk-28
111+
uses: actions/cache@v4
112+
with:
113+
path: ${{ env.ANDROID_HOME }}/ndk/${{ env.NDK_VERSION_28 }}
114+
key: android-ndk-${{ runner.os }}-${{ env.NDK_VERSION_28 }}
115+
116+
- name: Cache Android NDK r29
117+
id: cache-ndk-29
118+
uses: actions/cache@v4
119+
with:
120+
path: ${{ env.ANDROID_HOME }}/ndk/${{ env.NDK_VERSION_29 }}
121+
key: android-ndk-${{ runner.os }}-${{ env.NDK_VERSION_29 }}
122+
108123
- name: Install Android packages
109124
run: |
110125
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
111126
yes | sdkmanager --licenses || true
112127
sdkmanager "cmake;3.22.1"
113-
if [[ ! -d "${ANDROID_HOME}/ndk/${NDK_VERSION_27}" ]]; then
114-
sdkmanager "ndk;${NDK_VERSION_27}"
115-
fi
116-
UNICODE_DIR="${ANDROID_HOME}/ndk/${NDK_VERSION_27}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode"
117-
if [[ -d "${UNICODE_DIR}" ]]; then
118-
mv "${UNICODE_DIR}" "${UNICODE_DIR}2"
119-
fi
128+
for version in "${NDK_VERSION_27}" "${NDK_VERSION_28}" "${NDK_VERSION_29}"; do
129+
if [[ -z "$version" ]]; then
130+
continue
131+
fi
132+
if [[ ! -d "${ANDROID_HOME}/ndk/${version}" ]]; then
133+
sdkmanager "ndk;${version}"
134+
fi
135+
UNICODE_DIR="${ANDROID_HOME}/ndk/${version}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode"
136+
if [[ -d "${UNICODE_DIR}" ]]; then
137+
mv "${UNICODE_DIR}" "${UNICODE_DIR}2"
138+
fi
139+
done
120140
echo "ANDROID_NDK=$ANDROID_HOME/ndk/${NDK_VERSION_27}" >> $GITHUB_ENV
121141
echo "PATH=$PATH" >> $GITHUB_ENV
122142
shell: bash
@@ -138,7 +158,32 @@ jobs:
138158

139159
- name: Build
140160
if: steps.cache-dist.outputs.cache-hit != 'true'
141-
run: yarn start
161+
run: |
162+
variants=(ndk27 ndk28c ndk29)
163+
for variant in "${variants[@]}"; do
164+
case "$variant" in
165+
ndk27)
166+
export ANDROID_NDK="$ANDROID_HOME/ndk/${NDK_VERSION_27}"
167+
;;
168+
ndk28c)
169+
export ANDROID_NDK="$ANDROID_HOME/ndk/${NDK_VERSION_28}"
170+
;;
171+
ndk29)
172+
export ANDROID_NDK="$ANDROID_HOME/ndk/${NDK_VERSION_29}"
173+
;;
174+
*)
175+
echo "Unknown variant $variant" >&2
176+
exit 1
177+
esac
178+
179+
if [[ ! -d "$ANDROID_NDK" ]]; then
180+
echo "Android NDK not found at $ANDROID_NDK for variant $variant" >&2
181+
exit 1
182+
fi
183+
184+
export JSC_NDK_VARIANT="$variant"
185+
yarn start
186+
done
142187
shell: bash
143188

144189
- name: Show ccache stats
@@ -241,6 +286,16 @@ jobs:
241286
set +e
242287
maestro test maestro.yaml
243288
STATUS=$?
289+
if [ $STATUS -eq 0 ]; then
290+
for variant in ndk27 ndk28c ndk29; do
291+
../scripts/run-js-smoketest.sh "$variant"
292+
EXIT_CODE=$?
293+
if [ $EXIT_CODE -ne 0 ]; then
294+
STATUS=$EXIT_CODE
295+
break
296+
fi
297+
done
298+
fi
244299
adb logcat -d > adb.log
245300
exit $STATUS
246301
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/webkit/Source/WTF/wtf/Assertions.h b/webkit/Source/WTF/wtf/Assertions.h
2+
index 0000000..0000000 100644
3+
--- a/webkit/Source/WTF/wtf/Assertions.h
4+
+++ b/webkit/Source/WTF/wtf/Assertions.h
5+
@@ -49,7 +49,7 @@
6+
#include <stddef.h>
7+
#include <stdlib.h>
8+
#include <wtf/ExportMacros.h>
9+
10+
-#if OS(ANDROID) && !USE(BUN_JSC_ADDITIONS)
11+
+#if OS(ANDROID)
12+
#include <android/log.h>
13+
#endif
14+
15+
#if OS(DARWIN)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/webkit/Source/JavaScriptCore/runtime/OptionsList.h 2025-11-06 00:08:49
2+
+++ b/OptionsList.h.new 2025-11-06 16:08:43
3+
@@ -650,7 +650,7 @@
4+
v(Bool, useMapGetOrInsert, true, Normal, "Expose the Map.prototype.getOrInsert family of methods."_s) \
5+
v(Bool, useMathSumPreciseMethod, true, Normal, "Expose the Math.sumPrecise() method."_s) \
6+
v(Bool, useMoreCurrencyDisplayChoices, false, Normal, "Enable more currencyDisplay choices for Intl.NumberFormat"_s) \
7+
- v(Bool, useSharedArrayBuffer, false, Normal, nullptr) \
8+
+ v(Bool, useSharedArrayBuffer, true, Normal, nullptr) \
9+
v(Bool, useShadowRealm, false, Normal, "Expose the ShadowRealm object."_s) \
10+
v(Bool, useTemporal, false, Normal, "Expose the Temporal object."_s) \
11+
v(Bool, useTrustedTypes, true, Normal, "Enable trusted types eval protection feature."_s) \
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
--- a/webkit/Source/JavaScriptCore/runtime/StringPrototype.cpp 2025-11-06 15:50:41
2+
+++ b/StringPrototype.cpp.new 2025-11-06 15:55:15
3+
@@ -35,6 +35,7 @@
4+
#include "JSCInlines.h"
5+
#include "JSStringIterator.h"
6+
#include "ObjectConstructor.h"
7+
+#include <compare>
8+
#include "ParseInt.h"
9+
#include "RegExpConstructor.h"
10+
#include "RegExpGlobalDataInlines.h"
11+
@@ -1062,6 +1063,22 @@
12+
13+
auto that = thatCell->view(globalObject);
14+
RETURN_IF_EXCEPTION(scope, { });
15+
+
16+
+#if !ENABLE(INTL)
17+
+ auto fallback = [&] () -> EncodedJSValue {
18+
+ auto ordering = WTF::codePointCompare(string, that);
19+
+ int result = 0;
20+
+ if (std::is_lt(ordering))
21+
+ result = -1;
22+
+ else if (std::is_gt(ordering))
23+
+ result = 1;
24+
+ return JSValue::encode(jsNumber(result));
25+
+ };
26+
+ RELEASE_AND_RETURN(scope, fallback());
27+
+#else
28+
+ auto throwUnavailable = [&] () -> EncodedJSValue {
29+
+ return throwVMTypeError(globalObject, scope, "Intl.Collator is unavailable in this runtime"_s);
30+
+ };
31+
32+
JSValue locales = callFrame->argument(1);
33+
JSValue options = callFrame->argument(2);
34+
@@ -1072,8 +1089,11 @@
35+
collator = IntlCollator::create(vm, globalObject->collatorStructure());
36+
collator->initializeCollator(globalObject, locales, options);
37+
}
38+
- RETURN_IF_EXCEPTION(scope, encodedJSValue());
39+
+ RETURN_IF_EXCEPTION(scope, throwUnavailable());
40+
+ if (!collator)
41+
+ return throwUnavailable();
42+
RELEASE_AND_RETURN(scope, JSValue::encode(jsNumber(collator->compareStrings(globalObject, string, that))));
43+
+#endif
44+
}
45+
46+
enum class CaseConversionMode {
47+
--- a/webkit/Source/JavaScriptCore/runtime/JSGlobalObject.cpp 2025-11-06 15:50:48
48+
+++ b/JSGlobalObject.cpp.new 2025-11-06 15:55:47
49+
@@ -1460,6 +1460,7 @@
50+
init.setConstructor(IntlNumberFormatConstructor::create(init.vm, IntlNumberFormatConstructor::createStructure(init.vm, init.global, init.global->functionPrototype()), jsCast<IntlNumberFormatPrototype*>(init.prototype)));
51+
});
52+
53+
+#if ENABLE(INTL)
54+
m_defaultCollator.initLater(
55+
[] (const Initializer<IntlCollator>& init) {
56+
JSGlobalObject* globalObject = jsCast<JSGlobalObject*>(init.owner);
57+
@@ -1467,9 +1468,14 @@
58+
auto scope = DECLARE_THROW_SCOPE(vm);
59+
IntlCollator* collator = IntlCollator::create(vm, globalObject->collatorStructure());
60+
collator->initializeCollator(globalObject, jsUndefined(), jsUndefined());
61+
- RETURN_IF_EXCEPTION(scope, void());
62+
+ if (scope.exception()) {
63+
+ init.property.setMayBeNull(vm, globalObject, nullptr);
64+
+ return;
65+
+ }
66+
+ ASSERT(collator);
67+
init.set(collator);
68+
});
69+
+#endif
70+
71+
m_defaultNumberFormat.initLater(
72+
[] (const Initializer<IntlNumberFormat>& init) {

patches/jsc_android_release_flags.patch

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
diff --git a/webkit/Source/cmake/OptionsCommon.cmake b/webkit/Source/cmake/OptionsCommon.cmake
2-
index ea7d508967d6..b4de9ef50bbf 100644
32
--- a/webkit/Source/cmake/OptionsCommon.cmake
43
+++ b/webkit/Source/cmake/OptionsCommon.cmake
5-
@@ -1,7 +1,11 @@
6-
-set(CMAKE_CXX_STANDARD 23)
7-
+set(CMAKE_CXX_STANDARD 20)
4+
@@ -2,6 +2,9 @@
85
set(CMAKE_CXX_STANDARD_REQUIRED ON)
96
set(CMAKE_CXX_EXTENSIONS OFF)
107
set(CMAKE_EXPERIMENTAL_CXX_MODULE_DYNDEP OFF)
11-
+
128
+# Android builds rely on downstream flags, so keep CMake from adding -O3 automatically.
139
+set(CMAKE_C_COMPILE_OPTIONS_RELEASE -DNDEBUG CACHE STRING "" FORCE)
1410
+set(CMAKE_CXX_COMPILE_OPTIONS_RELEASE -DNDEBUG CACHE STRING "" FORCE)

patches/jsc_disable_api_tests.patch

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
diff --git a/webkit/Source/cmake/OptionsJSCOnly.cmake b/webkit/Source/cmake/OptionsJSCOnly.cmake
2-
index f00830dd41..f9e131cfa3 100644
3-
--- a/webkit/Source/cmake/OptionsJSCOnly.cmake
4-
+++ b/webkit/Source/cmake/OptionsJSCOnly.cmake
5-
@@ -101,10 +101,8 @@ else ()
1+
--- a/webkit/Source/cmake/OptionsJSCOnly.cmake 2025-11-06 00:08:55
2+
+++ b/OptionsJSCOnly.cpp.new 2025-11-06 16:04:34
3+
@@ -50,7 +50,7 @@
4+
WEBKIT_OPTION_BEGIN()
5+
WEBKIT_OPTION_DEFINE(ENABLE_STATIC_JSC "Whether to build JavaScriptCore as a static library." PUBLIC OFF)
6+
WEBKIT_OPTION_DEFINE(USE_LIBBACKTRACE "Whether to enable usage of libbacktrace." PUBLIC OFF)
7+
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE OFF)
8+
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_REMOTE_INSPECTOR PRIVATE ON)
9+
if (WIN32)
10+
WEBKIT_OPTION_DEFAULT_PORT_VALUE(USE_SYSTEM_MALLOC PRIVATE OFF)
11+
endif ()
12+
@@ -91,7 +91,7 @@
13+
SET_AND_EXPOSE_TO_BUILD(ENABLE_RESOURCE_USAGE ON)
14+
15+
WEBKIT_OPTION_BEGIN()
16+
-WEBKIT_OPTION_DEFINE(ENABLE_REMOTE_INSPECTOR "Whether to build JavaScriptCore with remote inspector support" PUBLIC OFF)
17+
+WEBKIT_OPTION_DEFINE(ENABLE_REMOTE_INSPECTOR "Whether to build JavaScriptCore with remote inspector support" PUBLIC ON)
18+
if (ENABLE_REMOTE_INSPECTOR)
19+
SET_AND_EXPOSE_TO_BUILD(ENABLE_INSPECTOR_ALTERNATE_DISPATCHERS 1)
20+
SET_AND_EXPOSE_TO_BUILD(USE_INSPECTOR_SOCKET_SERVER 1)
21+
@@ -101,10 +101,8 @@
622
endif ()
723
WEBKIT_OPTION_END()
824

scripts/build-hash.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const includePaths = [
1111
'yarn.lock',
1212
'patches',
1313
'scripts',
14+
'tools',
1415
'lib',
1516
];
1617

0 commit comments

Comments
 (0)