Skip to content

Commit

Permalink
Use bazel 7
Browse files Browse the repository at this point in the history
This updates the remote toolchains and bumps some rule sets to be
compatible. We use the latest release of rules_cc in the fixture repo.
This was needed to avoid the "osx/crosstool" error in the extraction repo.
  • Loading branch information
stagnation committed Dec 19, 2023
1 parent 08f2e33 commit c130087
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 27 deletions.
11 changes: 11 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# # Bazel7
# TODO: With bzlmod we cannot access the WORKSPACE file anymore
# $ bazel build //:gazelle
# ERROR: /.../external/bazel_gazelle_go_repository_config/BUILD.bazel: no such
# target '@@bazel_gazelle_go_repository_config//:WORKSPACE': target 'WORKSPACE'
# not declared in package '' defined by
# /CAS/bazel-cache/f1a15cfb78ca8fde7615be5d21224669/external/bazel_gazelle_go_repository_config/BUILD.bazel;
# however, a source file of this name exists. (Perhaps add
# 'exports_files(["WORKSPACE"])' to /BUILD?)
build --noenable_bzlmod

# Required for @com_google_absl and remoteapis that use it.
build --cxxopt=-std=c++17
build --host_cxxopt=-std=c++17
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.0
7.0.0
31 changes: 16 additions & 15 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,25 @@ gazelle_dependencies()

http_archive(
name = "com_google_protobuf",
sha256 = "a700a49470d301f1190a487a923b5095bf60f08f4ae4cac9f5f7c36883d17971",
strip_prefix = "protobuf-23.4",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protobuf-23.4.tar.gz"],
integrity = "sha256-m9h7goDvcg0yQFFPiE5WpxLyIY8NaTtIBQyDYCiUCkI=",
strip_prefix = "protobuf-25.1",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v25.1/protobuf-25.1.tar.gz"],
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

# Below dependencies are for the example project.
# # Dependencies below are for the example project.

# C++ rules for Bazel.

http_archive(
name = "rules_cc",
sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf",
strip_prefix = "rules_cc-0.0.9",
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
)

http_archive(
name = "com_grail_bazel_toolchain",
Expand All @@ -112,14 +121,6 @@ llvm_toolchain(
llvm_version = "14.0.0",
)

# C++ rules for Bazel.
http_archive(
name = "rules_cc",
sha256 = "fe1e7b1801a63e79eb1b40dc44bf0590117a399e118ac44afd6fa07bf63e9ece",
strip_prefix = "rules_cc-58f8e026c00a8a20767e3dc669f46ba23bc93bdb",
urls = ["https://github.com/bazelbuild/rules_cc/archive/58f8e026c00a8a20767e3dc669f46ba23bc93bdb.zip"],
)

# Register the auto configured rules_cc toolchain for local execution.
load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains")

Expand Down Expand Up @@ -208,9 +209,9 @@ http_archive(

http_archive(
name = "aspect_rules_js",
sha256 = "00e7b97b696af63812df0ca9e9dbd18579f3edd3ab9a56f227238b8405e4051c",
strip_prefix = "rules_js-1.23.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.23.0/rules_js-v1.23.0.tar.gz",
sha256 = "76a04ef2120ee00231d85d1ff012ede23963733339ad8db81f590791a031f643",
strip_prefix = "rules_js-1.34.1",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.34.1/rules_js-v1.34.1.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# C++ rules for Bazel.
http_archive(
name = "rules_cc",
sha256 = "954b7a3efc8752da957ae193a13b9133da227bdacf5ceb111f2e11264f7e8c95",
strip_prefix = "rules_cc-9e10b8a6db775b1ecd358d8ddd3dab379a2c29a5",
urls = ["https://github.com/bazelbuild/rules_cc/archive/9e10b8a6db775b1ecd358d8ddd3dab379a2c29a5.zip"],
sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf",
strip_prefix = "rules_cc-0.0.9",
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
)

load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies", "rules_cc_toolchains")
Expand Down
2 changes: 1 addition & 1 deletion tools/remote-toolchains/extract-bazel-auto-toolchains.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# `.bazelversion` in the repository root.
#
# Example usage: ./extract-bazel-auto-toolchains.sh ubuntu-act-22-04 ghcr.io/catthehacker/ubuntu:act-22.04
set -eEuo pipefail
set -eu -o pipefail

script_dir="$(dirname "${BASH_SOURCE[0]}")"

Expand Down
3 changes: 2 additions & 1 deletion tools/remote-toolchains/ubuntu-act-22-04/local_config_cc/BUILD
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ cc_toolchain_config(
"-Wl,-z,relro,-z,now",
"-B/usr/bin",
"-pass-exit-codes",
],
link_libs = [
"-lstdc++",
"-lm",
],
link_libs = [],
opt_compile_flags = [
"-g0",
"-O2",
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def _impl(ctx):
],
flag_groups = [
flag_group(
flags = ["-gsplit-dwarf"],
flags = ["-gsplit-dwarf", "-g"],
expand_if_available = "per_object_debug_info_file",
),
],
Expand Down Expand Up @@ -354,8 +354,8 @@ def _impl(ctx):
flag_group(
flags = [
"-fprofile-use=%{fdo_profile_path}",
"-Xclang-only=-Wno-profile-instr-unprofiled",
"-Xclang-only=-Wno-profile-instr-out-of-date",
"-Wno-profile-instr-unprofiled",
"-Wno-profile-instr-out-of-date",
"-fprofile-correction",
],
expand_if_available = "fdo_profile_path",
Expand Down Expand Up @@ -808,8 +808,8 @@ def _impl(ctx):
flag_groups = [
flag_group(
flags = [
"-Xclang-only=-mllvm",
"-Xclang-only=-prefetch-hints-file=%{fdo_prefetch_hints_path}",
"-mllvm",
"-prefetch-hints-file=%{fdo_prefetch_hints_path}",
],
expand_if_available = "fdo_prefetch_hints_path",
),
Expand Down Expand Up @@ -950,7 +950,6 @@ def _impl(ctx):
],
)

dynamic_library_linker_tool_path = tool_paths
dynamic_library_linker_tool_feature = feature(
name = "dynamic_library_linker_tool",
flag_sets = [
Expand Down Expand Up @@ -1114,6 +1113,8 @@ def _impl(ctx):
strip_debug_symbols_feature,
coverage_feature,
supports_pic_feature,
gcc_coverage_map_format_feature,
llvm_coverage_map_format_feature,
] + (
[
supports_start_end_lib_feature,
Expand Down Expand Up @@ -1150,6 +1151,8 @@ def _impl(ctx):
user_compile_flags_feature,
sysroot_feature,
unfiltered_compile_flags_feature,
gcc_coverage_map_format_feature,
llvm_coverage_map_format_feature,
]

return cc_common.create_cc_toolchain_config_info(
Expand Down
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ platform(
# Auto-detected host platform constraints.
constraint_values = HOST_CONSTRAINTS,
)

exports_files([
# Export constraints.bzl for use in downstream bzl_library targets.
"constraints.bzl",
])
Empty file modified tools/remote-toolchains/ubuntu-act-22-04/local_config_sh/BUILD
100644 → 100755
Empty file.

0 comments on commit c130087

Please sign in to comment.