Skip to content

Commit

Permalink
Updates Xcode examples to support Mac Catalyst.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 307654773
  • Loading branch information
tomball authored and copybara-github committed Apr 21, 2020
1 parent d468003 commit 2f1fb6a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 6 deletions.
22 changes: 21 additions & 1 deletion examples/Hello/Hello.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"${DERIVED_FILES_DIR}/org/j2objc/${INPUT_FILE_BASE}.m",
"${DERIVED_FILES_DIR}/org/j2objc/${INPUT_FILE_BASE}.h",
);
script = "if [ ! -f \"${J2OBJC_DIST}/j2objc\" ]; then echo \"J2OBJC_DIST not correctly defined in Hello.xcconfig, currently set to '${J2OBJC_DIST}'\"; exit 1; fi;\n\"${J2OBJC_DIST}/j2objc\" --quiet -g -d ${DERIVED_FILES_DIR} -use-arc ${INPUT_FILE_PATH};\n";
script = "if [ ! -f \"${J2OBJC_DIST}/j2objc\" ]; then echo \"J2OBJC_DIST not correctly defined in config.xcconfig, currently set to '${J2OBJC_DIST}'\"; exit 1; fi;\n\"${J2OBJC_DIST}/j2objc\" --quiet -g -d ${DERIVED_FILES_DIR} -use-arc ${INPUT_FILE_PATH};\n";
};
06CCF1401C77E42800CDF952 /* PBXBuildRule */ = {
isa = PBXBuildRule;
Expand Down Expand Up @@ -69,6 +69,8 @@
06B9901D1EA6BDF000581403 /* HelloJ2ObjC.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = HelloJ2ObjC.entitlements; sourceTree = "<group>"; };
06CCF1441C77E42800CDF952 /* Hello.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Hello.app; sourceTree = BUILT_PRODUCTS_DIR; };
06CCF1461C77E5EB00CDF952 /* ViewControllerNoJ2ObjC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewControllerNoJ2ObjC.m; sourceTree = "<group>"; };
06FCF74A244F6AC500E81301 /* HelloJ2ObjC.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HelloJ2ObjC.entitlements; sourceTree = "<group>"; };
06FCF74B244F6ACC00E81301 /* Hello.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Hello.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -93,6 +95,7 @@
069A97981C6A86AD00A00560 = {
isa = PBXGroup;
children = (
06FCF74A244F6AC500E81301 /* HelloJ2ObjC.entitlements */,
069A97D41C6A897900A00560 /* config.xcconfig */,
069A97A31C6A86AD00A00560 /* Hello */,
069A97A21C6A86AD00A00560 /* Products */,
Expand All @@ -112,6 +115,7 @@
069A97A31C6A86AD00A00560 /* Hello */ = {
isa = PBXGroup;
children = (
06FCF74B244F6ACC00E81301 /* Hello.entitlements */,
069A97A71C6A86AD00A00560 /* AppDelegate.h */,
069A97A81C6A86AD00A00560 /* AppDelegate.m */,
069A97AA1C6A86AD00A00560 /* ViewController.h */,
Expand Down Expand Up @@ -377,13 +381,17 @@
baseConfigurationReference = 069A97D41C6A897900A00560 /* config.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = HelloJ2ObjC.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
INFOPLIST_FILE = Hello/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.j2objc.Hello;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
};
name = Debug;
};
Expand All @@ -392,13 +400,17 @@
baseConfigurationReference = 069A97D41C6A897900A00560 /* config.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = HelloJ2ObjC.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
INFOPLIST_FILE = Hello/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.j2objc.Hello;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
};
name = Release;
};
Expand All @@ -407,13 +419,17 @@
baseConfigurationReference = 069A97D41C6A897900A00560 /* config.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Hello/Hello.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
INFOPLIST_FILE = Hello/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.j2objc.Hello;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
};
name = Debug;
};
Expand All @@ -422,13 +438,17 @@
baseConfigurationReference = 069A97D41C6A897900A00560 /* config.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = Hello/Hello.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
INFOPLIST_FILE = Hello/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.j2objc.Hello;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
};
name = Release;
};
Expand Down
10 changes: 10 additions & 0 deletions examples/Hello/Hello/Hello.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
10 changes: 10 additions & 0 deletions examples/Hello/HelloJ2ObjC.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
22 changes: 17 additions & 5 deletions examples/HelloSwift/HelloSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"$(DERIVED_FILE_DIR)/${INPUT_FILE_BASE}.h",
"$(DERIVED_FILE_DIR)/${INPUT_FILE_BASE}.m",
);
script = "if [ ! -f \"${J2OBJC_HOME}/j2objc\" ]; then echo \"J2OBJC_HOME is not correctly defined, currently set to '${J2OBJC_HOME}'\"; exit 1; fi;\n\"${J2OBJC_HOME}/j2objc\" -d ${DERIVED_FILE_DIR} --no-package-directories -g --swift-friendly --class-properties ${INPUT_FILE_PATH};";
script = "if [ ! -f \"${J2OBJC_DIST}/j2objc\" ]; then echo \"J2OBJC_DIST is not correctly defined in config.xcconfig, currently set to '${J2OBJC_DIST}'\"; exit 1; fi;\n\"${J2OBJC_DIST}/j2objc\" -d ${DERIVED_FILE_DIR} --no-package-directories -g --swift-friendly --class-properties ${INPUT_FILE_PATH};\n";
};
/* End PBXBuildRule section */

Expand All @@ -46,6 +46,7 @@
/* Begin PBXFileReference section */
061162DF244E29C6002D5893 /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = config.xcconfig; sourceTree = "<group>"; };
061162E0244E31CD002D5893 /* JRE.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = JRE.xcframework; path = ../../dist/frameworks/JRE.xcframework; sourceTree = "<group>"; };
06FCF749244F63DF00E81301 /* HelloSwift.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = HelloSwift.entitlements; sourceTree = "<group>"; };
FA8AEA89210F718A00FDC9ED /* HelloSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloSwift.app; sourceTree = BUILT_PRODUCTS_DIR; };
FA8AEA8C210F718A00FDC9ED /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
FA8AEA8E210F718A00FDC9ED /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -101,6 +102,7 @@
FA8AEA8B210F718A00FDC9ED /* HelloSwift */ = {
isa = PBXGroup;
children = (
06FCF749244F63DF00E81301 /* HelloSwift.entitlements */,
FA8AEA8C210F718A00FDC9ED /* AppDelegate.swift */,
FA8AEA8E210F718A00FDC9ED /* ViewController.swift */,
FA8AEA90210F718A00FDC9ED /* Main.storyboard */,
Expand Down Expand Up @@ -284,6 +286,7 @@
/* Begin XCBuildConfiguration section */
FA8AEA99210F718B00FDC9ED /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 061162DF244E29C6002D5893 /* config.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down Expand Up @@ -344,6 +347,7 @@
};
FA8AEA9A210F718B00FDC9ED /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 061162DF244E29C6002D5893 /* config.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
Expand Down Expand Up @@ -398,13 +402,16 @@
};
FA8AEA9C210F718B00FDC9ED /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 061162DF244E29C6002D5893 /* config.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = HelloSwift/HelloSwift.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
FRAMEWORK_SEARCH_PATHS = "${J2OBJC_HOME}/frameworks";
INFOPLIST_FILE = HelloSwift/Info.plist;
J2OBJC_HOME = ../..;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -416,6 +423,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.j2objc.HelloSwift;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
SWIFT_OBJC_BRIDGING_HEADER = "HelloSwift/HelloSwift-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
Expand All @@ -426,13 +434,16 @@
};
FA8AEA9D210F718B00FDC9ED /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 061162DF244E29C6002D5893 /* config.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = HelloSwift/HelloSwift.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
DERIVE_MACCATALYST_PRODUCT_BUNDLE_IDENTIFIER = YES;
FRAMEWORK_SEARCH_PATHS = "${J2OBJC_HOME}/frameworks";
INFOPLIST_FILE = HelloSwift/Info.plist;
J2OBJC_HOME = ../..;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -444,6 +455,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.google.j2objc.HelloSwift;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTS_MACCATALYST = YES;
SWIFT_OBJC_BRIDGING_HEADER = "HelloSwift/HelloSwift-Bridging-Header.h";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -453,11 +465,11 @@
};
FA8AEB05210FB05000FDC9ED /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 061162DF244E29C6002D5893 /* config.xcconfig */;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_STYLE = Automatic;
FRAMEWORK_SEARCH_PATHS = "${J2OBJC_HOME}/frameworks";
J2OBJC_HOME = ../..;
LIBRARY_SEARCH_PATHS = "${J2OBJC_HOME}/lib";
OTHER_LDFLAGS = (
"-ObjC",
Expand All @@ -473,11 +485,11 @@
};
FA8AEB06210FB05000FDC9ED /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 061162DF244E29C6002D5893 /* config.xcconfig */;
buildSettings = {
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_STYLE = Automatic;
FRAMEWORK_SEARCH_PATHS = "${J2OBJC_HOME}/frameworks";
J2OBJC_HOME = ../..;
LIBRARY_SEARCH_PATHS = "${J2OBJC_HOME}/lib";
OTHER_LDFLAGS = (
"-ObjC",
Expand Down
10 changes: 10 additions & 0 deletions examples/HelloSwift/HelloSwift/HelloSwift.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>

0 comments on commit 2f1fb6a

Please sign in to comment.