Skip to content

Commit 853253b

Browse files
authored
Merge branch 'main' into feat/ndk-27
2 parents 1bfaba0 + b31fc5f commit 853253b

29 files changed

+10613
-4664
lines changed

.github/workflows/npm_release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ jobs:
7373
- name: Build npm package
7474
run: ./gradlew -PgitCommitVersion=${{ github.sha }} -PnoCCache --stacktrace
7575
- name: Upload npm package artifact
76-
uses: actions/upload-artifact@v3
76+
uses: actions/upload-artifact@v4
7777
with:
7878
name: npm-package
7979
path: dist/nativescript-android-${{steps.npm_version_output.outputs.NPM_VERSION}}.tgz
8080
- name: Upload debug symbols
81-
uses: actions/upload-artifact@v3
81+
uses: actions/upload-artifact@v4
8282
with:
8383
name: debug-symbols
8484
path: test-app/runtime/build/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib/*
@@ -146,7 +146,7 @@ jobs:
146146
with:
147147
node-version: 18
148148
registry-url: "https://registry.npmjs.org"
149-
- uses: actions/download-artifact@v3
149+
- uses: actions/download-artifact@v4
150150
with:
151151
name: npm-package
152152
path: dist
@@ -176,11 +176,11 @@ jobs:
176176
node-version: 18
177177
- name: Setup
178178
run: npm install
179-
- uses: actions/download-artifact@v3
179+
- uses: actions/download-artifact@v4
180180
with:
181181
name: npm-package
182182
path: dist
183-
- uses: actions/download-artifact@v3
183+
- uses: actions/download-artifact@v4
184184
with:
185185
name: debug-symbols
186186
path: dist/debug-symbols

.github/workflows/pull_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ jobs:
7070
- name: Build npm package
7171
run: ./gradlew -PgitCommitVersion=${{ github.sha }} -PnoCCache --stacktrace
7272
- name: Upload npm package artifact
73-
uses: actions/upload-artifact@v3
73+
uses: actions/upload-artifact@v4
7474
with:
7575
name: npm-package
7676
path: dist/nativescript-android-${{steps.npm_version_output.outputs.NPM_VERSION}}.tgz
7777
- name: Upload debug symbols
78-
uses: actions/upload-artifact@v3
78+
uses: actions/upload-artifact@v4
7979
with:
8080
name: debug-symbols
8181
path: test-app/runtime/build/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib/*

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@nativescript/android",
33
"description": "NativeScript for Android using v8",
4-
"version": "8.8.6",
4+
"version": "8.9.0",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/NativeScript/android.git"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
describe("URLPattern", function () {
3+
it("throws on invalid URLPattern", function () {
4+
var exceptionCaught = false;
5+
try {
6+
const pattern = new URLPattern(1);
7+
} catch (e) {
8+
exceptionCaught = true;
9+
}
10+
expect(exceptionCaught).toBe(true);
11+
});
12+
13+
it("does not throw on valid URLPattern", function () {
14+
var exceptionCaught = false;
15+
try {
16+
const pattern = new URLPattern("https://example.com/books/:id");
17+
} catch (e) {
18+
exceptionCaught = true;
19+
}
20+
expect(exceptionCaught).toBe(false);
21+
});
22+
23+
it("parses simple pattern", function () {
24+
const pattern = new URLPattern("https://example.com/books/:id");
25+
expect(pattern.protocol).toBe("https");
26+
expect(pattern.hostname).toBe("example.com");
27+
expect(pattern.pathname).toBe("/books/:id");
28+
expect(pattern.port).toBe("");
29+
expect(pattern.search).toBe("*");
30+
expect(pattern.hash).toBe("*");
31+
expect(pattern.username).toBe("*");
32+
expect(pattern.password).toBe("*");
33+
expect(pattern.hasRegExpGroups).toBe(false);
34+
});
35+
36+
37+
it("parses with undefined base", function () {
38+
const pattern = new URLPattern("https://google.com", undefined);
39+
expect(pattern.protocol).toBe("https");
40+
expect(pattern.hostname).toBe("google.com");
41+
});
42+
43+
it("parses with null base", function () {
44+
const pattern = new URLPattern("https://google.com", null);
45+
expect(pattern.protocol).toBe("https");
46+
expect(pattern.hostname).toBe("google.com");
47+
});
48+
49+
});

test-app/gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ NS_DEFAULT_COMPILE_SDK_VERSION=35
2424
NS_DEFAULT_MIN_SDK_VERSION=21
2525
NS_DEFAULT_ANDROID_BUILD_TOOLS_VERSION=8.7.0
2626

27-
ns_default_androidx_appcompat_version = 1.5.1
27+
ns_default_androidx_appcompat_version = 1.7.0
2828
ns_default_androidx_exifinterface_version = 1.3.7
29-
ns_default_androidx_fragment_version = 1.5.7
29+
ns_default_androidx_fragment_version = 1.8.5
3030
ns_default_androidx_material_version = 1.8.0
3131
ns_default_androidx_multidex_version = 2.0.1
32-
ns_default_androidx_transition_version = 1.4.1
32+
ns_default_androidx_transition_version = 1.5.1
3333
ns_default_androidx_viewpager_version = 1.0.0
3434
ns_default_asm_util_version = 9.7
3535
ns_default_asm_version = 9.7

test-app/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Sun Dec 08 19:56:04 AST 2024
1+
#Tue Feb 11 10:56:28 AST 2025
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip

test-app/runtime/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# documentation: https://d.android.com/studio/projects/add-native-code.html
22

33
# Command info: https://cmake.org/cmake/help/v3.4/command/cmake_minimum_required.html
4-
cmake_minimum_required(VERSION 3.4.1)
4+
cmake_minimum_required(VERSION 3.18.1)
55

66
project(NativeScriptAndroidRuntime)
77

@@ -18,13 +18,16 @@ endif (CCACHE_FOUND AND (USE_CCACHE))
1818
# "-DANDROID_STL=c++_static" is just not enough for clang++ to find some libraries in the ndk
1919
MESSAGE(STATUS "## ANDROID_NDK_ROOT: " ${ANDROID_NDK_ROOT})
2020

21-
set(COMMON_CMAKE_ARGUMENTS "-std=c++17 -Werror -Wno-unused-result -mstackrealign -fexceptions -fno-builtin-stpcpy -fno-rtti -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_EMBEDDED_BUILTINS -Wno-vla-extension -Wno-deprecated")
21+
22+
set(COMMON_CMAKE_ARGUMENTS "-std=c++20 -Werror -Wno-unused-result -mstackrealign -fexceptions -fno-builtin-stpcpy -fno-rtti -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_EMBEDDED_BUILTINS -Wno-vla-extension -Wno-deprecated -Wno-vla-cxx-extension")
23+
2224

2325
if("${ANDROID_ABI}" MATCHES "arm64-v8a$" OR "${ANDROID_ABI}" MATCHES "x86_64$")
2426
# Enable pointer compression on 64 bit platforms
2527
set(COMMON_CMAKE_ARGUMENTS "${COMMON_CMAKE_ARGUMENTS} -DV8_COMPRESS_POINTERS")
2628
endif()
2729

30+
2831
# AOSP has switched to using LLD by default and the NDK will use it by default in the next release.
2932
# BFD and Gold will be removed once LLD has been through a release cycle with no major unresolved issues (estimated r21)
3033
# Note: lld does not currently work on Windows: https://github.com/android-ndk/ndk/issues/888
@@ -115,6 +118,7 @@ add_library(
115118
src/main/cpp/MetadataNode.cpp
116119
src/main/cpp/MetadataReader.cpp
117120
src/main/cpp/MetadataTreeNode.cpp
121+
src/main/cpp/MetadataEntry.cpp
118122
src/main/cpp/MethodCache.cpp
119123
src/main/cpp/ModuleBinding.cpp
120124
src/main/cpp/ModuleInternal.cpp
@@ -141,6 +145,7 @@ add_library(
141145
src/main/cpp/ada/ada.cpp
142146
src/main/cpp/URLImpl.cpp
143147
src/main/cpp/URLSearchParamsImpl.cpp
148+
src/main/cpp/URLPatternImpl.cpp
144149

145150
# V8 inspector source files will be included only in Release mode
146151
${INSPECTOR_SOURCES}
@@ -162,6 +167,7 @@ else ()
162167
)
163168
endif ()
164169

170+
165171
MESSAGE(STATUS "# General cmake Info")
166172
MESSAGE(STATUS "# PROJECT_SOURCE_DIR: " ${PROJECT_SOURCE_DIR})
167173
MESSAGE(STATUS "# CMAKE_VERSION: " ${CMAKE_VERSION})

test-app/runtime/build.gradle

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if (useCCache) {
2121
}
2222

2323

24-
def defaultNdkVersion = "27.0.12077973"
24+
def defaultNdkVersion = "27.2.12479018"
2525

2626
def hasNdkVersion = project.hasProperty("ndkVersion")
2727
if (hasNdkVersion) {
@@ -113,8 +113,8 @@ android {
113113
//
114114
// arguments "-DANDROID_TOOLCHAIN=clang", "-DANDROID_STL=c++_static", "-DANDROID_NDK_ROOT=${NDK_PATH}"
115115

116-
cppFlags "-std=c++14"
117-
arguments "-DANDROID_STL=c++_shared", "-DANDROID_NDK_ROOT=${NDK_PATH}", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
116+
cppFlags "-std=c++20"
117+
arguments "-DANDROID_STL=c++_static", "-DANDROID_NDK_ROOT=${NDK_PATH}", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
118118
}
119119
}
120120

@@ -149,13 +149,11 @@ android {
149149
}
150150

151151
allprojects {
152-
/* gradle.projectsEvaluated {
153-
tasks.withType(JavaCompile).tap {
154-
configureEach {
155-
options.compilerArgs << "-Xlint:all" << "-Werror"
156-
}
157-
}
158-
}*/
152+
afterEvaluate {
153+
tasks.withType(JavaCompile).configureEach {
154+
options.compilerArgs << "-Xlint:all" << "-Werror"
155+
}
156+
}
159157
}
160158

