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

Custom build flags choke on prefix workspaces #9177

Closed
ulysses4ever opened this issue Aug 15, 2019 · 9 comments
Closed

Custom build flags choke on prefix workspaces #9177

ulysses4ever opened this issue Aug 15, 2019 · 9 comments
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug

Comments

@ulysses4ever
Copy link
Contributor

Description of the problem

I believe custom build flags don't play well with proper @namespace//...-like references.

Bugs: what's the simplest, easiest way to reproduce this bug?

I set up a repository with a repro -- check out the README. It follows closely the running example of drinks and flavors in the documentation. Except that it actually sets up a named workspace.

In the master branch of the repo, everything is fine: I'm able to pass the flag in the command line. In the bug branch I add the workspace prefix when referencing the flag target from the attribute of my rule. This breaks the setup: I pass the flag in the command-line as before but it has no effect. If I try to add the workspace prefix when referencing the flag from the command-line, I get "Unrecognized option".

What operating system are you running Bazel on?

Ubuntu 18.04

What's the output of bazel info release?

release 0.28.0- (@non-git)

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

This is the version of Bazel imported by Nixpkgs version referenced in the current rules_haskell (master branch).

Have you found anything relevant by searching the web?

No. I only looked up the Issues here.

@ulysses4ever
Copy link
Contributor Author

ulysses4ever commented Aug 16, 2019

May I ping @juliexxia who did most of the job of implementing this exciting feature! And also @c-parsons who merged it.

@aiuto aiuto added team-Configurability platforms, toolchains, cquery, select(), config transitions untriaged labels Aug 26, 2019
@aiuto
Copy link
Contributor

aiuto commented Aug 26, 2019

Thanks for the detailed example.
@juliexxia is away on a fellowship for a few months. We'll get the right people to look at it.

@katre katre added P2 We'll consider working on this in future. (Assignee optional) type: bug and removed untriaged labels Aug 27, 2019
@gregestren gregestren removed their assignment Sep 11, 2019
@gregestren
Copy link
Contributor

This is a cutting edge feature so I'm not surprised this part doesn't work yet. I don't think anyone can take this on right now, but please re-ping whenever you feel to help us figure out a practical fix timeline.

Appreciate your patient guinea pigging!

@ulysses4ever
Copy link
Contributor Author

ulysses4ever commented Sep 12, 2019

@gregestren thanks for letting me know. I didn't quite get when you want me to re-ping you.

@gregestren
Copy link
Contributor

There's no obvious person to work on this right now (#9177 (comment)). I don't want this to fall into oblivion but it might get lost in the issue load. So please offer us some leeway but feel free to re-ping if/when you feel it's sitting around for too long. :)

@ulysses4ever
Copy link
Contributor Author

I see, thanks!

swiple-rules-gardener pushed a commit to bazelbuild/rules_swift that referenced this issue Nov 22, 2019
This will not work with Bazel until repository-prefixed command line flags are working (bazelbuild/bazel#9177).

RELNOTES: None.
PiperOrigin-RevId: 281381965
swiple-rules-gardener pushed a commit to bazelbuild/rules_swift that referenced this issue Nov 22, 2019
This will not work with Bazel until repository-prefixed command line flags are working (bazelbuild/bazel#9177).

RELNOTES: None.
PiperOrigin-RevId: 281381965
swiple-rules-gardener pushed a commit to bazelbuild/rules_swift that referenced this issue Nov 22, 2019
This will not work with Bazel until repository-prefixed command line flags are working (bazelbuild/bazel#9177).

RELNOTES: None.
PiperOrigin-RevId: 281994082
@aherrmann
Copy link
Contributor

I've tested this issue again on the more recent Bazel version 2.1. The original issue is still present. I.e. defining the workspace name prefix on the flag causes the flag to be ignored, if it is defined locally. Meaning, this issue is still open.

However, what is working now is to prefix the workspace name if the flag is defined in an external workspace. This is the use-case that is interesting for rule authors, because it allows them to define configurations in their rules sets that users can then affect on the command-line.

I've forked and updated @ulysses4ever's reproduction here. This illustrates that if a rules set, say rules_example, defines a flag //:favorite_flavor, then users can change it in their project that uses rules_example as an external repository using the command-line flag like so:

bazel build //:my_drink --@rules_example//:favorite_flavor=True

@gregestren
Copy link
Contributor

We recently prioritized this general theme in #11128 and added all related issues. I forgot to include this one. Apologies.

Thanks for the updated feedback.

@gregestren
Copy link
Contributor

Let's consolidate these bugs into #11128.

When that one is fixed, it if doesn't address this we can re-open this.

tymurmustafaiev pushed a commit to tymurmustafaiev/rules_swift that referenced this issue Jul 19, 2023
This will not work with Bazel until repository-prefixed command line flags are working (bazelbuild/bazel#9177).

RELNOTES: None.
PiperOrigin-RevId: 281994082
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Configurability platforms, toolchains, cquery, select(), config transitions type: bug
Projects
None yet
Development

No branches or pull requests

5 participants