skia2/bazel/Makefile
Kevin Lubick 5c6bf4f692 [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>
2022-05-16 14:18:20 +00:00

84 lines
4.7 KiB
Makefile

# 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.
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" \
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
# This target should be run after the go.mod file is updated (e.g. version rolls or new updates)
gazelle_update_repo:
cd .. && bazelisk run //:gazelle -- update-repos -from_file=go.mod -to_macro=go_repositories.bzl%go_repositories
# Run this target to test all known working Bazel builds
known_good_builds:
bazelisk build //experimental/bazel_test/... --config=clang_linux
bazelisk run //experimental/bazel_test:bazel_test_exe --config=clang_linux
bazelisk build //:skia_core --config=clang_linux
bazelisk build //src/sksl/lex:sksllex --config=clang_linux
bazelisk build //tools/skdiff --config=clang_linux
bazelisk build //tools/skslc --config=clang_linux
bazelisk build //modules/canvaskit:canvaskit_wasm --compilation_mode opt --sandbox_base=/dev/shm
# Test the enforcement of include what you use
bazelisk build //example:hello_world_gl --config=clang_linux --features skia_enforce_iwyu
# Both with and without a GPU backend should be error free (i.e. IWYU should let us
# conditionally import things.
bazelisk build //src/svg/... --config=clang_linux --features skia_enforce_iwyu \
--gpu_backend=gl_backend --include_decoder=jpeg_decode_codec
bazelisk build //src/svg/... --config=clang_linux --features skia_enforce_iwyu
bazelisk build //tools/debugger --config=clang_linux --gpu_backend=gl_backend \
--features skia_enforce_iwyu
bazelisk build //:skia_core --config=clang_linux --features skia_enforce_iwyu
bazelisk build //src/utils/... --config=clang_linux --features skia_enforce_iwyu
bazelisk build //src/utils/... --config=clang_linux --gpu_backend=gl_backend \
--features skia_enforce_iwyu
rbe_known_good_builds:
bazelisk build //experimental/bazel_test/... --config=linux_rbe
bazelisk run //experimental/bazel_test:bazel_test_exe --config=linux_rbe
bazelisk build //:skia_core --config=linux_rbe
bazelisk build //src/sksl/lex:sksllex --config=linux_rbe
bazelisk build //tools/skdiff --config=linux_rbe
bazelisk build //tools/skslc --config=linux_rbe
# TODO(kjlubick) CanvasKit in release mode (i.e. with Closure) requires
# https://github.com/emscripten-core/emscripten/pull/16640 to land
bazelisk build //modules/canvaskit:canvaskit_wasm --compilation_mode dbg --config=linux_rbe \
--jobs 100
# Test the enforcement of include what you use
bazelisk build //example:hello_world_gl --config=linux_rbe --features skia_enforce_iwyu
# Both with and without a GPU backend should be error free (i.e. IWYU should let us
# conditionally import things.
bazelisk build //src/svg/... --config=linux_rbe --features skia_enforce_iwyu \
--gpu_backend=gl_backend --include_decoder=jpeg_decode_codec
bazelisk build //src/svg/... --config=linux_rbe --features skia_enforce_iwyu
bazelisk build //tools/debugger --config=linux_rbe --gpu_backend=gl_backend \
--features skia_enforce_iwyu
bazelisk build //:skia_core --config=linux_rbe --features skia_enforce_iwyu