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

Add support for 'deployable_archives' for go and cpp rules. #4518

Merged
merged 1 commit into from Apr 27, 2017
Merged

Add support for 'deployable_archives' for go and cpp rules. #4518

merged 1 commit into from Apr 27, 2017

Conversation

ensonic
Copy link
Contributor

@ensonic ensonic commented Apr 26, 2017

This product_type is already used by java and python rules.
Fixes #4506

Problem

Tasks need a canonical way to depend on executables. See #4506

Solution

Add support for the 'deployable_archives' product-type to go and cpp rules. The mapping stores the executable name keyed under target and path, like done in the python/java rules.

@stuhood stuhood self-requested a review April 27, 2017 00:08
Copy link
Sponsor Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks! One minor comment.

@@ -49,7 +51,8 @@ def execute(self):
self._go_install(vt.target, gopath)
if self.is_binary(vt.target):
binary_path = os.path.join(gopath, 'bin', os.path.basename(vt.target.address.spec_path))
self.context.products.get_data('exec_binary')[vt.target] = binary_path
go_exec_binary[vt.target] = binary_path
go_deployable_archive.add(vt.target, os.path.dirname(binary_path)).append(os.path.basename(binary_path))
Copy link
Sponsor Member

Choose a reason for hiding this comment

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

This pattern (explicitly calling basename) seems less error prone than what you're doing for cpp, which could likely be missed in a refactor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I hope you can encapsulate this in the the new API. Like instead writing:
self.context.add_product_mapping('deployable_archives', vt.target, binary_path)
or something along the lines

Copy link
Sponsor Member

Choose a reason for hiding this comment

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

Even better than that, we hope! =)

This product_type is already used by java and python rules.
Fixes #4506
@stuhood stuhood merged commit aee45f9 into pantsbuild:master Apr 27, 2017
@stuhood
Copy link
Sponsor Member

stuhood commented Apr 27, 2017

Thanks for the patch!

thesamet pushed a commit to thesamet/pants that referenced this pull request May 9, 2017
…ld#4518)

### Problem

Tasks need a canonical way to depend on executables.

### Solution

Add support for the `deployable_archives` product-type to `go` and `cpp` rules, which is already used by the `java` and `python` rules. The mapping stores the executable name keyed under target and path, like done in the `java`/`python` rules.  Fixes pantsbuild#4506.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants