Skip to content
Merged
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
14 changes: 8 additions & 6 deletions apple/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ bzl_library(
":apple_product_type",
":apple_toolchains",
":bundling_support",
":cc_info_support",
":entitlements_support",
":features_support",
":linking_support",
Expand All @@ -225,10 +226,12 @@ bzl_library(
":rule_support",
":run_support",
":stub_support",
":swift_support",
":transition_support",
"//apple:providers",
"//apple/internal/aspects:swift_static_framework_aspect",
"//apple/internal/utils:clang_rt_dylibs",
"@bazel_skylib//lib:collections",
"@build_bazel_rules_swift//swift",
],
)

Expand Down Expand Up @@ -335,7 +338,6 @@ bzl_library(
"//apple/internal/partials:settings_bundle",
"//apple/internal/partials:swift_dylibs",
"//apple/internal/partials:swift_framework",
"//apple/internal/partials:swift_static_framework",
"//apple/internal/partials:watchos_stub",
],
)
Expand Down Expand Up @@ -415,12 +417,10 @@ bzl_library(
":apple_product_type",
":apple_toolchains",
":rule_support",
":transition_support",
"//apple:common",
"//apple:providers",
"//apple/internal/aspects:framework_provider_aspect",
"//apple/internal/aspects:resource_aspect",
"//apple/internal/aspects:swift_static_framework_aspect",
"//apple/internal/aspects:swift_usage_aspect",
"//apple/internal/testing:apple_test_bundle_support",
"//apple/internal/testing:apple_test_rule_support",
Expand All @@ -438,7 +438,6 @@ bzl_library(
deps = [
":apple_product_type",
":bundle_package_type",
":transition_support",
],
)

Expand Down Expand Up @@ -510,6 +509,7 @@ bzl_library(
":apple_product_type",
":apple_toolchains",
":bundling_support",
":cc_info_support",
":entitlements_support",
":features_support",
":linking_support",
Expand All @@ -521,9 +521,11 @@ bzl_library(
":rule_factory",
":rule_support",
":run_support",
":swift_support",
":transition_support",
"//apple:providers",
"//apple/internal/aspects:swift_static_framework_aspect",
"//apple/internal/utils:clang_rt_dylibs",
"@build_bazel_rules_swift//swift",
],
)

Expand Down
12 changes: 0 additions & 12 deletions apple/internal/aspects/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ bzl_library(
],
)

bzl_library(
name = "swift_static_framework_aspect",
srcs = ["swift_static_framework_aspect.bzl"],
visibility = [
"//apple/internal:__pkg__",
],
deps = [
"//apple/internal:swift_info_support",
"@build_bazel_rules_swift//swift",
],
)

bzl_library(
name = "swift_usage_aspect",
srcs = ["swift_usage_aspect.bzl"],
Expand Down
134 changes: 0 additions & 134 deletions apple/internal/aspects/swift_static_framework_aspect.bzl

This file was deleted.

57 changes: 41 additions & 16 deletions apple/internal/ios_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ load(
"@build_bazel_rules_apple//apple/internal:codesigning_support.bzl",
"codesigning_support",
)
load(
"@build_bazel_rules_apple//apple/internal:cc_info_support.bzl",
"cc_info_support",
)
load(
"@build_bazel_rules_apple//apple/internal:entitlements_support.bzl",
"entitlements_support",
Expand Down Expand Up @@ -80,8 +84,16 @@ load(
"stub_support",
)
load(
"@build_bazel_rules_apple//apple/internal/aspects:swift_static_framework_aspect.bzl",
"SwiftStaticFrameworkInfo",
"@build_bazel_rules_apple//apple/internal:swift_support.bzl",
"swift_support",
)
load(
"@build_bazel_rules_swift//swift:swift.bzl",
"SwiftInfo",
)
load(
"@build_bazel_rules_apple//apple/internal:transition_support.bzl",
"transition_support",
)
load(
"@build_bazel_rules_apple//apple/internal/aspects:swift_dynamic_framework_aspect.bzl",
Expand All @@ -102,10 +114,6 @@ load(
"IosStaticFrameworkBundleInfo",
"IosStickerPackExtensionBundleInfo",
)
load(
"@build_bazel_rules_swift//swift:swift.bzl",
"SwiftInfo",
)
load("@bazel_skylib//lib:collections.bzl", "collections")

def _ios_application_impl(ctx):
Expand Down Expand Up @@ -1368,25 +1376,29 @@ def _ios_dynamic_framework_impl(ctx):
] + providers

def _ios_static_framework_impl(ctx):
"""Experimental implementation of ios_static_framework."""
binary_target = ctx.attr.deps[0]
binary_artifact = binary_target[apple_common.AppleStaticLibrary].archive
"""Implementation of ios_static_framework."""

actions = ctx.actions
apple_mac_toolchain_info = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo]
apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo]
avoid_deps = ctx.attr.avoid_deps
deps = ctx.attr.deps
label = ctx.label
predeclared_outputs = ctx.outputs
split_deps = ctx.split_attr.deps
bundle_name, bundle_extension = bundling_support.bundle_full_name_from_rule_ctx(ctx)
executable_name = bundling_support.executable_name(ctx)
features = features_support.compute_enabled_features(
requested_features = ctx.features,
unsupported_features = ctx.disabled_features,
)
label = ctx.label
platform_prerequisites = platform_support.platform_prerequisites_from_rule_ctx(ctx)
predeclared_outputs = ctx.outputs
resource_deps = ctx.attr.deps + ctx.attr.resources
Comment on lines +1384 to 1396
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorta annoying that these are moved around, and are no longer alphabetical.

