Skip to content

Commit

Permalink
Add support for Bazel 8 and 9
Browse files Browse the repository at this point in the history
Adds some ObjC and rules_apple Bazel 8 related migrations. Officially drops anything Bazel 6 related.

Signed-off-by: Brentley Jones <[email protected]>
  • Loading branch information
brentleyjones committed Dec 13, 2024
1 parent 739b881 commit 9236e1c
Show file tree
Hide file tree
Showing 16 changed files with 140 additions and 136 deletions.
18 changes: 6 additions & 12 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ bazel_dep(
)
bazel_dep(
name = "rules_pkg",
version = "0.9.1",
version = "1.0.1",
dev_dependency = True,
)
bazel_dep(
Expand All @@ -55,15 +55,15 @@ bazel_dep(
repo_name = "io_bazel_stardoc",
)

# To support Bazel 8 tests
# Use newer versions of deps in development
single_version_override(
module_name = "rules_swift",
version = "1.18.0",
module_name = "apple_support",
version = "1.17.1",
)

single_version_override(
module_name = "apple_support",
version = "1.15.1",
module_name = "rules_swift",
version = "2.3.0",
)

# Some of our deps are forcing a new stardoc on us, so pinning for now
Expand All @@ -72,12 +72,6 @@ single_version_override(
version = "0.6.1",
)

# For Stardoc
single_version_override(
module_name = "bazel_skylib",
version = "1.6.0",
)

apple_cc_configure = use_extension(
"@build_bazel_apple_support//crosstool:setup.bzl",
"apple_cc_configure_extension",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ to include it in the list above.

| rules_xcodeproj | Bazel | [rules_apple][1] | [rules_swift][2] | Xcode | macOS | Supporting Branch |
| :-------------: | :---: | :--------------: | :--------------: | :---: | :---: | :---------------: |
| 2.10.0+ | 7.0-8.x | 3.16.1+ | 1.18.0+ | 13.3–15.x | 13–14.x | `main` |
| 2.10.0+ | 7.0-9.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 | - |
Expand Down
12 changes: 0 additions & 12 deletions bazel_6.bazelrc

This file was deleted.

4 changes: 1 addition & 3 deletions bazel_7.bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
common --incompatible_fail_on_unknown_attributes

build:cache --remote_build_event_upload=minimal
common --incompatible_disallow_empty_glob
Empty file added bazel_9.bazelrc
Empty file.
6 changes: 2 additions & 4 deletions buildbuddy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ x_templates:
USE_BAZEL_VERSION: 7.x
- &bazel_lts
env:
# FIXME: Adjust to 8.x
USE_BAZEL_VERSION: 7.x
USE_BAZEL_VERSION: 8.x
- &bazel_head
env:
# FIXME: Adjust to `last_green`
USE_BAZEL_VERSION: 7.x
USE_BAZEL_VERSION: last_green

- &normal_resources
resource_requests: { memory: 6GB }
Expand Down
3 changes: 3 additions & 0 deletions examples/integration/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import %workspace%/../../shared.bazelrc

build --experimental_cc_implementation_deps

# Until we fix our examples for Bazel 8
common --enable_workspace

# Exercise the extra flags feature

build:rules_xcodeproj --@rules_xcodeproj//xcodeproj:extra_common_flags='--verbose_failures'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ _deps_aspect = aspect(
attr_aspects = ["*"],
)

_is_bazel_6 = hasattr(apple_common, "link_multi_arch_static_library")

def _dep_resources_collector_impl(ctx):
all_deps = depset(
transitive = [dep[DepCollectorInfo].dep_names for dep in ctx.attr.deps],
Expand All @@ -39,9 +37,7 @@ def _dep_resources_collector_impl(ctx):
command = "echo '{}' > {}".format("\n".join(all_deps), output.path),
)

res = [output]
if _is_bazel_6:
res = {tuple(): res}
res = {tuple(): [output]}

return resources.bucketize(
resources = res,
Expand Down
60 changes: 30 additions & 30 deletions examples/integration/test/fixtures/bazel-8/bwb_replacements.txt
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
CONFIGURATION-STABLE-0 darwin_x86_64-dbg-ST-376989c9bb44
CONFIGURATION-STABLE-1 darwin_x86_64-dbg-ST-65b9ae3229ca
CONFIGURATION-STABLE-2 darwin_x86_64-opt-ST-4603bbaf5d98
CONFIGURATION-STABLE-3 ios_x86_64-dbg-ios-x86_64-min15.0-applebin_ios-ST-ec49b5570e6a
CONFIGURATION-STABLE-4 watchos_x86_64-dbg-watchos-x86_64-min7.0-applebin_watchos-ST-c601ed35d954
CONFIGURATION-STABLE-5 ios_x86_64-dbg-ios-x86_64-min16.0-applebin_ios-ST-7c661f35007d
CONFIGURATION-STABLE-6 tvos_x86_64-dbg-tvos-x86_64-min15.0-applebin_tvos-ST-8fa93ae60f3c
CONFIGURATION-STABLE-7 darwin_x86_64-dbg-macos-x86_64-min12.0-applebin_macos-ST-e4d1b54e0a5f
CONFIGURATION-STABLE-8 ios_arm64-dbg-ios-arm64-min15.0-applebin_ios-ST-d4ed85805c03
CONFIGURATION-STABLE-9 watchos_arm64_32-dbg-watchos-arm64_32-min7.0-applebin_watchos-ST-2d1383ea1bfd
CONFIGURATION-STABLE-10 ios_arm64-dbg-ios-arm64-min16.0-applebin_ios-ST-9d40ca217462
CONFIGURATION-STABLE-11 tvos_arm64-dbg-tvos-arm64-min15.0-applebin_tvos-ST-f0bf1e4db2b5
CONFIGURATION-STABLE-12 ios_x86_64-opt-ios-x86_64-min15.0-applebin_ios-ST-f0647120a524
CONFIGURATION-STABLE-13 watchos_x86_64-opt-watchos-x86_64-min7.0-applebin_watchos-ST-9b6da1c1ca96
CONFIGURATION-STABLE-14 ios_x86_64-opt-ios-x86_64-min16.0-applebin_ios-ST-98784b0141f7
CONFIGURATION-STABLE-15 tvos_x86_64-opt-tvos-x86_64-min15.0-applebin_tvos-ST-fd3222aa8913
CONFIGURATION-STABLE-16 darwin_x86_64-opt-macos-x86_64-min12.0-applebin_macos-ST-478bd2e7095f
CONFIGURATION-STABLE-17 ios_arm64-opt-ios-arm64-min15.0-applebin_ios-ST-d4b659e4a9d4
CONFIGURATION-STABLE-18 watchos_arm64_32-opt-watchos-arm64_32-min7.0-applebin_watchos-ST-ecd9d94fb4e5
CONFIGURATION-STABLE-19 ios_arm64-opt-ios-arm64-min16.0-applebin_ios-ST-9a1b0839beb3
CONFIGURATION-STABLE-20 tvos_arm64-opt-tvos-arm64-min15.0-applebin_tvos-ST-618e0eabc398
CONFIGURATION-STABLE-21 watchos_x86_64-dbg-watchos-x86_64-min8.0-applebin_watchos-ST-65044d9cb033
CONFIGURATION-STABLE-22 watchos_arm64_32-dbg-watchos-arm64_32-min8.0-applebin_watchos-ST-e2adfc6423ec
CONFIGURATION-STABLE-23 watchos_x86_64-opt-watchos-x86_64-min8.0-applebin_watchos-ST-b7000f81fbba
CONFIGURATION-STABLE-24 watchos_arm64_32-opt-watchos-arm64_32-min8.0-applebin_watchos-ST-58e24dd35eea
CONFIGURATION-STABLE-25 darwin_x86_64-dbg-macos-x86_64-min11.0-applebin_macos-ST-23ced71d870c
CONFIGURATION-STABLE-26 darwin_x86_64-opt-macos-x86_64-min11.0-applebin_macos-ST-5c2767082c6b
CONFIGURATION-STABLE-27 darwin_x86_64-dbg-macos-x86_64-min11.0-applebin_macos-ST-7c4786726810
CONFIGURATION-STABLE-28 darwin_arm64-dbg-macos-arm64-min11.0-applebin_macos-ST-5f46583411cc
CONFIGURATION-STABLE-29 darwin_x86_64-dbg-macos-x86_64-min11.0-applebin_macos-ST-a6b23e99dd1c
CONFIGURATION-STABLE-30 darwin_x86_64-opt-macos-x86_64-min11.0-applebin_macos-ST-d247baf1a2e1
CONFIGURATION-STABLE-31 darwin_arm64-opt-macos-arm64-min11.0-applebin_macos-ST-4320432566be
CONFIGURATION-STABLE-32 darwin_x86_64-opt-macos-x86_64-min11.0-applebin_macos-ST-11b4a0ee8e7b
CONFIGURATION-STABLE-3 ios_x86_64-dbg-ios-x86_64-min15.0-applebin_ios-ST-729671d856ea
CONFIGURATION-STABLE-4 watchos_x86_64-dbg-watchos-x86_64-min7.0-applebin_watchos-ST-a56208b3ea17
CONFIGURATION-STABLE-5 ios_x86_64-dbg-ios-x86_64-min16.0-applebin_ios-ST-e07395093609
CONFIGURATION-STABLE-6 tvos_x86_64-dbg-tvos-x86_64-min15.0-applebin_tvos-ST-f2eafbbb2c71
CONFIGURATION-STABLE-7 darwin_x86_64-dbg-macos-x86_64-min12.0-applebin_macos-ST-c5aba9a2664d
CONFIGURATION-STABLE-8 ios_arm64-dbg-ios-arm64-min15.0-applebin_ios-ST-ebc965843194
CONFIGURATION-STABLE-9 watchos_arm64_32-dbg-watchos-arm64_32-min7.0-applebin_watchos-ST-ee37b6f7c2f8
CONFIGURATION-STABLE-10 ios_arm64-dbg-ios-arm64-min16.0-applebin_ios-ST-22e6ffafd033
CONFIGURATION-STABLE-11 tvos_arm64-dbg-tvos-arm64-min15.0-applebin_tvos-ST-34aed803ff64
CONFIGURATION-STABLE-12 ios_x86_64-opt-ios-x86_64-min15.0-applebin_ios-ST-7e26020362db
CONFIGURATION-STABLE-13 watchos_x86_64-opt-watchos-x86_64-min7.0-applebin_watchos-ST-0b3052a22d34
CONFIGURATION-STABLE-14 ios_x86_64-opt-ios-x86_64-min16.0-applebin_ios-ST-24288e6a8a11
CONFIGURATION-STABLE-15 tvos_x86_64-opt-tvos-x86_64-min15.0-applebin_tvos-ST-839820e646a4
CONFIGURATION-STABLE-16 darwin_x86_64-opt-macos-x86_64-min12.0-applebin_macos-ST-fdfd02bb595a
CONFIGURATION-STABLE-17 ios_arm64-opt-ios-arm64-min15.0-applebin_ios-ST-a175c2921f59
CONFIGURATION-STABLE-18 watchos_arm64_32-opt-watchos-arm64_32-min7.0-applebin_watchos-ST-52c88b620570
CONFIGURATION-STABLE-19 ios_arm64-opt-ios-arm64-min16.0-applebin_ios-ST-d9e7edaa2e03
CONFIGURATION-STABLE-20 tvos_arm64-opt-tvos-arm64-min15.0-applebin_tvos-ST-09f0630d9e9d
CONFIGURATION-STABLE-21 watchos_x86_64-dbg-watchos-x86_64-min8.0-applebin_watchos-ST-c0f93201a38e
CONFIGURATION-STABLE-22 watchos_arm64_32-dbg-watchos-arm64_32-min8.0-applebin_watchos-ST-5383078a5ee1
CONFIGURATION-STABLE-23 watchos_x86_64-opt-watchos-x86_64-min8.0-applebin_watchos-ST-040af2a54015
CONFIGURATION-STABLE-24 watchos_arm64_32-opt-watchos-arm64_32-min8.0-applebin_watchos-ST-023f6c62a458
CONFIGURATION-STABLE-25 darwin_x86_64-dbg-macos-x86_64-min11.0-applebin_macos-ST-ab644b0d3414
CONFIGURATION-STABLE-26 darwin_x86_64-opt-macos-x86_64-min11.0-applebin_macos-ST-03342bc805f6
CONFIGURATION-STABLE-27 darwin_x86_64-dbg-macos-x86_64-min11.0-applebin_macos-ST-66f6a67d07be
CONFIGURATION-STABLE-28 darwin_arm64-dbg-macos-arm64-min11.0-applebin_macos-ST-857af5314a24
CONFIGURATION-STABLE-29 darwin_x86_64-dbg-macos-x86_64-min11.0-applebin_macos-ST-ca73ce429e0a
CONFIGURATION-STABLE-30 darwin_x86_64-opt-macos-x86_64-min11.0-applebin_macos-ST-34857d59845d
CONFIGURATION-STABLE-31 darwin_arm64-opt-macos-arm64-min11.0-applebin_macos-ST-4e8ee0b7762f
CONFIGURATION-STABLE-32 darwin_x86_64-opt-macos-x86_64-min11.0-applebin_macos-ST-db9afb28d4b1
CONFIGURATION-STABLE-33 darwin_x86_64-dbg-ST-3a99c2752788
CONFIGURATION-STABLE-34 darwin_x86_64-opt-ST-a99a48f137fe
3 changes: 3 additions & 0 deletions examples/sanitizers/.bazelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Import parent workspace settings
import %workspace%/../../shared.bazelrc

# Until bzlmod is supported in this example
common --enable_workspace

# This example doesn't support bzlmod yet
build --noexperimental_enable_bzlmod

Expand Down
8 changes: 0 additions & 8 deletions shared.bazelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# Opt into future migrations
build --incompatible_disallow_empty_glob

# Support rules_swift 2.0 on Bazel 6
common --experimental_enable_aspect_hints

# Don't create convenience symlinks
build --experimental_convenience_symlinks=ignore

Expand All @@ -27,8 +21,6 @@ startup --output_base=bazel-output-base
build --deleted_packages=test/fixtures/generated/xcodeproj_bwx,test/fixtures/generated/xcodeproj_bwb

# Ensure we work with BwtB
build --experimental_inmemory_jdeps_files
build --experimental_inmemory_dotd_files
build --remote_download_outputs=minimal
test --remote_download_outputs=toplevel

Expand Down
2 changes: 1 addition & 1 deletion tools/bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ readonly workspace_dir="${tool_location%/*/*}"

bazel_version=$("$BAZEL_REAL" info release | /usr/bin/cut -d ' ' -f 2 | /usr/bin/cut -d '.' -f 1)
if [[ "$bazel_version" == "version" ]]; then
bazel_version=8
bazel_version=9
fi

flags=("--noworkspace_rc")
Expand Down
3 changes: 2 additions & 1 deletion xcodeproj/internal/opts.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def _legacy_get_unprocessed_cc_compiler_opts(
if is_objc:
objc = ctx.fragments.objc
user_copts = (
objc.copts +
# TODO: Remove when we drop 7.x
getattr(objc, "copts", []) +
user_copts +
objc.copts_for_current_compilation_mode
)
Expand Down
17 changes: 10 additions & 7 deletions xcodeproj/internal/pbxproj_partials.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@ load(
"FALSE_ARG",
"TRUE_ARG",
)
load(":platforms.bzl", "PLATFORM_NAME")
load(":platforms.bzl", "platforms")

_UNIT_TEST_PRODUCT_TYPE = "u" # com.apple.product-type.bundle.unit-test

# Utility

def _apple_platform_to_platform_name(platform):
return PLATFORM_NAME[platform]

def _dsym_files_to_string(dsym_files):
dsym_paths = []
for file in dsym_files.to_list():
Expand Down Expand Up @@ -135,7 +132,9 @@ _FLAGS = struct(
def _write_consolidation_map_targets(
*,
actions,
apple_platform_to_platform_name = _apple_platform_to_platform_name,
apple_platform_to_platform_name = (
platforms.apple_platform_to_platform_name
),
colorize,
consolidation_map,
default_xcode_configuration,
Expand Down Expand Up @@ -654,7 +653,9 @@ def _write_generated_xcfilelist(
def _write_pbxproj_prefix(
*,
actions,
apple_platform_to_platform_name = _apple_platform_to_platform_name,
apple_platform_to_platform_name = (
platforms.apple_platform_to_platform_name
),
colorize,
config,
default_xcode_configuration,
Expand Down Expand Up @@ -814,7 +815,9 @@ def _write_pbxproj_prefix(
def _write_pbxtargetdependencies(
*,
actions,
apple_platform_to_platform_name = _apple_platform_to_platform_name,
apple_platform_to_platform_name = (
platforms.apple_platform_to_platform_name
),
colorize,
generator_name,
install_path,
Expand Down
Loading

0 comments on commit 9236e1c

Please sign in to comment.