2

Context

I have a list of directories

- libs
  - lib1
  - lib2
  - lib3
  ...
- bin
- WORKSPACE
- BUILD.bazel
...

And I'd like to run gazelle on a subset of these directories that I've whitelisted.

I have hundreds of directories under libs/ and I want to incrementally rollout gazelle.

Question

Can I pass a filegroup to gazelle of the directories that it should check or is there some way to limit which directories gazelle goes over?

GGhe
  • 663
  • 5
  • 17
  • 2
    did you try this `bazel run //:gazelle -- subdir` – Mohammed Mar 24 '22 at 04:41
  • That might not be scalable if I have to pass 30 subdirs. Is there a way to pass a list of subdirs to the gazelle rule (as opposed to `bazel run //:gazelle`)? – GGhe Mar 24 '22 at 10:56
  • 2
    what about `bazel run //:gazelle -- subdir1 subdir2` ? – Mohammed Mar 24 '22 at 17:06
  • If there are 30 subdirs, then the command will be too long. If there's no other approach, then it will have to do. Thank you – GGhe Mar 24 '22 at 18:37

1 Answers1

0

As some of the comments have indicated, gazelle accepts directory names on the command line, eg bazel run //:gazelle -- dir1 dir2.

If there are a lot of directories, try listing them out in a file then use a combination of cat and xargs. For example, cat dirs | xargs bazel run //:gazelle.

Noel Yap
  • 18,822
  • 21
  • 92
  • 144