aboutsummaryrefslogtreecommitdiff
path: root/BUILD.bazel
blob: 9394c96d8fdaf657880e61dc1198384d986c8a77 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
load("@skia_user_config//:copts.bzl", "DEFAULT_OBJC_COPTS")
load("//:defines.bzl", "DEFAULT_DEFINES", "DEFAULT_LOCAL_DEFINES")
load("//bazel:gen_compile_flags_txt_linux_amd64.bzl", "gen_compile_flags_txt_linux_amd64")
load("//bazel:skia_rules.bzl", "exports_files_legacy", "skia_cc_library", "skia_objc_library")

licenses(["notice"])

exports_files_legacy()

# All the mm files from the Skia library are rolled up to this objc library since cc_library
# ignores mm files. This private library is then deps'ed into the public and internal versions
# of the SKia library below. The Skia library Objective-C code requires ARC, while non-library code
# does not.
skia_objc_library(
    name = "skia_objc",
    srcs = [
        "//src:objc_srcs",
    ],
    copts = DEFAULT_OBJC_COPTS + ["-fobjc-arc"],
    defines = DEFAULT_DEFINES,
    deps = [
        "//src:deps",
        "@skia_user_config//:user_config",
    ],
)

# This target exposes the Skia public API. It is what external clients should use.
skia_cc_library(
    name = "skia_public",
    srcs = [
        "//include:private_hdrs",
        "//include:srcs",
        "//src:private_hdrs",
        "//src:srcs",
    ],
    hdrs = ["//include:public_hdrs"],
    defines = DEFAULT_DEFINES,
    local_defines = DEFAULT_LOCAL_DEFINES,
    visibility = ["//visibility:public"],
    deps = [
        "//src:deps",
        "@skia_user_config//:user_config",
    ] + select({
        "//src/gpu:metal_ganesh": ["//:skia_objc"],
        "//conditions:default": [],
    }),
)

# This target exposes headers beyond the public, supported API. It is intended to be
# used by Skia's tests and tooling.
skia_cc_library(
    name = "skia_internal",
    srcs = [
        "//include:srcs",
        "//src:srcs",
    ],
    hdrs = [
        "//include:private_hdrs",
        "//include:public_hdrs",
        "//src:private_hdrs",
    ],
    defines = DEFAULT_DEFINES,
    local_defines = DEFAULT_LOCAL_DEFINES,
    visibility = [
        "//bench:__subpackages__",
        "//dm:__subpackages__",
        "//gm:__subpackages__",
        "//modules:__subpackages__",
        "//tests:__subpackages__",
        "//tools:__subpackages__",
    ],
    deps = [
        "//src:deps",
        "@skia_user_config//:user_config",
    ] + select({
        "//src/gpu:metal_ganesh": ["//:skia_objc"],
        "//conditions:default": [],
    }),
)

####################################################################
# Experimental public buffet targets below

alias(
    name = "core",
    actual = "//src/core:core",
    visibility = ["//visibility:public"],
)

alias(
    name = "pathops",
    actual = "//src/pathops:pathops",
    visibility = ["//visibility:public"],
)

###

alias(
    name = "jpeg_encode_codec",
    actual = "//src/encode:jpeg_encode",
    visibility = ["//visibility:public"],
)

alias(
    name = "png_decode_codec",
    actual = "//src/codec:png_decode",
    visibility = ["//visibility:public"],
)

alias(
    name = "png_encode_codec",
    actual = "//src/encode:png_encode",
    visibility = ["//visibility:public"],
)

###

alias(
    name = "fontmgr_fontconfig_freetype",
    actual = "//src/ports:fontmgr_fontconfig_freetype",
    visibility = ["//visibility:public"],
)

alias(
    name = "fontmgr_empty_freetype",
    actual = "//src/ports:fontmgr_empty_freetype",
    visibility = ["//visibility:public"],
)

###

alias(
    name = "skparagraph_harfbuzz_icu",
    actual = "//modules/skparagraph:skparagraph_harfbuzz_icu",
    visibility = ["//visibility:public"],
)

# Load bearing comment below - gazelle looks here (and not in any other BUILD.bazel files)
# for a special comment indicating the prefix.
# gazelle:prefix go.skia.org/skia

# This is an alias to avoid having to load the golang toolchain code just to
# create the rules in our primary BUILD.bazel file
alias(
    name = "gazelle",
    actual = "//infra:gazelle",
    visibility = ["//visibility:public"],
)

test_suite(
    name = "all_go_tests",
    tests = [
        # Go tests in this list will be tested in CI. Please add any new Go tests to this suite.
        "//bazel/device_specific_configs:device_specific_configs_test",
        "//bazel/exporter:exporter_test",
        "//infra/bots/task_drivers/bazel_test_benchmark:bazel_test_benchmark_test",
        "//infra/bots/task_drivers/bazel_test_gm:bazel_test_gm_test",
        "//infra/bots/task_drivers/bazel_test_precompiled:bazel_test_precompiled_test",
        "//infra/bots/task_drivers/codesize:codesize_test",
        "//infra/bots/task_drivers/common:common_test",
        "//infra/bots/task_drivers/perf_puppeteer_canvas:perf_puppeteer_canvas_test",
        "//infra/bots/task_drivers/perf_puppeteer_render_skps:perf_puppeteer_render_skps_test",
        "//infra/bots/task_drivers/perf_puppeteer_skottie_frames:perf_puppeteer_skottie_frames_test",
    ],
)

# Generates a compile_flags.txt file for use with clangd against the Bazel-downloaded Linux AMD64
# clang hermetic toolchain.
#
# This command prints to standard output a compile_flags.txt file that can be used with clangd to
# enable autocompletion on editors that support it. See:
# https://clangd.llvm.org/design/compile-commands.
#
# Note that this is implemented on a best effort basis. The produced compile_flags.txt file will
# contain the subset of flags used by most targets, but some targets might require additional
# flags. If that's the case, please manually add them to your compile_flags.txt file.
#
# Sample usage:
#
#     $ bazel run //:gen_compile_flags_txt_linux_amd64 > compile_flags.txt
#
# Invoke with --config=<some config> to generate flags with the defines and includes required for
# your build. For example, if you build your binary as follows:
#
#     $ bazel build //path/to:binary --config=gl_ganesh
#
# Then your compile_flags.txt file should be generated with:
#
#     $ bazel run //:gen_compile_flags_txt_linux_amd64 --config=gl_ganesh > compile_flags.txt
#
# This was tested with Visual Studio Code and the clangd extension:
# https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd.
gen_compile_flags_txt_linux_amd64(
    name = "gen_compile_flags_txt_linux_amd64",
)

######
# go #
######

# Sample usage: "bazel run //:go -- generate ./...".
alias(
    name = "go",
    actual = "@go_sdk//:bin/go",
    visibility = ["//visibility:public"],
)

#########
# gofmt #
#########

# Sample usage: "bazel run //:gofmt -- -s -w .".
alias(
    name = "gofmt",
    actual = "@go_sdk//:bin/gofmt",
    visibility = ["//visibility:public"],
)

############
# Errcheck #
############

# Sample usage: "bazel run //:errcheck -- go.skia.org/skia/...".
alias(
    name = "errcheck",
    actual = "//infra:errcheck",
    visibility = ["//visibility:public"],
)

##############
# buildifier #
##############

# Sample usage: "bazel run //:buildifier".
alias(
    name = "buildifier",
    actual = "//bazel:buildifier",
)