-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Expand file tree
/
Copy pathdefaults.bzl
More file actions
111 lines (100 loc) · 3.43 KB
/
defaults.bzl
File metadata and controls
111 lines (100 loc) · 3.43 KB
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
# Re-export of Bazel rules with devtools-wide defaults
load("@aspect_rules_esbuild//esbuild:defs.bzl", _esbuild = "esbuild")
load("@aspect_rules_js//js:defs.bzl", _js_library = "js_library")
load("@bazel_lib//lib:copy_to_bin.bzl", _copy_to_bin = "copy_to_bin")
load("@bazel_lib//lib:copy_to_directory.bzl", _copy_to_directory = "copy_to_directory")
load("@bazel_skylib//rules:common_settings.bzl", _string_flag = "string_flag")
load(
"//tools:defaults.bzl",
_http_server = "http_server",
_ng_project = "ng_project",
_ng_web_test_suite = "ng_web_test_suite",
_npm_sass_library = "npm_sass_library",
_sass_binary = "sass_binary",
_sass_library = "sass_library",
_ts_config = "ts_config",
_ts_project = "ts_project",
_zoneless_web_test_suite = "zoneless_web_test_suite",
)
sass_binary = _sass_binary
sass_library = _sass_library
npm_sass_library = _npm_sass_library
http_server = _http_server
js_library = _js_library
def esbuild(minify = None, **kwargs):
_esbuild(
minify = minify if minify != None else select({
"//devtools:debug_build": False,
"//conditions:default": True,
}),
# Do not change this as otherwise the sourcemaps will cause the build not to be reproducable and firefox will not publish the extension.
# NB: Do not use `select` here either as this option is not configurable and bazel doesn't resolve to a value.
sourcemap = False,
**kwargs
)
copy_to_bin = _copy_to_bin
copy_to_directory = _copy_to_directory
string_flag = _string_flag
ts_config = _ts_config
def ng_web_test_suite(deps = [], **kwargs):
# Provide required modules for the imports in //tools/testing/browser_tests.init.mts
deps = deps + [
"//:node_modules/@angular/compiler",
"//:node_modules/@angular/core",
"//:node_modules/@angular/platform-browser",
]
_ng_web_test_suite(
deps = deps,
tsconfig = "//devtools:tsconfig_test",
**kwargs
)
def zoneless_web_test_suite(deps = [], **kwargs):
# Provide required modules for the imports in //tools/testing/browser_tests.init.mts
deps = deps + [
"//:node_modules/@angular/compiler",
"//:node_modules/@angular/core",
"//:node_modules/@angular/platform-browser",
]
_zoneless_web_test_suite(
deps = deps,
tsconfig = "//devtools:tsconfig_test",
**kwargs
)
def ng_project(name, srcs = [], angular_assets = [], **kwargs):
deps = kwargs.pop("deps", []) + [
"//:node_modules/tslib",
]
_ng_project(
name = name,
tsconfig = "//devtools:tsconfig_build",
srcs = srcs,
assets = angular_assets,
deps = deps,
**kwargs
)
def ts_project(name, **kwargs):
_ts_project(
name = name,
tsconfig = "//devtools:tsconfig_build",
**kwargs
)
def ts_test_library(name, deps = [], **kwargs):
_ts_project(
name = name,
tsconfig = "//devtools:tsconfig_test",
testonly = 1,
deps = deps + [
"//:node_modules/@types/jasmine",
],
**kwargs
)
def extension_package(
# Actually copy the files into the destination location so they can be copied
# out during use when publishing."
hardlink = "off",
**kwargs):
# Use the copy_to_directory rule for creating extension packages.
copy_to_directory(
hardlink = hardlink,
**kwargs
)