skia2/tools/skiaserve/BUILD.bazel

62 lines
1.5 KiB
Python
Raw Normal View History

[bazel] Try adding cc_binary rules that use generated rules To make the atomic rules a bit easier to work with, in many of the folders, this adds in cc_library rules to group together the sources from that folder (and subfolders where prudent). We only needs sources because those atoms should have their headers as deps. One issue that was pointed out is that there is currently no way to restrict the inclusion of certain packages, a la, `gn check`. For example, there is no mechanism from stopping a dev from adding #include "modules/canvaskit/WasmCommon.h" to something in //src/core (except circular dependencies). We can probably address that using Bazel's visibility rules as needed: https://docs.bazel.build/versions/main/visibility.html https://docs.bazel.build/versions/main/be/functions.html#package_group It is recommended to look at this CL patchset by patchset. PS1: Update gazelle command to generate rules in more folders. PS2: A few changes to make generation work better. PS3: The result of running make generate in //bazel PS4: Adding the rules to build sksllex, the simplest binary I could find in the Skia repo. PS5: Adding the rules to build skdiff, a more complex binary. I tried a few approaches, but ended up gravitating back towards the layout where we have each folder/package group up the sources. I imagine at some point, we'll have skdiff depend on skia_core or something, which will have things like //src/core, //src/codecs, //src/pathops all bundled together. PS7: Added in the groupings of sources, similar to what we had earlier. I liked these for readability. These helped fix up the //:skia_core build, and by extension, the CanvasKit build. Change-Id: I3faa7c4e821c876b243617aacf0246efa524cbde Bug: skia:12541 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/476219 Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-30 13:15:24 +00:00
load("//bazel:macros.bzl", "generated_cc_atom")
generated_cc_atom(
name = "Request_hdr",
hdrs = ["Request.h"],
visibility = ["//:__subpackages__"],
deps = [
"//include/core:SkPicture_hdr",
"//include/core:SkStream_hdr",
"//include/core:SkSurface_hdr",
"//include/core:SkTypes_hdr",
"//tools:UrlDataManager_hdr",
"//tools/debugger:DebugCanvas_hdr",
"//tools/gpu:GrContextFactory_hdr",
],
)
generated_cc_atom(
name = "Request_src",
srcs = ["Request.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":Request_hdr",
"//include/core:SkPictureRecorder_hdr",
"//include/gpu:GrDirectContext_hdr",
"//src/utils:SkJSONWriter_hdr",
"//tools:ToolUtils_hdr",
],
)
generated_cc_atom(
name = "Response_hdr",
hdrs = ["Response.h"],
visibility = ["//:__subpackages__"],
)
generated_cc_atom(
name = "Response_src",
srcs = ["Response.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":Request_hdr",
":Response_hdr",
"//include/core:SkData_hdr",
"//include/core:SkString_hdr",
"//tools/flags:CommandLineFlags_hdr",
],
)
generated_cc_atom(
name = "skiaserve_src",
srcs = ["skiaserve.cpp"],
visibility = ["//:__subpackages__"],
deps = [
":Request_hdr",
":Response_hdr",
"//include/core:SkGraphics_hdr",
"//tools/flags:CommandLineFlags_hdr",
"//tools/skiaserve/urlhandlers:UrlHandler_hdr",
],
)