Skip to content

Commit

Permalink
Removed protobuf as a core dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Feb 8, 2025
1 parent 2dd6fe2 commit ba18ddc
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .bazelci/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ tasks:
- //...
min_supported_version:
name: "Minimum Supported Version"
bazel: "6.5.0"
bazel: "7.4.1"
skip_in_bazel_downstream_pipeline: "Duplicates tests in other targets"
platform: ubuntu1804
build_targets:
Expand Down
2 changes: 1 addition & 1 deletion .bcr/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
matrix:
platform: ["centos7", "debian10", "macos", "ubuntu2004", "windows"]
bazel: ["6.x", "7.x"]
bazel: ["7.x"]

tasks:
verify_targets:
Expand Down
16 changes: 6 additions & 10 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
"bazel-contrib/rules_foreign_cc"
"""bazel-contrib/rules_foreign_cc"""

module(
name = "rules_foreign_cc",
version = "0.0.0",
compatibility_level = 1,
)

bazel_dep(name = "bazel_features", version = "1.15.0")
bazel_dep(name = "bazel_skylib", version = "1.3.0")
bazel_dep(name = "platforms", version = "0.0.5")
bazel_dep(name = "rules_cc", version = "0.0.17")
bazel_dep(name = "rules_python", version = "1.1.0-rc0")
bazel_dep(name = "bazel_features", version = "1.21.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "rules_python", version = "1.1.0")
bazel_dep(name = "rules_shell", version = "0.3.0")

# This is only here because of the docs generation!
bazel_dep(name = "protobuf", version = "29.3", repo_name = "com_google_protobuf")

# Dev dependencies
bazel_dep(name = "gazelle", version = "0.41.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.5.6", dev_dependency = True, repo_name = "io_bazel_stardoc")
bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
Expand Down
4 changes: 0 additions & 4 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

load("//:docs/stardoc_repository.bzl", "stardoc_repository")

stardoc_repository()

http_archive(
name = "bazelci_rules",
sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e",
Expand Down
45 changes: 39 additions & 6 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,48 +1,81 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
load("@rules_rust_mdbook//:defs.bzl", "mdbook", "mdbook_server")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")

# `rules_foreign_cc` does not use `protobuf` yet due to a
# deficiency in `rules_cc` the symbols in general being
# incorrectly included and `rules_cc` does not include
# the necessary symbols, leading to errors for consumers.
# This target aims to avoid this issue
# See https://github.com/bazelbuild/rules_cc/issues/274
bzl_library(
name = "rules_cc_deps",
visibility = ["//visibility:public"],
deps = [
"@com_google_protobuf//bazel:cc_proto_library_bzl",
],
)

stardoc(
name = "cmake_docs",
out = "src/cmake.md",
input = "@rules_foreign_cc//foreign_cc:cmake.bzl",
deps = ["@rules_foreign_cc//foreign_cc:cmake"],
deps = [
":rules_cc_deps",
"@rules_foreign_cc//foreign_cc:cmake",
],
)

stardoc(
name = "make_docs",
out = "src/make.md",
input = "@rules_foreign_cc//foreign_cc:make.bzl",
deps = ["@rules_foreign_cc//foreign_cc:make"],
deps = [
":rules_cc_deps",
"@rules_foreign_cc//foreign_cc:make",
],
)

stardoc(
name = "ninja_docs",
out = "src/ninja.md",
input = "@rules_foreign_cc//foreign_cc:ninja.bzl",
deps = ["@rules_foreign_cc//foreign_cc:ninja"],
deps = [
":rules_cc_deps",
"@rules_foreign_cc//foreign_cc:ninja",
],
)

stardoc(
name = "configure_make_docs",
out = "src/configure_make.md",
input = "@rules_foreign_cc//foreign_cc:configure.bzl",
deps = ["@rules_foreign_cc//foreign_cc:configure"],
deps = [
":rules_cc_deps",
"@rules_foreign_cc//foreign_cc:configure",
],
)

stardoc(
name = "meson_docs",
out = "src/meson.md",
input = "@rules_foreign_cc//foreign_cc:meson.bzl",
deps = ["@rules_foreign_cc//foreign_cc:meson"],
deps = [
":rules_cc_deps",
"@rules_foreign_cc//foreign_cc:meson",
],
)

stardoc(
name = "providers_docs",
out = "src/providers.md",
input = "@rules_foreign_cc//foreign_cc:providers.bzl",
deps = ["@rules_foreign_cc//foreign_cc:providers"],
deps = [
":rules_cc_deps",
"@rules_foreign_cc//foreign_cc:providers",
],
)

DOCS_TARGETS = [
Expand Down
7 changes: 6 additions & 1 deletion docs/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,10 @@ bazel_dep(
)
bazel_dep(
name = "rules_python",
version = "1.1.0-rc0",
version = "1.1.0",
)
bazel_dep(
name = "protobuf",
version = "29.3",
repo_name = "com_google_protobuf",
)
2 changes: 1 addition & 1 deletion examples/third_party/mesa/mesa_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def mesa_repositories():
],
sha256 = "670d8cbe8b72902a45ea2da68a9da4dc4a5d99c5953a926177adbce1b1640b76",
strip_prefix = "mesa-22.1.4",
url = "https://archive.mesa3d.org//mesa-22.1.4.tar.xz",
urls = ["https://archive.mesa3d.org/older-versions/22.x/mesa-22.1.4.tar.xz"],
)

maybe(
Expand Down
5 changes: 0 additions & 5 deletions foreign_cc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ bzl_library(
"//foreign_cc/private:transitions",
"//foreign_cc/private/framework:platform",
"//toolchains/native_tools:tool_access",
"@com_google_protobuf//bazel:cc_proto_library_bzl",
"@rules_cc//cc:bzl_srcs",
"@rules_cc//cc/common",
"@rules_cc//cc/toolchains:toolchain_rules",
Expand All @@ -45,7 +44,6 @@ bzl_library(
"//foreign_cc/private:framework",
"//foreign_cc/private:transitions",
"//toolchains/native_tools:tool_access",
"@com_google_protobuf//bazel:cc_proto_library_bzl",
"@rules_cc//cc:bzl_srcs",
"@rules_cc//cc/common",
"@rules_cc//cc/toolchains:toolchain_rules",
Expand Down Expand Up @@ -88,7 +86,6 @@ bzl_library(
"//foreign_cc/private:make_script",
"//foreign_cc/private:transitions",
"//toolchains/native_tools:tool_access",
"@com_google_protobuf//bazel:cc_proto_library_bzl",
"@rules_cc//cc:bzl_srcs",
"@rules_cc//cc/common",
"@rules_cc//cc/toolchains:toolchain_rules",
Expand All @@ -108,7 +105,6 @@ bzl_library(
"//foreign_cc/private:transitions",
"//toolchains/native_tools:native_tools_toolchain",
"//toolchains/native_tools:tool_access",
"@com_google_protobuf//bazel:cc_proto_library_bzl",
"@rules_cc//cc:bzl_srcs",
"@rules_cc//cc/common",
"@rules_cc//cc/toolchains:toolchain_rules",
Expand All @@ -124,7 +120,6 @@ bzl_library(
"//foreign_cc/private:detect_root",
"//foreign_cc/private:framework",
"//toolchains/native_tools:tool_access",
"@com_google_protobuf//bazel:cc_proto_library_bzl",
"@rules_cc//cc:bzl_srcs",
"@rules_cc//cc/common",
"@rules_cc//cc/toolchains:toolchain_rules",
Expand Down
15 changes: 6 additions & 9 deletions foreign_cc/private/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,19 @@ bzl_library(
deps = ["//foreign_cc:providers"],
)

bzl_library(
name = "detect_root",
srcs = ["detect_root.bzl"],
visibility = [
"//foreign_cc:__subpackages__",
"//test:__subpackages__",
],
)

bzl_library(
name = "detect_xcompile",
srcs = ["detect_xcompile.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
deps = ["//foreign_cc/private/framework:platform"],
)

bzl_library(
name = "detect_root",
srcs = ["detect_root.bzl"],
visibility = ["//foreign_cc:__subpackages__"],
)

bzl_library(
name = "run_shell_file_utils",
srcs = ["run_shell_file_utils.bzl"],
Expand Down
20 changes: 2 additions & 18 deletions test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load(":cmake_text_tests.bzl", "cmake_script_test_suite")
load(":convert_shell_script_test.bzl", "shell_script_conversion_suite")
load(":shell_script_helper_test_rule.bzl", "shell_script_helper_test_rule")
load(":symlink_contents_to_dir_test_rule.bzl", "symlink_contents_to_dir_test_rule")
load(":utils_test.bzl", "utils_test_suite")

# gazelle:exclude

cmake_script_test_suite()

shell_script_conversion_suite()
Expand Down Expand Up @@ -72,20 +73,3 @@ diff_test(
}),
file2 = ":symlink_dirs",
)

bzl_library(
name = "shell_script_helper_test_rule",
srcs = ["shell_script_helper_test_rule.bzl"],
visibility = ["//visibility:public"],
deps = ["//foreign_cc/private/framework:helpers"],
)

bzl_library(
name = "symlink_contents_to_dir_test_rule",
srcs = ["symlink_contents_to_dir_test_rule.bzl"],
visibility = ["//visibility:public"],
deps = [
"@rules_foreign_cc//foreign_cc/private:detect_root",
"@rules_foreign_cc//foreign_cc/private/framework:helpers",
],
)

0 comments on commit ba18ddc

Please sign in to comment.