Skip to content

aliases: package name with hyphens not being matched #1983

Open
@aristotle9

Description

@aristotle9

rules_rust version:

# To find additional information on this release or newer ones visit:
# https://github.com/bazelbuild/rules_rust/releases
http_archive(
    name = "rules_rust",  #0.22.0, 2023-05-22
    sha256 = "50272c39f20a3a3507cb56dcb5c3b348bda697a7d868708449e2fa6fb893444c",
    urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.22.0/rules_rust-v0.22.0.tar.gz"],
)

part of Cargo.toml:

[dependencies]
term_color = { package = "owo-colors", version = "3.6" }

[patch.crates-io]
owo-colors = { git = "https://github.com/jam1garner/owo-colors.git", rev = "509f6e68cfe0ce7e062837f60b33b0d9e0e5e374" }

BUILD.bazel:

load("@rules_rust//rust:defs.bzl", "rust_binary")
load("@crate_index//:defs.bzl", "aliases", "all_crate_deps")

print(aliases())

rust_binary(
    name = "main",
    srcs = glob(["src/**/*.rs"]),
    edition = "2021",
    aliases = aliases(),
    proc_macro_deps = all_crate_deps(
        proc_macro = True,
    ),
    deps = all_crate_deps(
        normal = True,
    ),
)

Error:

% bazel build --color=yes --subcommands --strip=always --compilation_mode=opt \
	--@rules_rust//:extra_rustc_flags="-C,panic=abort,-C,debuginfo=2,-C,opt-level=3" \
	//:main
DEBUG: /Users/user1/src/rust/some-test/BUILD.bazel:4:6: {"@crate_index__owo-colors-3.6.0//:owo-colors": "term_color"}
ERROR: /Users/user1/src/rust/some-test/BUILD.bazel:6:12: no such target '@crate_index__owo-colors-3.6.0//:owo-colors': target 'owo-colors' not declared in package '' defined by /private/var/tmp/_bazel_user1/81d27ea67214ab39b28fce880af4107d/external/crate_index__owo-colors-3.6.0/BUILD.bazel (did you mean 'owo_colors'? Tip: use `query "@crate_index__owo-colors-3.6.0//:*"` to see all the targets in that package) and referenced by '//:main'
ERROR: Analysis of target '//:main' failed; build aborted: Analysis failed
INFO: Elapsed time: 2.521s
INFO: 0 processes.
% bazel query "@crate_index__owo-colors-3.6.0//:*"
@crate_index__owo-colors-3.6.0//:.github/dependabot.yml
@crate_index__owo-colors-3.6.0//:.github/workflows/ci.yml
@crate_index__owo-colors-3.6.0//:.gitignore
@crate_index__owo-colors-3.6.0//:BUILD.bazel
@crate_index__owo-colors-3.6.0//:Cargo.toml
@crate_index__owo-colors-3.6.0//:LICENSE
@crate_index__owo-colors-3.6.0//:README.md
@crate_index__owo-colors-3.6.0//:examples/all_xterm_colors.rs
@crate_index__owo-colors-3.6.0//:examples/banner.rs
@crate_index__owo-colors-3.6.0//:examples/colors.rs
@crate_index__owo-colors-3.6.0//:examples/custom_colors.rs
@crate_index__owo-colors-3.6.0//:examples/dyn_colors.rs
@crate_index__owo-colors-3.6.0//:examples/extra_colors.rs
@crate_index__owo-colors-3.6.0//:examples/override.rs
@crate_index__owo-colors-3.6.0//:examples/supports_color.rs
@crate_index__owo-colors-3.6.0//:owo_colors
@crate_index__owo-colors-3.6.0//:src/colors.rs
@crate_index__owo-colors-3.6.0//:src/colors/css.rs
@crate_index__owo-colors-3.6.0//:src/colors/custom.rs
@crate_index__owo-colors-3.6.0//:src/colors/dynamic.rs
@crate_index__owo-colors-3.6.0//:src/colors/xterm.rs
@crate_index__owo-colors-3.6.0//:src/combo.rs
@crate_index__owo-colors-3.6.0//:src/dyn_colors.rs
@crate_index__owo-colors-3.6.0//:src/dyn_styles.rs
@crate_index__owo-colors-3.6.0//:src/lib.rs
@crate_index__owo-colors-3.6.0//:src/overrides.rs
@crate_index__owo-colors-3.6.0//:src/styled_list.rs
@crate_index__owo-colors-3.6.0//:src/styles.rs
@crate_index__owo-colors-3.6.0//:src/supports_colors.rs
@crate_index__owo-colors-3.6.0//:src/tests.rs
Loading: 0 packages loaded

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions