Skip to content
This repository was archived by the owner on Nov 9, 2026. It is now read-only.

Commit f41030f

Browse files
committed
Refresh Android compatibility coverage for API 35
1 parent 8cd1429 commit f41030f

5 files changed

Lines changed: 41 additions & 18 deletions

File tree

‎.github/workflows/build-android.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Run Connected Android Test
6363
uses: reactivecircus/android-emulator-runner@v2
6464
with:
65-
api-level: 33
65+
api-level: 35
6666
target: google_apis
6767
arch: x86_64
6868
emulator-options: -no-snapshot -no-window -no-boot-anim -no-audio

‎Core/AppRuntime/V8Inspector/Source/V8InspectorAgent.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,9 @@ namespace Babylon
419419
}
420420
v8::Local<v8::String> string_value = v8::Local<v8::String>::Cast(value);
421421
int len = string_value->Length();
422-
std::basic_string<char16_t> buffer(len, '\0');
423-
string_value->Write(v8::Isolate::GetCurrent(), reinterpret_cast<uint16_t*>(&buffer[0]), 0, len); // Write expects uint16_t* but the template parameter is char16_t
424-
return v8_inspector::StringBuffer::create(v8_inspector::StringView(reinterpret_cast<uint16_t*>(buffer.data()), len));
422+
std::vector<uint16_t> buffer(len);
423+
string_value->Write(v8::Isolate::GetCurrent(), buffer.data(), 0, len);
424+
return v8_inspector::StringBuffer::create(v8_inspector::StringView(buffer.data(), len));
425425
}
426426

427427
bool AgentImpl::AppendMessage(
@@ -661,4 +661,4 @@ namespace Babylon
661661
return "file://" + script_path_;
662662
}
663663

664-
} // namespace inspector
664+
} // namespace inspector

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ npm install
3737
_Follow the steps from [All Development Platforms](#all-development-platforms) before proceeding._
3838

3939
**Required Tools:**
40-
[Android Studio](https://developer.android.com/studio), [Node.js](https://nodejs.org/en/download/), [Ninja](https://ninja-build.org/)
40+
[Android Studio](https://developer.android.com/studio) with Android NDK 28.2.13676358 and API level 35 SDK platform installed, [Node.js](https://nodejs.org/en/download/), [Ninja](https://ninja-build.org/)
4141

4242
The minimal requirement target is Android 5.0.
4343

@@ -47,7 +47,7 @@ An `.apk` that can be executed on your device or simulator is the output.
4747

4848
First, download the latest release of Ninja, extract the binary, and add it to your system path.
4949

50-
Once you have Android Studio downloaded, you need to set up an Android emulator if you do not have a physical Android device. You can do this by selecting `Tools` -> `Device Manager` and then selecting a device. (We are using Pixel 2 API 27).
50+
Once you have Android Studio downloaded, you need to set up an Android emulator if you do not have a physical Android device. You can do this by selecting `Tools` -> `Device Manager` and then selecting a device. (We are using Pixel 2 API 35).
5151

5252
Open the project located at
5353
`JsRuntimeHost\Tests\UnitTests\Android` with Android Studio. Note that this can take a while to load. (The bottom right corner of the Android Studio window shows you what is currently being loaded.)
@@ -73,4 +73,4 @@ Security Response Center (MSRC) at [secure@microsoft.com](mailto:secure@microsof
7373
You should receive a response within 24 hours. If for some reason you do not, please
7474
follow up via email to ensure we received your original message. Further information,
7575
including the [MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can
76-
be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/default).
76+
be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/default).

‎Tests/UnitTests/Android/app/build.gradle‎

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ if (project.hasProperty("jsEngine")) {
77
jsEngine = project.property("jsEngine")
88
}
99

10+
def targetApiLevel = 35
11+
def requiredNdkVersion = project.findProperty("ndkVersion") ?: "28.2.13676358"
12+
1013
def cmakeArguments = [
1114
"-DANDROID_STL=c++_shared",
1215
"-DNAPI_JAVASCRIPT_ENGINE=${jsEngine}",
@@ -24,16 +27,13 @@ if (project.hasProperty("importHostCompilers")) {
2427

2528
android {
2629
namespace 'com.jsruntimehost.unittests'
27-
compileSdk 33
28-
ndkVersion = "23.1.7779620"
29-
if (project.hasProperty("ndkVersion")) {
30-
ndkVersion = project.property("ndkVersion")
31-
}
30+
compileSdk targetApiLevel
31+
ndkVersion = requiredNdkVersion
3232

3333
defaultConfig {
3434
applicationId "com.jsruntimehost.unittests"
3535
minSdk 21
36-
targetSdk 33
36+
targetSdk targetApiLevel
3737
versionCode 1
3838
versionName "1.0"
3939

@@ -45,9 +45,28 @@ android {
4545
}
4646
}
4747

48-
if (project.hasProperty("abiFilters")) {
49-
ndk {
50-
abiFilters project.getProperty("abiFilters")
48+
ndk {
49+
def abiFiltersProp = project.findProperty("abiFilters")?.toString()
50+
if (abiFiltersProp) {
51+
def propFilters = abiFiltersProp.split(',').collect { it.trim() }.findAll { !it.isEmpty() }
52+
if (!propFilters.isEmpty()) {
53+
abiFilters(*propFilters)
54+
}
55+
} else {
56+
def requestedAbi = project.findProperty("android.injected.build.abi") ?: System.getenv("ANDROID_ABI")
57+
def defaultAbis = []
58+
if (requestedAbi) {
59+
defaultAbis = requestedAbi.split(',').collect { it.trim() }.findAll { !it.isEmpty() }
60+
}
61+
if (defaultAbis.isEmpty()) {
62+
def hostArch = (System.getProperty("os.arch") ?: "").toLowerCase()
63+
if (hostArch.contains("aarch64") || hostArch.contains("arm64")) {
64+
defaultAbis = ['arm64-v8a']
65+
} else {
66+
defaultAbis = ['arm64-v8a', 'x86_64']
67+
}
68+
}
69+
abiFilters(*defaultAbis)
5170
}
5271
}
5372
}

‎Tests/UnitTests/Android/app/src/main/cpp/JNI.cpp‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ Java_com_jsruntimehost_unittests_Native_javaScriptTests(JNIEnv* env, jclass claz
2222
android::global::Initialize(javaVM, context);
2323

2424
Babylon::DebugTrace::EnableDebugTrace(true);
25-
Babylon::DebugTrace::SetTraceOutput([](const char* trace) { printf("%s\n", trace); fflush(stdout); });
25+
// Emit debug-trace lines straight to logcat under a dedicated "JsRuntimeHost" tag instead of
26+
// routing them through AndroidExtensions' StdoutLogger (which forwards all stdout under a single
27+
// tag, interleaved with the gtest output). The distinct tag keeps connected-test diagnostics
28+
// filterable, e.g. `adb logcat -s JsRuntimeHost`.
29+
Babylon::DebugTrace::SetTraceOutput([](const char* trace) { __android_log_print(ANDROID_LOG_INFO, "JsRuntimeHost", "%s", trace); });
2630

2731
auto testResult = RunTests();
2832

0 commit comments

Comments
 (0)