skia2/include/core
Kevin Lubick 2c65579aad [bazel] Add in hierarchical filegroup Bazel rules.
The primary goal of this organization structure is to keep
our top level BUILD.bazel file short, with as little logic
as feasible. The logic required to control which files to
include, which third_party deps are needed, what system libraries
should be linked again, etc, should be in the BUILD.bazel
file best should be as close to the affected files as feasible.

In essence, we use filegroup() rules to bubble up the files
needed to build Skia (all as one big cc_library call) and
cc_library rules to bubble up the other components needed to build.

For example, //src/ports/SkFontHost_FreeType.cpp needs FreeType,
but only if we are compiling Skia with that type of font
support. With the new organization structure in this CL,
//src/ports/BUILD.bazel should have the logic that determines
if the cpp file should be included in the build of Skia and
if it is, that the Skia build should depend on //third_party:freetype2

Another example is //src/gpu/ganesh/BUILD.bazel, which
chooses which of the dawn, gl, vulkan, etc backend sources,
and the associated dependencies to include in the build.
It does not specify what those are, but delegates to the
BUILD.bazel files in the subdirectories housing the
backend-specific code.

The structure guidelines for BUILD.bazel files are as follows:
 - Have a filegroup() called "hdrs" (for public headers) or
   "srcs" (for private headers and all .cpp files) that is
   visible to the parent directory. This should list the
   files from the containing directory to include in the
   build.
   See //include/core/BUILD.bazel and //src/effects/BUILD.bazel
   as examples.
 - filegroup() rules can list a child directory's "hdrs"
   or "srcs" in their "srcs" attributes, but should not contain
   select statements pertaining to child directory files.
   See //include/gpu/BUILD.bazel and //src/gpu/ganesh/BUILD.bazel
   as examples.
 - May have a cc_library() called "deps". This can specify
   dependencies, cc_opts, and linkopts, but not srcs or hdrs. [1]
   See //src/codec/BUILD.bazel as an example. These should
   be visible to the parent directory.
 - "hdrs", "srcs", and "deps" for the primary Skia build
   (currently called "skia_core") should bubble up through
   //include/BUILD.bazel and //src/BUILD.bazel, one directory
   at a time.

This CL demonstrates a very basic build of Skia with many features
turned off (CPU only, no fonts, no codecs). Follow-on CLs will
add to these rules as more targets are supported. See bazel/Makefile
for the builds that work with just this CL.

Suggested Review Order:
 - //BUILD.bazel to see the very small skia_core rule which
   delegates all the logic down stack. Note that it has a
   dependency on //bazel:defines_from_flags which will set
   all the defines listed there when compiling all the
   .cpp and .h files in skia_core *and* anything that depends
   on skia_core, but *not* //src:deps.
 - //include/BUILD.bazel and other BUILD.bazel files in the
   subdirectories of that folder. Note that the filegroups in
   //include/private/... are called "srcs" to be similar to
   how Bazel wants "private headers" to be in the "srcs" of
   cc_library, cc_binary, etc. and only public headers are
   to be in "hdrs" [2].
 - //src/BUILD.bazel and other BUILD.bazel files in the
   subdirectories of that folder. //src/gpu/ganesh/...
   will be filled in for dawn, vulkan, and GL in the next CL.
 - //PRESUBMIT.py, which adds a check that runs buildifier [3]
   on modified BUILD.bazel files to make sure they stay
   consistently formatted.
 - //bazel/... to see the new option I added to make sksl
   opt-in or opt-out, so one could build Skia with sksl,
   but not with a gpu backend.
 - Misc .h and .cpp files, whose includes were removed if
   unnecessary or #ifdef'd out to make the minimal build
   work without GPU or SkSL includes.
 - //bazel/Makefile to see the builds that work with this CL.

[1] Setting srcs or hdrs is error-prone at best, because those
   files will be compiled with a different set of defines than
   the rest of skia_core, because they wouldn't depend on
   //bazel:defines_from_flags.
[2] https://bazel.build/reference/be/c-cpp#cc_library.hdrs
[3] https://github.com/bazelbuild/buildtools/releases
Change-Id: I5e0e3ae01ad42d672506d5aad1239f2512188191
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/543977
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-05-31 14:14:54 +00:00
..
BUILD.bazel [bazel] Add in hierarchical filegroup Bazel rules. 2022-05-31 14:14:54 +00:00
SkAlphaType.h [includes] Prepare to remove SkColor<->SkImageInfo 2022-03-09 18:40:44 +00:00
SkAnnotation.h [pdf] Differentiate text from byte strings. 2022-05-24 18:46:42 +00:00
SkBBHFactory.h Reenable Wdeprecated-copy-dtor 2021-02-16 17:53:28 +00:00
SkBitmap.h Make float color versions of SkBitmap::clear 2022-05-19 23:25:06 +00:00
SkBlender.h Move Mode() factory into SkBlender 2021-07-06 13:39:05 +00:00
SkBlendMode.h Add kSkBlendModeCount 2022-05-13 18:56:38 +00:00
SkBlurTypes.h
SkCanvas.h Fix up Ganesh and Graphite defines. 2022-05-23 20:51:28 +00:00
SkCanvasVirtualEnforcer.h
SkCapabilities.h Remove SkSL portions of SkCapabilities when SkSL is not enabled 2022-05-19 19:32:48 +00:00
SkClipOp.h Remove SK_SUPPORT_DEPRECATED_CLIPOPS and expanding clip op defs 2021-08-06 19:15:13 +00:00
SkColor.h Comment SkColor4f's makeOpaque function 2022-05-29 23:50:43 +00:00
SkColorFilter.h [includes] Prepare to remove SkColor<->SkImageInfo 2022-03-09 18:40:44 +00:00
SkColorPriv.h
SkColorSpace.h
SkColorType.h [graphite] Add format tables to MtlCaps 2022-03-28 14:10:29 +00:00
SkCombinationBuilder.h [graphite] Add SkCombinationBuilder.h 2022-05-23 20:26:17 +00:00
SkContourMeasure.h
SkCoverageMode.h
SkCubicMap.h
SkData.h Zero-initialize uniform data in SkRuntimeEffectBuilder 2021-11-18 17:15:07 +00:00
SkDataTable.h
SkDeferredDisplayList.h Reland "Purge ccpr" 2021-06-19 18:42:38 +00:00
SkDeferredDisplayListRecorder.h mipMapped -> mipmapped 2022-04-18 14:26:19 +00:00
SkDocument.h
SkDrawable.h Plumbing for glyph drawable 2022-02-08 18:14:27 +00:00
SkDrawLooper.h Hide (unused) SkDrawLooper 2021-02-07 12:49:53 +00:00
SkEncodedImageFormat.h Add MVP implementation of JPEGXL decoder. 2022-02-02 15:17:14 +00:00
SkExecutor.h Reenable Wdeprecated-copy-dtor 2021-02-16 17:53:28 +00:00
SkFlattenable.h Fixup enum name in SkFlattenable. 2021-07-30 18:19:11 +00:00
SkFont.h Extract the CPU code of SkGlyphRunPainter called SkGlyphRunPainterCPU 2022-05-10 16:54:33 +00:00
SkFontArguments.h Support font palette overrides through SkFontArguments 2022-02-17 13:19:53 +00:00
SkFontMetrics.h
SkFontMgr.h Purge 2020 picture versions 2021-07-19 19:35:49 +00:00
SkFontParameters.h
SkFontStyle.h
SkFontTypes.h
SkGraphics.h Add optional OT-SVG support to FreeType 2022-04-25 18:51:01 +00:00
SkICC.h
SkImage.h [graphite] Add SkBudgeted field to Resources. 2022-05-23 17:59:54 +00:00
SkImageEncoder.h Reland "[includes] Remove link between SkImageEncoder and SkBitmap" 2022-03-15 18:26:16 +00:00
SkImageFilter.h Move more virtuals into ...Base to hide them from public api 2021-06-18 20:20:06 +00:00
SkImageGenerator.h Reland "Remove skstd::optional entirely." 2022-02-24 15:12:43 +00:00
SkImageInfo.h Reland "Reland "[includes] Remove SkColorSpace include from SkImageInfo"" 2022-05-02 13:33:21 +00:00
SkM44.h [androidkit] optimize JNI calls in AndroidKit.Matrix transformations 2021-05-07 16:17:09 +00:00
SkMallocPixelRef.h
SkMaskFilter.h Move more virtuals into ...Base to hide them from public api 2021-06-18 20:20:06 +00:00
SkMath.h
SkMatrix.h Document SkMatrix default constructs to identity 2021-07-24 16:04:39 +00:00
SkMesh.h Rename SkCustomMesh to SkMesh 2022-05-09 13:36:21 +00:00
SkMilestone.h Update Skia milestone to 104 2022-05-13 14:21:17 +00:00
SkOpenTypeSVGDecoder.h Add optional OT-SVG support to FreeType 2022-04-25 18:51:01 +00:00
SkOverdrawCanvas.h introduce SkCanvas::onDrawGlyphRunList 2021-04-15 19:44:24 +00:00
SkPaint.h [includes] Prepare to remove SkColor<->SkImageInfo 2022-03-09 18:40:44 +00:00
SkPath.h [includes] Remove include link between SkPath.h and SkPathRef.h 2022-03-09 00:55:54 +00:00
SkPathBuilder.h [includes] Remove include link between SkPath.h and SkPathRef.h 2022-03-09 00:55:54 +00:00
SkPathEffect.h Pass CTM to path effects (experimental) 2021-07-13 18:42:55 +00:00
SkPathMeasure.h
SkPathTypes.h
SkPicture.h Remove legacy support for inheriting sampling from the paint. 2021-03-19 16:17:42 +00:00
SkPictureRecorder.h
SkPixelRef.h Always copy base level in SkImage_Raster::onMakeWithMipmaps 2022-03-31 20:48:55 +00:00
SkPixmap.h [includes] Prepare for moving SkColorSpace to forward declare 2022-03-31 19:50:10 +00:00
SkPngChunkReader.h
SkPoint3.h
SkPoint.h
SkPromiseImageTexture.h Remove all unused uniqueKey support from SkPromiseImageTexture. 2021-12-21 21:32:43 +00:00
SkRasterHandleAllocator.h Reenable Wdeprecated-copy-dtor 2021-02-16 17:53:28 +00:00
SkRect.h Make simple coord/size getters on Sk[I]Rect constexpr 2021-12-09 22:17:30 +00:00
SkRefCnt.h
SkRegion.h
SkRRect.h
SkRSXform.h Add SkRSXform to SK_API 2022-02-28 14:07:10 +00:00
SkSamplingOptions.h Reland "Reland "Add anisotropic option to SkSamplingOptions."" 2022-04-29 19:28:52 +00:00
SkScalar.h
SkSerialProcs.h
SkShader.h Generalize composing imagefilters and shaders to blenders 2021-07-26 21:07:51 +00:00
SkSize.h
SkSpan.h Add support for SkSpan::subspan(offset). 2022-04-12 22:44:11 +00:00
SkStream.h
SkString.h Add SK_PRINTF_LIKE to existing variadic print functions. 2022-02-07 14:55:39 +00:00
SkStrokeRec.h
SkSurface.h Make GrCaps and graphite::Caps derive from SkCapabilities 2022-05-18 20:25:25 +00:00
SkSurfaceCharacterization.h Move more GPU-specific code behind SK_SUPPORT_GPU flag 2021-11-03 14:12:52 +00:00
SkSurfaceProps.h Move the DMSAA surface flag into the public API 2021-07-13 19:21:00 +00:00
SkSwizzle.h
SkTextBlob.h Expose experimental iterator on SkParagraph 2021-04-16 16:50:33 +00:00
SkTileMode.h
SkTime.h Reland "Add format-specifier warnings to SkDebugf." 2021-06-25 17:57:43 +00:00
SkTraceMemoryDump.h Add ability to trace wrapped objects and be able to differentiate 2021-04-08 18:38:14 +00:00
SkTypeface.h rename fontID to typefaceID 2022-02-07 20:12:39 +00:00
SkTypes.h Fix up Ganesh and Graphite defines. 2022-05-23 20:51:28 +00:00
SkUnPreMultiply.h
SkVertices.h Remove custom SkVertices data and runtime effect varying support 2021-04-19 17:49:25 +00:00
SkYUVAInfo.h
SkYUVAPixmaps.h