Copy link
Copy Markdown
Member Author

@keith keith Jul 7, 2022

Choose a reason for hiding this comment

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

🙃

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

probably not worth fixing and hitting more conflicts ¯_(ツ)_/¯

rule_descriptor = rule_support.rule_descriptor(ctx)

link_result = linking_support.register_static_library_linking_action(ctx = ctx)
binary_artifact = link_result.library

processor_partials = [
partials.apple_bundle_info_partial(
actions = actions,
Expand All @@ -1407,15 +1419,28 @@ def _ios_static_framework_impl(ctx):
),
]

swift_infos = {}
if swift_support.uses_swift(deps):
for link_output in link_result.outputs:
split_attr_key = transition_support.apple_common_multi_arch_split_key(
cpu = link_output.architecture,
environment = link_output.environment,
platform_type = link_output.platform,
)
for dep in split_deps[split_attr_key]:
if SwiftInfo in dep:
swift_infos[link_output.architecture] = dep[SwiftInfo]

# If there's any Swift dependencies on the static framework rule, treat it as a Swift static
# framework.
if SwiftStaticFrameworkInfo in binary_target:
if swift_infos:
processor_partials.append(
partials.swift_static_framework_partial(
partials.swift_framework_partial(
actions = actions,
avoid_deps = avoid_deps,
bundle_name = bundle_name,
label_name = label.name,
swift_static_framework_info = binary_target[SwiftStaticFrameworkInfo],
swift_infos = swift_infos,
),
)
else:
Expand All @@ -1425,8 +1450,8 @@ def _ios_static_framework_impl(ctx):
bundle_name = bundle_name,
hdrs = ctx.files.hdrs,
label_name = label.name,
sdk_dylibs = getattr(binary_target[apple_common.Objc], "sdk_dylib", []),
sdk_frameworks = getattr(binary_target[apple_common.Objc], "sdk_framework", []),
sdk_dylibs = cc_info_support.get_sdk_dylibs(deps = deps),
sdk_frameworks = cc_info_support.get_sdk_frameworks(deps = deps),
umbrella_header = ctx.file.umbrella_header,
),
)
Expand Down
5 changes: 0 additions & 5 deletions apple/internal/partials.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ load(
"@build_bazel_rules_apple//apple/internal/partials:swift_framework.bzl",
_swift_framework_partial = "swift_framework_partial",
)
load(
"@build_bazel_rules_apple//apple/internal/partials:swift_static_framework.bzl",
_swift_static_framework_partial = "swift_static_framework_partial",
)
load(
"@build_bazel_rules_apple//apple/internal/partials:watchos_stub.bzl",
_watchos_stub_partial = "watchos_stub_partial",
Expand Down Expand Up @@ -133,7 +129,6 @@ partials = struct(
swift_dylibs_partial = _swift_dylibs_partial,
swift_dynamic_framework_partial = _swift_dynamic_framework_partial,
swift_framework_partial = _swift_framework_partial,
swift_static_framework_partial = _swift_static_framework_partial,
apple_symbols_file_partial = _apple_symbols_file_partial,
watchos_stub_partial = _watchos_stub_partial,
)
14 changes: 0 additions & 14 deletions apple/internal/partials/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -304,20 +304,6 @@ bzl_library(
],
)

bzl_library(
name = "swift_static_framework",
srcs = ["swift_static_framework.bzl"],
visibility = [
"//apple/internal:__pkg__",
],
deps = [
"//apple/internal:processor",
"//apple/internal:swift_info_support",
"@bazel_skylib//lib:partial",
"@bazel_skylib//lib:paths",
],
)

bzl_library(
name = "watchos_stub",
srcs = ["watchos_stub.bzl"],
Expand Down
Loading