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

Test Scala 3 input/output with rule built against Scala 2.12 #19

Merged
merged 7 commits into from
May 21, 2021
Merged

Conversation

bjaglin
Copy link
Collaborator

@bjaglin bjaglin commented May 14, 2021

This is moving the template from the built-in mutable/sequential crossScalaVersions way to the immutable/parallel sbt-projectmatrix one, to try to make it clearer that we test 3.x, but we don't cross-publish. For the record, here is the initial attempt without sbt-projectmatrix: 3ce2acf#diff-8b4a41b53e6e5f25138da6b4dc5f2d34051e59204e43fa2e9714a275997cf5e0 which mostly worked but was very hacky and hard to understand IMHO.

sbt:my-repo> projects
[info] In file:/home/bjaglin/git/projects/scalafix.g8/target/sbt-test/scalafix.g8-root/scripted/scalafix/
[info] 	   input2_11
[info] 	   input2_12
[info] 	   input2_13
[info] 	   input3
[info] 	   output2_11
[info] 	   output2_12
[info] 	   output2_13
[info] 	   output3
[info] 	 * my-repo
[info] 	   rules2_11
[info] 	   rules2_12
[info] 	   rules2_13
[info] 	   tests
[info] 	   testsTarget2_11
[info] 	   testsTarget2_12
[info] 	   testsTarget2_13
[info] 	   testsTarget3

I verified that

  • the project can be imported in IntelliJ (2021.1)
  • sbt ~tests/test is working
  • +publishLocal publishes 3 artifacts

@bjaglin
Copy link
Collaborator Author

bjaglin commented May 16, 2021

Moving back to draft while upstreaming changed made here to scalacenter/sbt-scalafix#219

@bjaglin bjaglin changed the title Test Scala 3 input/output with Scala 2.13 rule Test Scala 3 input/output with rule built against Scala 2.12 May 17, 2021
@bjaglin bjaglin marked this pull request as ready for review May 17, 2021 12:20
@mlachkar
Copy link
Collaborator

I don't completely get why we have multiple rules modules. I think it can lead to thinking that to use write a scala 3 rule, you need to do it under rules_3 that doesn't exist.

@bjaglin
Copy link
Collaborator Author

bjaglin commented May 17, 2021

I don't completely get why we have multiple rules modules.

That materializes what gets cross-built, it's common when moving from crossScalaVersions to https://github.com/sbt/sbt-projectmatrix.

I think it can lead to thinking that to use write a scala 3 rule, you need to do it under rules_3 that doesn't exist.

I went through several iterations to avoid that impression, and I thought the testsInput3 project was quite clear. It's the central point of using https://github.com/sbt/sbt-projectmatrix: testing 4 inputs with only 3 cross-built rules. Do you have any other idea?

@mlachkar
Copy link
Collaborator

I would like to have @adpi2 advice/review (if you can).
Maybe we can just put rules in 2.13, no crossVersion ?

@@ -1,11 +1,15 @@
lazy val V = _root_.scalafix.sbt.BuildInfo

lazy val rulesCrossVersions = Seq(V.scala213, V.scala212, V.scala211)
lazy val scala3Version = "3.0.0"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As 3.x releases come out, we might want to test against different versions (although upgrading scala should not be as hard as on the 2.x era obviously). When/if that happens, we should use the full scala version as matrix suffixes, but I don't see a reason to do it now.

bjaglin pushed a commit to bjaglin/sbt-scalafix that referenced this pull request May 19, 2021
@bjaglin bjaglin requested review from mlachkar and sjrd May 19, 2021 12:25
bjaglin pushed a commit to bjaglin/sbt-scalafix that referenced this pull request May 19, 2021
Move to sbt-projectmatrix so that `sbt tests/test` checks
* Scala 2.x input/output with Scala 2.x rule and
* Scala 3 input/output with Scala 2.12 rule
As it only works with Scala 2.x, the few rule authors relying on it
would have to disable Scala 3 testing which is on by default, so we'd
better make it an opt-in rather than an opt-out.
@bjaglin
Copy link
Collaborator Author

bjaglin commented May 21, 2021

@bjaglin bjaglin merged commit 7c3e3c8 into main May 21, 2021
@bjaglin bjaglin deleted the scala3 branch May 28, 2021 10:39
bjaglin added a commit to bjaglin/scalafix that referenced this pull request Feb 22, 2024
- it was written 4 years ago as a "migration guide" to track and encourage the
  cross-building effort, which is now complete for all major rules
- it does not cover Scala 3 at all, for which sbt-projectmatrix was introduced
  in scalafix.g8 via scalacenter/scalafix.g8#19
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.

None yet

4 participants