blob: 55b14b6fcb9d41dda8585c5bbaef1bd0352ff50a [file] [log] [blame]
load("//bazel:macros.bzl", "exports_files_legacy", "generate_cpp_files_for_headers", "skia_filegroup")
licenses(["notice"])
exports_files_legacy()
skia_filegroup(
name = "public_hdrs",
srcs = [
"//include/android:public_hdrs",
"//include/codec:public_hdrs",
"//include/config:public_hdrs",
"//include/core:public_hdrs",
"//include/docs:public_hdrs",
"//include/effects:public_hdrs",
"//include/encode:public_hdrs",
"//include/pathops:public_hdrs",
"//include/ports:public_hdrs",
"//include/utils:public_hdrs",
] + select({
"//src/sksl:needs_sksl": ["//include/sksl:public_hdrs"],
"//conditions:default": [],
}) + select({
"//src/gpu:has_gpu_backend": ["//include/gpu:public_hdrs"],
"//conditions:default": [],
}) + select({
"//src/svg:enable_svg_canvas_true": ["//include/svg:public_hdrs"],
"//conditions:default": [],
}),
visibility = [
"//:__pkg__",
"//src/opts:__pkg__",
],
)
skia_filegroup(
name = "private_hdrs",
srcs = [
"//include/private:private_hdrs",
],
visibility = [
"//:__pkg__",
"//src/opts:__pkg__",
],
)
skia_filegroup(
name = "srcs",
srcs = select({
# These sources are not checked in - Bazel generates them dynamically. We only want to
# generate and compile them when we are doing compile-time analysis, e.g. IWYU.
"//bazel/common_config_settings:compile_generated_cpp_files_for_headers_true": [
":generated_srcs",
],
# If filegroups are empty and used in a cc_library, Bazel throws an error. So we have to
# put something here.
"//conditions:default": [":private_hdrs"],
}),
visibility = ["//:__pkg__"],
)
generate_cpp_files_for_headers(
name = "generated_srcs",
headers = [
":public_hdrs",
":private_hdrs",
],
# All headers listed here (using paths relative to the Skia root) will have a .cpp file
# generated that is a copy of the header file just with a .cpp suffix so Bazel will try to
# compile it. This allows us to run IWYU on these files.
to_generate = [
"include/config/SkUserConfig.h",
"include/core/SkAlphaType.h",
"include/core/SkBlendMode.h",
"include/core/SkBlurTypes.h",
"include/core/SkCoverageMode.h",
"include/core/SkFontStyle.h",
"include/core/SkFontTypes.h",
"include/core/SkMath.h",
"include/core/SkPathTypes.h",
"include/core/SkRefCnt.h",
"include/core/SkScalar.h",
"include/core/SkSize.h",
"include/core/SkSpan.h",
"include/core/SkTypes.h",
"include/gpu/GrTypes.h",
"include/private/SkFixed.h",
"include/private/SkFloatBits.h",
"include/private/SkFloatingPoint.h",
"include/private/SkIDChangeListener.h",
"include/private/SkMacros.h",
"include/private/SkNoncopyable.h",
"include/private/SkSafe32.h",
"include/private/SkSafe_math.h",
"include/private/SkTArray.h",
"include/private/SkTDArray.h",
"include/private/SkTLogic.h",
"include/private/SkTPin.h",
"include/private/SkTemplates.h",
"include/private/SkWeakRefCnt.h",
"include/private/base/SingleOwner.h",
"include/private/base/SkAPI.h",
"include/private/base/SkAlign.h",
"include/private/base/SkAssert.h",
"include/private/base/SkAttributes.h",
"include/private/base/SkDebug.h",
"include/private/base/SkDeque.h",
"include/private/base/SkFeatures.h",
"include/private/base/SkLoadUserConfig.h",
"include/private/base/SkMalloc.h",
"include/private/base/SkMutex.h",
"include/private/base/SkOnce.h",
"include/private/base/SkSemaphore.h",
"include/private/base/SkTFitsIn.h",
"include/private/base/SkThreadAnnotations.h",
"include/private/base/SkThreadID.h",
"include/private/base/SkTo.h",
# IWYU chokes on the following file:
# "include/private/SkVx.h",
],
)