Skip to content

Commit

Permalink
Add bzlmod crate universe to CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
matts1 committed Mar 17, 2023
1 parent 7343c4d commit d52c31d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
10 changes: 8 additions & 2 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,18 @@ tasks:
- "//..."
build_flags: *aspects_flags
soft_fail: yes
ubuntu2004_examples_bzlmod:
name: Bzlmod Examples
ubuntu2004_examples_bzlmod_hello_world:
name: Bzlmod hello world example
platform: ubuntu2004
working_directory: examples/bzlmod/hello_world
build_targets:
- "//..."
ubuntu2004_examples_bzlmod_crate_universe:
name: Bzlmod crate universe examples
platform: ubuntu2004
working_directory: examples/bzlmod/crate_universe
build_targets:
- "//..."
rbe_ubuntu1604_examples:
name: Examples
platform: rbe_ubuntu1604
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ bazel_dep(name = "bazel_skylib", version = "1.2.0")
bazel_dep(
name = "apple_support",
repo_name = "build_bazel_apple_support",
version = "1.4.0"
version = "1.3.2"
)

non_bzlmod_deps = use_extension("//bzlmod/private/non_bzlmod_deps:non_bzlmod_deps.bzl", "non_bzlmod_deps")
Expand Down
8 changes: 4 additions & 4 deletions bzlmod/private/crate/crate.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ load("//rust/platform:triple.bzl", "get_host_triple")
load("//crate_universe/private:crates_vendor.bzl", "CRATES_VENDOR_ATTRS", "write_config_file", "write_splicing_manifest", _crates_vendor_repo_rule = "crates_vendor")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
load("//bzlmod/private:symlink_repo.bzl", "symlink_repo")
load("//bzlmod/private:generate_repo.bzl", "generate_repo")
load("//bzlmod/private/cargo_bazel_bootstrap:cargo_bazel_bootstrap.bzl", "get_cargo_bazel_runner")
load("//bzlmod/private/crate/tag_classes:annotation.bzl", "annotation_tags_to_json", annotation_tag = "annotation")
load("//bzlmod/private/crate/tag_classes:from_cargo.bzl", from_cargo_tag = "from_cargo")
Expand Down Expand Up @@ -113,10 +113,10 @@ def _crate_impl(module_ctx):
])

crates_dir = tag_path.get_child(repo_name)
symlink_repo(
generate_repo(
name = repo_name,
files = {
"BUILD.bazel": str(crates_dir.get_child("BUILD.bazel")),
contents = {
"BUILD.bazel": module_ctx.read(crates_dir.get_child("BUILD.bazel")),
},
)

Expand Down
10 changes: 10 additions & 0 deletions bzlmod/private/generate_repo.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def _generate_repo_impl(repo_ctx):
for path, contents in repo_ctx.attr.contents.items():
repo_ctx.file(path, contents)

generate_repo = repository_rule(
implementation = _generate_repo_impl,
attrs = dict(
contents = attr.string_dict(mandatory = True),
),
)
10 changes: 0 additions & 10 deletions bzlmod/private/symlink_repo.bzl

This file was deleted.

0 comments on commit d52c31d

Please sign in to comment.