diff --git a/NativeScript/CMakeLists.txt b/NativeScript/CMakeLists.txt index 9bcd878fb..cbf01989e 100644 --- a/NativeScript/CMakeLists.txt +++ b/NativeScript/CMakeLists.txt @@ -37,10 +37,10 @@ if (BUILD_MACOS_NODE_API) endif() if(TARGET_PLATFORM STREQUAL "ios") - set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "13.0") + set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "15.0") set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") - set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0") + set(CMAKE_OSX_DEPLOYMENT_TARGET "15.0") set(LIBFFI_BUILD "iphoneos-arm64") set(TARGET_PLATFORM_IOS TRUE) set(SDK_NAME "iphoneos") @@ -48,10 +48,10 @@ if(TARGET_PLATFORM STREQUAL "ios") set(TARGET_PLATFORM_SPEC "ios-arm64") elseif(TARGET_PLATFORM STREQUAL "ios-sim") - set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "13.0") + set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "15.0") set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") set(CMAKE_XCODE_ATTRIBUTE_ENABLE_BITCODE "NO") - set(CMAKE_OSX_DEPLOYMENT_TARGET "13.0") + set(CMAKE_OSX_DEPLOYMENT_TARGET "15.0") set(LIBFFI_BUILD "iphonesimulator-universal") set(TARGET_PLATFORM_IOS TRUE) set(TARGET_PLATFORM_SIM TRUE) diff --git a/metadata-generator/src/IR/TypeSpec.cpp b/metadata-generator/src/IR/TypeSpec.cpp index 33b7fe1e5..2132f1048 100644 --- a/metadata-generator/src/IR/TypeSpec.cpp +++ b/metadata-generator/src/IR/TypeSpec.cpp @@ -15,6 +15,29 @@ static const std::unordered_set KNOWN_BRIDGED_TYPES = { namespace metagen { +// The canonical function type of a block has lost its parameters' typedef +// names (CMSampleBufferRef becomes struct opaqueCMSampleBuffer *), and with +// them the CF bridging, so parameters are read from the sugared type. +static CXType sugaredBlockFunctionType(CXType type, CXType canonicalPointee) { + while (type.kind != CXType_BlockPointer) { + if (type.kind == CXType_Typedef) { + type = clang_getTypedefDeclUnderlyingType(clang_getTypeDeclaration(type)); + } else if (type.kind == CXType_Attributed) { + type = clang_Type_getModifiedType(type); + } else if (type.kind == CXType_Elaborated) { + type = clang_Type_getNamedType(type); + } else { + return canonicalPointee; + } + } + + CXType pointee = clang_getPointeeType(type); + if (clang_getNumArgTypes(pointee) != clang_getNumArgTypes(canonicalPointee)) { + return canonicalPointee; + } + return pointee; +} + TypeSpec::TypeSpec(CXType type, std::vector* classTypeParameters) { auto canonicalType = clang_getCanonicalType(type); @@ -176,7 +199,8 @@ TypeSpec::TypeSpec(CXType type, std::vector* classTypeParameters) { break; case CXType_BlockPointer: { - auto pointeeType = clang_getPointeeType(canonicalType); + auto pointeeType = + sugaredBlockFunctionType(type, clang_getPointeeType(canonicalType)); auto resultType = clang_getResultType(pointeeType); callbackReturn = std::make_shared(resultType, classTypeParameters); diff --git a/platforms/apple/templates/ios/__PROJECT_NAME__.xcodeproj/project.pbxproj b/platforms/apple/templates/ios/__PROJECT_NAME__.xcodeproj/project.pbxproj index 142e4274c..19e28656f 100644 --- a/platforms/apple/templates/ios/__PROJECT_NAME__.xcodeproj/project.pbxproj +++ b/platforms/apple/templates/ios/__PROJECT_NAME__.xcodeproj/project.pbxproj @@ -353,7 +353,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; STRIP_SWIFT_SYMBOLS = NO; @@ -407,7 +407,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 15.0; SDKROOT = iphoneos; STRIP_SWIFT_SYMBOLS = NO; SUPPORTS_UIKITFORMAC = YES; diff --git a/platforms/apple/test/runtime/runner/app/tests/Marshalling/ObjCTypesTests.js b/platforms/apple/test/runtime/runner/app/tests/Marshalling/ObjCTypesTests.js index eafc0bc49..feecf28a4 100644 --- a/platforms/apple/test/runtime/runner/app/tests/Marshalling/ObjCTypesTests.js +++ b/platforms/apple/test/runtime/runner/app/tests/Marshalling/ObjCTypesTests.js @@ -201,6 +201,23 @@ describe(module.id, function () { expect(actual).toBe("complex block called\nTNSObjCTypes"); }); + it("Block parameters with CF typedefs are marshalled as objects", function () { + var metadata = CGImageMetadataCreateMutable(); + expect(CGImageMetadataSetValueWithPath(metadata, null, "xmp:CreatorTool", "NativeScript")).toBe(true); + + var calls = []; + CGImageMetadataEnumerateTagsUsingBlock(metadata, null, null, function (path, tag) { + calls.push({ path: path, tag: tag }); + return true; + }); + + expect(calls.length).toBe(1); + expect(calls[0].path instanceof interop.Pointer).toBe(false); + expect(calls[0].path instanceof interop.Reference).toBe(false); + expect(calls[0].path).toBe("xmp:CreatorTool"); + expect(String(CGImageMetadataTagCopyName(calls[0].tag))).toBe("CreatorTool"); + }); + it("MethodWithBlockReturn", function () { var block = TNSObjCTypes.alloc().init().methodWithBlockScope(4); //expect(block.length).toBe(3); diff --git a/scripts/build_libffi.js b/scripts/build_libffi.js index 8958424d8..a0993b17b 100755 --- a/scripts/build_libffi.js +++ b/scripts/build_libffi.js @@ -11,21 +11,21 @@ const buildTargets = [ sdk: "iphoneos", arch: "arm64", host: "aarch64-apple-darwin13", - minVersionFlag: "-miphoneos-version-min=13.0", + minVersionFlag: "-miphoneos-version-min=15.0", }, { dir: "build_iphonesimulator-x86_64", sdk: "iphonesimulator", arch: "x86_64", host: "x86_64-apple-darwin13", - minVersionFlag: "-mios-simulator-version-min=13.0", + minVersionFlag: "-mios-simulator-version-min=15.0", }, { dir: "build_iphonesimulator-arm64", sdk: "iphonesimulator", arch: "arm64", host: "aarch64-apple-darwin13", - minVersionFlag: "-mios-simulator-version-min=13.0", + minVersionFlag: "-mios-simulator-version-min=15.0", }, { dir: "build_macosx-x86_64", diff --git a/scripts/run-tests-ios.js b/scripts/run-tests-ios.js index 2a66e5ca8..a889f10d4 100644 --- a/scripts/run-tests-ios.js +++ b/scripts/run-tests-ios.js @@ -485,7 +485,7 @@ function buildTKLiveSyncSimulatorXCFramework() { runAndRequireSuccess("xcrun", [ "--sdk", "iphonesimulator", "clang", - "-target", "arm64-apple-ios13.0-simulator", + "-target", "arm64-apple-ios15.0-simulator", "-dynamiclib", sourcePath, "-install_name", "@rpath/TKLiveSync.framework/TKLiveSync", @@ -495,7 +495,7 @@ function buildTKLiveSyncSimulatorXCFramework() { runAndRequireSuccess("xcrun", [ "--sdk", "iphonesimulator", "clang", - "-target", "x86_64-apple-ios13.0-simulator", + "-target", "x86_64-apple-ios15.0-simulator", "-dynamiclib", sourcePath, "-install_name", "@rpath/TKLiveSync.framework/TKLiveSync", diff --git a/scripts/test_react_native_ffi_compat.sh b/scripts/test_react_native_ffi_compat.sh index 9182a4525..5f11c79a3 100755 --- a/scripts/test_react_native_ffi_compat.sh +++ b/scripts/test_react_native_ffi_compat.sh @@ -118,7 +118,7 @@ Pod::Spec.new do |s| s.homepage = "https://github.com/NativeScript/napi-ios" s.license = "Apache-2.0" s.author = "NativeScript Team" - s.platforms = { :ios => "13.0" } + s.platforms = { :ios => "15.0" } s.source = { :path => "." } s.requires_arc = true s.prefix_header_file = "fixtures/TestFixtures-Prefix.h"