-
-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When we simplified tool lockfiles into user lockfiles, we removed a lot of boilerplate machinery. But one problem is that we lost the ability to export tools from their default lockfile, as that lockfile isn't a user resolve. This MR adds an implementation template for language backends to hook into. It works as follows: - A union `ExportableTool` which provides a single point of integration. We could in theory pull common information up into here, such as the resolve name - Language backends use this `ExportableTool` to pull all such tools. They then filter these based on whether they're subclasses of classes they know how to export. - Language backends generate resolves for these tools and add them to the list of known resolves. This lets Pants know that these are valid lockfiles - Language backends, in their implementations of export, construct the resolve for the tool. This should only happen if the resolve is not defined by a user, so that users can shadow default tool lockfiles - Plugin authors must register their tools to the `ExportableTool` UnionRule. (We could probably do something with `__init_subclass__` but that sounds janky.) This is a single line, and seems like acceptable boilerplate to me. In theory this also enables making some tools non-exportable. An argument can be made that this would allow us to hide internal tools (such as dependency parsers). I'm not sure how good an argument this actually is. Limitations: - the list of resolves is the same for `generate-lockfiles` and `export`. Generating lockfiles doesn't make sense for a tool using the default lockfile, so we have to error late. I've got it print some helpful error messages though. - this MR doesn't enroll tools in this new mechanism. I'll split that out to separate MRs, per-backend, so it's easier to roll back if needed.
- Loading branch information
Showing
15 changed files
with
513 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
docs/docs/writing-plugins/common-plugin-tasks/plugin-helpers.mdx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.