Skip to content
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

feat(builtin): npm_package_bin can produce directory output #1164

Merged
merged 1 commit into from
Sep 20, 2019

Conversation

alexeagle
Copy link
Collaborator

No description provided.

@@ -8,26 +8,45 @@ _ATTRS = {
"outs": attr.output_list(),
"args": attr.string_list(mandatory = True),
"data": attr.label_list(allow_files = True, aspects = [module_mappings_aspect]),
"out_dir": attr.string(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be added to doc string for rule and comment on $@ usage in args

Copy link
Collaborator

@gregmagolan gregmagolan Sep 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could out_dir be a label to give the user more freedom as to where it will be? as a string it is limited to subdirs of the package

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's possible since https://docs.bazel.build/versions/master/skylark/lib/actions.html#declare_directory is the only API to produce TreeArtifact and it takes string - and you can't use a label to reference something that doesn't exist yet
anyway it's probably good that the output directory has to be inside the package that owns it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added missing doc

Also handle the case of args=["--out-dir=$@"] (it's a substring of the arg)

@alexeagle
Copy link
Collaborator Author

thanks @c-parsons for advising on this

Copy link
Collaborator

@gregmagolan gregmagolan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

may also include targets that produce or reference npm packages which are needed by the tool
outs: identical to [genrule.outs](https://docs.bazel.build/versions/master/be/general.html#genrule.outs)
outs: similar to [genrule.outs](https://docs.bazel.build/versions/master/be/general.html#genrule.outs)
out_dir: use this instead of `outs` if you want the output to be a directory
Copy link
Collaborator

@gregmagolan gregmagolan Sep 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: mention this is a string and relative to the current package?

@alexeagle alexeagle merged commit 6d8c625 into bazel-contrib:master Sep 20, 2019
@alexeagle alexeagle deleted the npm_bin branch September 20, 2019 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants