Skip to content

Commit b8e53c6

Browse files
authored
Add support for extension_safe attr (#876)
Similar to how rules_apple supports this, add an `extension_safe` attr handling which automatically sets `-fapplication-extension`.
1 parent 839cf60 commit b8e53c6

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

rules/library.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,11 @@ def apple_library(
585585
defines = kwargs.pop("defines", [])
586586
testonly = kwargs.pop("testonly", False)
587587
features = kwargs.pop("features", [])
588+
extension_safe = kwargs.pop("extension_safe", None)
589+
590+
# Set extra linkopt for application extension safety
591+
if extension_safe:
592+
linkopts.append("-fapplication-extension")
588593

589594
# Collect the swift_library related kwargs, these are typically only set when provided to allow
590595
# for wider compatibility with rule_swift versions.

tests/ios/frameworks/dynamic/b/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ apple_framework(
55
srcs = glob(["*.swift"]),
66
bundle_id = "com.example.b",
77
data = ["b_data.txt"],
8+
extension_safe = True,
89
infoplists = ["Info.plist"],
910
link_dynamic = True,
1011
platforms = {"ios": "12.0"},
1112
visibility = ["//visibility:public"],
12-
xcconfig = {"APPLICATION_EXTENSION_API_ONLY": "YES"},
1313
deps = ["//tests/ios/frameworks/dynamic/c"],
1414
)

tests/ios/xcodeproj/Test-Mixed-Dynamic-App-Project.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
/* Begin PBXFileReference section */
1818
02153936701CAAE5E5530BE4 /* BUILD.bazel */ = {isa = PBXFileReference; path = BUILD.bazel; sourceTree = "<group>"; };
19-
49A50B056BD5E4179AC67F43 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
2019
4B591E98E01C3FB1BE1C7410 /* BUILD.bazel */ = {isa = PBXFileReference; path = BUILD.bazel; sourceTree = "<group>"; };
2120
4E0674CDE1D42113DF39B8D1 /* aWithResourceBundles.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = aWithResourceBundles.framework; sourceTree = BUILT_PRODUCTS_DIR; };
2221
6CD05C1A97322FF05C07A575 /* lib.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = lib.swift; sourceTree = "<group>"; };
@@ -127,7 +126,6 @@
127126
children = (
128127
8BD8BAFA513836E6FFFA7A8C /* b_data.txt */,
129128
4B591E98E01C3FB1BE1C7410 /* BUILD.bazel */,
130-
49A50B056BD5E4179AC67F43 /* Info.plist */,
131129
6CD05C1A97322FF05C07A575 /* lib.swift */,
132130
);
133131
path = b;
@@ -407,7 +405,6 @@
407405
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks \"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-sim_arm64-min12.0-applebin_ios-ios_sim_arm64-dbg-ST-008b8551197e/bin/tests/ios/frameworks/dynamic/c/c\"";
408406
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
409407
HEADER_SEARCH_PATHS = "\"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-sim_arm64-min12.0-applebin_ios-ios_sim_arm64-dbg-ST-008b8551197e/bin/tests/ios/frameworks/dynamic/b/b_public_hmap.hmap\" \"$BAZEL_WORKSPACE_ROOT\"";
410-
INFOPLIST_FILE = ../../../tests/ios/frameworks/dynamic/b/Info.plist;
411408
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
412409
MACH_O_TYPE = "$(inherited)";
413410
ONLY_ACTIVE_ARCH = YES;
@@ -627,7 +624,6 @@
627624
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks \"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-sim_arm64-min12.0-applebin_ios-ios_sim_arm64-dbg-ST-008b8551197e/bin/tests/ios/frameworks/dynamic/c/c\"";
628625
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
629626
HEADER_SEARCH_PATHS = "\"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-sim_arm64-min12.0-applebin_ios-ios_sim_arm64-dbg-ST-008b8551197e/bin/tests/ios/frameworks/dynamic/b/b_public_hmap.hmap\" \"$BAZEL_WORKSPACE_ROOT\"";
630-
INFOPLIST_FILE = ../../../tests/ios/frameworks/dynamic/b/Info.plist;
631627
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
632628
MACH_O_TYPE = "$(inherited)";
633629
ONLY_ACTIVE_ARCH = YES;

0 commit comments

Comments
 (0)