Skip to content

Commit 6491a0c

Browse files
authored
Move protobuf to a dev dependency (#1363)
1 parent 2dd6fe2 commit 6491a0c

File tree

10 files changed

+62
-56
lines changed

10 files changed

+62
-56
lines changed

.bazelci/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ tasks:
234234
- //...
235235
min_supported_version:
236236
name: "Minimum Supported Version"
237-
bazel: "6.5.0"
237+
bazel: "7.4.1"
238238
skip_in_bazel_downstream_pipeline: "Duplicates tests in other targets"
239239
platform: ubuntu1804
240240
build_targets:

.bcr/presubmit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
matrix:
22
platform: ["centos7", "debian10", "macos", "ubuntu2004", "windows"]
3-
bazel: ["6.x", "7.x"]
3+
bazel: ["7.x"]
44

55
tasks:
66
verify_targets:

MODULE.bazel

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
"bazel-contrib/rules_foreign_cc"
1+
"""bazel-contrib/rules_foreign_cc"""
22

33
module(
44
name = "rules_foreign_cc",
55
version = "0.0.0",
66
compatibility_level = 1,
77
)
88

9-
bazel_dep(name = "bazel_features", version = "1.15.0")
10-
bazel_dep(name = "bazel_skylib", version = "1.3.0")
11-
bazel_dep(name = "platforms", version = "0.0.5")
12-
bazel_dep(name = "rules_cc", version = "0.0.17")
13-
bazel_dep(name = "rules_python", version = "1.1.0-rc0")
9+
bazel_dep(name = "bazel_features", version = "1.21.0")
10+
bazel_dep(name = "bazel_skylib", version = "1.7.1")
11+
bazel_dep(name = "platforms", version = "0.0.11")
12+
bazel_dep(name = "rules_cc", version = "0.1.1")
13+
bazel_dep(name = "rules_python", version = "1.1.0")
1414
bazel_dep(name = "rules_shell", version = "0.3.0")
1515

16-
# This is only here because of the docs generation!
17-
bazel_dep(name = "protobuf", version = "29.3", repo_name = "com_google_protobuf")
18-
1916
# Dev dependencies
2017
bazel_dep(name = "gazelle", version = "0.41.0", dev_dependency = True, repo_name = "bazel_gazelle")
2118
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependency = True)
22-
bazel_dep(name = "stardoc", version = "0.5.6", dev_dependency = True, repo_name = "io_bazel_stardoc")
2319
bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)
2420

2521
python = use_extension("@rules_python//python/extensions:python.bzl", "python")

WORKSPACE.bazel

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
3737

3838
protobuf_deps()
3939

