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
Feature request: allow labels as path argument of local_repository rule #11573
Comments
@stefanheule FYI |
…roject. * Use local repositories for local build, but fall back to git repositories for 3rd party build. This is necessary due to bazelbuild/bazel#11573 * Rename lex -> flex. * Ignore bazel sub-projects so `bazel build //...` works.
…roject. * Use local repositories for local build, but fall back to git repositories for 3rd party build. This is necessary due to bazelbuild/bazel#11573 * Rename lex -> flex. * Ignore bazel sub-projects so `bazel build //...` works.
…roject. * Use local repositories for local build, but fall back to git repositories for 3rd party build. This is necessary due to bazelbuild/bazel#11573 * Rename lex -> flex. * Ignore bazel sub-projects so `bazel build //...` works.
Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team ( |
@bazelbuild/triage please review this issue; i believe it is a valid feature request. |
Description of feature request:
The
path
argument of thelocal_repository
rule can currently be only a relative or absolute path, see https://docs.bazel.build/versions/master/be/workspace.html#local_repository_args.This request asks to support labels as well.
What underlying problem are you trying to solve with this feature?
Projects using the
local_repository
rule are currently not compositional in the sense that they brake when nested inside other Bazel projects. The root cause is that relative paths are resolved with respect to the including project instead of the included project.Details
To allow the nested use of bazel projects within other bazel projects, it is customary to define a function
<project name>_deps
that sets up all necessary repositories like so:Users of the project can then load all transitive dependencies by calling the function in their WORKSPACE file:
Here are examples of this pattern in widely used projects: protobuf, grpc, ...
Unfortunately, this pattern brakes when
local_repository
together with a local path is used by the project one includes, as the relative path is resolved with respect to the root of the including (rather than the included) project.The problem could be solved by using a label instead of a relative path, since labels can be absolute rather than relative.
The text was updated successfully, but these errors were encountered: