Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions NativeScript/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ 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")
set(CMAKE_OSX_ARCHITECTURES "arm64")
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)
Expand Down
26 changes: 25 additions & 1 deletion metadata-generator/src/IR/TypeSpec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,29 @@ static const std::unordered_set<std::string> 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<std::string>* classTypeParameters) {
auto canonicalType = clang_getCanonicalType(type);

Expand Down Expand Up @@ -176,7 +199,8 @@ TypeSpec::TypeSpec(CXType type, std::vector<std::string>* 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<TypeSpec>(resultType, classTypeParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions scripts/build_libffi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-tests-ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion scripts/test_react_native_ffi_compat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading