New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(bazel): add data
attr to ng_package
#22919
Conversation
You can preview 043fd58 at https://pr22919-043fd58.ngbuilds.io/. |
name = "arbitrary_text_file", | ||
outs = ["arbitrary_text.txt"], | ||
cmd = "echo Hello > $@", | ||
output_to_bindir = True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also add one with output_to_bindir = False
to test the bazel-genfiles prefix gets stripped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -212,6 +213,7 @@ def _ng_package_impl(ctx): | |||
packager_args.add(_flatten_paths(esm5), join_with=",") | |||
packager_args.add(_flatten_paths(bundles), join_with=",") | |||
packager_args.add([s.path for s in ctx.files.srcs], join_with=",") | |||
packager_args.add([d.path for d in ctx.files.data], join_with=",") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right - ctx.files.data will only receive the default outputs of the targets listed in data. for example, if you put a ts_library
in the data
(a strange thing to do) I think you'll find that the .d.ts
files go in the bundle but not the .js
files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be all outputs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a TODO here to study the right way to gather the runfiles providers from the transitive closure, looking at the mpm_package rule as an example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// We want the relative path from the given file to its ancestor "root" directory. | ||
// This root depends on whether the file lives in the source tree (srcDir) as a basic file | ||
// input to ng_package, or in the out tree (binDir) as the output of another rule. | ||
const rootDir = inputPath.includes(binDir) ? binDir : srcDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should check genfilesDir too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
043fd58
to
51dbe69
Compare
You can preview 51dbe69 at https://pr22919-51dbe69.ngbuilds.io/. |
@@ -14,6 +14,9 @@ function main(args: string[]): number { | |||
// Exit immediately when encountering an error. | |||
shx.set('-e'); | |||
|
|||
// Keep track of whether an error has occured so that we can return an appropriate exist code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exit
51dbe69
to
318834a
Compare
318834a
to
c1f6225
Compare
You can preview 318834a at https://pr22919-318834a.ngbuilds.io/. |
You can preview c1f6225 at https://pr22919-c1f6225.ngbuilds.io/. |
c1f6225
to
e2ffeed
Compare
You can preview e2ffeed at https://pr22919-e2ffeed.ngbuilds.io/. |
ab3cdb1
to
fa09def
Compare
You can preview ab3cdb1 at https://pr22919-ab3cdb1.ngbuilds.io/. |
You can preview fa09def at https://pr22919-fa09def.ngbuilds.io/. |
fa09def
to
841bc36
Compare
You can preview 841bc36 at https://pr22919-841bc36.ngbuilds.io/. |
For caretaker: this PR doesn't affect g3 |
841bc36
to
41749db
Compare
You can preview 41749db at https://pr22919-41749db.ngbuilds.io/. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
@alexeagle One weird thing now is that you can put static files (css, markdown, scss, etc.) into either
srcs
ordata
and they will work the same way. I'm not a fan of having two valid ways to do this, which goes back to the question of whethersrcs
should only acceptts_library
andng_module
.I wasn't sure how to add a test for the error case when
srcs
includes the output of another rule. Also, it's just checkingbinDir
now, but should we also be doing stuff forbazel-genfiles
?