Skip to content

Conversation

fzakaria
Copy link
Contributor

Previously, unused_deps would emit add deps for all the exports of a particular label that it was removing. If there were no exports, the buildozer commands would fail complaining about having 0 arguments.

> buildozer "add deps $(bazel query 'labels(exports, @maven//:com_google_guava_guava)' | tr '\n' ' ')" //http-server/ce-kafka-http-server:http-server-test-jar
INFO: Invocation ID: cd696714-cd65-497d-b2cd-206dc679a610
Loading: 0 packages loaded
INFO: Empty results
Too few arguments for command 'add', expected at least 2.

We now guard against running the buildozer command only if the query returns values.

> deps=$(bazel query 'labels(exports, @maven//:com_google_guava_guava)' | tr '\n' ' '); [ -n "$deps" ] && buildozer "add deps $deps" //http-server/ce-kafka-http-server:http-server-test-jar
INFO: Invocation ID: f7d9a5fe-ef85-4ea8-8ac7-8eed6ae1a158
Loading: 0 packages loaded
INFO: Empty results

Previously, unused_deps would emit `add deps` for all the exports of
a particular label that it was removing. If there were no exports, the
buildozer commands would fail complaining about having 0 arguments.

```
> buildozer "add deps $(bazel query 'labels(exports, @maven//:com_google_guava_guava)' | tr '\n' ' ')" //http-server/ce-kafka-http-server:http-server-test-jar
INFO: Invocation ID: cd696714-cd65-497d-b2cd-206dc679a610
Loading: 0 packages loaded
INFO: Empty results
Too few arguments for command 'add', expected at least 2.
```

We now guard against running the buildozer command only if the query
returns values.

```
> deps=$(bazel query 'labels(exports, @maven//:com_google_guava_guava)' | tr '\n' ' '); [ -n "$deps" ] && buildozer "add deps $deps" //http-server/ce-kafka-http-server:http-server-test-jar
INFO: Invocation ID: f7d9a5fe-ef85-4ea8-8ac7-8eed6ae1a158
Loading: 0 packages loaded
INFO: Empty results
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant