-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
Let plugins declare @rules and move the native backend into contrib #5970
Let plugins declare @rules and move the native backend into contrib #5970
Conversation
Why do we want to move the native backend to contrib? |
Moving the native backend to contrib was based off a discussion I had with @stuhood that happened haphazardly in #engine and #native yesterday -- there are two concerns here. The first is that we're unconditionally pulling down gcc and clang right now for building any |
It's probably unfortunate that today contrib == plugin. It seems a clear win to have native (and most everything) as a plugin, it's only the 'contrib' connotation that doesn't really fit here. It's true we do have the backends mechanism, but it's unweildy and ~unusable except by Pants PHDs as a Pants trimming customization mechanism. |
Yeah, I guess my only beef is with the name "contrib". In my mind "contrib" means "outside contribution of peripheral importance, possibly unstable". But this native backend was written, reviewed and tested by core Pants team members, so I think it should be on the same footing as Python and JVM. And I also think Go and possibly Node should be in that category, for similar reasons. I agree with @jsirois that, in terms of the discovery and loading mechanism, everything should be plugins, even JVM and Python, and backends should probably go away entirely. But I think there's still value to the distinction between "this is core pants functionality with first-class support by the pants team" vs "here's possibly useful stuff that has been contributed, but you may need to ask the author for help with it" . |
Granted, this is all outside the scope of this change, and regardless if what we call it, it's true that you need to make native loadable as a plugin. |
Unrelated, seems to me that "Let plugins declare @rules" and "move the native backend into contrib" should be separate pull requests. |
+1 |
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.
Thanks: looks good.
While I agree that this could be two PRs, the change to allow contrib modules to declare So my preference would be for just dropping it from the title. |
Let's wait to land this until after |
So your thoughts here I totally get -- my thought was that outside of making a whole new testproject (feasible!), there's no way I would be comfortable making the change to allow declaring We discussed earlier today about merging #5815 after
There are two things up for debate in (2): whether to move @CMLivingston and @kwlzn -- can you speak to whether there would be a problem with moving It seems like exposing |
Talked to @CMLivingston and now we're planning to move |
Hm. I would like a test that specifically exercises the plugin rule loading, along the lines of the goal install test case https://github.com/pantsbuild/pants/blob/master/tests/python/pants_test/init/test_extension_loader.py#L270-L283 Otherwise it looks pretty good to me! |
It would be great if we could wait to forklift native into Maybe we could separate that bit out into a different PR? |
Sounds like a plan!
…On Thu, Jun 21, 2018 at 14:46 Chris Livingston ***@***.***> wrote:
It would be great if we could wait to forklift native into contrib/ until
#5998 <#5998> has been reviewed
and merged.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#5970 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABPqT4_37t2e5d_Yfuf5DmVvL3sm7u8iks5t_BRFgaJpZM4UqXI1>
.
|
The rationale for landing
If #6652 gets resolved earlier (essentially by someone else doing (1) above), we can move directly to (2). |
Sounds good. A variation on (1) might be to find a contrib plugin to add a |
Plugins can already declare |
Problem
We want to move the native backend entirely into contrib in #5815, but we can't declare
@rule
s in plugins (or contrib packages) yet. We added the ability to declare rules in backends in #5747 -- this is the corresponding change for plugins.We want to move the native backend into contrib because for now the utility is limited to
python_dist()
creation, and because it brings in multiple large downloads (the native toolchain) that aren't necessary if the user doesn't want to compile any native code. This may also affect the number of downloads we see of these large packages, because we were pulling them in unconditionally before -- see #5780 for further context.Solution
rules()
method in a plugin'sregister.py
into the build configuration.contrib/native
.pantsbuild.pants.contrib.native
plugin and register it.NativeToolchainEnvironment
insetup_py.py
and depend on it as an optional product inBuildLocalPythonDistributions
.@rule
s for generatingNativeToolchainEnvironment
in thecontrib/native
plugin. Register a shellPopulateNativeEnvironment
task which simply requests aNativeToolchainEnvironment
from the scheduler and places it intoself.context.products
(since there's not a fully formed story on extending@rule
s yet).Result
Plugins can now declare
@rule
s by defining arules()
method in theirregister.py
, and all of the native toolchain has been moved tocontrib/native
, which provides an end-to-end of the new functionality, making it very simple to move the rest of the native backend intocontrib/native
in #5815 before merging.