161159
dependencies {

test-app/runtime/src/main/cpp/CallbackHandlers.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ void CallbackHandlers::CallJavaMethod(const Local<Object> &caller, const string
213213

214214
auto isolate = args.GetIsolate();
215215

216-
if ((entry != nullptr) && entry->isResolved) {
216+
if ((entry != nullptr) && entry->getIsResolved()) {
217+
auto &entrySignature = entry->getSig();
217218
isStatic = entry->isStatic;
218219

219220
if (entry->memberId == nullptr) {
@@ -236,14 +237,14 @@ void CallbackHandlers::CallJavaMethod(const Local<Object> &caller, const string
236237
if (isFromInterface) {
237238
auto methodAndClassPair = env.GetInterfaceStaticMethodIDAndJClass(className,
238239
methodName,
239-
entry->sig);
240+
entrySignature);
240241
entry->memberId = methodAndClassPair.first;
241242
clazz = methodAndClassPair.second;
242243
} else {
243-
entry->memberId = env.GetStaticMethodID(clazz, methodName, entry->sig);
244+
entry->memberId = env.GetStaticMethodID(clazz, methodName, entrySignature);
244245
}
245246
} else {
246-
entry->memberId = env.GetMethodID(clazz, methodName, entry->sig);
247+
entry->memberId = env.GetMethodID(clazz, methodName, entrySignature);
247248
}
248249

249250
if (entry->memberId == nullptr) {
@@ -257,14 +258,14 @@ void CallbackHandlers::CallJavaMethod(const Local<Object> &caller, const string
257258
if (isFromInterface) {
258259
auto methodAndClassPair = env.GetInterfaceStaticMethodIDAndJClass(className,
259260
methodName,
260-
entry->sig);
261+
entrySignature);
261262
entry->memberId = methodAndClassPair.first;
262263
clazz = methodAndClassPair.second;
263264
} else {
264-
entry->memberId = env.GetStaticMethodID(clazz, methodName, entry->sig);
265+
entry->memberId = env.GetStaticMethodID(clazz, methodName, entrySignature);
265266
}
266267
} else {
267-
entry->memberId = env.GetMethodID(clazz, methodName, entry->sig);
268+
entry->memberId = env.GetMethodID(clazz, methodName, entrySignature);
268269
}
269270

270271
if (entry->memberId == nullptr) {
@@ -279,9 +280,9 @@ void CallbackHandlers::CallJavaMethod(const Local<Object> &caller, const string
279280

280281
mid = reinterpret_cast<jmethodID>(entry->memberId);
281282
clazz = entry->clazz;
282-
sig = &entry->sig;
283-
returnType = &entry->returnType;
284-
retType = entry->retType;
283+
sig = &entrySignature;
284+
returnType = &entry->getReturnType();
285+
retType = entry->getRetType();
285286
} else {
286287
DEBUG_WRITE("Resolving method: %s on className %s", methodName.c_str(), className.c_str());
287288

test-app/runtime/src/main/cpp/FieldAccessor.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ Local<Value> FieldAccessor::GetJavaField(Isolate* isolate, const Local<Object>&
1919

2020
JniLocalRef targetJavaObject;
2121

22-
const auto& fieldTypeName = fieldData->signature;
23-
auto isStatic = fieldData->isStatic;
22+
auto &fieldMetadata = fieldData->metadata;
23+
24+
const auto& fieldTypeName = fieldMetadata.getSig();
25+
auto isStatic = fieldMetadata.isStatic;
2426

2527
auto isPrimitiveType = fieldTypeName.size() == 1;
2628
auto isFieldArray = fieldTypeName[0] == '[';
@@ -35,11 +37,11 @@ Local<Value> FieldAccessor::GetJavaField(Isolate* isolate, const Local<Object>&
3537
("L" + fieldTypeName + ";"));
3638

3739
if (isStatic) {
38-
fieldData->clazz = env.FindClass(fieldData->declaringType);
39-
fieldData->fid = env.GetStaticFieldID(fieldData->clazz, fieldData->name, fieldJniSig);
40+
fieldData->clazz = env.FindClass(fieldMetadata.getDeclaringType());
41+
fieldData->fid = env.GetStaticFieldID(fieldData->clazz, fieldMetadata.name, fieldJniSig);
4042
} else {
41-
fieldData->clazz = env.FindClass(fieldData->declaringType);
42-
fieldData->fid = env.GetFieldID(fieldData->clazz, fieldData->name, fieldJniSig);
43+
fieldData->clazz = env.FindClass(fieldMetadata.getDeclaringType());
44+
fieldData->fid = env.GetFieldID(fieldData->clazz, fieldMetadata.name, fieldJniSig);
4345
}
4446
}
4547

@@ -48,7 +50,7 @@ Local<Value> FieldAccessor::GetJavaField(Isolate* isolate, const Local<Object>&
4850

4951
if (targetJavaObject.IsNull()) {
5052
stringstream ss;
51-
ss << "Cannot access property '" << fieldData->name.c_str() << "' because there is no corresponding Java object";
53+
ss << "Cannot access property '" << fieldMetadata.name.c_str() << "' because there is no corresponding Java object";
5254
throw NativeScriptException(ss.str());
5355
}
5456
}
@@ -186,14 +188,17 @@ Local<Value> FieldAccessor::GetJavaField(Isolate* isolate, const Local<Object>&
186188
void FieldAccessor::SetJavaField(Isolate* isolate, const Local<Object>& target, const Local<Value>& value, FieldCallbackData* fieldData) {
187189
JEnv env;
188190

191+
auto &fieldMetadata = fieldData->metadata;
192+
189193
HandleScope handleScope(isolate);
190194
auto runtime = Runtime::GetRuntime(isolate);
191195
auto objectManager = runtime->GetObjectManager();
192196

193197
JniLocalRef targetJavaObject;
194198

195-
const auto& fieldTypeName = fieldData->signature;
196-
auto isStatic = fieldData->isStatic;
199+
const auto& fieldTypeName = fieldMetadata.getSig();
200+
auto isStatic = fieldMetadata.isStatic;
201+
197202

198203
auto isPrimitiveType = fieldTypeName.size() == 1;
199204
auto isFieldArray = fieldTypeName[0] == '[';
@@ -208,14 +213,14 @@ void FieldAccessor::SetJavaField(Isolate* isolate, const Local<Object>& target,
208213
("L" + fieldTypeName + ";"));
209214

210215
if (isStatic) {
211-
fieldData->clazz = env.FindClass(fieldData->declaringType);
216+
fieldData->clazz = env.FindClass(fieldMetadata.getDeclaringType());
212217
assert(fieldData->clazz != nullptr);
213-
fieldData->fid = env.GetStaticFieldID(fieldData->clazz, fieldData->name, fieldJniSig);
218+
fieldData->fid = env.GetStaticFieldID(fieldData->clazz, fieldMetadata.name, fieldJniSig);
214219
assert(fieldData->fid != nullptr);
215220
} else {
216-
fieldData->clazz = env.FindClass(fieldData->declaringType);
221+
fieldData->clazz = env.FindClass(fieldMetadata.getDeclaringType());
217222
assert(fieldData->clazz != nullptr);
218-
fieldData->fid = env.GetFieldID(fieldData->clazz, fieldData->name, fieldJniSig);
223+
fieldData->fid = env.GetFieldID(fieldData->clazz, fieldMetadata.name, fieldJniSig);
219224
assert(fieldData->fid != nullptr);
220225
}
221226
}
@@ -225,7 +230,7 @@ void FieldAccessor::SetJavaField(Isolate* isolate, const Local<Object>& target,
225230

226231
if (targetJavaObject.IsNull()) {
227232
stringstream ss;
228-
ss << "Cannot access property '" << fieldData->name.c_str() << "' because there is no corresponding Java object";
233+
ss << "Cannot access property '" << fieldMetadata.name.c_str() << "' because there is no corresponding Java object";
229234
throw NativeScriptException(ss.str());
230235
}
231236
}

0 commit comments

Comments
 (0)