Debian Codegraph @

tools/BUILD.bazel

raw
1 load("//bazel:macros.bzl", "py_binary")
2 load("//bazel:skia_rules.bzl", "skia_cc_library", "skia_objc_library")
3
4 package(
5 default_applicable_licenses = ["//:license"],
6 )
7
8 licenses(["notice"])
9
10 exports_files([
11 "ToolUtils.h",
12 "ToolUtils.cpp",
13 "SkMetaData.h",
14 "SkMetaData.cpp",
15 "Registry.h",
16 "Resources.h",
17 "Resources.cpp",
18 "ResourceFactory.h",
19 ])
20
21 skia_cc_library(
22 name = "registry",
23 hdrs = ["Registry.h"],
24 visibility = [
25 "//bench:__pkg__",
26 "//gm:__pkg__",
27 "//tests:__subpackages__",
28 "//tools/viewer:__pkg__",
29 ],
30 deps = ["//:core"],
31 )
32
33 skia_cc_library(
34 name = "hash_and_encode",
35 testonly = True,
36 srcs = ["HashAndEncode.cpp"],
37 hdrs = ["HashAndEncode.h"],
38 visibility = [
39 "//dm:__pkg__",
40 "//gm:__pkg__",
41 ],
42 deps = [
43 "//:core",
44 "//:png_encode_codec",
45 "//tools/flags:cmd_flags",
46 ],
47 )
48
49 py_binary(
50 name = "embed_resources",
51 srcs = ["embed_resources.py"],
52 visibility = ["//:__subpackages__"],
53 )
54
55 skia_cc_library(
56 name = "autorelease_pool",
57 hdrs = ["AutoreleasePool.h"],
58 visibility = [
59 "//bench:__pkg__",
60 "//dm:__pkg__",
61 "//tools/gpu:__pkg__",
62 ],
63 deps = ["//src/base"],
64 )
65
66 skia_objc_library(
67 name = "autorelease_pool_objc",
68 hdrs = ["AutoreleasePool.h"],
69 non_arc_srcs = ["AutoreleasePool.mm"],
70 visibility = ["//tools/ganesh:__pkg__"],
71 deps = ["//src/base"],
72 )
73
74 skia_cc_library(
75 name = "url_data_manager",
76 srcs = ["UrlDataManager.cpp"],
77 hdrs = ["UrlDataManager.h"],
78 visibility = [
79 "//dm:__pkg__",
80 "//tools/debugger:__pkg__",
81 ],
82 deps = ["//:core"],
83 )
84
85 skia_cc_library(
86 name = "test_font_data_provider",
87 testonly = True,
88 srcs = ["TestFontDataProvider.cpp"],
89 hdrs = ["TestFontDataProvider.h"],
90 visibility = ["//dm:__pkg__"],
91 deps = [
92 "//:core",
93 "//modules/jsonreader",
94 "//tools/flags:cmd_flags",
95 ],
96 )
97
98 skia_cc_library(
99 name = "sk_sharing_proc",
100 srcs = ["SkSharingProc.cpp"],
101 hdrs = ["SkSharingProc.h"],
102 visibility = ["//tools/debugger:__pkg__"],
103 deps = [
104 "//:core",
105 "//:png_decode_codec",
106 "//:png_encode_codec",
107 ],
108 )
109
110 skia_cc_library(
111 name = "mskp_player",
112 testonly = True,
113 srcs = ["MSKPPlayer.cpp"],
114 hdrs = ["MSKPPlayer.h"],
115 visibility = ["//tools/viewer:__pkg__"],
116 deps = [
117 ":sk_sharing_proc",
118 "//src/gpu/ganesh:ganesh_TEST_UTIL",
119 "//src/utils:multi_picture_document",
120 ],
121 )
122
123 skia_cc_library(
124 name = "runtime_blend_utils",
125 srcs = ["RuntimeBlendUtils.cpp"],
126 hdrs = ["RuntimeBlendUtils.h"],
127 visibility = [
128 "//dm:__pkg__",
129 "//tests:__pkg__",
130 "//tools/viewer:__pkg__",
131 ],
132 deps = ["//:core"],
133 )
134
135 skia_cc_library(
136 name = "stats",
137 srcs = ["ProcStats.cpp"],
138 hdrs = [
139 "ProcStats.h",
140 "Stats.h",
141 ],
142 visibility = [
143 "//bench:__pkg__",
144 "//dm:__pkg__",
145 ],
146 deps = ["//:core"],
147 )
148
149 skia_cc_library(
150 name = "tool_utils",
151 testonly = True,
152 srcs = [
153 "SkMetaData.cpp",
154 "ToolUtils.cpp",
155 ],
156 hdrs = [
157 "SkMetaData.h",
158 "ToolUtils.h",
159 ],
160 visibility = [
161 "//bench:__subpackages__",
162 "//gm:__subpackages__",
163 "//tools:__subpackages__",
164 ],
165 deps = [
166 "//:core",
167 "//src/base",
168 "//src/core:core_priv",
169 ],
170 )
171
172 skia_cc_library(
173 name = "codec_utils",
174 testonly = True,
175 srcs = [
176 "DecodeUtils.cpp",
177 "EncodeUtils.cpp",
178 ],
179 hdrs = [
180 "CodecUtils.h",
181 "DecodeUtils.h",
182 "EncodeUtils.h",
183 ],
184 visibility = [
185 "//dm:__pkg__",
186 "//gm:__subpackages__",
187 "//tools/viewer:__pkg__",
188 ],
189 deps = [
190 "//:core",
191 "//:png_decode_codec",
192 "//:png_encode_codec",
193 "//src/base",
194 "//src/core:core_priv",
195 "//tools:resources",
196 ],
197 )
198
199 skia_cc_library(
200 name = "deserial_procs_utils",
201 testonly = True,
202 srcs = [
203 "DeserialProcsUtils.cpp",
204 ],
205 hdrs = [
206 "DeserialProcsUtils.h",
207 ],
208 visibility = [
209 "//bench:__subpackages__",
210 "//dm:__pkg__",
211 "//gm:__subpackages__",
212 "//tools/viewer:__pkg__",
213 ],
214 deps = [
215 "//:core",
216 "//:png_decode_libpng",
217 "//tools/fonts:font_tool_utils",
218 ],
219 )
220
221 skia_cc_library(
222 name = "resources",
223 testonly = True,
224 srcs = [
225 "Resources.cpp",
226 ],
227 hdrs = [
228 "Resources.h",
229 ],
230 visibility = [
231 "//bench:__subpackages__",
232 "//tools:__subpackages__",
233 ],
234 deps = [
235 "//:core",
236 "//src/base",
237 "//src/core:core_priv",
238 "//tools/flags:cmd_flags",
239 ],
240 )
241
242 skia_cc_library(
243 name = "gpu_tool_utils",
244 testonly = True,
245 hdrs = ["GpuToolUtils.h"],
246 visibility = [
247 "//dm:__pkg__",
248 "//tools:__subpackages__",
249 ],
250 deps = [
251 "//:core",
252 ],
253 )
254
255 # Regenerate workarounds with `bazel run //tools:generate_workarounds`
256 py_binary(
257 name = "generate_workarounds",
258 srcs = [":generate_workarounds.py"],
259 args = [
260 "--output-file",
261 "include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h",
262 "src/gpu/gpu_workaround_list.txt",
263 ],
264 data = [
265 ":build_workaround_header",
266 ],
267 tags = ["no-remote"],
268 )
269
270 py_binary(
271 name = "build_workaround_header",
272 srcs = ["build_workaround_header.py"],
273 )
274
275 _GENERATE_WORKAROUNDS = """
276 import os
277 import subprocess
278 import sys
279
280 # https://bazel.build/docs/user-manual#running-executables
281 # Note: Bazel eats single quotes, so we must use double quotes.
282 os.chdir(os.environ["BUILD_WORKSPACE_DIRECTORY"])
283
284 # execpath returns the path to the given label relative to the Skia root.
285 # This will be something like:
286 # bazel-out/k8-opt-exec-81C6BA4F/bin/tools/build_workaround_header
287 # https://bazel.build/reference/be/make-variables#predefined_label_variables
288 generate_script = os.path.abspath("$(execpath :build_workaround_header)")
289
290 result = subprocess.run(
291 [generate_script] + sys.argv[1:], capture_output=True, encoding="utf-8")
292 if result.returncode != 0:
293 print(result.stdout)
294 print(result.stderr)
295 sys.exit(result.returncode)
296 """
297
298 genrule(
299 name = "create_generate_workarounds_script",
300 outs = ["generate_workarounds.py"],
301 cmd = "echo '%s' > $@" % _GENERATE_WORKAROUNDS,
302 tools = [":build_workaround_header"],
303 )
304
305 skia_cc_library(
306 name = "full_build",
307 testonly = True,
308 srcs = [
309 "//include/codec:headers_to_compile",
310 "//include/core:headers_to_compile",
311 "//include/docs:headers_to_compile",
312 "//include/effects:headers_to_compile",
313 "//include/encode:headers_to_compile",
314 "//include/gpu:headers_to_compile",
315 "//include/gpu/ganesh:headers_to_compile",
316 "//include/gpu/ganesh/gl:headers_to_compile",
317 "//include/gpu/ganesh/mock:headers_to_compile",
318 "//include/gpu/ganesh/vk:headers_to_compile",
319 "//include/gpu/graphite:headers_to_compile",
320 "//include/gpu/graphite/precompile:headers_to_compile",
321 "//include/gpu/graphite/vk:headers_to_compile",
322 "//include/gpu/graphite/vk/precompile:headers_to_compile",
323 "//include/gpu/vk:headers_to_compile",
324 "//include/pathops:headers_to_compile",
325 "//include/ports:headers_to_compile",
326 "//include/private:headers_to_compile",
327 "//include/private/base:headers_to_compile",
328 "//include/sksl:headers_to_compile",
329 "//include/svg:headers_to_compile",
330 "//include/utils:headers_to_compile",
331 "//src/base:headers_to_compile",
332 "//src/codec:headers_to_compile",
333 "//src/core:headers_to_compile",
334 ],
335 copts = [
336 # We don't want errors like "unused symbol"
337 "-Wno-error",
338 ],
339 # This is not intended to be used for tests or anything, just for a smoke test build
340 visibility = ["//visibility:private"],
341 deps = [
342 "//:bmp_decode_codec",
343 "//:core",
344 "//:fontmgr_data_freetype",
345 "//:fontmgr_directory_freetype",
346 "//:fontmgr_empty_fontations",
347 "//:fontmgr_empty_freetype",
348 "//:gif_decode_codec",
349 "//:ico_decode_codec",
350 "//:jpeg_decode_codec",
351 "//:jpeg_encode_codec",
352 "//:jpegxl_decode_codec",
353 "//:pathops",
354 "//:pdf_writer",
355 "//:png_decode_codec",
356 "//:png_encode_libpng",
357 "//:png_encode_rust",
358 "//:skparagraph_harfbuzz_skunicode",
359 "//:skresources",
360 "//:skshaper_core",
361 "//:skshaper_harfbuzz",
362 "//:skshaper_unicode",
363 "//:skunicode_core",
364 "//:skunicode_icu",
365 "//:svg_renderer",
366 "//:svg_writer",
367 "//:wbmp_decode_codec",
368 "//:webp_decode_codec",
369 "//:webp_encode_codec",
370 "//modules/jsonreader",
371 "//src/codec:android_codec",
372 "//src/gpu/ganesh/gl:ganesh_gl_TEST_UTIL",
373 "//src/gpu/ganesh/vk:ganesh_vulkan_TEST_UTIL",
374 "//src/gpu/graphite:graphite_TEST_UTIL",
375 "//src/gpu/graphite/precompile:precompile_TEST_UTIL",
376 "//src/gpu/graphite/vk:graphite_native_vulkan_TEST_UTIL",
377 "//tools/sksltrace:sksltraceutils",
378 ],
379 )