angular/packages/bazel/test/ng_package/example/BUILD.bazel
Paul Gschwendtner f8a1ea0c11 fix(bazel): do not error if files part of srcs are outside of package (#45622)
We recently refactored how the ng package rule deals with static files.
As part of this refactoring, transitive files outside of the current
Bazel package were flagged as errors, while previously this was just
ignored. We need to revert back this behavior (even though code remains
much simpler and predicable now) since sass library targets for example
reference all transtive files in the default info and break packages then

PR Close #45622
2022-04-14 14:58:27 -07:00

60 lines
1.6 KiB
Text

load("//tools:defaults.bzl", "ng_module", "ng_package", "pkg_npm")
package(default_visibility = ["//packages/bazel/test:__subpackages__"])
ng_module(
name = "example",
srcs = glob(["*.ts"]),
module_name = "example",
deps = [
"//packages/bazel/test/ng_package/example/secondary",
"@npm//@types",
],
)
ng_package(
name = "npm_package",
srcs = [
"_index.scss",
"package.json",
"some-file.txt",
":arbitrary_bin_file",
":arbitrary_genfiles_file",
":extra-styles.css",
":logo.png",
# This file should be just ignored, and not copied into the package.
"//packages/bazel/test/ng_package:outside_package.txt",
],
nested_packages = [
":arbitrary_npm_package",
],
primary_bundle_name = "waffels",
deps = [
":example",
"//packages/bazel/test/ng_package/example/a11y",
"//packages/bazel/test/ng_package/example/imports",
"//packages/bazel/test/ng_package/example/secondary",
],
)
# 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,
)
pkg_npm(
name = "arbitrary_npm_package",
srcs = [":arbitrary-npm-package-main.js"],
)