Skip to content

Comments

feat: full test coverage on macos & ios, v8 14#28

Draft
DjDeveloperr wants to merge 31 commits intomainfrom
macos-tests
Draft

feat: full test coverage on macos & ios, v8 14#28
DjDeveloperr wants to merge 31 commits intomainfrom
macos-tests

Conversation

@DjDeveloperr
Copy link
Collaborator

No description provided.

- Removed duplicate inclusion of <TargetConditionals.h> in TNSTestNativeCallbacks.h.
- Reformatted method calls and assertions in TNSTestNativeCallbacks.m for improved readability.
- Updated imports in TestFixtures.h to maintain consistent ordering.
- Enhanced RecordTests.js to support both CGRect and NSRect constructors, ensuring compatibility across platforms.
- Modified VersionDiffTests.js to handle macOS and iOS version checks more gracefully.
- Introduced ObjCClassMemberOverload structure to manage method overloads.
- Updated ObjCClassMember to support multiple overloads and refined member definition logic.
- Added jsReadOnlySetter to handle readonly property assignments gracefully.
- Enhanced jsCall to resolve method overloads based on argument types.
- Implemented URLPattern class in the runtime for URL pattern matching.
- Updated metadata generation to include protocol names in category declarations.
- Improved duplicate method handling in class member processing.
…lity features

- Added support for handling C strings as references in TypeConv.
- Improved SInt64 and UInt64 type conversions to handle large integers using BigInt.
- Enhanced PointerTypeConv to allow for void pointers and improved handling of struct types.
- Introduced new utility functions for managing struct encodings and type definitions.
- Implemented compatibility shims for UIColor on macOS to ensure consistent behavior.
- Updated timer management in Timers.mm to use mutexes for thread safety and prevent memory leaks.
- Enabled reference tests in the TestRunner to ensure proper functionality of reference types.
… and type handling

- Enhanced memory management in Timers.mm by simplifying deallocation logic.
- Improved CFTypeRef handling in TNSReturnsRetained.m to ensure proper memory ownership semantics.
- Added metadata generator support for function return ownership tracking with new flags and attributes.
- Implemented vector and complex type handling in TypeSpec and MetadataWriter for better type serialization.
- Updated test scripts to ensure metadata generator is built before running tests, enhancing build reliability.
- Added utility functions for cursor attribute checks in metadata generation.
@DjDeveloperr DjDeveloperr requested a review from Copilot February 24, 2026 21:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates NativeScript’s Apple builds for V8 14 and improved macOS/iOS testing, while cleaning up legacy V8 headers and hardening parts of the ObjC/FFI bridge.

Changes:

  • Removed legacy v8/include_old inspector + cppgc public headers and metadata files.
  • Updated ObjC bridge/FFI codepaths (struct/enum handling, function/block wrapping, lifecycle + caching).
  • Reworked Apple V8 linking to consume libv8_monolith.xcframework and added iOS pointer-compression compile defs.

Reviewed changes

