Skip to content

--use_top_level_targets_for_symlinks doesn't apply through alias() targets #14602

@keith

Description

@keith

With this BUILD file:

load("@build_bazel_rules_apple//apple:macos.bzl", "macos_command_line_application")

alias(
    name = "alias",
    actual = "cli",
)

cc_library(
    name = "lib",
    srcs = ["main.c"],
)

macos_command_line_application(
    name = "cli",
    minimum_os_version = "10.10",
    deps = ["lib"],
)

Building the CI directly with --use_top_level_targets_for_symlinks correctly results in a top level symlink:

% bazel build cli  --use_top_level_targets_for_symlinks
INFO: Analyzed target //:cli (23 packages loaded, 387 targets configured).
INFO: Found 1 target...
Target //:cli up-to-date:
  bazel-bin/cli
INFO: Elapsed time: 2.727s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action

But building the alias target still uses the transition path:

% bazel build alias --use_top_level_targets_for_symlinks
INFO: Analyzed target //:alias (0 packages loaded, 1 target configured).
INFO: Found 1 target...
Target //:cli up-to-date:
  bazel-out/applebin_macos-darwin_x86_64-fastbuild-ST-45701c223259/bin/cli
INFO: Elapsed time: 0.218s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action

repro project: aliasrepro.zip

What operating system are you running Bazel on?

macOS

What's the output of bazel info release?

release 5.0.0 (not a regression, also repros on 4.2.2)

Metadata

Metadata

Labels

P2We'll consider working on this in future. (Assignee optional)team-Configurabilityplatforms, toolchains, cquery, select(), config transitionstype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions