-
Notifications
You must be signed in to change notification settings - Fork 300
/
BUILD.bazel
108 lines (94 loc) · 2.96 KB
/
BUILD.bazel
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
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@aspect_rules_js//npm:defs.bzl", "npm_link_package")
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@capnp-cpp//src/capnp:cc_capnp_library.bzl", "cc_capnp_library")
load("@npm//:capnpc-ts/package_json.bzl", capnpc_ts_bin = "bin")
load("@npm//:defs.bzl", "npm_link_all_packages")
cc_capnp_library(
name = "icudata-embed",
srcs = ["icudata-embed.capnp"],
data = ["@com_googlesource_chromium_icu//:icudata"],
defines = ["WORKERD_ICU_DATA_EMBED"],
include_prefix = ".",
visibility = ["//visibility:public"],
)
npm_link_all_packages(name = "node_modules")
npm_link_package(
name = "node_modules/@workerd/jsg",
src = "//src/workerd/jsg:jsg_js",
package = "@workerd/jsg",
)
# The @workerd/test package provides a small library to manage workerd subprocesses in js_test()
# targets.
npm_link_package(
name = "node_modules/@workerd/test",
src = "//src/workerd/server/tests:test_js",
package = "@workerd/test",
)
capnpc_ts_bin.capnpc_ts_binary(
name = "capnpc_ts",
visibility = ["//visibility:public"],
)
# Platform definition for using clang-cl on Windows
platform(
name = "x64_windows-clang-cl",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:windows",
"@bazel_tools//tools/cpp:clang-cl",
],
)
# Used for cross-compilation
platform(
name = "macOS_x86",
constraint_values = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
)
# bazel enables the --ffunction-sections, --gc-sections flags used to remove dead code by default
# on Linux opt builds. Enable the equivalent macOS flag -Wl,-dead_strip here to work around bazel
# idiosyncrasies.
# Note that the flag is defined for all non-debug builds of kj_test() and wd_cc_binary() on mac as
# it surprisingly appears to be faster, perhaps because the linker generates and writes binaries
# with much fewer symbols. This also helps reduce local and CI disk usage. If needed, dead code
# stripping can be limited to optimized builds.
config_setting(
name = "fast_build",
values = {"compilation_mode": "fastbuild"},
)
config_setting(
name = "opt_build",
values = {"compilation_mode": "opt"},
)
bool_flag(
name = "dead_strip",
build_setting_default = True,
)
config_setting(
name = "set_dead_strip",
flag_values = {"dead_strip": "True"},
)
# Workaround for bazel not supporting negated conditions (https://github.com/bazelbuild/bazel-skylib/issues/272)
selects.config_setting_group(
name = "not_dbg_build",
match_any = [
":fast_build",
":opt_build",
],
)
selects.config_setting_group(
name = "use_dead_strip",
match_all = [
"@platforms//os:macos",
":set_dead_strip",
":not_dbg_build",
],
)
# prettier
js_library(
name = "prettierrc",
srcs = [".prettierrc.json"],
visibility = ["//visibility:public"],
)