-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Get the name of current repository from macro #10923
Copy link
Copy link
Closed
Labels
P3We're not considering working on this, but happy to review a PR. (No assignee)We're not considering working on this, but happy to review a PR. (No assignee)team-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.External dependency handling, remote repositiories, WORKSPACE file.type: feature request
Description
Description of the problem / feature request:
I am trying to get the name of the current repository from a macro.
.
├── a
│ ├── BUILD.bazel
│ ├── WORKSPACE
│ ├── empty.txt
│ └── txt_files.bzl
└── b
├── BUILD.bazel
├── WORKSPACE
└── empty2.txt
(see full example here )
I want that if repo b will call the macro in @a//:txt_files.bzl then somehow I'd be able to retrieve that it was called from repo b.
Right now (not sure if it's a bug or work as intended) - calling native.repository_name() will return @ and not the name of repo as declared in its WORKSPACE file.
Feature requests: what underlying problem are you trying to solve with this feature?
I want to change the behavior of a macro based on the callee repository.
Can we allow native.repository_name() to return the explicit name of the repository and not @? To maintain backward compatibility - I assume it would be better if we add a flag to this method that will be turned off by default.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3We're not considering working on this, but happy to review a PR. (No assignee)We're not considering working on this, but happy to review a PR. (No assignee)team-ExternalDepsExternal dependency handling, remote repositiories, WORKSPACE file.External dependency handling, remote repositiories, WORKSPACE file.type: feature request