[bazel] Use toolchain features to opt files into being IWYU compliant.
PS1 regenerates the Bazel files. It is recommended to review this CL with a diff from PS1. Example output when a file does not pass the test: tools/sk_app/CommandSet.h should add these lines: #include "include/core/SkTypes.h" #include "include/private/SkTArray.h" #include "tools/skui/InputState.h" #include "tools/skui/Key.h" #include "tools/skui/ModifierKey.h" namespace sk_app { class Window; } tools/sk_app/CommandSet.h should remove these lines: - #include "tools/sk_app/Window.h" The full include-list for tools/sk_app/CommandSet.h: #include "include/core/SkString.h" #include "include/core/SkTypes.h" #include "include/private/SkTArray.h" #include "tools/skui/InputState.h" #include "tools/skui/Key.h" #include "tools/skui/ModifierKey.h" #include <functional> #include <vector> class SkCanvas; namespace sk_app { class Window; } --- This makes use of Bazel's toolchain features https://bazel.build/docs/cc-toolchain-config-reference#features to allow us to configure compiler flags when compiling individual files. This analysis is off by default, and can be turned on with --features skia_enforce_iwyu. When enabled, it will only be run for files that have opted in. Example: bazelisk build //example:hello_world_gl --config=clang \ --sandbox_base=/dev/shm --features skia_enforce_iwyu There are two ways to opt files in: - Add enforce_iwyu = True to a generated_cc_atom rule - Add enforce_iwyu_on_package() to a BUILD.bazel file (which enforces IWYU for all rules in that file) Note that Bazel does not propagate features to dependencies or dependents, so trying to enable the feature on cc_library or cc_executable targets will only impact any files listed in srcs or hdrs, not deps. This may be counter-intuitive when compared to things like defines. IWYU supports a mapping file, which we supply to help properly handle things system headers (//toolchain/IWYU_mapping.imp) Suggested Review Order: - toolchain/build_toolchain.bzl to see how we get the IWYU binaries into the toolchain - toolchain/BUILD.bazel and toolchain/IWYU_mapping.imp to see how the mapping file is made available for all compile steps - toolchain/clang_toolchain_config.bzl, where we define the skia_enforce_iwyu feature to turn on any verification at all and skia_opt_file_into_iwyu to enable the check for specific files using a define. - toolchain/clang_trampoline.sh, which is the toolchain is configured to call instead of clang directly (see line 83 of clang_toolchain_config.bzl). This bash script used to just forward all arguments directly onto clang. Now it inspects them and either calls clang directly (if it does not find the define in the arguments or we are linking [bazel sometimes links with clang instead of ld]) or calls clang and then include-what-you-use. In all cases, the trampoline sends the arguments to clang and IWYU unchanged). - //tools/sk_app/... to see enforcement enabled (and fixed) for select files, as an example of that method. - //experimental/bazel_test/... to see enforcement enabled for all rules in a BUILD.bazel file. - all other files. Change-Id: I60a2ea9d5dc9955b6a8f166bd449de9e2b81a233 Bug: skia:13052 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/519776 Reviewed-by: Ben Wagner <bungeman@google.com> Reviewed-by: Leandro Lovisolo <lovisolo@google.com> Commit-Queue: Kevin Lubick <kjlubick@google.com>
This commit is contained in:
parent
0d81bc7bb0
commit
e253cc3e55
@ -17,8 +17,8 @@ gazelle_update_repo:
|
||||
|
||||
# Run this target to test all known working Bazel builds
|
||||
known_good_builds:
|
||||
bazelisk build //experimental/bazel_test/... --config=clang
|
||||
bazelisk run //experimental/bazel_test:bazel_test_exe --config=clang
|
||||
bazelisk build //experimental/bazel_test/... --config=clang --sandbox_base=/dev/shm --features skia_enforce_iwyu
|
||||
bazelisk run //experimental/bazel_test:bazel_test_exe --config=clang --sandbox_base=/dev/shm
|
||||
bazelisk build //:skia_core --config=clang --sandbox_base=/dev/shm
|
||||
bazelisk build //src/sksl/lex:sksllex --config=clang --sandbox_base=/dev/shm
|
||||
bazelisk build //tools/skdiff --config=clang --sandbox_base=/dev/shm
|
||||
|
@ -50,11 +50,14 @@ def select_multi(values_map, default, name = ""):
|
||||
})
|
||||
return rv
|
||||
|
||||
def generated_cc_atom(name, **kwargs):
|
||||
def generated_cc_atom(name, enforce_iwyu = False, **kwargs):
|
||||
"""A self-annotating label for a generated cc_library for exactly one file.
|
||||
|
||||
Args:
|
||||
name: string, the name of the cc_library
|
||||
enforce_iwyu: boolean, if true, this file will fail to compile if the headers to not comply
|
||||
with the include-what-you-use standards. This does not affect dependencies nor
|
||||
dependents, only the file listed in srcs/hdrs.
|
||||
**kwargs: All other arguments are passed verbatim to cc_library
|
||||
"""
|
||||
if len(kwargs.get("srcs", [])) > 1 or len(kwargs.get("hdrs", [])) > 1:
|
||||
@ -66,7 +69,16 @@ def generated_cc_atom(name, **kwargs):
|
||||
deps = kwargs.get("deps", [])
|
||||
deps.append("//bazel:defines_from_flags")
|
||||
kwargs["deps"] = deps
|
||||
|
||||
features = kwargs.get("features", [])
|
||||
if enforce_iwyu:
|
||||
features.append("skia_opt_file_into_iwyu")
|
||||
native.cc_library(
|
||||
name = name,
|
||||
features = features,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def enforce_iwyu_on_package():
|
||||
"""A self-annotating macro to set force_iwyu = True on all rules in this package."""
|
||||
native.package(features = ["skia_opt_file_into_iwyu"])
|
||||
|
@ -1,7 +1,9 @@
|
||||
load("//bazel:macros.bzl", "generated_cc_atom")
|
||||
load("//bazel:macros.bzl", "enforce_iwyu_on_package", "generated_cc_atom")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
|
||||
|
||||
enforce_iwyu_on_package()
|
||||
|
||||
cc_binary(
|
||||
name = "bazel_test_exe",
|
||||
visibility = ["//:__subpackages__"],
|
||||
|
@ -1,11 +1,14 @@
|
||||
// Copyright 2020 Google LLC.
|
||||
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
||||
#include "png.h"
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
#include "png.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
|
||||
void print_localtime() {
|
||||
std::time_t result = std::time(nullptr);
|
||||
std::cout << std::asctime(std::localtime(&result));
|
||||
|
@ -13,8 +13,10 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkVideoDecoder_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkColorSpace_hdr",
|
||||
"//include/core:SkImage_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/core:SkYUVAPixmaps_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -122,17 +122,12 @@ generated_cc_atom(
|
||||
srcs = ["ContextUtils.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":ContextPriv_hdr",
|
||||
":ContextUtils_hdr",
|
||||
":DrawTypes_hdr",
|
||||
":PaintParams_hdr",
|
||||
"//include/core:SkPaint_hdr",
|
||||
"//include/private:SkUniquePaintParamsID_hdr",
|
||||
"//src/core:SkBlenderBase_hdr",
|
||||
"//src/core:SkKeyHelpers_hdr",
|
||||
"//src/core:SkPipelineData_hdr",
|
||||
"//src/core:SkShaderCodeDictionary_hdr",
|
||||
"//src/core:SkUniformData_hdr",
|
||||
"//src/core:SkUniform_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -368,6 +363,7 @@ generated_cc_atom(
|
||||
"//experimental/graphite/src/geom:BoundsManager_hdr",
|
||||
"//src/core:SkMathPriv_hdr",
|
||||
"//src/core:SkPaintParamsKey_hdr",
|
||||
"//src/core:SkPipelineData_hdr",
|
||||
"//src/core:SkTBlockList_hdr",
|
||||
"//src/core:SkUniformData_hdr",
|
||||
"//src/gpu:BufferWriter_hdr",
|
||||
@ -386,6 +382,7 @@ generated_cc_atom(
|
||||
hdrs = ["DrawWriter.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":DrawBufferManager_hdr",
|
||||
":DrawTypes_hdr",
|
||||
"//src/gpu:BufferWriter_hdr",
|
||||
],
|
||||
@ -526,7 +523,7 @@ generated_cc_atom(
|
||||
":TaskGraph_hdr",
|
||||
"//experimental/graphite/include:Recorder_hdr",
|
||||
"//experimental/graphite/include:Recording_hdr",
|
||||
"//src/core:SkUniformData_hdr",
|
||||
"//src/core:SkPipelineData_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -970,6 +967,6 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":PipelineDataCache_hdr",
|
||||
"//src/core:SkOpts_hdr",
|
||||
"//src/core:SkUniformData_hdr",
|
||||
"//src/core:SkPipelineData_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -15,5 +15,6 @@ generated_cc_atom(
|
||||
"//src/core:SkUniformData_hdr",
|
||||
"//src/gpu:BufferWriter_hdr",
|
||||
"//src/gpu/tessellate:MiddleOutPolygonTriangulator_hdr",
|
||||
"//src/gpu/tessellate:PathTessellator_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -4428,6 +4428,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":gm_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkFont_hdr",
|
||||
"//include/effects:SkRuntimeEffect_hdr",
|
||||
"//src/core:SkCanvasPriv_hdr",
|
||||
@ -4448,6 +4449,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":gm_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkColor_hdr",
|
||||
"//include/core:SkImageInfo_hdr",
|
||||
@ -4837,6 +4839,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":gm_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkImage_hdr",
|
||||
"//include/core:SkPaint_hdr",
|
||||
@ -5865,6 +5868,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":gm_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkPaint_hdr",
|
||||
"//include/core:SkRect_hdr",
|
||||
@ -7633,6 +7637,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":gm_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkData_hdr",
|
||||
"//include/core:SkPaint_hdr",
|
||||
@ -8556,6 +8561,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":gm_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkImageInfo_hdr",
|
||||
"//include/core:SkMatrix_hdr",
|
||||
@ -9244,6 +9250,7 @@ generated_cc_atom(
|
||||
"//include/core:SkPaint_hdr",
|
||||
"//include/core:SkPath_hdr",
|
||||
"//include/core:SkSize_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/core:SkString_hdr",
|
||||
"//include/core:SkTextBlob_hdr",
|
||||
"//include/utils:SkCustomTypeface_hdr",
|
||||
@ -9586,6 +9593,7 @@ generated_cc_atom(
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkImage_hdr",
|
||||
"//include/core:SkPixmap_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/core:SkSurface_hdr",
|
||||
"//include/encode:SkJpegEncoder_hdr",
|
||||
"//include/gpu:GrRecordingContext_hdr",
|
||||
|
@ -140,6 +140,7 @@ generated_cc_atom(
|
||||
hdrs = ["SkColor.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkAlphaType_hdr",
|
||||
":SkImageInfo_hdr",
|
||||
":SkScalar_hdr",
|
||||
":SkTypes_hdr",
|
||||
@ -391,7 +392,9 @@ generated_cc_atom(
|
||||
hdrs = ["SkImageInfo.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkAlphaType_hdr",
|
||||
":SkColorSpace_hdr",
|
||||
":SkColorType_hdr",
|
||||
":SkMath_hdr",
|
||||
":SkRect_hdr",
|
||||
":SkSize_hdr",
|
||||
@ -405,7 +408,6 @@ generated_cc_atom(
|
||||
hdrs = ["SkImage.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkImageEncoder_hdr",
|
||||
":SkImageInfo_hdr",
|
||||
":SkRefCnt_hdr",
|
||||
":SkSamplingOptions_hdr",
|
||||
@ -505,6 +507,7 @@ generated_cc_atom(
|
||||
":SkMatrix_hdr",
|
||||
":SkPathTypes_hdr",
|
||||
":SkPath_hdr",
|
||||
":SkRefCnt_hdr",
|
||||
"//include/private:SkTDArray_hdr",
|
||||
],
|
||||
)
|
||||
@ -545,7 +548,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":SkMatrix_hdr",
|
||||
":SkPathTypes_hdr",
|
||||
"//include/private:SkPathRef_hdr",
|
||||
":SkRefCnt_hdr",
|
||||
"//include/private:SkTo_hdr",
|
||||
],
|
||||
)
|
||||
@ -942,3 +945,16 @@ generated_cc_atom(
|
||||
":SkTypes_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "SkAlphaType_hdr",
|
||||
hdrs = ["SkAlphaType.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "SkColorType_hdr",
|
||||
hdrs = ["SkColorType.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [":SkTypes_hdr"],
|
||||
)
|
||||
|
@ -5,6 +5,7 @@ generated_cc_atom(
|
||||
srcs = ["AudioLayer.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkStream_hdr",
|
||||
"//modules/skottie/include:Skottie_hdr",
|
||||
"//tests:Test_hdr",
|
||||
],
|
||||
@ -15,6 +16,7 @@ generated_cc_atom(
|
||||
srcs = ["Expression.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkStream_hdr",
|
||||
"//modules/skottie/include:SkottieProperty_hdr",
|
||||
"//modules/skottie/include:Skottie_hdr",
|
||||
"//tests:Test_hdr",
|
||||
@ -26,6 +28,7 @@ generated_cc_atom(
|
||||
srcs = ["Image.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/core:SkSurface_hdr",
|
||||
"//modules/skottie/include:Skottie_hdr",
|
||||
"//tests:Test_hdr",
|
||||
|
@ -269,6 +269,7 @@ generated_cc_atom(
|
||||
"//include/core:SkPath_hdr",
|
||||
"//include/private:SkColorData_hdr",
|
||||
"//include/private:SkMacros_hdr",
|
||||
"//include/private:SkTDArray_hdr",
|
||||
"//include/private:SkTo_hdr",
|
||||
],
|
||||
)
|
||||
@ -688,7 +689,6 @@ generated_cc_atom(
|
||||
":SkArenaAlloc_hdr",
|
||||
":SkVM_hdr",
|
||||
"//include/core:SkBlender_hdr",
|
||||
"//include/core:SkColorSpace_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1013,6 +1013,7 @@ generated_cc_atom(
|
||||
":SkTextFormatParams_hdr",
|
||||
":SkTraceEvent_hdr",
|
||||
":SkVerticesPriv_hdr",
|
||||
"//experimental/graphite/src:Device_hdr",
|
||||
"//include/core:SkBlender_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkColorFilter_hdr",
|
||||
@ -2136,6 +2137,7 @@ generated_cc_atom(
|
||||
":SkStrikeForGPU_hdr",
|
||||
":SkStrikeSpec_hdr",
|
||||
":SkTraceEvent_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkColorFilter_hdr",
|
||||
"//include/core:SkMaskFilter_hdr",
|
||||
"//include/core:SkPathEffect_hdr",
|
||||
@ -3008,7 +3010,7 @@ generated_cc_atom(
|
||||
"//include/core:SkString_hdr",
|
||||
"//include/private:SkColorData_hdr",
|
||||
"//include/utils:SkRandom_hdr",
|
||||
"//src/gpu:GrBlend_hdr",
|
||||
"//src/gpu:Blend_hdr",
|
||||
"//src/gpu:GrFragmentProcessor_hdr",
|
||||
"//src/gpu:SkGr_hdr",
|
||||
"//src/gpu/effects:GrBlendFragmentProcessor_hdr",
|
||||
@ -3254,7 +3256,9 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkPathBuilder_hdr",
|
||||
"//include/core:SkRefCnt_hdr",
|
||||
"//include/private:SkIDChangeListener_hdr",
|
||||
"//include/private:SkPathRef_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -3868,6 +3872,7 @@ generated_cc_atom(
|
||||
":SkRecordDraw_hdr",
|
||||
"//include/core:SkBBHFactory_hdr",
|
||||
"//include/core:SkImage_hdr",
|
||||
"//include/private:SkTDArray_hdr",
|
||||
"//src/utils:SkPatchUtils_hdr",
|
||||
],
|
||||
)
|
||||
@ -5206,6 +5211,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":SkVM_fwd_hdr",
|
||||
"//include/core:SkBlendMode_hdr",
|
||||
"//include/core:SkColorType_hdr",
|
||||
"//include/core:SkColor_hdr",
|
||||
"//include/core:SkSpan_hdr",
|
||||
"//include/private:SkMacros_hdr",
|
||||
@ -5572,6 +5578,7 @@ generated_cc_atom(
|
||||
"//include/core:SkBlendMode_hdr",
|
||||
"//include/core:SkShader_hdr",
|
||||
"//include/core:SkTileMode_hdr",
|
||||
"//include/private:SkColorData_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -5583,8 +5590,8 @@ generated_cc_atom(
|
||||
":SkDebugUtils_hdr",
|
||||
":SkKeyHelpers_hdr",
|
||||
":SkPaintParamsKey_hdr",
|
||||
":SkPipelineData_hdr",
|
||||
":SkShaderCodeDictionary_hdr",
|
||||
":SkUniformData_hdr",
|
||||
":SkUniform_hdr",
|
||||
"//experimental/graphite/src:UniformManager_hdr",
|
||||
"//src/shaders:SkShaderBase_hdr",
|
||||
@ -5635,10 +5642,7 @@ generated_cc_atom(
|
||||
name = "SkUniformData_src",
|
||||
srcs = ["SkUniformData.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkOpts_hdr",
|
||||
":SkUniformData_hdr",
|
||||
],
|
||||
deps = [":SkUniformData_hdr"],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
@ -5674,9 +5678,32 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":SkArenaAlloc_hdr",
|
||||
":SkPaintParamsKey_hdr",
|
||||
":SkPipelineData_hdr",
|
||||
":SkUniform_hdr",
|
||||
"//include/core:SkSpan_hdr",
|
||||
"//include/private:SkSpinlock_hdr",
|
||||
"//include/private:SkUniquePaintParamsID_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "SkPipelineData_hdr",
|
||||
hdrs = ["SkPipelineData.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkUniformData_hdr",
|
||||
"//include/core:SkRefCnt_hdr",
|
||||
"//include/private:SkColorData_hdr",
|
||||
"//src/gpu:Blend_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "SkPipelineData_src",
|
||||
srcs = ["SkPipelineData.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":SkOpts_hdr",
|
||||
":SkPipelineData_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -185,7 +185,6 @@ cc_library(
|
||||
"//src/gpu/ops:TessellationPathRenderer_src",
|
||||
"//src/gpu/ops:TextureOp_src",
|
||||
"//src/gpu/ops:TriangulatingPathRenderer_src",
|
||||
"//src/gpu/tessellate:PatchWriter_src",
|
||||
"//src/gpu/tessellate:PathCurveTessellator_src",
|
||||
"//src/gpu/tessellate:PathWedgeTessellator_src",
|
||||
"//src/gpu/tessellate:StrokeFixedCountTessellator_src",
|
||||
@ -650,13 +649,6 @@ generated_cc_atom(
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "GrBlend_hdr",
|
||||
hdrs = ["GrBlend.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = ["//include/core:SkTypes_hdr"],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "GrBlurUtils_hdr",
|
||||
hdrs = ["GrBlurUtils.h"],
|
||||
@ -681,6 +673,7 @@ generated_cc_atom(
|
||||
":GrThreadSafeCache_hdr",
|
||||
":GrUtil_hdr",
|
||||
":SkGr_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkPaint_hdr",
|
||||
"//include/gpu:GrDirectContext_hdr",
|
||||
"//include/gpu:GrRecordingContext_hdr",
|
||||
@ -742,7 +735,7 @@ generated_cc_atom(
|
||||
hdrs = ["GrCaps.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":GrBlend_hdr",
|
||||
":Blend_hdr",
|
||||
":GrSamplerState_hdr",
|
||||
":GrShaderCaps_hdr",
|
||||
":GrSurfaceProxy_hdr",
|
||||
@ -1095,6 +1088,7 @@ generated_cc_atom(
|
||||
":SkGr_hdr",
|
||||
":SurfaceContext_hdr",
|
||||
":SurfaceFillContext_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/gpu:GrContextThreadSafeProxy_hdr",
|
||||
"//include/gpu:GrDirectContext_hdr",
|
||||
"//src/core:SkRuntimeEffectPriv_hdr",
|
||||
@ -2602,6 +2596,7 @@ generated_cc_atom(
|
||||
":GrTextureProxy_hdr",
|
||||
":SkGr_hdr",
|
||||
":SurfaceContext_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/gpu:GrRecordingContext_hdr",
|
||||
"//src/core:SkMatrixProvider_hdr",
|
||||
"//src/gpu/geometry:GrStyledShape_hdr",
|
||||
@ -3283,7 +3278,7 @@ generated_cc_atom(
|
||||
hdrs = ["GrXferProcessor.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":GrBlend_hdr",
|
||||
":Blend_hdr",
|
||||
":GrNonAtomicRef_hdr",
|
||||
":GrProcessorAnalysis_hdr",
|
||||
":GrProcessor_hdr",
|
||||
@ -3341,7 +3336,7 @@ generated_cc_atom(
|
||||
hdrs = ["SkGr.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":GrBlend_hdr",
|
||||
":Blend_hdr",
|
||||
":GrCaps_hdr",
|
||||
":GrColor_hdr",
|
||||
":GrSamplerState_hdr",
|
||||
@ -3539,3 +3534,10 @@ generated_cc_atom(
|
||||
"//src/core:SkRasterPipeline_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "Blend_hdr",
|
||||
hdrs = ["Blend.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = ["//include/core:SkTypes_hdr"],
|
||||
)
|
||||
|
@ -302,6 +302,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":GrMatrixConvolutionEffect_hdr",
|
||||
":GrTextureEffect_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/private:SkHalf_hdr",
|
||||
"//src/gpu:GrDirectContextPriv_hdr",
|
||||
"//src/gpu:GrProxyProvider_hdr",
|
||||
@ -405,7 +406,7 @@ generated_cc_atom(
|
||||
"//include/gpu:GrTypes_hdr",
|
||||
"//include/private:SkMacros_hdr",
|
||||
"//include/private:SkTo_hdr",
|
||||
"//src/gpu:GrBlend_hdr",
|
||||
"//src/gpu:Blend_hdr",
|
||||
"//src/gpu:GrCaps_hdr",
|
||||
"//src/gpu:GrPipeline_hdr",
|
||||
"//src/gpu:GrProcessorAnalysis_hdr",
|
||||
|
@ -261,6 +261,7 @@ generated_cc_atom(
|
||||
"//include/private:SkTo_hdr",
|
||||
"//src/core:SkAutoMalloc_hdr",
|
||||
"//src/core:SkCompressedDataUtils_hdr",
|
||||
"//src/core:SkLRUCache_hdr",
|
||||
"//src/core:SkMipmap_hdr",
|
||||
"//src/core:SkScopeExit_hdr",
|
||||
"//src/core:SkTraceEvent_hdr",
|
||||
|
@ -36,7 +36,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":GrGLSLShaderBuilder_hdr",
|
||||
"//src/gpu:GrBlend_hdr",
|
||||
"//src/gpu:Blend_hdr",
|
||||
"//src/gpu:GrFragmentProcessor_hdr",
|
||||
"//src/gpu:GrProcessor_hdr",
|
||||
],
|
||||
|
@ -969,6 +969,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":GrSimpleMeshDrawOpHelper_hdr",
|
||||
":ShadowRRectOp_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/gpu:GrRecordingContext_hdr",
|
||||
"//src/core:SkRRectPriv_hdr",
|
||||
"//src/gpu:GrDrawOpTest_hdr",
|
||||
|
@ -38,22 +38,10 @@ generated_cc_atom(
|
||||
hdrs = ["PatchWriter.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":MiddleOutPolygonTriangulator_hdr",
|
||||
":Tessellation_hdr",
|
||||
":WangsFormula_hdr",
|
||||
"//include/private:SkColorData_hdr",
|
||||
"//src/gpu:GrVertexChunkArray_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "PatchWriter_src",
|
||||
srcs = ["PatchWriter.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":MiddleOutPolygonTriangulator_hdr",
|
||||
":PatchWriter_hdr",
|
||||
":PathTessellator_hdr",
|
||||
":StrokeTessellator_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -64,6 +52,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":PathTessellator_hdr",
|
||||
"//src/core:SkArenaAlloc_hdr",
|
||||
"//src/gpu/geometry:GrInnerFanTriangulator_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -88,7 +77,6 @@ generated_cc_atom(
|
||||
hdrs = ["PathTessellator.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":PatchWriter_hdr",
|
||||
":Tessellation_hdr",
|
||||
"//src/gpu:GrGpuBuffer_hdr",
|
||||
"//src/gpu:GrVertexChunkArray_hdr",
|
||||
@ -199,6 +187,7 @@ generated_cc_atom(
|
||||
hdrs = ["Tessellation.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkPoint_hdr",
|
||||
"//include/core:SkStrokeRec_hdr",
|
||||
"//include/gpu:GrTypes_hdr",
|
||||
"//include/private:SkVx_hdr",
|
||||
|
@ -56,6 +56,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/gpu/vk:GrVkTypes_hdr",
|
||||
"//include/private:SkTDArray_hdr",
|
||||
"//src/gpu:GrCaps_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -41,6 +41,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//experimental/graphite/src:TextureProxyView_hdr",
|
||||
"//include/core:SkData_hdr",
|
||||
"//include/core:SkImage_hdr",
|
||||
"//include/core:SkSurface_hdr",
|
||||
"//include/private:SkTDArray_hdr",
|
||||
@ -111,6 +112,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":SkImage_GpuYUVA_hdr",
|
||||
":SkImage_Gpu_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkYUVAPixmaps_hdr",
|
||||
"//include/gpu:GrDirectContext_hdr",
|
||||
"//include/gpu:GrRecordingContext_hdr",
|
||||
|
@ -118,6 +118,7 @@ generated_cc_atom(
|
||||
":SkPDFUtils_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkData_hdr",
|
||||
"//include/core:SkEncodedImageFormat_hdr",
|
||||
"//include/core:SkExecutor_hdr",
|
||||
"//include/core:SkImage_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
|
@ -268,6 +268,7 @@ generated_cc_atom(
|
||||
"//include/core:SkFontMgr_hdr",
|
||||
"//include/core:SkTypeface_hdr",
|
||||
"//include/core:SkTypes_hdr",
|
||||
"//include/private:SkMutex_hdr",
|
||||
"//src/core:SkGlyph_hdr",
|
||||
"//src/core:SkScalerContext_hdr",
|
||||
"//src/core:SkSharedMutex_hdr",
|
||||
@ -1044,6 +1045,7 @@ generated_cc_atom(
|
||||
":SkTypeface_win_dw_hdr",
|
||||
"//include/core:SkScalar_hdr",
|
||||
"//include/core:SkTypes_hdr",
|
||||
"//include/private:SkTDArray_hdr",
|
||||
"//src/core:SkScalerContext_hdr",
|
||||
],
|
||||
)
|
||||
@ -1057,6 +1059,7 @@ generated_cc_atom(
|
||||
":SkTypeface_win_dw_hdr",
|
||||
"//include/codec:SkCodec_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkData_hdr",
|
||||
"//include/core:SkDrawable_hdr",
|
||||
"//include/core:SkFontMetrics_hdr",
|
||||
"//include/core:SkPath_hdr",
|
||||
|
@ -437,8 +437,8 @@ generated_cc_atom(
|
||||
hdrs = ["SkPatchUtils.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkMatrix_hdr",
|
||||
"//include/private:SkColorData_hdr",
|
||||
"//include/core:SkColor_hdr",
|
||||
"//include/core:SkRefCnt_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -494,7 +494,7 @@ generated_cc_atom(
|
||||
"//include/gpu:GrDirectContext_hdr",
|
||||
"//include/private:GrTypesPriv_hdr",
|
||||
"//include/private:SkColorData_hdr",
|
||||
"//src/gpu:GrBlend_hdr",
|
||||
"//src/gpu:Blend_hdr",
|
||||
"//src/gpu:GrCaps_hdr",
|
||||
"//src/gpu:GrDirectContextPriv_hdr",
|
||||
"//src/gpu:GrPaint_hdr",
|
||||
@ -973,6 +973,7 @@ generated_cc_atom(
|
||||
"//include/core:SkRect_hdr",
|
||||
"//include/core:SkRegion_hdr",
|
||||
"//include/core:SkScalar_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/core:SkSurface_hdr",
|
||||
"//include/core:SkTypes_hdr",
|
||||
"//include/private:SkTDArray_hdr",
|
||||
@ -1464,6 +1465,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":Test_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkVertices_hdr",
|
||||
"//src/core:SkBlendModePriv_hdr",
|
||||
"//src/core:SkMatrixProvider_hdr",
|
||||
@ -1845,6 +1847,7 @@ generated_cc_atom(
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkColorPriv_hdr",
|
||||
"//include/core:SkEncodedImageFormat_hdr",
|
||||
"//include/core:SkImageEncoder_hdr",
|
||||
"//include/core:SkImage_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/core:SkSurface_hdr",
|
||||
@ -2082,6 +2085,7 @@ generated_cc_atom(
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkFont_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/core:SkTypeface_hdr",
|
||||
"//include/ports:SkFontMgr_android_hdr",
|
||||
"//include/private:SkFixed_hdr",
|
||||
@ -3469,6 +3473,7 @@ generated_cc_atom(
|
||||
":Test_hdr",
|
||||
"//include/core:SkData_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/private:SkTDArray_hdr",
|
||||
"//include/private:SkTo_hdr",
|
||||
"//src/pdf:SkPDFMakeToUnicodeCmap_hdr",
|
||||
],
|
||||
@ -4676,6 +4681,7 @@ generated_cc_atom(
|
||||
srcs = ["ProcessorTest.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":TestHarness_hdr",
|
||||
":TestUtils_hdr",
|
||||
":Test_hdr",
|
||||
"//include/gpu:GrDirectContext_hdr",
|
||||
@ -4866,6 +4872,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":Test_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkColorPriv_hdr",
|
||||
"//include/core:SkImage_hdr",
|
||||
@ -5644,6 +5651,7 @@ generated_cc_atom(
|
||||
"//include/core:SkColorFilter_hdr",
|
||||
"//include/core:SkData_hdr",
|
||||
"//include/core:SkPaint_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/core:SkSurface_hdr",
|
||||
"//include/effects:SkBlenders_hdr",
|
||||
"//include/effects:SkRuntimeEffect_hdr",
|
||||
@ -5766,6 +5774,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":Test_hdr",
|
||||
"//include/core:SkM44_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//src/sksl:SkSLCompiler_hdr",
|
||||
"//src/sksl/codegen:SkSLVMCodeGenerator_hdr",
|
||||
"//src/sksl/ir:SkSLExternalFunction_hdr",
|
||||
@ -5812,6 +5821,7 @@ generated_cc_atom(
|
||||
srcs = ["SkSLTest.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":TestHarness_hdr",
|
||||
":Test_hdr",
|
||||
"//gm:gm_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
@ -6263,7 +6273,9 @@ generated_cc_atom(
|
||||
srcs = ["SurfaceTest.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":TestHarness_hdr",
|
||||
":Test_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkData_hdr",
|
||||
"//include/core:SkOverdrawCanvas_hdr",
|
||||
@ -6379,6 +6391,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":TestUtils_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/encode:SkPngEncoder_hdr",
|
||||
"//include/utils:SkBase64_hdr",
|
||||
"//src/core:SkAutoPixmapStorage_hdr",
|
||||
@ -7050,3 +7063,16 @@ generated_cc_atom(
|
||||
"//include/gpu:GrDirectContext_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "TestHarness_hdr",
|
||||
hdrs = ["TestHarness.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "TestHarness_src",
|
||||
srcs = ["TestHarness.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [":TestHarness_hdr"],
|
||||
)
|
||||
|
@ -130,6 +130,7 @@ generated_cc_atom(
|
||||
"//include/effects:SkGradientShader_hdr",
|
||||
"//include/private:SkUniquePaintParamsID_hdr",
|
||||
"//src/core:SkKeyHelpers_hdr",
|
||||
"//src/core:SkPipelineData_hdr",
|
||||
"//src/core:SkShaderCodeDictionary_hdr",
|
||||
"//src/core:SkUniformData_hdr",
|
||||
"//tests:Test_hdr",
|
||||
@ -157,7 +158,7 @@ generated_cc_atom(
|
||||
"//experimental/graphite/include:Recorder_hdr",
|
||||
"//experimental/graphite/src:PipelineDataCache_hdr",
|
||||
"//experimental/graphite/src:RecorderPriv_hdr",
|
||||
"//src/core:SkUniformData_hdr",
|
||||
"//src/core:SkPipelineData_hdr",
|
||||
"//src/core:SkUniform_hdr",
|
||||
"//tests:Test_hdr",
|
||||
],
|
||||
|
@ -18,6 +18,7 @@ filegroup(name = "not_implemented")
|
||||
filegroup(
|
||||
name = "all-toolchain-files",
|
||||
srcs = [
|
||||
"IWYU_mapping.imp",
|
||||
"ar_trampoline.sh",
|
||||
"clang_trampoline.sh",
|
||||
"lld_trampoline.sh",
|
||||
|
12
toolchain/IWYU_mapping.imp
Normal file
12
toolchain/IWYU_mapping.imp
Normal file
@ -0,0 +1,12 @@
|
||||
[
|
||||
{ include: ["<__algorithm/max.h>", "private", "<algorithm>", "public"] },
|
||||
{ include: ["<__algorithm/stable_sort.h>", "private", "<algorithm>", "public"] },
|
||||
|
||||
{ include: ["<__functional/function.h>", "private", "<functional>", "public"] },
|
||||
|
||||
{ include: ["<__memory/unique_ptr.h>", "private", "<memory>", "public"] },
|
||||
|
||||
{ include: ["<string.h>", "public", "<string>", "public"] },
|
||||
|
||||
{ include: ["<__utility/move.h>", "private", "<utility>", "public"] },
|
||||
]
|
@ -99,6 +99,13 @@ debs_to_install = [
|
||||
"sha256": "80a2413ace2a0a073f2472059b9e589737cbf8a336fb6862684a5811bf640aa3",
|
||||
"url": "https://ftp.debian.org/debian/pool/main/libx/libx11/libx11-xcb-dev_1.7.2-1_amd64.deb",
|
||||
},
|
||||
# This is used to make sure we include only the headers we need. This corresponds to
|
||||
# IWYU version 0.17, which uses Clang 13, like we compile with.
|
||||
{
|
||||
# From https://packages.debian.org/sid/amd64/iwyu/download
|
||||
"sha256": "9fd6932a7609e89364f7edc5f9613892c98c21c88a3931e51cf1a0f8744759bd",
|
||||
"url": "https://ftp.debian.org/debian/pool/main/i/iwyu/iwyu_8.17-1_amd64.deb",
|
||||
},
|
||||
]
|
||||
|
||||
def _download_and_extract_deb(ctx, deb, sha256, prefix, output = ""):
|
||||
|
@ -15,6 +15,7 @@ load(
|
||||
"@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
|
||||
"action_config",
|
||||
"feature",
|
||||
"feature_set",
|
||||
"flag_group",
|
||||
"flag_set",
|
||||
"tool",
|
||||
@ -30,6 +31,7 @@ def _clang_impl(ctx):
|
||||
features = []
|
||||
features += _make_default_flags()
|
||||
features += _make_diagnostic_flags()
|
||||
features += _make_iwyu_flags()
|
||||
|
||||
# https://docs.bazel.build/versions/main/skylark/lib/cc_common.html#create_cc_toolchain_config_info
|
||||
# Note, this rule is defined in Java code, not Starlark
|
||||
@ -329,3 +331,49 @@ def _make_diagnostic_flags():
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
def _make_iwyu_flags():
|
||||
"""Here we define the flags that signal whether or not to enforce IWYU."""
|
||||
|
||||
# https://bazel.build/docs/cc-toolchain-config-reference#features
|
||||
opt_file_into_iwyu = flag_set(
|
||||
actions = [
|
||||
ACTION_NAMES.c_compile,
|
||||
ACTION_NAMES.cpp_compile,
|
||||
],
|
||||
flag_groups = [
|
||||
flag_group(
|
||||
flags = [
|
||||
# This define does not impact compilation, but it acts as a signal to the
|
||||
# clang_trampoline.sh whether check the file with include-what-you-use
|
||||
# A define was chosen because it is ignored by clang and IWYU, but can be
|
||||
# easily found with bash.
|
||||
"-DSKIA_ENFORCE_IWYU_FOR_THIS_FILE",
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
return [
|
||||
feature(
|
||||
# The IWYU checks can add some overhead to the build (1-5 seconds per file), so we only
|
||||
# want to run them sometimes. By adding --feature skia_enforce_iwyu to the Bazel
|
||||
# command, this will turn on the checking (for all files that have not been opted-out).
|
||||
"skia_enforce_iwyu",
|
||||
enabled = False,
|
||||
),
|
||||
feature(
|
||||
"skia_opt_file_into_iwyu",
|
||||
enabled = False,
|
||||
flag_sets = [
|
||||
opt_file_into_iwyu,
|
||||
],
|
||||
# If the skia_enforce_iwyu features is not enabled (e.g. globally via a CLI flag), we
|
||||
# will not run the IWYU analysis on any files.
|
||||
requires = [
|
||||
feature_set(features = [
|
||||
"skia_enforce_iwyu",
|
||||
]),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
@ -4,4 +4,38 @@
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
external/clang_linux_amd64/bin/clang $@
|
||||
# If compilation fails, we want to exit right away
|
||||
set -e
|
||||
# We only want to run include-what-you-use if SKIA_ENFORCE_IWYU_FOR_THIS_FILE is in the arguments
|
||||
# passed in (i.e. the "skia_opt_file_into_iwyu" feature is enabled) and we are not linking
|
||||
# (as detected by the presence of -fuse-ld).
|
||||
if [[ "$@" != *SKIA_ENFORCE_IWYU_FOR_THIS_FILE* || "$@" == *use-ld* ]]; then
|
||||
external/clang_linux_amd64/bin/clang $@
|
||||
exit 0
|
||||
else
|
||||
# Now try to compile with Clang, and then verify with IWYU
|
||||
external/clang_linux_amd64/bin/clang $@
|
||||
# IWYU always returns a non-zero code because it doesn't produce the .o file (that's why
|
||||
# we ran Clang first). As such, we do not want bash to fail after running IWYU.
|
||||
set +e
|
||||
# Get absolute path to the mapping file because resolving the relative path is tricky, given
|
||||
# how Bazel locates the toolchain files.
|
||||
MAPPING_FILE=$(realpath $(dirname ${BASH_SOURCE[0]}))"/IWYU_mapping.imp"
|
||||
# IWYU always outputs something to stderr, which can be noisy if everything is fixed.
|
||||
# Otherwise, we send the exact same arguments to include-what-you-use that we would for
|
||||
# regular compilation with clang.
|
||||
external/clang_linux_amd64/usr/bin/include-what-you-use \
|
||||
-Xiwyu --mapping_file=$MAPPING_FILE $@ 2>/dev/null
|
||||
# IWYU returns 2 if everything looks good. It returns some other non-zero exit code otherwise.
|
||||
if [ $? -eq 2 ]; then
|
||||
exit 0 # keep the build going
|
||||
else
|
||||
# Run IWYU again, but this time display the output. Then return non-zero to fail the build.
|
||||
# These flags are a little different, but only in ways that affect what was displayed, not the
|
||||
# analysis.
|
||||
external/clang_linux_amd64/usr/bin/include-what-you-use \
|
||||
-Xiwyu --mapping_file=$MAPPING_FILE -Xiwyu --no_comments \
|
||||
-Xiwyu --quoted_includes_first -Xiwyu --verbose=3 $@
|
||||
exit 1 # fail the build
|
||||
fi
|
||||
fi
|
||||
|
@ -240,6 +240,8 @@ generated_cc_atom(
|
||||
hdrs = ["Resources.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkData_hdr",
|
||||
"//include/core:SkImage_hdr",
|
||||
"//include/core:SkString_hdr",
|
||||
],
|
||||
@ -325,6 +327,7 @@ generated_cc_atom(
|
||||
"//include/core:SkData_hdr",
|
||||
"//include/core:SkImage_hdr",
|
||||
"//include/core:SkSerialProcs_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
@ -561,7 +564,10 @@ generated_cc_atom(
|
||||
name = "list_gpu_unit_tests_src",
|
||||
srcs = ["list_gpu_unit_tests.cpp"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = ["//tests:Test_hdr"],
|
||||
deps = [
|
||||
"//tests:TestHarness_hdr",
|
||||
"//tests:Test_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
|
@ -27,6 +27,7 @@ generated_cc_atom(
|
||||
"//src/gpu:GrDirectContextPriv_hdr",
|
||||
"//src/gpu:GrGpu_hdr",
|
||||
"//src/utils:SkOSPath_hdr",
|
||||
"//tests:TestHarness_hdr",
|
||||
"//tests:Test_hdr",
|
||||
"//tools:AutoreleasePool_hdr",
|
||||
"//tools:CrashHandler_hdr",
|
||||
|
@ -39,7 +39,7 @@ generated_cc_atom(
|
||||
hdrs = ["BackendSurfaceFactory.h"],
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkImageInfo_hdr",
|
||||
"//include/core:SkRefCnt_hdr",
|
||||
"//include/core:SkSize_hdr",
|
||||
"//include/gpu:GrTypes_hdr",
|
||||
"//include/private:SkColorData_hdr",
|
||||
@ -66,6 +66,7 @@ generated_cc_atom(
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
"//include/core:SkColor_hdr",
|
||||
"//include/core:SkImageInfo_hdr",
|
||||
"//include/core:SkRefCnt_hdr",
|
||||
"//include/gpu:GrTypes_hdr",
|
||||
],
|
||||
|
@ -52,27 +52,38 @@ cc_library(
|
||||
generated_cc_atom(
|
||||
name = "Application_hdr",
|
||||
hdrs = ["Application.h"],
|
||||
enforce_iwyu = True,
|
||||
visibility = ["//:__subpackages__"],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "CommandSet_hdr",
|
||||
hdrs = ["CommandSet.h"],
|
||||
enforce_iwyu = True,
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":Window_hdr",
|
||||
"//include/core:SkString_hdr",
|
||||
"//include/core:SkTypes_hdr",
|
||||
"//include/private:SkTArray_hdr",
|
||||
"//tools/skui:InputState_hdr",
|
||||
"//tools/skui:Key_hdr",
|
||||
"//tools/skui:ModifierKey_hdr",
|
||||
],
|
||||
)
|
||||
|
||||
generated_cc_atom(
|
||||
name = "CommandSet_src",
|
||||
srcs = ["CommandSet.cpp"],
|
||||
enforce_iwyu = True,
|
||||
visibility = ["//:__subpackages__"],
|
||||
deps = [
|
||||
":CommandSet_hdr",
|
||||
":Window_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkFontTypes_hdr",
|
||||
"//include/core:SkFont_hdr",
|
||||
"//include/core:SkPaint_hdr",
|
||||
"//include/core:SkScalar_hdr",
|
||||
"//src/core:SkStringUtils_hdr",
|
||||
],
|
||||
)
|
||||
|
@ -9,7 +9,13 @@
|
||||
|
||||
#include "include/core/SkCanvas.h"
|
||||
#include "include/core/SkFont.h"
|
||||
#include "include/core/SkFontTypes.h"
|
||||
#include "include/core/SkPaint.h"
|
||||
#include "include/core/SkScalar.h"
|
||||
#include "src/core/SkStringUtils.h"
|
||||
#include "tools/sk_app/Window.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace sk_app {
|
||||
|
||||
|
@ -9,7 +9,11 @@
|
||||
#define CommandSet_DEFINED
|
||||
|
||||
#include "include/core/SkString.h"
|
||||
#include "tools/sk_app/Window.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/private/SkTArray.h"
|
||||
#include "tools/skui/InputState.h"
|
||||
#include "tools/skui/Key.h"
|
||||
#include "tools/skui/ModifierKey.h"
|
||||
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
@ -17,6 +21,7 @@
|
||||
class SkCanvas;
|
||||
|
||||
namespace sk_app {
|
||||
class Window;
|
||||
|
||||
/**
|
||||
* Helper class used by applications that want to hook keypresses to trigger events.
|
||||
|
@ -37,6 +37,7 @@ generated_cc_atom(
|
||||
deps = [
|
||||
":skqp_hdr",
|
||||
"//gm:gm_hdr",
|
||||
"//include/core:SkBitmap_hdr",
|
||||
"//include/core:SkFontStyle_hdr",
|
||||
"//include/core:SkGraphics_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
@ -49,6 +50,7 @@ generated_cc_atom(
|
||||
"//src/core:SkOSFile_hdr",
|
||||
"//src/core:SkStreamPriv_hdr",
|
||||
"//src/utils:SkOSPath_hdr",
|
||||
"//tests:TestHarness_hdr",
|
||||
"//tests:Test_hdr",
|
||||
"//tools/fonts:TestFontMgr_hdr",
|
||||
"//tools/gpu/gl:GLTestContext_hdr",
|
||||
|
@ -226,6 +226,7 @@ generated_cc_atom(
|
||||
":Viewer_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkFont_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
"//include/effects:SkGradientShader_hdr",
|
||||
"//include/effects:SkPerlinNoiseShader_hdr",
|
||||
"//include/sksl:SkSLDebugTrace_hdr",
|
||||
@ -483,5 +484,6 @@ generated_cc_atom(
|
||||
":SkSLDebuggerSlide_hdr",
|
||||
":Viewer_hdr",
|
||||
"//include/core:SkCanvas_hdr",
|
||||
"//include/core:SkStream_hdr",
|
||||
],
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user