-
-
Notifications
You must be signed in to change notification settings - Fork 637
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
[internal] BSP: use seperate config file for defining groups for BSP build targets #14943
Conversation
Before we go ahead with landing the "manually define the BSP build targets" approach, it would be good to sketch out some more design on #14563 (or another ticket). Because I continue to think that while "which Pants targets should have BSP build targets" makes sense as something to configure using a config file like this, which build targets are actually created out of the selected subset is something that we can automate. And I feel like that would probably be good, since it avoids needing to think about how to name (or display name) build targets, and avoids putting users in situations where they might create cycles between the targets which they have manually defined. |
Given our prior discussions, I thought the plan was for |
That is not what I am suggesting. I said:
i.e.: I agree that a user should configure the subset of the repo that is loadable as targets. But I don't think that they should have to name or declare individual build targets: those can be calculated from the subset. Here is the whole workflow I was thinking of:
The advantage here (as mentioned above) is not needing to name build targets, or define multiple build targets such that they don't form cycles (since the cycle removal is automated: happy to help implement that). |
IntelliJ's data model assumes that IntelliJ modules will basically own entire source roots, not just a subset of directories and files under a source root. "
This does not help differentiate between two source roots that should be BSP build targets (e.g. It is experimental for a reason, so we can research while getting user feedback. |
If the granularity that you're going for is "sbt or maven projects", the effect of this config file as implemented ("manually declared targets") would be that in addition to declaring your targets in your BUILD files, you would also need to declare on the order of dozens to hundreds of non-cyclic build targets in this file. Additionally, AFAICT from #14885, the primary unit of progress is "compilation or testing has completed for On the other hand, the number of distinct directories in a project should fall somewhere between the number of files, and the number of hypothetical "sbt or maven projects" / "
Is it actually necessary for |
It is not, but maybe users would want to do that? I don't know either way. The |
That is not the case. The BSP protocol progress indicator notification uses an abstract notion of "work units" with integer fields for |
Yea, having looking at it a bit more, that makes sense. But I think that this point ("unit of work") still applies when it comes to what the IDE will allow a user to actually ask to be compiled or tested. For example: if I want to compile or test one directory, but the defined build target is larger than that, I'll still end up compiling/testing "everything in the build target". |
This assumes that the IDE does not merge build targets when mapping to its own data model. IntelliJ's Scala plugin does that if build targets share the same "base directory." I don't know offhand though how that impacts trying to build the resulting merged IntelliJ module. |
@tdyas and I discussed this out of band, and came to the following understanding:
The goal of differentiating the |
Given that, there are a few naming and semantics changes which should be made to this config format to decouple the |
[ci skip-rust] [ci skip-build-wheels]
[ci skip-rust] [ci skip-build-wheels]
b309116
to
5afe31f
Compare
Latest commit renames "targets" to "groups" in the BSP TOML config 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.
Thanks. I think that making the selection change here would make this code much simpler, so I'd suggest doing that... but not a blocker.
src/python/pants/bsp/goal.py
Outdated
targets_config_files = FileListOption( | ||
"--targets-config-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.
Based on my comment about disconnecting the selection of the group
(p,s,t
) from the number of build targets created, I think that you will either want to:
- add another option which selects which
group
to load from the config - remove support for putting more than one
group
in a file (and for multiple files), and then have this option point to a single file which defines a singlegroup
.
My preference would be for 2, both because it avoids coupling multiple teams/groups
together unnecessarily, and because it's simpler, with only one option overall. But not blocking.
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.
My preference is (1). Consider that the user may more than one group active. They could be part of multiple teams (but still not all teams); or common infrastructure libraries could be their own group and the user wants to activate both their own team and the common team.
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.
(with the option specifying 1+ groups to select)
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'll rename the option as well so it does not have "targets" in the name.
[ci skip-rust] [ci skip-build-wheels]
[ci skip-rust] [ci skip-build-wheels]
Introduce a separate config file in TOML format for defining groupings of source code used in computing BSP build targets. This allows more metadata to be specified in the definition of BSP build targets without making configuration in
pants.toml
unwieldy. The--experimental-bsp-groups-config-files
option takes a list of config file paths that are merged together to form the final set of groups used to compute the BSP build targets.Each config file contains a
groups
dictionary where entries look as follows:Note: Filtering by resolve will be implemented in a follow-on PR since it entails changes to interfaces between core BSP rules and language-specific BSP rules which would make this PR more complex than it needs to be.