Revert "[bazel] Run gazelle only on the files that changed"

This reverts commit 5c6bf4f692.

Reason for revert: git diff does not work well with deleted files

Original change's description:
> [bazel] Run gazelle only on the files that changed
>
> With this change, make generate takes 1.8 seconds instead of
> 7.9 seconds.
>
> We still have generate_force to run on everything.
>
> Change-Id: I6d57031adbe38a7f25a59570baea89970eea024f
> Bug: skia:12541
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540740
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>

Bug: skia:12541
Change-Id: I47c23adf09bbc6324817e166f7ab33eb16f4bf61
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/540743
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Kevin Lubick 2022-05-16 15:40:59 +00:00
parent 8c1fe9f743
commit c4abee5e38
2 changed files with 2 additions and 22 deletions

View File

@ -1,25 +1,5 @@
# This target should be run when new files are added or includes changed. This should be
# faster than generate_force because it only runs gazelle on a subset of all Skia files.
# This target should be run when new files are added or includes changed.
generate:
bazelisk build @org_skia_go_infra//bazel/gazelle:gazelle_cpp
# We ask git for any file that has changed when compared to origin/main and have gazelle
# look only at those files. If the diff would be empty, we do not want to run gazelle on
# every file in Skia, so we add in one folder (example) as a sentinel value. This folder
# was chosen because there are only a few files in it, so it should be fast to analyze.
cd .. && git diff --name-only origin/main -- include/ src/ tools/ gm/ tests/ \
modules/skshaper modules/svg modules/skresources modules/skparagraph modules/skunicode \
modules/skottie modules/skresources modules/sksg experimental/ffmpeg \
modules/particles \
experimental/bazel_test example \
modules/canvaskit/go \
infra/bots/task_drivers | \
xargs bazel-bin/external/org_skia_go_infra/bazel/gazelle/gazelle_cpp_/gazelle_cpp update \
--third_party_file_map="third_party/file_map_for_bazel.json" example/
# This will force all the folders we care about to have their build files generated. This should
# be run by the CI and locally only when we opt-in a new folder. Any changes here should be
# mirrored in the make generate rule.
generate_force:
bazelisk build @org_skia_go_infra//bazel/gazelle:gazelle_cpp
cd .. && bazel-bin/external/org_skia_go_infra/bazel/gazelle/gazelle_cpp_/gazelle_cpp update \
--third_party_file_map="third_party/file_map_for_bazel.json" \

View File

@ -88,7 +88,7 @@ func ensureNoGeneratedDiffs(ctx context.Context, checkoutDir string) error {
genCmd := &sk_exec.Command{
Name: "make",
Args: []string{"generate_force"},
Args: []string{"generate"},
InheritEnv: true, // Makes sure bazelisk is on PATH
Dir: filepath.Join(checkoutDir, "bazel"),
LogStdout: true,