Skip to content

fix missing alias_rules.bzl file #3505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions crate_universe/private/crates_vendor.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,15 @@ call against the generated workspace. The following table describes how to contr

def _crates_vendor_remote_repository_impl(repository_ctx):
build_file = repository_ctx.path(repository_ctx.attr.build_file)
defs_module = repository_ctx.path(repository_ctx.attr.defs_module)

repository_ctx.file("BUILD.bazel", repository_ctx.read(build_file))

defs_module = repository_ctx.path(repository_ctx.attr.defs_module)
repository_ctx.file("defs.bzl", repository_ctx.read(defs_module))

if repository_ctx.attr.alias_rules_module:
alias_rules_module = repository_ctx.path(repository_ctx.attr.alias_rules_module)
repository_ctx.file("alias_rules.bzl", repository_ctx.read(alias_rules_module))

repository_ctx.file("crates.bzl", "")
repository_ctx.file("WORKSPACE.bazel", """workspace(name = "{}")""".format(
repository_ctx.name,
Expand All @@ -679,6 +684,12 @@ crates_vendor_remote_repository = repository_rule(
doc = "Creates a repository paired with `crates_vendor` targets using the `remote` vendor mode.",
implementation = _crates_vendor_remote_repository_impl,
attrs = {
"alias_rules_module": attr.label(
doc = "The `alias_rules.bzl` file to use in the repository",
# Not mandatory because making it mandatory would break all current vendors,
# making it very hard to re-vendor without manually changing the files.
mandatory = False,
),
"build_file": attr.label(
doc = "The BUILD file to use for the root package",
mandatory = True,
Expand Down
2 changes: 1 addition & 1 deletion crate_universe/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl AliasRule {
match self {
AliasRule::Alias => None,
AliasRule::Dbg | AliasRule::Fastbuild | AliasRule::Opt => {
Some("//:alias_rules.bzl".to_owned())
Some(":alias_rules.bzl".to_owned())
}
AliasRule::Custom { bzl, .. } => Some(bzl.clone()),
}
Expand Down
1 change: 1 addition & 0 deletions crate_universe/src/rendering/templates/vendor_module.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def crate_repositories():
maybe(
crates_vendor_remote_repository,
name = "{{ repository_name }}",
alias_rules_module = Label("{{ crates_module_label(file="alias_rules.bzl") }}"),
build_file = Label("{{ crates_module_label(file="BUILD.bazel") }}"),
defs_module = Label("{{ crates_module_label(file="defs.bzl") }}"),
)
Expand Down