fix(bazel): ng_package packages attr not forwarded to npm_package (#22967)
PR Close #22967
This commit is contained in:
parent
2388f24256
commit
2aabbc51fa
|
@ -239,7 +239,11 @@ def _ng_package_impl(ctx):
|
|||
for d in ctx.attr.deps:
|
||||
devfiles = depset(transitive = [devfiles, d.files, d.node_sources])
|
||||
|
||||
package_dir = create_package(ctx, devfiles.to_list(), [npm_package_directory])
|
||||
# Re-use the create_package function from the nodejs npm_package rule.
|
||||
package_dir = create_package(
|
||||
ctx,
|
||||
devfiles.to_list(),
|
||||
[npm_package_directory] + ctx.files.packages)
|
||||
return struct(
|
||||
files = depset([package_dir])
|
||||
)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package(default_visibility = ["//packages/bazel/test:__subpackages__"])
|
||||
|
||||
load("//packages/bazel:index.bzl", "ng_module", "ng_package")
|
||||
load("//tools:defaults.bzl", "npm_package")
|
||||
|
||||
ng_module(
|
||||
name = "example",
|
||||
|
@ -21,6 +22,9 @@ ng_package(
|
|||
":extra-styles.css",
|
||||
],
|
||||
entry_point = "packages/bazel/test/ng_package/example/index.js",
|
||||
packages = [
|
||||
":arbitrary_npm_package",
|
||||
],
|
||||
deps = [
|
||||
":example",
|
||||
"//packages/bazel/test/ng_package/example/secondary",
|
||||
|
@ -43,3 +47,8 @@ genrule(
|
|||
cmd = "echo World > $@",
|
||||
output_to_bindir = True,
|
||||
)
|
||||
|
||||
npm_package(
|
||||
name = "arbitrary_npm_package",
|
||||
srcs = [":arbitrary-npm-package-main.js"],
|
||||
)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
const x = 1;
|
|
@ -1,3 +1,4 @@
|
|||
arbitrary-npm-package-main.js
|
||||
arbitrary_bin.txt
|
||||
arbitrary_genfiles.txt
|
||||
bundles
|
||||
|
@ -68,6 +69,11 @@ secondary
|
|||
secondary.d.ts
|
||||
secondary.metadata.json
|
||||
some-file.txt
|
||||
--- arbitrary-npm-package-main.js ---
|
||||
|
||||
const x = 1;
|
||||
|
||||
|
||||
--- arbitrary_bin.txt ---
|
||||
|
||||
World
|
||||
|
|
Loading…
Reference in New Issue