Skip to content

alias() doesn't support surfacing a *_flag to the command line #20582

@afq984

Description

@afq984

Description of the feature request:

load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

config_setting(
    name = "my_flag_enabled",
    flag_values = {
        ":my_flag": "true",
    },
)

bool_flag(
    name = "my_flag",
    build_setting_default = False,
)

alias(
    name = "my_flag_alias",
    actual = ":my_flag",
)
bazelisk build --//:my_flag_alias //:my_flag_enabled
INFO: Invocation ID: 4dda7f49-80a0-4ae1-be58-37d1ebd1876d
ERROR: //:my_flag_alias :: Unrecognized option: //:my_flag_alias

Which category does this issue belong to?

Configurability

What underlying problem are you trying to solve with this feature?

We were trying to expose user-friendly flags aliases to generated repositories, so users don't have to type the full path of packages.

E.g. people can use --@portage//target/sys-apps/attr:2.5.1_incremental instead of --@portage//internal/packages/stage2/target/board/portage-stable/sys-apps/attr:2.5.1_incremental

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

development version

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

cat .bazelversion 
bbc4b12eb562de5e5daeec9700fa258dfdc5a51b

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

For our use case, we also need the alias's actual to be in a select.

e.g. something like alias(name = "incremental", actual = select({"//bazel/stage1": "//internal/stage1/pkg/incremental", "//bazel/stage2": "//internal/stage2/pkg/incremental"})

Not sure if it is something possible to support.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3We're not considering working on this, but happy to review a PR. (No assignee)team-Configurabilityplatforms, toolchains, cquery, select(), config transitionstype: feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions