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