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

Support Scala 3 in ScalafixTestkitPlugin #219

Merged
merged 1 commit into from
May 17, 2021

Conversation

bjaglin
Copy link
Collaborator

@bjaglin bjaglin commented May 16, 2021

Integrating iterations of scalacenter/scalafix.g8#19 for a proper way to test against different scala versions.

This effectively drops support of sbt 0.13 in ScalafixTestkitPlugin, since it now depends on sbt-projectmatrix which is not available.

val values = Map[String, Seq[File]](
"sourceroot" ->
List(baseDirectory.in(ThisBuild).value),
"inputClasspath" ->
(scalafixTestkitInputClasspath.value
.map(_.data) ++ targetrootClasspath),
scalafixTestkitInputClasspath.value.map(_.data),
Copy link
Contributor

@mlachkar mlachkar May 17, 2021

Choose a reason for hiding this comment

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

I don't understand everything, we still need to retrieve semanticdbTargetRoot.value.toPath no to pass it in withTargetRootDirs ?

Copy link
Collaborator Author

@bjaglin bjaglin May 17, 2021

Choose a reason for hiding this comment

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

no, it's captured by parsing scalacOptions just like the CLI has been doing for years in Scala 2 (that echoes my second bullet on scalacenter/scalafix#1406 (comment))

Comment on lines 36 to 40
lazy val testsScala3 = project
.aggregate(tests)
.settings(
crossScalaVersions := List(scala3InputOutputVersion)
)
Copy link
Collaborator Author

@bjaglin bjaglin May 17, 2021

Choose a reason for hiding this comment

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

this is very confusing - I am working on a sbt-projectmatrix-based variant locally as I feel like this is hitting the limits of crossScalaVersions, will push that during the day

@bjaglin bjaglin force-pushed the scala3-testkit branch 2 times, most recently from 6425737 to 58b8255 Compare May 17, 2021 11:19
@@ -2,7 +2,7 @@ import sbt._

object Dependencies {
val x = List(1) // scalafix:ok
def scalafixVersion: String = "0.9.27+52-6c9eeec9-SNAPSHOT"
def scalafixVersion: String = "0.9.27+78-f41dec8f-SNAPSHOT"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@bjaglin bjaglin force-pushed the scala3-testkit branch 2 times, most recently from 8afb937 to 98b1695 Compare May 17, 2021 12:14
* rely on scalafix-testkit to add semanticdbTargetRoot to classpath
  based on scalacOptions
* use sbt-projectmatrix (sbt 1.x only) to make it possible to test
  Scala 3 input with Scala 2.x
* introduce testsAggregate to avoid updating the docs referencing
  `tests/test` and introducing a breaking change for CI statements
@bjaglin bjaglin changed the title support Scala 3 in testkit Support Scala 3 in testkit May 17, 2021
@bjaglin bjaglin marked this pull request as ready for review May 17, 2021 12:19
@bjaglin bjaglin requested a review from mlachkar May 17, 2021 12:19
@bjaglin bjaglin changed the title Support Scala 3 in testkit Support Scala 3 in ScalafixTestkitPlugin May 17, 2021
@@ -13,4 +13,8 @@ object Dependencies {
"com.geirsson" %% "coursier-small" % "1.3.3",
"io.get-coursier" % "interface" % "1.0.4"
)

val sbt1Plugins = List(
"com.eed3si9n" % "sbt-projectmatrix" % "0.8.0"
Copy link
Collaborator Author

@bjaglin bjaglin May 17, 2021

Choose a reason for hiding this comment

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

Unfortunately, this is adding a new dependency also for scalafix users (not just rule authors). It does not look like there is a MiMa on it, so this could be a problem if it evicts the user's potential version. I think the risk is very limited, so unless we have such reports, I don't think it's worth creating a separate sbt-scalafix-testkit artifact.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Comment on lines +58 to +59
scalaVersions = Seq(V.scala212),
axisValues = Seq(InputAxis(scala3Version), VirtualAxis.jvm),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I chose Scala 2.12 because of

scalafixScalaBinaryVersion := "2.12"

.defaultAxes(VirtualAxis.jvm)
.jvmPlatform(scalaVersions = rulesCrossVersions :+ scala3Version)

lazy val testsAggregate = Project("tests", file("tests/aggregate"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

arbitrary path to avoid recompiling, we just want this for tests/test to aggregate over the tests*

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.

3 participants