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

Iterate on project selection #251

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

oyvindberg
Copy link
Owner

@oyvindberg oyvindberg commented Dec 29, 2022

Fix for #204 , cc @sideeffffect if you have any comments :)

Can now choose projects by:

  • @2 or @3 for epoch scala versions
  • @213 for scala binary versions
  • @native, @js, @jvm for platform
  • @main/@test to account for isTestProject
  • @jvm213 still works like before, just with an @

Subtracting from selection

Can also subtract projects from selection by prefixing ~ @2 ~@jvm will choose all projects for for instance 2.12 and 2.13 except those for jvm platform

demo

Kapture.2022-12-29.at.03.19.47.mp4

## Can now choose projects by:
- `@2` or `@3` for epoch scala versions
- `@213` for scala binary versions
- `@native`, `@js`, `@jvm` for platform
- `main`/`test` to account for `isTestProject`
- `@jvm213` still works like before

## Can also subtract projects from selection by prefixing `~`
`@2 ~@jvm` will choose all projects for for instance 2.12 and 2.13 except those for jvm platform
## Can now choose projects by:
- `@2` or `@3` for epoch scala versions
- `@213` for scala binary versions
- `@native`, `@js`, `@jvm` for platform
- `main`/`test` to account for `isTestProject`
- `@jvm213` still works like before

## Can also subtract projects from selection by prefixing `~`
`@2 ~@jvm` will choose all projects for for instance 2.12 and 2.13 except those for jvm platform
Copy link
Contributor

@sideeffffect sideeffffect left a comment

Choose a reason for hiding this comment

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

Looks awesome, thanks for this!
Just a note about Scala versions:
Scala used to have an epoch version. In Scala 2, 2 was the epoch version. 2.13 was the major version (and 2.13.10 was the minor version; there were no patch versions).
But this scheme changed. It is Semver now. With Scala 3, the 3 is the major version, 3.2 is the minor version and 3.2.2 is the patch version.

So I don't think @2 makes much sense. @2 and @3 is apples to oranges.
@2.13 and @3 is apples to apples.

Suggestions:

  • how about @2.13 instead of @213?
  • It would be nice if we could (now or in the future) also do @2.13.10; such build matrices are required in some rare situations
  • What do you think about changing the schema to something more structured. We seem to have 3 axes (platform, versions and configuration), right? So something like @js/2.13/test? Or would , be a better symbol for separating the parts?

@@ -1,10 +1,10 @@
package bleep
package rewrites

case class keepSelectedProjects(selectedProjectGlobs: List[String]) extends BuildRewrite {
case class keepSelectedProjects(selectedProjectGlobs: Array[model.ProjectGlob]) extends BuildRewrite {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the changes to Array? If List is not good for some reason, why not at least ArraySeq?

@oyvindberg
Copy link
Owner Author

Just a note about Scala versions: Scala used to have an epoch version. In Scala 2, 2 was the epoch version. 2.13 was the major version (and 2.13.10 was the minor version; there were no patch versions). But this scheme changed. It is Semver now. With Scala 3, the 3 is the major version, 3.2 is the minor version and 3.2.2 is the patch version.
So I don't think @2 makes much sense. @2 and @3 is apples to oranges. @2.13 and @3 is apples to apples.

Yeah, I'm aware. but even without epoch @3 is the string used to select all projects with binary version 3. So the only addition is that you're able to select all 2.x projects in one go. not sure if that pulls its weight really.

Suggestions:

* how about `@2.13` instead of `@213`?

Maybe! The reason why I took out the . is that there is significant keytravel on the way from numbers to ., and the scala version selector is the one I use the most I think. It just feels more smooth without the . :)

* It would be nice if we could (now or in the future) also do `@2.13.10`; such build matrices are required in some rare situations

This is actually somewhat supported. Full cross builds will receive crossIds like jvm2.13.10, so you'll be able to select them with @jvm2.13.10. I don't think there will ever be any full cross builds for other platforms so I'm not terribly concerned about that.

* What do you think about changing the schema to something more structured. We seem to have 3 axes (platform, versions and configuration), right? So something like `@js/2.13/test`? Or would `,` be a better symbol for separating the parts?

Ok, I like the suggestion because I think it can remove the need for the ~ things to remove from selection.
Slightly more cumbersome to write maybe, but if we generate all relevant permutations of these things perhaps it'll be more clear and more flexible.

I'll give this a shot within to see how it feels.

I should note that the format chosen here comes from the generated crossIds (js3, jvm213), so to remain consistent those should probably change to something similar (jvm/3, 3,jvm, 2.13/js, js,2.13, or similar). In other words it's a "big" semantic change, but it's important to find something workable here

@sideeffffect
Copy link
Contributor

sideeffffect commented Jan 1, 2023

To make things even more complicated, we may want to add another axis, for the version of the platform -- Scala Native 0.4.x is not compatible with Scala Native 0.5.x. So that would make it something like @native/0.4/2.13/test... or just @native0.4/2.13/test...

We maybe should take inspiration from what is put in the name of the JAR and just do exactly that.

https://repo1.maven.org/maven2/io/circe/circe-core_native0.4_2.13/
https://repo1.maven.org/maven2/io/circe/circe-core_sjs1_2.13/

  • So for platform names it would be native0.4 (instead of native) and sjs1 (instead of js). jvm could be a special case which is "empty".
  • For Scala version numbers it would be 2.13, not 213.
  • And instead of / or ,, we would use _

Then it would be @test_native0.4_2.13. Note that the last thing is the version of Scala, just as it is in the JAR names.

Generally speaking, I like the idea of using already existing and established idioms and conventions instead of reinventing the wheel (plays well with the whole idea of Bleep: using Bloop, BSP, etc).

@sideeffffect
Copy link
Contributor

Hi @oyvindberg , do you think it's worth reviving this?

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.

2 participants