[2.x] feat: queriable slash syntax (sbt query)#7699
Conversation
**Problem** We want a more flexible way of aggregating subprojects. **Solution** This implements a subproject filtering as a replacement of the subproject axis in the act command.
There was a problem hiding this comment.
Before going into the implementation I'd like to discuss the syntax.
I had never seen this ...@foo=bar syntax before #6801. Is it specified anywhere? Is it used in other tools?
How is it better than a regex or a glob pattern?
Since the binary version and platform are contained in the project name we could use a glob pattern like *_sjs1_3 instead of ...@binarScalaVersion=3@platform=sjs1. It is more concise, seems more flexible (custom axes) and should look more familiar to most people.
|
Bazel query uses |
|
Do we really need the |
For this specific usage I don't think we need it, but I think it becomes complicated to remember which suffix comes first etc for the build users, so the explicit parameter looks nicer on GitHub Action etc.
I'm not exactly sure how safe it would be from the parser to call arbitrary keys, but it might work? In this PR I just wanted to add something as a demo. |
|
This is potentially pendantic and a bit late but it is possible to use a more terse syntax for the glob? Either a single I quite like Cool idea for filtering though! I've been missing that using sbt-typelevel projects which use crossproject |
Typo on pedantic :). But, in general, I welcome feedback on the query syntax at this point in time.
There are multiple problems with the underscore (
but
Thanks! |
|
This is a great idea! Having used mill a bit I really liked its wildcard syntax and missed it when I came back to sbt. That said, I'd like to add my support for a shorter syntax as well.
The way I see it, it's not so much about being easy to type as it is about how quickly it can be typed. There's no way that typing
I don't 100% follow how the mix of symbols relates to short commands. If the concern is that adding new symbols will confuse users then it doesn't matter how short the new syntax is, it will confuse people regardless. IMO the shorter the syntax, the easier to learn/remember.
I totally get the concern with I understand the concern with Would you consider supporting |
Yea. I am warming up to |
|
A bit of the note on sbt shell vs system shell:
Using the sbt shell has long been our recommendation (to keep the JIT warm), but with the advent of BSP support, I've switched to using the native client sbtn or Given that many projects would have $ sbt */testactually ends up matching $ sbt src/testSo if we supported So I feel like this is a tricky UX design. If we make something intuitive, but it has a major pitfall, we're basically making an on-ramp into a pitfall, and future work for ourselves. |
BillyAutrey
left a comment
There was a problem hiding this comment.
🚢
Here's my opinion on the choice of wildcard. Full disclosure, I have spent the last few years in the Bazel space.
I think ..., _, and * are the only real wildcard contenders. Everything else is not intuitively a wildcard.
*breaks shell integration. We want to embraceshas a viable option for SBT interaction, because the new--clientoption allows us to amortize the JVM warmup cost. Thus, to use*, we'll be forcing shell users to escape with quotes._has compatibility issues, which Eugene has detailed above. We want to preserve compatibility with existing projects....is not intuitive at first, but it's easy to learn and is acceptable to thousands of Bazel users. And having used it for 3+ years now, it doesn't bother me.
I see build tool interactions homogenizing a bit, and ... is an acceptable and familiar wildcard for many build tool users. I say we go with it.
See https://eed3si9n.com/sudori-part6/ for details.
Fixes #7642
Problem
We want a more flexible way of aggregating subprojects.
Solution
This implements a subproject filtering as a replacement of the subproject axis in the act command.