Skip to content

Conversation

raboof
Copy link
Contributor

@raboof raboof commented May 9, 2022

This adds the ability to use semantic version selector expression (such as 2.13.x and 3.x) in ++ command as discussed in #6893. The following description includes the patch in #6936.

Usage

++ 2.13.x test

Explanation

This is an extension of existing ++ <sv> <command1> where the given <command1> will be executed only within the subprojects listing <sv> in their respective crossScalaVersions setting.

sbt 1.7.0 now allows the <sv> part to be a semantic version selector expression, implemented originally by @tanishiking in sbt/librarymanagement#239 based on npm-semver. Note that the semantic version selector expression may match at most one Scala version within crossScalaVersions per subproject. This is because ++ remains to be a switch command.

@eed3si9n
Copy link
Member

@raboof I am thinking about wrapping up 1.7.0 soon.

@raboof raboof force-pushed the fuzzy-switch branch 4 times, most recently from 3198cab to b4b0e5f Compare June 21, 2022 12:22
@raboof raboof marked this pull request as ready for review June 21, 2022 12:55
@raboof
Copy link
Contributor Author

raboof commented Jun 21, 2022

@raboof I am thinking about wrapping up 1.7.0 soon.

Thanks for the ping, added tests (and fixed behavior), now ready for review.

@raboof
Copy link
Contributor Author

raboof commented Jun 21, 2022

(rebased on origin/develop - or should that be origin/1.7.x at this point?)

@raboof raboof force-pushed the fuzzy-switch branch 2 times, most recently from 257b333 to ee83457 Compare June 21, 2022 14:50
Picking from the `crossScalaVersions`

As discussed in sbt#6893
@eed3si9n
Copy link
Member

1.7.x branch would be better but either is ok.

Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

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

Thanks. Looks good to me.

@eed3si9n eed3si9n merged commit a12ef40 into sbt:develop Jun 23, 2022
@eed3si9n eed3si9n added this to the 1.7.0 milestone Jun 23, 2022
raboof added a commit to raboof/sbt that referenced this pull request Jun 26, 2022
Instead of custom globbing.

Follow-up on sbt#6894,
fixes sbt#6934
raboof added a commit to raboof/sbt that referenced this pull request Jun 26, 2022
By using SemanticSelector instead of custom globbing.

Follow-up on sbt#6894,
fixes sbt#6934
@eed3si9n eed3si9n changed the title Add support for wildcards in Scala version switch Add support for wildcards in Scala version switch (fuzzy switch) Jun 26, 2022
@SethTisue
Copy link
Member

SethTisue commented Jun 27, 2022

this is awesome. I love it!

a small suggestion. the output is:

sbt:root> ++3.x
[info] Setting Scala version to 3.x on 3 projects.

but it doesn't tell me which version it actually selected; I'd prefer not to have to show scalaVersion to see that information.

raboof added a commit to raboof/sbt that referenced this pull request Jun 28, 2022
Suggested by @SethTisue in sbt#6894 (comment)

Will show multiple lines when different versions are selected for different subprojects.

When no subprojects have a matching Scala version you will get a
'Switch failed' exception anyway, so in that case there is no
change in behavior.
@He-Pin
Copy link

He-Pin commented Sep 13, 2022

@raboof Seems like it can't match both 3.1.3 and 3.2.0 reported at
#7018

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants