Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rules_apple to 2.0.0 #633

Merged
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 1 addition & 2 deletions rules/framework.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,6 @@ def _bundle_dynamic_framework(ctx, is_extension_safe, avoid_deps):
),
partials.debug_symbols_partial(
actions = actions,
bin_root_path = bin_root_path,
bundle_extension = bundle_extension,
bundle_name = bundle_name,
debug_dependencies = dep_frameworks,
Expand All @@ -700,7 +699,6 @@ def _bundle_dynamic_framework(ctx, is_extension_safe, avoid_deps):
dsym_info_plist_template = apple_mac_toolchain_info.dsym_info_plist_template,
executable_name = executable_name,
platform_prerequisites = platform_prerequisites,
rule_label = label,
),
partials.embedded_bundles_partial(
frameworks = [archive_for_embedding],
Expand All @@ -722,6 +720,7 @@ def _bundle_dynamic_framework(ctx, is_extension_safe, avoid_deps):
binary_artifact = binary_artifact,
bundle_name = bundle_name,
bundle_only = False,
cc_info = link_result.cc_info,
objc_provider = link_result.objc,
rule_label = label,
),
Expand Down
12 changes: 6 additions & 6 deletions rules/internal/framework_middleman.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ load(
def _framework_middleman(ctx):
resource_providers = []
objc_providers = []
dynamic_frameworks = []
dynamic_framework_providers = []
apple_embeddable_infos = []
cc_providers = []

def _collect_providers(lib_dep):
def _process_dep(lib_dep):
if AppleEmbeddableInfo in lib_dep:
apple_embeddable_infos.append(lib_dep[AppleEmbeddableInfo])

Expand All @@ -53,15 +54,16 @@ def _framework_middleman(ctx):
if apple_common.Objc in lib_dep:
objc_providers.append(lib_dep[apple_common.Objc])
if apple_common.AppleDynamicFramework in lib_dep:
dynamic_frameworks.append(lib_dep)
dynamic_framework_providers.append(lib_dep[apple_common.AppleDynamicFramework])

for dep in ctx.attr.framework_deps:
_collect_providers(dep)
_process_dep(dep)

# Loop AvoidDepsInfo here as well
if AvoidDepsInfo in dep:
for lib_dep in dep[AvoidDepsInfo].libraries:
_collect_providers(lib_dep)
_process_dep(lib_dep)

# Here we only need to loop a subset of the keys
objc_provider_fields = objc_provider_utils.merge_objc_providers_dict(providers = objc_providers, merge_keys = [
Expand Down Expand Up @@ -108,9 +110,7 @@ def _framework_middleman(ctx):
partials.extension_safe_validation_partial(
is_extension_safe = ctx.attr.extension_safe,
rule_label = ctx.label,
# Pass 'ctx.attr.framework_deps' once 'partials.extension_safe_validation_partial'
# is populated on from 'apple_framework_packaging' implementation.
targets_to_validate = ctx.attr.framework_deps,
targets_to_validate = dynamic_frameworks,
),
)

Expand Down
10 changes: 5 additions & 5 deletions rules/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ def rules_ios_dependencies():
_maybe(
github_repo,
name = "build_bazel_rules_swift",
project = "bazel-ios",
ref = "a25aed4e75893a55c1c98524201451c05f66ab89",
project = "bazelbuild",
ref = "cb64a41e3a4c93f67abdfcc0d5f18aa04f02f5b0",
repo = "rules_swift",
sha256 = "9f13f4be00dfd6a37d9338e49ebbc337445361134a4bcc668658b96fdbdeaae4",
sha256 = "200a35c2c84096f155a5c6092bac2abf1b2149fbeb3eb730a2923997db079a83",
)

_maybe(
github_repo,
name = "build_bazel_rules_apple",
ref = "f99c3cb7e472ecd68b81ea8dab97609a4b75db06",
ref = "c628b0e4b3261b4627bcd4e9f91e75b4e5eb0e1a",
project = "bazelbuild",
repo = "rules_apple",
sha256 = "5e82a98a591efda772a5ee96ed17bcad38338aafeba6055daab04a5d6c13ea50",
sha256 = "495ffc13769b81e401d108a47925885c43f9dfccfbb229d4418d509c6cea14be",
)

_maybe(
Expand Down
1 change: 0 additions & 1 deletion tests/ios/frameworks/dynamic/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ apple_xcframework(
name = "iOSSwiftXCFramework",
bundle_id = "com.google.example",
bundle_name = "c",
framework_type = ["dynamic"],
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this now automatically detect this? If so - nice 👍 !

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems like it was only ever supported as a single value and now it's just not an attribute at all: bazelbuild/rules_apple@a4de222

infoplists = [
"Info.plist",
],
Expand Down
2 changes: 1 addition & 1 deletion tests/ios/unit-test/test-imports-app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apple_framework(
visibility = ["//visibility:public"],
deps = [
"//tests/ios/unit-test/test-imports-app/frameworks/Basic",
"//tests/ios/unit-test/test-imports-app/frameworks/NestedHeaders",
"//tests/ios/unit-test/test-imports-app/frameworks/Nested",
],
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("//rules:framework.bzl", "apple_framework")

apple_framework(
name = "NestedHeaders",
Copy link
Contributor

Choose a reason for hiding this comment

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

The nice thing here - detecting Headers captures and tests an obscure usage and some of bugs in rules_ios like
https://github.com/bazelbuild/rules_apple/pull/1798/files 🙈

Is there any way we can undo this now that you've got it fixed in rules_apple. Also I wonder why objc_import is even dealing with headers now - I think there was a limitation around it that caused it to only pull linkable files like .a or .so

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, since I've gotten it fixed in rules_apple, I'm happy to revert this change and update to an even newer rules_apple commit.

name = "Nested",
objc_copts = ["-fmodules-disable-diagnostic-validation"],
platforms = {"ios": "12.0"},
vendored_static_frameworks = ["ios/NestedHeaders.framework"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
BAZEL_SWIFTMODULEFILES_TO_COPY = "bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftmodule bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftdoc bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftsourceinfo";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks \"$BAZEL_WORKSPACE_ROOT/external/GoogleMobileAdsSDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_x86_64-simulator\" \"$BAZEL_WORKSPACE_ROOT/external/TensorFlowLiteC/Frameworks\" \"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-11376cdf8928/bin/tests/ios/unit-test/test-imports-app/SomeFramework\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Basic/ios\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/NestedHeaders/ios\"";
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks \"$BAZEL_WORKSPACE_ROOT/external/GoogleMobileAdsSDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_x86_64-simulator\" \"$BAZEL_WORKSPACE_ROOT/external/TensorFlowLiteC/Frameworks\" \"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-11376cdf8928/bin/tests/ios/unit-test/test-imports-app/SomeFramework\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Basic/ios\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Nested/ios\"";
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
HEADER_SEARCH_PATHS = "\"$BAZEL_WORKSPACE_ROOT\"";
INFOPLIST_FILE = "";
Expand All @@ -405,7 +405,7 @@
BAZEL_SWIFTMODULEFILES_TO_COPY = "bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftmodule bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftdoc bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftsourceinfo";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks \"$BAZEL_WORKSPACE_ROOT/external/GoogleMobileAdsSDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_x86_64-simulator\" \"$BAZEL_WORKSPACE_ROOT/external/TensorFlowLiteC/Frameworks\" \"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-11376cdf8928/bin/tests/ios/unit-test/test-imports-app/SomeFramework\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Basic/ios\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/NestedHeaders/ios\"";
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks \"$BAZEL_WORKSPACE_ROOT/external/GoogleMobileAdsSDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_x86_64-simulator\" \"$BAZEL_WORKSPACE_ROOT/external/TensorFlowLiteC/Frameworks\" \"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-11376cdf8928/bin/tests/ios/unit-test/test-imports-app/SomeFramework\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Basic/ios\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Nested/ios\"";
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
HEADER_SEARCH_PATHS = "\"$BAZEL_WORKSPACE_ROOT\"";
INFOPLIST_FILE = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
BAZEL_SWIFTMODULEFILES_TO_COPY = "bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftmodule bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftdoc bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftsourceinfo";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks \"$BAZEL_WORKSPACE_ROOT/external/GoogleMobileAdsSDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_x86_64-simulator\" \"$BAZEL_WORKSPACE_ROOT/external/TensorFlowLiteC/Frameworks\" \"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-11376cdf8928/bin/tests/ios/unit-test/test-imports-app/SomeFramework\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Basic/ios\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/NestedHeaders/ios\"";
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks \"$BAZEL_WORKSPACE_ROOT/external/GoogleMobileAdsSDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_x86_64-simulator\" \"$BAZEL_WORKSPACE_ROOT/external/TensorFlowLiteC/Frameworks\" \"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-11376cdf8928/bin/tests/ios/unit-test/test-imports-app/SomeFramework\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Basic/ios\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Nested/ios\"";
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
HEADER_SEARCH_PATHS = "\"$BAZEL_WORKSPACE_ROOT\"";
INFOPLIST_FILE = "";
Expand Down Expand Up @@ -514,7 +514,7 @@
BAZEL_SWIFTMODULEFILES_TO_COPY = "bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftmodule bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftdoc bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-41567f1bc2e5/bin/tests/ios/unit-test/test-imports-app/TestImports_App.swiftsourceinfo";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks \"$BAZEL_WORKSPACE_ROOT/external/GoogleMobileAdsSDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_x86_64-simulator\" \"$BAZEL_WORKSPACE_ROOT/external/TensorFlowLiteC/Frameworks\" \"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-11376cdf8928/bin/tests/ios/unit-test/test-imports-app/SomeFramework\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Basic/ios\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/NestedHeaders/ios\"";
FRAMEWORK_SEARCH_PATHS = "$(PLATFORM_DIR)/Developer/Library/Frameworks \"$BAZEL_WORKSPACE_ROOT/external/GoogleMobileAdsSDK/Frameworks/GoogleMobileAdsFramework-Current/GoogleMobileAds.xcframework/ios-arm64_x86_64-simulator\" \"$BAZEL_WORKSPACE_ROOT/external/TensorFlowLiteC/Frameworks\" \"$BAZEL_WORKSPACE_ROOT/bazel-out/ios-x86_64-min12.0-applebin_ios-ios_x86_64-dbg-ST-11376cdf8928/bin/tests/ios/unit-test/test-imports-app/SomeFramework\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Basic/ios\" \"$BAZEL_WORKSPACE_ROOT/tests/ios/unit-test/test-imports-app/frameworks/Nested/ios\"";
GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)";
HEADER_SEARCH_PATHS = "\"$BAZEL_WORKSPACE_ROOT\"";
INFOPLIST_FILE = "";
Expand Down