Skip to content

Commit

Permalink
Upgrade to rules_apple 3.16.1 (#3114)
Browse files Browse the repository at this point in the history
  • Loading branch information
brentleyjones authored Dec 13, 2024
1 parent 2126821 commit 739b881
Show file tree
Hide file tree
Showing 16 changed files with 119 additions and 45 deletions.
13 changes: 7 additions & 6 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ bazel_dep(
)
bazel_dep(
name = "rules_apple",
version = "3.6.0",
version = "3.16.1",
repo_name = "build_bazel_rules_apple",
)
bazel_dep(name = "rules_python", version = "0.27.1")
Expand Down Expand Up @@ -56,11 +56,6 @@ bazel_dep(
)

# To support Bazel 8 tests
single_version_override(
module_name = "rules_apple",
version = "3.5.1",
)

single_version_override(
module_name = "rules_swift",
version = "1.18.0",
Expand All @@ -71,6 +66,12 @@ single_version_override(
version = "1.15.1",
)

# Some of our deps are forcing a new stardoc on us, so pinning for now
single_version_override(
module_name = "stardoc",
version = "0.6.1",
)

# For Stardoc
single_version_override(
module_name = "bazel_skylib",
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ to include it in the list above.

| rules_xcodeproj | Bazel | [rules_apple][1] | [rules_swift][2] | Xcode | macOS | Supporting Branch |
| :-------------: | :---: | :--------------: | :--------------: | :---: | :---: | :---------------: |
| 1.17.0+ | 6.3-7.x | 1.0.1–2.x | 1.x | 13.3–15.x | 13–14.x | `main` |
| 2.10.0+ | 7.0-8.x | 3.16.1+ | 1.18.0+ | 13.3–15.x | 13–14.x | `main` |
| 1.17.0+ | 6.3-7.x | 1.0.1–2.x | 1.x | 13.3–15.x | 13–14.x | - |
| 1.16.0 | 6.3-7.x | 1.0.1–2.x | 1.x | 13.3–15.2 | 13–14.x | - |
| 1.14.0-1.15.0 | 6.1-7.x | 1.0.1–2.x | 1.x | 13.3–15.2 | 13–14.x | - |
| 1.7.0-1.13.0 | 5.3–6.x | 1.0.1–2.x | 1.x | 13.3–15.2 | 12–13.x | - |
Expand Down
9 changes: 4 additions & 5 deletions buildbuddy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ x_templates:
env: {}
- &bazel_previous_lts
env:
USE_BAZEL_VERSION: 6.x
USE_BAZEL_VERSION: 7.x
- &bazel_lts
env:
# FIXME: Adjust to 8.x
USE_BAZEL_VERSION: 7.x
- &bazel_head
env:
# See https://github.com/MobileNativeFoundation/rules_xcodeproj/pull/3029
#
# Temporary change to make CI pass until the fix is in `last_green`
USE_BAZEL_VERSION: dd2464a5933e0a5a6765024573832717b71989bf
# FIXME: Adjust to `last_green`
USE_BAZEL_VERSION: 7.x

- &normal_resources
resource_requests: { memory: 6GB }
Expand Down
2 changes: 1 addition & 1 deletion examples/integration/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bazel_dep(
)
bazel_dep(
name = "rules_apple",
version = "3.6.0",
version = "3.16.1",
repo_name = "build_bazel_rules_apple",
)
bazel_dep(
Expand Down
2 changes: 1 addition & 1 deletion examples/integration/iOSApp/external/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ module(

bazel_dep(
name = "rules_apple",
version = "2.1.0",
version = "3.16.1",
repo_name = "build_bazel_rules_apple",
)
2 changes: 1 addition & 1 deletion examples/rules_ios/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bazel_dep(
)
bazel_dep(
name = "rules_apple",
version = "3.2.1",
version = "3.16.1",
repo_name = "build_bazel_rules_apple",
)
bazel_dep(
Expand Down
4 changes: 2 additions & 2 deletions xcodeproj/internal/compilation_providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ def _merge_compilation_providers(
"""Merges compilation providers from the deps of a target.
Args:
apple_dynamic_framework_info: The
`apple_common.AppleDynamicFrameworkInfo` of the target, or `None`.
apple_dynamic_framework_info: The `AppleDynamicFrameworkInfo` of the
target, or `None`.
cc_info: The `CcInfo` of the target, or `None`.
propagate_providers: A `bool` indicating whether providers should be
propagated to downstream targets.
Expand Down
8 changes: 4 additions & 4 deletions xcodeproj/internal/files/incremental_input_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ def _collect_incremental_input_files(
avoid_deps: A `list` of the targets that already consumed resources, and
their resources shouldn't be bundled with the target.
framework_files: A `depset` of framework files from
`AppleDynamicFramework.framework_files`, if the target has the
`AppleDynamicFramework` provider.
`AppleDynamicFrameworkInfo.framework_files`, if the target has the
`AppleDynamicFrameworkInfo` provider.
focused_labels: A `depset` of label strings of focused targets. This
will include the current target (if focused) and any focused
dependencies of the current target. This is only set for top-level
Expand Down Expand Up @@ -955,8 +955,8 @@ def _merge_top_level_input_files(
will include the current target (if focused) and any focused
dependencies of the current target.
framework_files: A `depset` of framework files from
`AppleDynamicFramework.framework_files`, if the target has the
`AppleDynamicFramework` provider.
`AppleDynamicFrameworkInfo.framework_files`, if the target has the
`AppleDynamicFrameworkInfo` provider.
platform: A value from `platforms.collect`.
resource_info: The `AppleResourceInfo` provider for the target if it is
resource bundle consuming.
Expand Down
4 changes: 2 additions & 2 deletions xcodeproj/internal/files/incremental_output_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _get_outputs(*, debug_outputs, product, swift_info, output_group_info):
indexing process.
Args:
debug_outputs: The `AppleDebugOutputs` provider for the target, or
debug_outputs: The `AppleDebugOutputsInfo` provider for the target, or
`None`.
output_group_info: The `OutputGroupInfo` provider for the target, or
`None`.
Expand Down Expand Up @@ -143,7 +143,7 @@ def _collect_incremental_output_files(
copy_product_transitively: Whether or not to copy the product
transitively. Currently this should only be true for top-level
targets.
debug_outputs: The `AppleDebugOutputs` provider for the target, or
debug_outputs: The `AppleDebugOutputsInfo` provider for the target, or
`None`.
id: A unique identifier for the target.
indexstore_overrides: A `list` of `(indexstore, target_name)` `tuple`s
Expand Down
4 changes: 2 additions & 2 deletions xcodeproj/internal/files/legacy_output_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _get_outputs(*, debug_outputs, id, product, swift_info, output_group_info):
indexing process.
Args:
debug_outputs: The `AppleDebugOutputs` provider for the target, or
debug_outputs: The `AppleDebugOutputsInfo` provider for the target, or
`None`.
id: The unique identifier of the target.
output_group_info: The `OutputGroupInfo` provider for the target, or
Expand Down Expand Up @@ -137,7 +137,7 @@ def _collect_legacy_output_files(
copy_product_transitively: Whether or not to copy the product
transitively. Currently this should only be true for top-level
targets.
debug_outputs: The `AppleDebugOutputs` provider for the target, or
debug_outputs: The `AppleDebugOutputsInfo` provider for the target, or
`None`.
id: A unique identifier for the target.
output_group_info: The `OutputGroupInfo` provider for the target, or
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Functions for processing library targets."""

load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
load("@build_bazel_rules_apple//apple:providers.bzl", "AppleDebugOutputsInfo")
load("@build_bazel_rules_swift//swift:swift.bzl", "SwiftInfo", "SwiftProtoInfo")
load("//xcodeproj/internal:build_settings.bzl", "get_product_module_name")
load("//xcodeproj/internal:compilation_providers.bzl", "compilation_providers")
Expand Down Expand Up @@ -154,8 +155,8 @@ def _process_incremental_library_target(
] if not swift_debug_settings_file else None,
)

if apple_common.AppleDebugOutputs in target:
debug_outputs = target[apple_common.AppleDebugOutputs]
if AppleDebugOutputsInfo in target:
debug_outputs = target[AppleDebugOutputsInfo]
else:
debug_outputs = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ load("@bazel_skylib//rules:common_settings.bzl", "BuildSettingInfo")
load(
"@build_bazel_rules_apple//apple:providers.bzl",
"AppleBundleInfo",
"AppleDebugOutputsInfo",
"AppleDynamicFrameworkInfo",
"AppleResourceInfo",
)
load("@build_bazel_rules_swift//swift:swift.bzl", "SwiftInfo", "SwiftProtoInfo")
Expand Down Expand Up @@ -84,6 +86,20 @@ _TEST_HOST_PRODUCT_TYPES = {
"w": None, # com.apple.product-type.application.watchapp2
}

# TODO: Remove when we drop 7.x
_AppleDebugOutputsInfo = getattr(
apple_common,
"AppleDebugOutputs",
AppleDebugOutputsInfo,
)

# TODO: Remove when we drop 7.x
_AppleDynamicFrameworkInfo = getattr(
apple_common,
"AppleDynamicFramework",
AppleDynamicFrameworkInfo,
)

def _calculate_product_type(*, target_files, bundle_info):
"""Calculates the product type for a top level target.
Expand Down Expand Up @@ -272,9 +288,9 @@ def _process_focused_top_level_target(
target = target,
)

if target and apple_common.AppleDynamicFramework in target:
if target and _AppleDynamicFrameworkInfo in target:
framework_files = (
target[apple_common.AppleDynamicFramework].framework_files
target[_AppleDynamicFrameworkInfo].framework_files
)
product_file = product.file
framework_product_mappings = [
Expand Down Expand Up @@ -491,8 +507,8 @@ def _process_focused_top_level_target(
],
)

if apple_common.AppleDebugOutputs in target:
debug_outputs = target[apple_common.AppleDebugOutputs]
if _AppleDebugOutputsInfo in target:
debug_outputs = target[_AppleDebugOutputsInfo]
else:
debug_outputs = None

Expand Down Expand Up @@ -730,9 +746,9 @@ def _process_unfocused_top_level_target(
target = target,
)

if target and apple_common.AppleDynamicFramework in target:
if target and _AppleDynamicFrameworkInfo in target:
framework_files = (
target[apple_common.AppleDynamicFramework].framework_files
target[_AppleDynamicFrameworkInfo].framework_files
)
slim_product_file = slim_product.file
framework_product_mappings = [
Expand Down Expand Up @@ -927,9 +943,9 @@ def _process_incremental_top_level_target(
),
)

if apple_common.AppleDynamicFramework in target:
if _AppleDynamicFrameworkInfo in target:
apple_dynamic_framework_info = (
target[apple_common.AppleDynamicFramework]
target[_AppleDynamicFrameworkInfo]
)
else:
apple_dynamic_framework_info = None
Expand Down
21 changes: 19 additions & 2 deletions xcodeproj/internal/processed_targets/legacy_library_targets.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Functions for processing library targets."""

load("@build_bazel_rules_apple//apple:providers.bzl", "AppleDebugOutputsInfo")
load("@build_bazel_rules_swift//swift:swift.bzl", "SwiftInfo")
load("//xcodeproj/internal:build_settings.bzl", "get_product_module_name")
load("//xcodeproj/internal:collections.bzl", "set_if_true")
Expand Down Expand Up @@ -36,6 +37,13 @@ load(
processed_targets = "legacy_processed_targets",
)

# TODO: Remove when we drop 7.x
_AppleDebugOutputsInfo = getattr(
apple_common,
"AppleDebugOutputs",
AppleDebugOutputsInfo,
)

def _process_legacy_library_target(
*,
ctx,
Expand Down Expand Up @@ -133,8 +141,17 @@ def _process_legacy_library_target(
modulemaps = modulemaps,
transitive_infos = transitive_infos,
)
debug_outputs = target[apple_common.AppleDebugOutputs] if apple_common.AppleDebugOutputs in target else None
output_group_info = target[OutputGroupInfo] if OutputGroupInfo in target else None

if _AppleDebugOutputsInfo in target:
debug_outputs = target[_AppleDebugOutputsInfo]
else:
debug_outputs = None

if OutputGroupInfo in target:
output_group_info = target[OutputGroupInfo]
else:
output_group_info = None

(target_outputs, provider_outputs) = output_files.collect(
ctx = ctx,
debug_outputs = debug_outputs,
Expand Down
36 changes: 32 additions & 4 deletions xcodeproj/internal/processed_targets/legacy_top_level_targets.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
""" Functions for processing top level targets """

load(
"@build_bazel_rules_apple//apple:providers.bzl",
"AppleDebugOutputsInfo",
"AppleDynamicFrameworkInfo",
)
load("@build_bazel_rules_swift//swift:swift.bzl", "SwiftInfo")
load(
"//xcodeproj/internal:build_settings.bzl",
Expand Down Expand Up @@ -48,6 +53,20 @@ load(
processed_targets = "legacy_processed_targets",
)

# TODO: Remove when we drop 7.x
_AppleDebugOutputsInfo = getattr(
apple_common,
"AppleDebugOutputs",
AppleDebugOutputsInfo,
)

# TODO: Remove when we drop 7.x
_AppleDynamicFrameworkInfo = getattr(
apple_common,
"AppleDynamicFramework",
AppleDynamicFrameworkInfo,
)

def _get_codesign_opts(*, ctx, inputs_attr, opts_attr, rule_attr):
if not opts_attr:
return ([], [])
Expand Down Expand Up @@ -325,9 +344,9 @@ def _process_legacy_top_level_target(
else:
avoid_compilation_providers = None

if apple_common.AppleDynamicFramework in target:
if _AppleDynamicFrameworkInfo in target:
apple_dynamic_framework_info = (
target[apple_common.AppleDynamicFramework]
target[_AppleDynamicFrameworkInfo]
)
else:
apple_dynamic_framework_info = None
Expand Down Expand Up @@ -412,8 +431,17 @@ def _process_legacy_top_level_target(
transitive_infos = transitive_infos,
avoid_deps = avoid_deps,
)
debug_outputs = target[apple_common.AppleDebugOutputs] if apple_common.AppleDebugOutputs in target else None
output_group_info = target[OutputGroupInfo] if OutputGroupInfo in target else None

if _AppleDebugOutputsInfo in target:
debug_outputs = target[_AppleDebugOutputsInfo]
else:
debug_outputs = None

if OutputGroupInfo in target:
output_group_info = target[OutputGroupInfo]
else:
output_group_info = None

(target_outputs, provider_outputs) = output_files.collect(
ctx = ctx,
copy_product_transitively = True,
Expand Down
15 changes: 13 additions & 2 deletions xcodeproj/internal/product.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
`generation_mode = "legacy"`."""

load("@bazel_skylib//lib:paths.bzl", "paths")
load(
"@build_bazel_rules_apple//apple:providers.bzl",
"AppleDynamicFrameworkInfo",
)
load("//xcodeproj/internal/files:linker_input_files.bzl", "linker_input_files")
load(":memory_efficiency.bzl", "EMPTY_DEPSET")

Expand Down Expand Up @@ -43,6 +47,13 @@ _ARCHIVE_EXTENSIONS = {
"zip": None,
}

# TODO: Remove when we drop 7.x
_AppleDynamicFrameworkInfo = getattr(
apple_common,
"AppleDynamicFramework",
AppleDynamicFrameworkInfo,
)

def _codesign_executable(*, actions, executable):
executable_path = "{}_codesigned".format(
executable.basename,
Expand Down Expand Up @@ -235,9 +246,9 @@ def process_product(
original_path = None
path = None

if target and apple_common.AppleDynamicFramework in target:
if target and _AppleDynamicFrameworkInfo in target:
framework_files = (
target[apple_common.AppleDynamicFramework].framework_files
target[_AppleDynamicFrameworkInfo].framework_files
)
else:
framework_files = EMPTY_DEPSET
Expand Down
Loading

0 comments on commit 739b881

Please sign in to comment.