Skip to content

Commit

Permalink
RBE
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre committed Dec 3, 2024
1 parent 28331a4 commit 9482410
Show file tree
Hide file tree
Showing 17 changed files with 188 additions and 29 deletions.
3 changes: 3 additions & 0 deletions extensions/bindgen/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ build --incompatible_merge_fixed_and_default_shell_env
## Bzlmod
###############################################################################

# A configuration for disabling bzlmod.
common:no-bzlmod --noenable_bzlmod --enable_workspace

# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock
common --lockfile_mode=off

Expand Down
15 changes: 15 additions & 0 deletions extensions/bindgen/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,18 @@ bazel_dep(
version = "0.7.0",
dev_dependency = True,
)
bazel_dep(
name = "bazel_ci_rules",
version = "1.0.0",
dev_dependency = True,
)

rust_ext_dev = use_extension(
"//private:internal_extensions.bzl",
"rust_ext_dev",
dev_dependency = True,
)
use_repo(
rust_ext_dev,
"buildkite_config",
)
26 changes: 26 additions & 0 deletions extensions/bindgen/private/internal_extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Bzlmod internal extensions"""

load("@bazel_ci_rules//:rbe_repo.bzl", "rbe_preconfig")

def _rust_ext_dev_impl(module_ctx):
deps = []

rbe_preconfig(
name = "buildkite_config",
toolchain = "ubuntu1804-bazel-java11",
)

deps.append(struct(repo = "buildkite_config"))

# is_dev_dep is ignored here. It's not relevant for internal_deps, as dev
# dependencies are only relevant for module extensions that can be used
# by other MODULES.
return module_ctx.extension_metadata(
root_module_direct_deps = [],
root_module_direct_dev_deps = [repo.repo for repo in deps],
)

rust_ext_dev = module_extension(
doc = "Development dependencies for the rules_rust_bindgen extension.",
implementation = _rust_ext_dev_impl,
)
3 changes: 3 additions & 0 deletions extensions/prost/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ build --incompatible_merge_fixed_and_default_shell_env
## Bzlmod
###############################################################################

# A configuration for disabling bzlmod.
common:no-bzlmod --noenable_bzlmod --enable_workspace

# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock
common --lockfile_mode=off

Expand Down
15 changes: 15 additions & 0 deletions extensions/prost/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,18 @@ bazel_dep(
dev_dependency = True,
repo_name = "com_google_googleapis",
)
bazel_dep(
name = "bazel_ci_rules",
version = "1.0.0",
dev_dependency = True,
)

rust_ext_dev = use_extension(
"//private:internal_extensions.bzl",
"rust_ext_dev",
dev_dependency = True,
)
use_repo(
rust_ext_dev,
"buildkite_config",
)
26 changes: 26 additions & 0 deletions extensions/prost/private/internal_extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Bzlmod internal extensions"""

load("@bazel_ci_rules//:rbe_repo.bzl", "rbe_preconfig")

def _rust_ext_dev_impl(module_ctx):
deps = []

rbe_preconfig(
name = "buildkite_config",
toolchain = "ubuntu1804-bazel-java11",
)

deps.append(struct(repo = "buildkite_config"))

# is_dev_dep is ignored here. It's not relevant for internal_deps, as dev
# dependencies are only relevant for module extensions that can be used
# by other MODULES.
return module_ctx.extension_metadata(
root_module_direct_deps = [],
root_module_direct_dev_deps = [repo.repo for repo in deps],
)

rust_ext_dev = module_extension(
doc = "Development dependencies for the rules_rust_prost extension.",
implementation = _rust_ext_dev_impl,
)
3 changes: 3 additions & 0 deletions extensions/protobuf/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ build --incompatible_merge_fixed_and_default_shell_env
## Bzlmod
###############################################################################

# A configuration for disabling bzlmod.
common:no-bzlmod --noenable_bzlmod --enable_workspace

# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock
common --lockfile_mode=off

Expand Down
5 changes: 0 additions & 5 deletions extensions/protobuf/3rdparty/patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,3 @@ For this crate, the patch that is applied is replacing the include! macro with
what would be generated by the build.rs file. This lets us avoid running the
build file altogether, at the expense of having to update the patch for every
version.


## com_google_protobuf-v3.10.0-bzl_visibility

The patches here provide the required visibility to `*.bzl` files used by the rules defined in `com_google_protobuf`.

This file was deleted.

16 changes: 16 additions & 0 deletions extensions/protobuf/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ bazel_dep(
repo_name = "com_google_protobuf",
)

bazel_dep(
name = "bazel_ci_rules",
version = "1.0.0",
dev_dependency = True,
)

rust_ext = use_extension("//:extensions.bzl", "rust_ext")
use_repo(
rust_ext,
Expand All @@ -51,3 +57,13 @@ use_repo(
register_toolchains(
"//:default_proto_toolchain",
)

rust_ext_dev = use_extension(
"//private:internal_extensions.bzl",
"rust_ext_dev",
dev_dependency = True,
)
use_repo(
rust_ext_dev,
"buildkite_config",
)
Empty file.
26 changes: 26 additions & 0 deletions extensions/protobuf/private/internal_extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Bzlmod internal extensions"""

load("@bazel_ci_rules//:rbe_repo.bzl", "rbe_preconfig")

def _rust_ext_dev_impl(module_ctx):
deps = []

rbe_preconfig(
name = "buildkite_config",
toolchain = "ubuntu1804-bazel-java11",
)

deps.append(struct(repo = "buildkite_config"))

# is_dev_dep is ignored here. It's not relevant for internal_deps, as dev
# dependencies are only relevant for module extensions that can be used
# by other MODULES.
return module_ctx.extension_metadata(
root_module_direct_deps = [],
root_module_direct_dev_deps = [repo.repo for repo in deps],
)

rust_ext_dev = module_extension(
doc = "Development dependencies for the rules_rust_protobuf extension.",
implementation = _rust_ext_dev_impl,
)
13 changes: 3 additions & 10 deletions extensions/protobuf/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,9 @@ def rust_proto_protobuf_dependencies(bzlmod = False):
maybe(
http_archive,
name = "com_google_protobuf",
sha256 = "758249b537abba2f21ebc2d02555bf080917f0f2f88f4cbe2903e0e28c4187ed",
strip_prefix = "protobuf-3.10.0",
urls = [
"https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.10.0.tar.gz",
"https://github.com/protocolbuffers/protobuf/archive/v3.10.0.tar.gz",
],
patch_args = ["-p1"],
patches = [
Label("//3rdparty/patches:com_google_protobuf-v3.10.0-bzl_visibility.patch"),
],
integrity = "sha256-4HBG+6xDKwWtwf0TGMbxmrGw7AZV9/TnRifZcTlZoTU=",
strip_prefix = "protobuf-21.7",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protobuf-all-21.7.tar.gz"],
)

return crate_repositories()
Expand Down
3 changes: 3 additions & 0 deletions extensions/protobuf/transitive_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
load("@bazel_features//:deps.bzl", "bazel_features_deps")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")

def rust_proto_protobuf_transitive_repositories():
Expand All @@ -25,3 +26,5 @@ def rust_proto_protobuf_transitive_repositories():
"https://storage.googleapis.com/mirror.tensorflow.org/zlib.net/zlib-1.2.11.tar.gz",
],
)

protobuf_deps()
3 changes: 3 additions & 0 deletions extensions/wasm_bindgen/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ build --incompatible_merge_fixed_and_default_shell_env
## Bzlmod
###############################################################################

# A configuration for disabling bzlmod.
common:no-bzlmod --noenable_bzlmod --enable_workspace

# Disable the bzlmod lockfile, so we don't accidentally commit MODULE.bazel.lock
common --lockfile_mode=off

Expand Down
20 changes: 20 additions & 0 deletions extensions/wasm_bindgen/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ bazel_dep(
name = "bazel_skylib",
version = "1.7.1",
)
bazel_dep(
name = "platforms",
version = "0.0.10",
)
bazel_dep(
name = "rules_cc",
version = "0.0.17",
Expand Down Expand Up @@ -58,3 +62,19 @@ register_toolchains(
"@rules_rust//rust/private/dummy_cc_toolchain:dummy_cc_wasm32_toolchain",
"@rules_rust//rust/private/dummy_cc_toolchain:dummy_cc_wasm64_toolchain",
)

bazel_dep(
name = "bazel_ci_rules",
version = "1.0.0",
dev_dependency = True,
)

rust_ext_dev = use_extension(
"//private:internal_extensions.bzl",
"rust_ext_dev",
dev_dependency = True,
)
use_repo(
rust_ext_dev,
"buildkite_config",
)
26 changes: 26 additions & 0 deletions extensions/wasm_bindgen/private/internal_extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Bzlmod internal extensions"""

load("@bazel_ci_rules//:rbe_repo.bzl", "rbe_preconfig")

def _rust_ext_dev_impl(module_ctx):
deps = []

rbe_preconfig(
name = "buildkite_config",
toolchain = "ubuntu1804-bazel-java11",
)

deps.append(struct(repo = "buildkite_config"))

# is_dev_dep is ignored here. It's not relevant for internal_deps, as dev
# dependencies are only relevant for module extensions that can be used
# by other MODULES.
return module_ctx.extension_metadata(
root_module_direct_deps = [],
root_module_direct_dev_deps = [repo.repo for repo in deps],
)

rust_ext_dev = module_extension(
doc = "Development dependencies for the rules_rust_wasm_bindgen extension.",
implementation = _rust_ext_dev_impl,
)

0 comments on commit 9482410

Please sign in to comment.