Copilot reviewed 89 out of 1316 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
NativeScript/napi/v8/include_old/inspector/Schema.h Removed legacy generated inspector protocol header.
NativeScript/napi/v8/include_old/inspector/Runtime.h Removed legacy generated inspector protocol header.
NativeScript/napi/v8/include_old/inspector/Debugger.h Removed legacy generated inspector protocol header.
NativeScript/napi/v8/include_old/cppgc/type-traits.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/trace-trait.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/testing.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/source-location.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/sentinel-pointer.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/process-heap-statistics.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/prefinalizer.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/platform.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/persistent.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/object-size-trait.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/name-provider.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/macros.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/liveness-broker.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/internal/pointer-policies.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/persistent-node.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/name-trait.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/member-storage.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/logging.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/gc-info.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/finalizer-trait.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/compiler-specific.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/caged-heap.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/caged-heap-local-data.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/base-page-handle.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/atomic-entry-flag.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/internal/api-constants.h Removed legacy cppgc internal header.
NativeScript/napi/v8/include_old/cppgc/heap.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/heap-statistics.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/heap-state.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/heap-handle.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/heap-consistency.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/garbage-collected.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/explicit-management.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/ephemeron-pair.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/default-platform.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/custom-space.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/common.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/allocation.h Removed legacy cppgc public header.
NativeScript/napi/v8/include_old/cppgc/README.md Removed legacy cppgc documentation.
NativeScript/napi/v8/include_old/cppgc/OWNERS Removed legacy ownership metadata.
NativeScript/napi/v8/include_old/cppgc/DEPS Removed legacy include rules metadata.
NativeScript/napi/v8/include_old/OWNERS Removed legacy ownership metadata.
NativeScript/napi/v8/include_old/DIR_METADATA Removed legacy directory metadata.
NativeScript/napi/v8/include_old/DEPS Removed legacy include rules metadata.
NativeScript/napi/v8/include_old/APIDesign.md Removed legacy V8 API design doc copy.
NativeScript/napi/common/native_api_util.h Fixed argc initialization in callback macro.
NativeScript/libffi/macosx-universal/include/ffitarget.h Adjusted libffi target config and trampoline sizing logic.
NativeScript/libffi/macosx-universal/include/ffi.h Modified vendored libffi public header (types/status/layout).
NativeScript/libffi/iphonesimulator-universal/include/ffitarget.h Adjusted libffi target config and trampoline sizing logic.
NativeScript/libffi/iphonesimulator-universal/include/ffi.h Modified vendored libffi public header (types/status/layout).
NativeScript/libffi/iphoneos-arm64/include/ffitarget.h Adjusted libffi target config macros for ARM64.
NativeScript/libffi/iphoneos-arm64/include/ffi.h Modified vendored libffi public header (types/status/layout).
NativeScript/ffi/node_api_util.h Removed heap allocation from N-API error-info macro.
NativeScript/ffi/Variable.mm Added safer metadata string validation and wider symbol lookup.
NativeScript/ffi/Util.mm Added struct type-encoding discovery and stricter type handling.
NativeScript/ffi/TypeConv.h Added new conversion flags + ffiTypeForArgument() hook.
NativeScript/ffi/Struct.mm Added struct global aliases, equality helper, and safer instance checks.
NativeScript/ffi/Protocol.mm Added protocol name fallback resolution logic.
NativeScript/ffi/Object.mm Added lifecycle association + round-trip reuse improvements.
NativeScript/ffi/Object.h Exposed lifecycle association helper.
NativeScript/ffi/ObjCBridge.h Added round-trip cache frames and initialized refs to null.
NativeScript/ffi/JSObject.mm Fixed bridge-state cleanup ordering on finalize/dealloc.
NativeScript/ffi/Interop.h Extended Pointer/Reference APIs + FunctionReference signature changes.
NativeScript/ffi/Enum.mm Added enum global constants, aliasing, and reverse mapping.
NativeScript/ffi/Closure.mm Added function callback path + NSError out-parameter error mapping.
NativeScript/ffi/Closure.h Extended Closure ctor and added selector field.
NativeScript/ffi/ClassMember.h Added overload representation and readonly setter hook.
NativeScript/ffi/ClassBuilder.h Added multi-descriptor lookup for overload/setter resolution.
NativeScript/ffi/Class.mm Added pointer-arg interop parsing and “alloc then init(...)” flow.
NativeScript/ffi/Cif.mm Added CIF construction from runtime Method and arg-skipping support.
NativeScript/ffi/Cif.h Added new CIF constructors (implicit argc + runtime Method).
NativeScript/ffi/CFunction.mm Adjusted function parsing and return/arg memory ownership flags.
NativeScript/ffi/Block.mm Added block<->JS callback identity cache and signature helpers.
NativeScript/ffi/Block.h Exposed block cache/signature helpers + encoding-based wrapper.
NativeScript/CMakeLists.txt Switched V8 linking to imported xcframework slice + iOS pointer-compression defs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +38 to +39
constexpr int kBlockHasSignature = (1 << 30);
std::unordered_map<void*, napi_ref> g_blockToJsFunction;
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

g_blockToJsFunction is a global std::unordered_map accessed from multiple codepaths (block_release, block_finalize, wrapper creation) and can be hit from different threads (blocks can be copied/released off the JS thread). This is a data race and can corrupt the map. Protect all accesses with a mutex (or move the cache behind a single-threaded dispatch queue) and ensure reference deletion happens on the same thread/loop as N-API expects.

Copilot uses AI. Check for mistakes.
Comment on lines +410 to +412
if(TARGET_PLATFORM STREQUAL "ios-sim")
# Prefer universal sim slice if present
set(V8_SLICE_DIR "${V8_XCFRAMEWORK}/ios-arm64-simulator/libv8_monolith.framework")
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The xcframework slice selection is hard-coded to *-arm64* paths, which will fail on Intel macOS (macos-x86_64) and Intel iOS Simulator (ios-x86_64-simulator) environments. Select the slice based on CMAKE_OSX_ARCHITECTURES (or CMAKE_SYSTEM_PROCESSOR) and choose the correct xcframework folder (including universal simulator slices if present), otherwise builds will be host-arch dependent.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant