Skip to content

Commit

Permalink
[bazel] Move remaining deps out of //third_party/BUILD.bazel
Browse files Browse the repository at this point in the history
Change-Id: Ib6083b99670eff7b8455cee2b21814db7a790d2a
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/559537
Reviewed-by: Ben Wagner <[email protected]>
  • Loading branch information
kjlubick committed Jul 18, 2022
1 parent 0a5bcd1 commit b247169
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 54 deletions.
2 changes: 1 addition & 1 deletion PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def _CheckBazelBUILDFiles(input_api, output_api):
is_bazel = affected_file_path.endswith('BUILD.bazel')
# This list lines up with the one in autoroller_lib.py (see G3).
excluded_paths = ["infra/", "bazel/rbe/", "bazel/external/", "bazel/common_config_settings/",
"modules/canvaskit/go/", "experimental/", "bazel/platform"]
"modules/canvaskit/go/", "experimental/", "bazel/platform", "third_party/"]
is_excluded = any(affected_file_path.startswith(n) for n in excluded_paths)
if is_bazel and not is_excluded:
with open(affected_file_path, 'r') as file:
Expand Down
7 changes: 7 additions & 0 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ new_local_repository(
workspace_file_content = "",
)

new_local_repository(
name = "spirv_cross",
build_file = "bazel/external/spirv_cross/BUILD.bazel",
path = "third_party/externals/spirv-cross",
workspace_file_content = "",
)

new_local_repository(
name = "perfetto",
build_file = "bazel/external/perfetto/BUILD.bazel",
Expand Down
39 changes: 39 additions & 0 deletions bazel/external/spirv_cross/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This file will be copied into //third_party/externals/spirv-cross via the new_local_repository
# rule in WORKSPACE.bazel, so all files should be relative to that path.

cc_library(
name = "spirv_cross",
srcs = [
"GLSL.std.450.h",
"spirv.hpp",
"spirv_cfg.cpp",
"spirv_cfg.hpp",
"spirv_common.hpp",
"spirv_cpp.cpp",
"spirv_cpp.hpp",
"spirv_cross.cpp",
"spirv_cross.hpp",
"spirv_cross_containers.hpp",
"spirv_cross_error_handling.hpp",
"spirv_cross_parsed_ir.cpp",
"spirv_cross_parsed_ir.hpp",
"spirv_glsl.cpp",
"spirv_glsl.hpp",
"spirv_hlsl.cpp",
"spirv_msl.cpp",
"spirv_msl.hpp",
"spirv_parser.cpp",
"spirv_parser.hpp",
"spirv_reflect.cpp",
"spirv_reflect.hpp",
],
hdrs = [
"spirv_hlsl.hpp",
],
defines = ["SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS"],
includes = [
# This allows #include <spirv_hlsl.hpp> to work
".",
],
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion src/sksl/codegen/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ cc_library(
name = "deps",
visibility = ["//src/sksl:__pkg__"],
deps = select({
"//src/sksl:use_sksl_gpu_srcs": ["//third_party:spirv_cross"],
"//src/sksl:use_sksl_gpu_srcs": ["@spirv_cross"],
"//conditions:default": [],
}),
)
2 changes: 1 addition & 1 deletion src/sksl/codegen/SkSLSPIRVtoHLSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#if defined(SK_ENABLE_SPIRV_CROSS)

#include "third_party/externals/spirv-cross/spirv_hlsl.hpp"
#include <spirv_hlsl.hpp>

/*
* This translation unit serves as a bridge between Skia/SkSL and SPIRV-Cross.
Expand Down
49 changes: 0 additions & 49 deletions third_party/BUILD.bazel

This file was deleted.

6 changes: 4 additions & 2 deletions third_party/README
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The third_party directory contains a set of dependencies from outside sources
that are needed to build various components and tools within Skia.
that are needed to build various components and tools within Skia.

Some of these dependencies reside within the Skia repo, while others are pulled
Some of these dependencies reside within the Skia repo, while others are pulled
from other repositories and placed in the third_party/externals directory
during build. These external dependencies are defined in a DEPS file.

Expand All @@ -11,3 +11,5 @@ header or file. If the source itself does not include a license header or file,
create a README that refers to reliable documentation of the project's license
terms on the web.

We, the Skia team, write Bazel rules for these third_party libraries if they do not have their own.
We maintain these Bazel rules in //bazel/external.
11 changes: 11 additions & 0 deletions third_party/etc1/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cc_library(
name = "etc1",
testonly = True, # Only used for a few gms
srcs = [
"etc1.cpp",
],
hdrs = [
"etc1.h",
],
visibility = ["//gm:__pkg__"],
)

0 comments on commit b247169

Please sign in to comment.