Skip to content

Commit

Permalink
fix: outputs and outputs-bbclientd should take all aquery flags (#3235)
Browse files Browse the repository at this point in the history
Fixes #365.

---

### Type of change

- Bug fix (change which fixes an issue)

**For changes visible to end-users**

- Suggested release notes are provided below:

Aspect CLI outputs command now accepts all Bazel aquery flags since
`outputs` makes a `bazel aquery` call under the hood.

### Test plan

- Manual testing; please provide instructions so we can reproduce:

Manually tested that I could pass `--invocation_id` to an `aspect
outputs` call.

GitOrigin-RevId: d22ba7a2905db94fe610b7d552f9e0b61a8fcf84
  • Loading branch information
gregmagolan authored and alexeagle committed Aug 31, 2023
1 parent 7ad0c0b commit 6726e5e
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions pkg/bazel/bazel_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,20 @@ func (b *bazel) AddBazelFlags(cmd *cobra.Command) error {
flag := bzlFlags[flagName]
documented := isDocumented(flagName)

for _, command := range flag.Commands {
if subcommand, ok := subCommands[command]; ok {
subcommand.DisableFlagParsing = true // only want to disable flag parsing on actual bazel verbs
subcommand.FParseErrWhitelist.UnknownFlags = true
if documented {
addFlagToFlagSet(flag, subcommand.Flags())
for _, flagCommand := range flag.Commands {
commands := []string{flagCommand}
if flagCommand == "aquery" {
// outputs & outputs-bbclientd call aquery under the hood and accept all aquery flags
commands = append(commands, "outputs")
commands = append(commands, "outputs-bbclientd")
}
for _, command := range commands {
if subcommand, ok := subCommands[command]; ok {
subcommand.DisableFlagParsing = true // only want to disable flag parsing on actual bazel verbs
subcommand.FParseErrWhitelist.UnknownFlags = true
if documented {
addFlagToFlagSet(flag, subcommand.Flags())
}
}
}
}
Expand Down

0 comments on commit 6726e5e

Please sign in to comment.