40-
load("//:docs/stardoc_repository.bzl", "stardoc_repository")
41-
42-
stardoc_repository()
43-
4440
http_archive(
4541
name = "bazelci_rules",
4642
sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e",

docs/BUILD.bazel

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,81 @@
1+
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
12
load("@bazel_skylib//rules:build_test.bzl", "build_test")
23
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
34
load("@rules_rust_mdbook//:defs.bzl", "mdbook", "mdbook_server")
45
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
56

7+
# `rules_foreign_cc` does not use `protobuf` yet due to a
8+
# deficiency in `rules_cc` the symbols in general being
9+
# incorrectly included and `rules_cc` does not include
10+
# the necessary symbols, leading to errors for consumers.
11+
# This target aims to avoid this issue
12+
# See https://github.com/bazelbuild/rules_cc/issues/274
13+
bzl_library(
14+
name = "rules_cc_deps",
15+
visibility = ["//visibility:public"],
16+
deps = [
17+
"@com_google_protobuf//bazel:cc_proto_library_bzl",
18+
],
19+
)
20+
621
stardoc(
722
name = "cmake_docs",
823
out = "src/cmake.md",
924
input = "@rules_foreign_cc//foreign_cc:cmake.bzl",
10-
deps = ["@rules_foreign_cc//foreign_cc:cmake"],
25+
deps = [
26+
":rules_cc_deps",
27+
"@rules_foreign_cc//foreign_cc:cmake",
28+
],
1129
)
1230

1331
stardoc(
1432
name = "make_docs",
1533
out = "src/make.md",
1634
input = "@rules_foreign_cc//foreign_cc:make.bzl",
17-
deps = ["@rules_foreign_cc//foreign_cc:make"],
35+
deps = [
36+
":rules_cc_deps",
37+
"@rules_foreign_cc//foreign_cc:make",
38+
],
1839
)
1940

2041
stardoc(
2142
name = "ninja_docs",
2243
out = "src/ninja.md",
2344
input = "@rules_foreign_cc//foreign_cc:ninja.bzl",
24-
deps = ["@rules_foreign_cc//foreign_cc:ninja"],
45+
deps = [
46+
":rules_cc_deps",
47+
"@rules_foreign_cc//foreign_cc:ninja",
48+
],
2549
)
2650

2751
stardoc(
2852
name = "configure_make_docs",
2953
out = "src/configure_make.md",
3054
input = "@rules_foreign_cc//foreign_cc:configure.bzl",
31-
deps = ["@rules_foreign_cc//foreign_cc:configure"],
55+
deps = [
56+
":rules_cc_deps",
57+
"@rules_foreign_cc//foreign_cc:configure",
58+
],
3259
)
3360

3461
stardoc(
3562
name = "meson_docs",
3663
out = "src/meson.md",
3764
input = "@rules_foreign_cc//foreign_cc:meson.bzl",
38-
deps = ["@rules_foreign_cc//foreign_cc:meson"],
65+
deps = [
66+
":rules_cc_deps",
67+
"@rules_foreign_cc//foreign_cc:meson",
68+
],
3969
)
4070

4171
stardoc(
4272
name = "providers_docs",
4373
out = "src/providers.md",
4474
input = "@rules_foreign_cc//foreign_cc:providers.bzl",
45-
deps = ["@rules_foreign_cc//foreign_cc:providers"],
75+
deps = [
76+
":rules_cc_deps",
77+
"@rules_foreign_cc//foreign_cc:providers",
78+
],
4679
)
4780

4881
DOCS_TARGETS = [

docs/MODULE.bazel

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,10 @@ bazel_dep(
3030
)
3131
bazel_dep(
3232
name = "rules_python",
33-
version = "1.1.0-rc0",
33+
version = "1.1.0",
34+
)
35+
bazel_dep(
36+
name = "protobuf",
37+
version = "29.3",
38+
repo_name = "com_google_protobuf",
3439
)

examples/third_party/mesa/mesa_repositories.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def mesa_repositories():
2626
],
2727
sha256 = "670d8cbe8b72902a45ea2da68a9da4dc4a5d99c5953a926177adbce1b1640b76",
2828
strip_prefix = "mesa-22.1.4",
29-
url = "https://archive.mesa3d.org//mesa-22.1.4.tar.xz",
29+
urls = ["https://archive.mesa3d.org/older-versions/22.x/mesa-22.1.4.tar.xz"],
3030
)
3131

3232
maybe(

foreign_cc/BUILD.bazel

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ bzl_library(
2727
"//foreign_cc/private:transitions",
2828
"//foreign_cc/private/framework:platform",
2929
"//toolchains/native_tools:tool_access",
30-
"@com_google_protobuf//bazel:cc_proto_library_bzl",
3130
"@rules_cc//cc:bzl_srcs",
3231
"@rules_cc//cc/common",
3332
"@rules_cc//cc/toolchains:toolchain_rules",
@@ -45,7 +44,6 @@ bzl_library(
4544
"//foreign_cc/private:framework",
4645
"//foreign_cc/private:transitions",
4746
"//toolchains/native_tools:tool_access",
48-
"@com_google_protobuf//bazel:cc_proto_library_bzl",
4947
"@rules_cc//cc:bzl_srcs",
5048
"@rules_cc//cc/common",
5149
"@rules_cc//cc/toolchains:toolchain_rules",
@@ -88,7 +86,6 @@ bzl_library(
8886
"//foreign_cc/private:make_script",
8987
"//foreign_cc/private:transitions",
9088
"//toolchains/native_tools:tool_access",
91-
"@com_google_protobuf//bazel:cc_proto_library_bzl",
9289
"@rules_cc//cc:bzl_srcs",
9390
"@rules_cc//cc/common",
9491
"@rules_cc//cc/toolchains:toolchain_rules",
@@ -108,7 +105,6 @@ bzl_library(
108105
"//foreign_cc/private:transitions",
109106
"//toolchains/native_tools:native_tools_toolchain",
110107
"//toolchains/native_tools:tool_access",
111-
"@com_google_protobuf//bazel:cc_proto_library_bzl",
112108
"@rules_cc//cc:bzl_srcs",
113109
"@rules_cc//cc/common",
114110
"@rules_cc//cc/toolchains:toolchain_rules",
@@ -124,7 +120,6 @@ bzl_library(
124120
"//foreign_cc/private:detect_root",
125121
"//foreign_cc/private:framework",
126122
"//toolchains/native_tools:tool_access",
127-
"@com_google_protobuf//bazel:cc_proto_library_bzl",
128123
"@rules_cc//cc:bzl_srcs",
129124
"@rules_cc//cc/common",
130125
"@rules_cc//cc/toolchains:toolchain_rules",

foreign_cc/private/BUILD.bazel

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,19 @@ bzl_library(
7575
deps = ["//foreign_cc:providers"],
7676
)
7777

78-
bzl_library(
79-
name = "detect_root",
80-
srcs = ["detect_root.bzl"],
81-
visibility = [
82-
"//foreign_cc:__subpackages__",
83-
"//test:__subpackages__",
84-
],
85-
)
86-
8778
bzl_library(
8879
name = "detect_xcompile",
8980
srcs = ["detect_xcompile.bzl"],
9081
visibility = ["//foreign_cc:__subpackages__"],
9182
deps = ["//foreign_cc/private/framework:platform"],
9283
)
9384

85+
bzl_library(
86+
name = "detect_root",
87+
srcs = ["detect_root.bzl"],
88+
visibility = ["//foreign_cc:__subpackages__"],
89+
)
90+
9491
bzl_library(
9592
name = "run_shell_file_utils",
9693
srcs = ["run_shell_file_utils.bzl"],

test/BUILD.bazel

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
21
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
32
load(":cmake_text_tests.bzl", "cmake_script_test_suite")
43
load(":convert_shell_script_test.bzl", "shell_script_conversion_suite")
54
load(":shell_script_helper_test_rule.bzl", "shell_script_helper_test_rule")
65
load(":symlink_contents_to_dir_test_rule.bzl", "symlink_contents_to_dir_test_rule")
76
load(":utils_test.bzl", "utils_test_suite")
87

8+
# gazelle:exclude
9+
910
cmake_script_test_suite()
1011

1112
shell_script_conversion_suite()
@@ -72,20 +73,3 @@ diff_test(
7273
}),
7374
file2 = ":symlink_dirs",
7475
)
75-
76-
bzl_library(
77-
name = "shell_script_helper_test_rule",
78-
srcs = ["shell_script_helper_test_rule.bzl"],
79-
visibility = ["//visibility:public"],
80-
deps = ["//foreign_cc/private/framework:helpers"],
81-
)
82-
83-
bzl_library(
84-
name = "symlink_contents_to_dir_test_rule",
85-
srcs = ["symlink_contents_to_dir_test_rule.bzl"],
86-
visibility = ["//visibility:public"],
87-
deps = [
88-
"@rules_foreign_cc//foreign_cc/private:detect_root",
89-
"@rules_foreign_cc//foreign_cc/private/framework:helpers",
90-
],
91-
)

0 commit comments

Comments
 (0)