build(bazel): add data attr to ng_package (#22919)

PR Close #22919
This commit is contained in:
Jeremy Elbourn
2018-03-21 16:18:06 -07:00
committed by Matias Niemelä
parent bcaa07b0ac
commit d9a0a8ff3e
5 changed files with 114 additions and 34 deletions

View File

@ -15,9 +15,31 @@ ng_package(
"package.json",
"some-file.txt",
],
data = [
":arbitrary_bin_file",
":arbitrary_genfiles_file",
":extra-styles.css",
],
entry_point = "packages/bazel/test/ng_package/example/index.js",
deps = [
":example",
"//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,
)

View File

@ -0,0 +1,3 @@
.special {
color: goldenrod;
}

View File

@ -1,3 +1,5 @@
arbitrary_bin.txt
arbitrary_genfiles.txt
bundles
bundles/example-secondary.umd.js
bundles/example-secondary.umd.js.map
@ -43,6 +45,7 @@ esm5
esm5/secondary/secondarymodule.ngsummary.js
example_public_index.d.ts
example_public_index.metadata.json
extra-styles.css
fesm2015
fesm2015/example.js
fesm2015/example.js.map
@ -65,6 +68,16 @@ secondary
secondary.d.ts
secondary.metadata.json
some-file.txt
--- arbitrary_bin.txt ---
World
--- arbitrary_genfiles.txt ---
Hello
--- bundles/example-secondary.umd.js ---
(function (global, factory) {
@ -661,6 +674,13 @@ export * from './index';
{"__symbolic":"module","version":4,"metadata":{"MyModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":11,"character":1},"arguments":[{}]}],"members":{}}},"origins":{"MyModule":"./mymodule"},"importAs":"example"}
--- extra-styles.css ---
.special {
color: goldenrod;
}
--- fesm2015/example.js ---
import { NgModule } from '@angular/core';