Skip to content

Commit 9680f18

Browse files
authored
feat: support bazel 7 (#188)
1 parent 24e18a9 commit 9680f18

File tree

11 files changed

+42
-145
lines changed

11 files changed

+42
-145
lines changed

.bazelrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18+
common --noenable_bzlmod
19+
1820
build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
1921
build --incompatible_strict_action_env=true
2022
build --incompatible_enable_cc_toolchain_resolution

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.5.0
1+
7.6.1

WORKSPACE

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ load("//:internal.bzl", "internal_dependencies")
2525

2626
internal_dependencies()
2727

28+
load("@bazel_features//:deps.bzl", "bazel_features_deps")
29+
30+
bazel_features_deps()
31+
32+
load("@rules_cc//cc:extensions.bzl", "compatibility_proxy_repo")
33+
34+
compatibility_proxy_repo()
35+
2836
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
2937

3038
bazel_skylib_workspace()
@@ -54,10 +62,6 @@ load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_depende
5462

5563
rules_foreign_cc_dependencies()
5664

57-
load("@bazel_features//:deps.bzl", "bazel_features_deps")
58-
59-
bazel_features_deps()
60-
6165
load("@rules_python//python:repositories.bzl", "py_repositories")
6266

6367
py_repositories()

examples/hello_world_c/BUILD.bazel

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717

1818
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
1919
load("@bazel_skylib//rules:build_test.bzl", "build_test")
20-
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
2120

2221
build_test(
2322
name = "hello_world_c_build_test",
2423
targets = [
2524
":hello_world_c",
26-
":hello_world_c_linux_aarch64_tar",
27-
":hello_world_c_linux_armv7_tar",
25+
":hello_world_c_linux_aarch64",
26+
":hello_world_c_linux_armv7",
2827
],
2928
)
3029

@@ -39,22 +38,8 @@ platform_transition_filegroup(
3938
target_platform = "//platforms:aarch64_linux",
4039
)
4140

42-
pkg_tar(
43-
name = "hello_world_c_linux_aarch64_tar",
44-
srcs = [":hello_world_c_linux_aarch64"],
45-
include_runfiles = True,
46-
strip_prefix = "/",
47-
)
48-
4941
platform_transition_filegroup(
5042
name = "hello_world_c_linux_armv7",
5143
srcs = [":hello_world_c"],
5244
target_platform = "//platforms:armv7_linux",
5345
)
54-
55-
pkg_tar(
56-
name = "hello_world_c_linux_armv7_tar",
57-
srcs = [":hello_world_c_linux_armv7"],
58-
include_runfiles = True,
59-
strip_prefix = "/",
60-
)

examples/hello_world_cpp/BUILD.bazel

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717

1818
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
1919
load("@bazel_skylib//rules:build_test.bzl", "build_test")
20-
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
21-
load("//rules_cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
20+
load("//rules_cc:defs.bzl", "cc_binary", "cc_test")
2221

2322
build_test(
2423
name = "hello_world_cpp_build_test",
2524
targets = [
2625
":hello_world_cpp",
27-
":hello_world_cpp_linux_aarch64_tar",
28-
":hello_world_cpp_linux_armv7_tar",
26+
":hello_world_cpp_linux_aarch64",
27+
":hello_world_cpp_linux_armv7",
2928
],
3029
)
3130

@@ -47,26 +46,12 @@ platform_transition_filegroup(
4746
target_platform = "//platforms:aarch64_linux",
4847
)
4948

50-
pkg_tar(
51-
name = "hello_world_cpp_linux_aarch64_tar",
52-
srcs = [":hello_world_cpp_linux_aarch64"],
53-
include_runfiles = True,
54-
strip_prefix = "/",
55-
)
56-
5749
platform_transition_filegroup(
5850
name = "hello_world_cpp_linux_armv7",
5951
srcs = [":hello_world_cpp"],
6052
target_platform = "//platforms:armv7_linux",
6153
)
6254

63-
pkg_tar(
64-
name = "hello_world_cpp_linux_armv7_tar",
65-
srcs = [":hello_world_cpp_linux_armv7"],
66-
include_runfiles = True,
67-
strip_prefix = "/",
68-
)
69-
7055
cc_binary(
7156
name = "hello_world_cpp_static",
7257
srcs = ["main.cpp"],
@@ -80,22 +65,8 @@ platform_transition_filegroup(
8065
target_platform = "//platforms:aarch64_linux",
8166
)
8267

83-
pkg_tar(
84-
name = "hello_world_cpp_static_linux_aarch64_tar",
85-
srcs = [":hello_world_cpp_static_linux_aarch64"],
86-
include_runfiles = True,
87-
strip_prefix = "/",
88-
)
89-
9068
platform_transition_filegroup(
9169
name = "hello_world_cpp_static_linux_armv7",
9270
srcs = [":hello_world_cpp_static"],
9371
target_platform = "//platforms:armv7_linux",
9472
)
95-
96-
pkg_tar(
97-
name = "hello_world_cpp_static_linux_armv7_tar",
98-
srcs = [":hello_world_cpp_static_linux_armv7"],
99-
include_runfiles = True,
100-
strip_prefix = "/",
101-
)

examples/hello_world_fortran/BUILD.bazel

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717

1818
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
1919
load("@bazel_skylib//rules:build_test.bzl", "build_test")
20-
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
2120
load("//rules_fortran:defs.bzl", "fortran_binary")
2221

2322
build_test(
2423
name = "hello_world_fortran_build_test",
2524
targets = [
2625
":hello_world_fortran",
27-
":hello_world_fortran_aarch64_tar",
28-
":hello_world_fortran_armv7_tar",
26+
":hello_world_fortran_aarch64",
27+
":hello_world_fortran_armv7",
2928
],
3029
)
3130

@@ -40,22 +39,8 @@ platform_transition_filegroup(
4039
target_platform = "//platforms:aarch64_linux",
4140
)
4241

43-
pkg_tar(
44-
name = "hello_world_fortran_aarch64_tar",
45-
srcs = [":hello_world_fortran_aarch64"],
46-
include_runfiles = True,
47-
strip_prefix = "/",
48-
)
49-
5042
platform_transition_filegroup(
5143
name = "hello_world_fortran_armv7",
5244
srcs = [":hello_world_fortran"],
5345
target_platform = "//platforms:armv7_linux",
5446
)
55-
56-
pkg_tar(
57-
name = "hello_world_fortran_armv7_tar",
58-
srcs = [":hello_world_fortran_armv7"],
59-
include_runfiles = True,
60-
strip_prefix = "/",
61-
)

examples/openssl/BUILD.bazel

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
1919
load("@bazel_skylib//rules:build_test.bzl", "build_test")
2020
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make")
21-
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
2221

2322
build_test(
2423
name = "openssl_build_test",
2524
targets = [
2625
":openssl",
27-
":openssl_linux_aarch64_tar",
28-
":openssl_linux_armv7_tar",
26+
":openssl_linux_aarch64",
27+
":openssl_linux_armv7",
2928
],
3029
)
3130

@@ -62,22 +61,8 @@ platform_transition_filegroup(
6261
target_platform = "//platforms:aarch64_linux",
6362
)
6463

65-
pkg_tar(
66-
name = "openssl_linux_aarch64_tar",
67-
srcs = [":openssl_linux_aarch64"],
68-
include_runfiles = True,
69-
strip_prefix = "/",
70-
)
71-
7264
platform_transition_filegroup(
7365
name = "openssl_linux_armv7",
7466
srcs = [":openssl"],
7567
target_platform = "//platforms:armv7_linux",
7668
)
77-
78-
pkg_tar(
79-
name = "openssl_linux_armv7_tar",
80-
srcs = [":openssl_linux_armv7"],
81-
include_runfiles = True,
82-
strip_prefix = "/",
83-
)

examples/protobuf/BUILD.bazel

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
1919
load("@bazel_skylib//rules:build_test.bzl", "build_test")
2020
load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
21-
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
2221
load("@rules_proto//proto:defs.bzl", "proto_library")
2322

2423
build_test(
2524
name = "hello_world_cc_proto_build_test",
2625
targets = [
2726
":hello_world_cc_proto",
28-
":hello_world_cc_proto_linux_aarch64_tar",
29-
":hello_world_cc_proto_linux_armv7_tar",
27+
":hello_world_cc_proto_linux_aarch64",
28+
":hello_world_cc_proto_linux_armv7",
3029
],
3130
)
3231

@@ -46,22 +45,8 @@ platform_transition_filegroup(
4645
target_platform = "//platforms:aarch64_linux",
4746
)
4847

49-
pkg_tar(
50-
name = "hello_world_cc_proto_linux_aarch64_tar",
51-
srcs = [":hello_world_cc_proto_linux_aarch64"],
52-
include_runfiles = True,
53-
strip_prefix = "/",
54-
)
55-
5648
platform_transition_filegroup(
5749
name = "hello_world_cc_proto_linux_armv7",
5850
srcs = [":hello_world_cc_proto"],
5951
target_platform = "//platforms:armv7_linux",
6052
)
61-
62-
pkg_tar(
63-
name = "hello_world_cc_proto_linux_armv7_tar",
64-
srcs = [":hello_world_cc_proto_linux_armv7"],
65-
include_runfiles = True,
66-
strip_prefix = "/",
67-
)

examples/tabulate_fortran/BUILD.bazel

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717

1818
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
1919
load("@bazel_skylib//rules:build_test.bzl", "build_test")
20-
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
2120
load("//rules_fortran:defs.bzl", "fortran_binary")
2221

2322
build_test(
2423
name = "tabulate_fortran_build_test",
2524
targets = [
2625
":tabulate_fortran",
27-
":tabulate_fortran_aarch64_tar",
28-
":tabulate_fortran_armv7_tar",
26+
":tabulate_fortran_aarch64",
27+
":tabulate_fortran_armv7",
2928
],
3029
)
3130

@@ -47,22 +46,8 @@ platform_transition_filegroup(
4746
target_platform = "//platforms:aarch64_linux",
4847
)
4948

50-
pkg_tar(
51-
name = "tabulate_fortran_aarch64_tar",
52-
srcs = [":tabulate_fortran_aarch64"],
53-
include_runfiles = True,
54-
strip_prefix = "/",
55-
)
56-
5749
platform_transition_filegroup(
5850
name = "tabulate_fortran_armv7",
5951
srcs = [":tabulate_fortran"],
6052
target_platform = "//platforms:armv7_linux",
6153
)
62-
63-
pkg_tar(
64-
name = "tabulate_fortran_armv7_tar",
65-
srcs = [":tabulate_fortran_armv7"],
66-
include_runfiles = True,
67-
strip_prefix = "/",
68-
)

internal.bzl

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,18 @@
1818
"""Internal dependencies the users don't need."""
1919

2020
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
21-
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
2221

2322
load("//examples/lapack:patches.bzl", "LAPACK_PATCHES")
2423

2524
# buildifier: disable=function-docstring
2625
def internal_dependencies():
26+
http_archive(
27+
name = "bazel_features",
28+
sha256 = "c41853e3b636c533b86bf5ab4658064e6cc9db0a3bce52cbff0629e094344ca9",
29+
strip_prefix = "bazel_features-1.33.0",
30+
url = "https://github.com/bazel-contrib/bazel_features/releases/download/v1.33.0/bazel_features-v1.33.0.tar.gz",
31+
)
32+
2733
http_archive(
2834
name = "io_bazel_stardoc",
2935
sha256 = "dfbc364aaec143df5e6c52faf1f1166775a5b4408243f445f44b661cfdc3134f",
@@ -33,13 +39,6 @@ def internal_dependencies():
3339
],
3440
)
3541

36-
http_archive(
37-
name = "aspect_bazel_lib",
38-
sha256 = "a7e356f8a5cb8bf1e9be38c2c617ad22f5a1606792e839fc040971bdfbecf971",
39-
strip_prefix = "bazel-lib-1.40.2",
40-
url = "https://github.com/aspect-build/bazel-lib/archive/refs/tags/v1.40.2.tar.gz",
41-
)
42-
4342
http_archive(
4443
name = "rules_foreign_cc",
4544
sha256 = "32759728913c376ba45b0116869b71b68b1c2ebf8f2bcf7b41222bc07b773d73",
@@ -49,9 +48,9 @@ def internal_dependencies():
4948

5049
http_archive(
5150
name = "rules_python",
52-
sha256 = "7b9039c31e909cf59eeaea8ccbdc54f09f7ebaeb9609b94371c7de45e802977c",
53-
strip_prefix = "rules_python-1.5.0",
54-
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.5.0/rules_python-1.5.0.tar.gz",
51+
sha256 = "9f9f3b300a9264e4c77999312ce663be5dee9a56e361a1f6fe7ec60e1beef9a3",
52+
strip_prefix = "rules_python-1.4.1",
53+
url = "https://github.com/bazel-contrib/rules_python/releases/download/1.4.1/rules_python-1.4.1.tar.gz",
5554
)
5655

5756
http_archive(
@@ -90,11 +89,8 @@ def internal_dependencies():
9089

9190
http_archive(
9291
name = "rules_pkg",
93-
sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
94-
urls = [
95-
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
96-
"https://github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
97-
],
92+
sha256 = "b7215c636f22c1849f1c3142c72f4b954bb12bb8dcf3cbe229ae6e69cc6479db",
93+
url = "https://github.com/bazelbuild/rules_pkg/releases/download/1.1.0/rules_pkg-1.1.0.tar.gz",
9894
)
9995

10096
_ALL_SRCS = """\

0 commit comments

Comments
 (0)