Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bazel_dep(name = "apple_support", version = "1.21.1", repo_name = "build_bazel_a
bazel_dep(name = "bazel_features", version = "1.30.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_cc", version = "0.1.2")
bazel_dep(name = "rules_cc", version = "0.2.13")
bazel_dep(
name = "rules_swift",
version = "2.4.0",
Expand Down
5 changes: 5 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@ stardoc_external_deps()
load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install")

stardoc_pinned_maven_install()

load("@rules_cc//cc:extensions.bzl", "compatibility_proxy_repo")

compatibility_proxy_repo()

3 changes: 2 additions & 1 deletion apple/dtrace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ load(
)
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_cc//cc/common:objc_info.bzl", "ObjcInfo")
load(
"//apple/internal/utils:bundle_paths.bzl",
"bundle_paths",
Expand Down Expand Up @@ -69,7 +70,7 @@ def _dtrace_compile_impl(ctx):
include_dir = hdr.path.removesuffix(hdr_suffix)

return [
apple_common.new_objc_provider(
ObjcInfo(
strict_include = depset([include_dir]),
),
CcInfo(
Expand Down
7 changes: 4 additions & 3 deletions apple/internal/apple_framework_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ load(
"swift_common",
)
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_cc//cc/common:objc_info.bzl", "ObjcInfo")
load(
"//apple:providers.bzl",
"AppleFrameworkImportInfo",
Expand Down Expand Up @@ -347,11 +348,11 @@ def _apple_static_framework_import_impl(ctx):
if swiftmodule:
additional_objc_provider_fields.update(_ensure_swiftmodule_is_embedded(swiftmodule))

# Create apple_common.Objc provider
# Create ObjcInfo provider
additional_objc_providers.extend([
dep[apple_common.Objc]
dep[ObjcInfo]
for dep in deps
if apple_common.Objc in dep
if ObjcInfo in dep
])

linkopts = []
Expand Down
5 changes: 3 additions & 2 deletions apple/internal/apple_xcframework_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ load(
"swift_common",
)
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_cc//cc/common:objc_info.bzl", "ObjcInfo")
load("//apple:providers.bzl", "AppleFrameworkImportInfo")
load(
"//apple/internal:apple_toolchains.bzl",
Expand Down Expand Up @@ -659,9 +660,9 @@ def _apple_static_xcframework_import_impl(ctx):

# Create Objc provider
additional_objc_providers.extend([
dep[apple_common.Objc]
dep[ObjcInfo]
for dep in deps
if apple_common.Objc in dep
if ObjcInfo in dep
])

sdk_linkopts = []
Expand Down
9 changes: 5 additions & 4 deletions apple/internal/header_map.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ load("@build_bazel_rules_swift//swift:providers.bzl", "SwiftInfo")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_common")
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_cc//cc/common:objc_info.bzl", "ObjcInfo")

HeaderMapInfo = provider(
doc = "Provides information about created `.hmap` (header map) files",
Expand Down Expand Up @@ -66,8 +67,8 @@ def _header_map_impl(ctx):

for dep in ctx.attr.deps:
found_headers = []
if apple_common.Objc in dep:
found_headers.append(getattr(dep[apple_common.Objc], "direct_headers", []))
if ObjcInfo in dep:
found_headers.append(getattr(dep[ObjcInfo], "direct_headers", []))
if CcInfo in dep:
found_headers.append(dep[CcInfo].compilation_context.direct_headers)
if not found_headers:
Expand All @@ -91,7 +92,7 @@ def _header_map_impl(ctx):
swift_info = SwiftInfo()

return [
apple_common.new_objc_provider(),
ObjcInfo(),
swift_info,
CcInfo(
compilation_context = cc_common.create_compilation_context(
Expand All @@ -117,7 +118,7 @@ header_map = rule(
),
"deps": attr.label_list(
mandatory = False,
providers = [[apple_common.Objc], [CcInfo]],
providers = [[ObjcInfo], [CcInfo]],
doc = "Targets whose direct headers should be added to the list of hdrs and rooted at the module_name",
),
"_hmaptool": attr.label(
Expand Down
7 changes: 3 additions & 4 deletions apple/internal/linking_support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ load(
load("@build_bazel_apple_support//lib:lipo.bzl", "lipo")
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_cc//cc/common:objc_info.bzl", "ObjcInfo")
load(
"//apple/internal:cc_toolchain_info_support.bzl",
"cc_toolchain_info_support",
Expand All @@ -41,8 +42,6 @@ load(
"new_appledebugoutputsinfo",
)

ObjcInfo = apple_common.Objc

def _archive_multi_arch_static_library(
*,
ctx,
Expand Down Expand Up @@ -435,7 +434,7 @@ def _register_binary_linking_action(
This target must propagate the `AppleExecutableBinaryInfo` provider.
This simplifies the process of passing the bundle loader to all the arguments
that need it: the binary will automatically be added to the linker inputs, its
path will be added to linkopts via `-bundle_loader`, and the `apple_common.Objc`
path will be added to linkopts via `-bundle_loader`, and the `ObjcInfo`
provider of its dependencies (obtained from the `AppleExecutableBinaryInfo` provider)
will be passed as an additional `avoid_dep` to ensure that those dependencies are
subtracted when linking the bundle's binary.
Expand Down Expand Up @@ -474,7 +473,7 @@ def _register_binary_linking_action(
is a new universal (fat) binary obtained by invoking `lipo`.
* `cc_info`: The CcInfo provider containing information about the targets that were
linked.
* `objc`: The `apple_common.Objc` provider containing information about the targets
* `objc`: The `ObjcInfo` provider containing information about the targets
that were linked.
* `outputs`: A `list` of `struct`s containing the single-architecture binaries and
debug outputs, with identifying information about the target platform, architecture,
Expand Down
2 changes: 1 addition & 1 deletion apple/internal/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ Contains the executable binary output that was built using
fields = {
# TODO: Remove when we drop 7.x
"objc": """\
apple_common.Objc provider used for legacy linking behavior.
ObjcInfo provider used for legacy linking behavior.
""",
"binary": """\
The executable binary artifact output by `link_multi_arch_binary`.
Expand Down
3 changes: 2 additions & 1 deletion apple/internal/resource_rules/apple_resource_bundle.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"""Implementation of apple_resource_bundle rule."""

load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_cc//cc/common:objc_info.bzl", "ObjcInfo")
load(
"//apple/internal:providers.bzl",
"new_appleresourcebundleinfo",
Expand All @@ -27,7 +28,7 @@ def _apple_resource_bundle_impl(_ctx):
# be used to iterate through all relevant instances of this rule in the build graph.
return [
# TODO(b/122578556): Remove this ObjC provider instance.
apple_common.new_objc_provider(),
ObjcInfo(),
CcInfo(),
new_appleresourcebundleinfo(),
]
Expand Down
3 changes: 2 additions & 1 deletion apple/internal/rule_attrs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ load(
"SwiftInfo",
)
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/common:objc_info.bzl", "ObjcInfo")
load(
"//apple:common.bzl",
"entitlements_validation_mode",
Expand Down Expand Up @@ -664,7 +665,7 @@ def _settings_bundle_attrs():
return {
"settings_bundle": attr.label(
aspects = [apple_resource_aspect],
providers = [[AppleResourceBundleInfo], [apple_common.Objc]],
providers = [[AppleResourceBundleInfo], [ObjcInfo]],
doc = """
A resource bundle (e.g. `apple_bundle_import`) target that contains the files that make up the
application's settings bundle. These files will be copied into the root of the final application
Expand Down
5 changes: 3 additions & 2 deletions apple/internal/testing/apple_test_bundle_support.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ load(
"SwiftInfo",
)
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_cc//cc/common:objc_info.bzl", "ObjcInfo")
load(
"//apple:providers.bzl",
"AppleBundleInfo",
Expand Down Expand Up @@ -150,8 +151,8 @@ def _apple_test_info_aspect_impl(target, ctx):
module_maps.append(test_info.module_maps)
swift_modules.append(test_info.swift_modules)

if apple_common.Objc in target:
objc_provider = target[apple_common.Objc]
if ObjcInfo in target:
objc_provider = target[ObjcInfo]
includes.append(objc_provider.strict_include)

if CcInfo in target:
Expand Down
3 changes: 2 additions & 1 deletion apple/internal/visionos_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ load(
)
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/common:cc_info.bzl", "CcInfo")
load("@rules_cc//cc/common:objc_info.bzl", "ObjcInfo")
load(
"//apple/internal:apple_product_type.bzl",
"apple_product_type",
Expand Down Expand Up @@ -746,7 +747,7 @@ def _visionos_dynamic_framework_impl(ctx):
libraries = provider.framework_files.to_list(),
)
additional_providers.extend([
apple_common.new_objc_provider(
ObjcInfo(
dynamic_framework_file = provider.framework_files,
),
CcInfo(
Expand Down
8 changes: 7 additions & 1 deletion apple/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,13 @@ def apple_rules_dependencies(ignore_version_differences = False, include_bzlmod_
url = "https://github.com/bazelbuild/rules_swift/releases/download/2.4.0/rules_swift.2.4.0.tar.gz",
ignore_version_differences = ignore_version_differences,
)

_maybe(
http_archive,
name = "rules_cc",
sha256 = "472ddca8cec1e64ad78e4f0cabbec55936a3baddbe7bef072764ca91504bd523",
strip_prefix = "rules_cc-0.2.13",
url = "https://github.com/bazelbuild/rules_cc/releases/download/0.2.13/rules_cc-0.2.13.tar.gz",
)
_maybe(
http_archive,
name = "platforms",
Expand Down
2 changes: 1 addition & 1 deletion doc/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Contains the executable binary output that was built using

| Name | Description |
| :------------- | :------------- |
| <a id="AppleExecutableBinaryInfo-objc"></a>objc | apple_common.Objc provider used for legacy linking behavior. |
| <a id="AppleExecutableBinaryInfo-objc"></a>objc | ObjcInfo provider used for legacy linking behavior. |
| <a id="AppleExecutableBinaryInfo-binary"></a>binary | The executable binary artifact output by `link_multi_arch_binary`. |
| <a id="AppleExecutableBinaryInfo-cc_info"></a>cc_info | A `CcInfo` which contains information about the transitive dependencies linked into the binary. |

Expand Down