Skip to content
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

Bazel throws an error if the same dep appear in two select expressions #483

Open
jgao54 opened this issue Apr 28, 2022 · 2 comments
Open

Comments

@jgao54
Copy link

jgao54 commented Apr 28, 2022

Currently Bazel will throw an error while parsing a build file if it identifies the same dep appearing in two select expressions being added together.

I encountered this issue with the raze-generated BUILD.sha2-0.9.5.bazel file:

rust_library(
    name = "sha2",
    srcs = glob(["**/*.rs"]),
    aliases = {
    },
    crate_features = [
        "default",
        "std",
    ],
    crate_root = "src/lib.rs",
    data = [],
    edition = "2018",
    rustc_flags = [
        "--cap-lints=allow",
    ],
    tags = [
        "cargo-raze",
        "crate-name=sha2",
        "manual",
    ],
    version = "0.9.5",
    # buildifier: leave-alone
    deps = [
        "@raze__block_buffer__0_9_0//:block_buffer",
        "@raze__cfg_if__1_0_0//:cfg_if",
        "@raze__digest__0_9_0//:digest",
        "@raze__opaque_debug__0_3_0//:opaque_debug",
    ] + selects.with_or({
        # aarch64-apple-darwin
        (
            "@rules_rust//rust/platform:aarch64-apple-darwin",
        ): [
            "@raze__cpufeatures__0_1_4//:cpufeatures",
        ],
        "//conditions:default": [],
    }) + selects.with_or({
        # cfg(any(target_arch = "x86", target_arch = "x86_64"))
        (
            "@rules_rust//rust/platform:x86_64-apple-darwin",
            "@rules_rust//rust/platform:x86_64-unknown-linux-gnu",
        ): [
            "@raze__cpufeatures__0_1_4//:cpufeatures",
        ],
        "//conditions:default": [],
    }),
)

This will result in the following error during parsing of the build file:

ERROR: Label '@raze__cpufeatures__0_1_4//:cpufeatures' is duplicated in the 'deps' attribute of rule 'sha2'
@sayrer
Copy link
Contributor

sayrer commented Jun 29, 2022

#512 should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@sayrer @jgao54 and others