2020-01-10 16:40:05 -05:00
|
|
|
load("//tools:defaults.bzl", "ng_module", "ng_package", "npm_package")
|
2018-02-28 09:51:40 -05:00
|
|
|
|
2019-01-16 04:19:01 -05:00
|
|
|
package(default_visibility = ["//packages/bazel/test:__subpackages__"])
|
|
|
|
|
2018-02-28 09:51:40 -05:00
|
|
|
ng_module(
|
|
|
|
name = "example",
|
|
|
|
srcs = glob(["*.ts"]),
|
2018-03-15 21:04:34 -04:00
|
|
|
module_name = "example",
|
2018-10-04 16:14:14 -04:00
|
|
|
deps = [
|
|
|
|
"//packages/bazel/test/ng_package/example/secondary",
|
2019-02-20 12:54:42 -05:00
|
|
|
"@npm//@types",
|
2018-10-04 16:14:14 -04:00
|
|
|
],
|
2018-02-28 09:51:40 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
ng_package(
|
|
|
|
name = "npm_package",
|
|
|
|
srcs = [
|
|
|
|
"package.json",
|
|
|
|
"some-file.txt",
|
|
|
|
],
|
2018-03-21 19:18:06 -04:00
|
|
|
data = [
|
|
|
|
":arbitrary_bin_file",
|
|
|
|
":arbitrary_genfiles_file",
|
|
|
|
":extra-styles.css",
|
2019-09-17 12:30:27 -04:00
|
|
|
":logo.png",
|
2018-03-21 19:18:06 -04:00
|
|
|
],
|
2019-06-07 16:38:06 -04:00
|
|
|
entry_point = ":index.ts",
|
2018-04-02 19:52:13 -04:00
|
|
|
entry_point_name = "waffels",
|
2020-01-10 16:40:05 -05:00
|
|
|
packages = [
|
2018-03-23 18:32:10 -04:00
|
|
|
":arbitrary_npm_package",
|
|
|
|
],
|
2018-03-15 21:04:34 -04:00
|
|
|
deps = [
|
|
|
|
":example",
|
|
|
|
"//packages/bazel/test/ng_package/example/secondary",
|
|
|
|
],
|
2018-02-28 09:51:40 -05:00
|
|
|
)
|
2018-03-21 19:18:06 -04:00
|
|
|
|
|
|
|
# Use a genrule to create a file in bazel-genfiles to ensure that the genfiles output of
|
|
|
|
# a rule can be passed through to the `data` of ng_package.
|
|
|
|
genrule(
|
|
|
|
name = "arbitrary_genfiles_file",
|
|
|
|
outs = ["arbitrary_genfiles.txt"],
|
|
|
|
cmd = "echo Hello > $@",
|
|
|
|
)
|
|
|
|
|
|
|
|
# Use a genrule to create a file in bazel-bin to ensure that the bin output of
|
|
|
|
# a rule can be passed through to the `data` of ng_package.
|
|
|
|
genrule(
|
|
|
|
name = "arbitrary_bin_file",
|
|
|
|
outs = ["arbitrary_bin.txt"],
|
|
|
|
cmd = "echo World > $@",
|
|
|
|
output_to_bindir = True,
|
|
|
|
)
|
2018-03-23 18:32:10 -04:00
|
|
|
|
2020-01-10 16:40:05 -05:00
|
|
|
npm_package(
|
2018-03-23 18:32:10 -04:00
|
|
|
name = "arbitrary_npm_package",
|
|
|
|
srcs = [":arbitrary-npm-package-main.js"],
|
|
|
|
)
|