-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test Scala 3 input/output with Scala 2.12 rule by default
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
- Loading branch information
1 parent
8c89008
commit 4b4f00b
Showing
6 changed files
with
138 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
repo = My Repo | ||
repo = scalafix-my-rules | ||
scalafix_version = maven(ch.epfl.scala, scalafix-cli_2.13.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/g8/scalafix/input/src/main/scala-3/fix/$repo__Camel$SignificantIndentation.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
rule = $repo;format="Camel"$ | ||
*/ | ||
package fix | ||
|
||
object $repo;format="Camel"$SignificantIndentation: | ||
val a = 1 | ||
// Add code that needs fixing here. |
5 changes: 5 additions & 0 deletions
5
src/main/g8/scalafix/output/src/main/scala-3/fix/$repo__Camel$SignificantIndentation.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package fix | ||
|
||
object $repo;format="Camel"$SignificantIndentation: | ||
val a = 1 | ||
// Add code that needs fixing here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import sbt._ | ||
import sbt.internal.ProjectMatrix | ||
import sbtprojectmatrix.ProjectMatrixPlugin.autoImport._ | ||
|
||
/** Use on ProjectMatrix rows to tag an affinity to a custom scalaVersion */ | ||
case class TargetAxis(scalaVersion: String) extends VirtualAxis.WeakAxis { | ||
|
||
private val scalaBinaryVersion = CrossVersion.binaryScalaVersion(scalaVersion) | ||
|
||
override val idSuffix = s"Target\${scalaBinaryVersion.replace('.', '_')}" | ||
override val directorySuffix = s"target\$scalaBinaryVersion" | ||
} | ||
|
||
object TargetAxis { | ||
|
||
private def targetScalaVersion(virtualAxes: Seq[VirtualAxis]): String = | ||
virtualAxes.collectFirst { case a: TargetAxis => a.scalaVersion }.get | ||
|
||
/** When invoked on a ProjectMatrix with a TargetAxis, lookup the project | ||
* generated by `matrix` with a scalaVersion matching the one defined in | ||
* that and resolve `key`. | ||
*/ | ||
def resolve[T]( | ||
matrix: ProjectMatrix, | ||
key: TaskKey[T] | ||
): Def.Initialize[Task[T]] = | ||
Def.taskDyn { | ||
val sv = targetScalaVersion(virtualAxes.value) | ||
val project = matrix.finder().apply(sv) | ||
Def.task((project / key).value) | ||
} | ||
|
||
/** When invoked on a ProjectMatrix with a TargetAxis, lookup the project | ||
* generated by `matrix` with a scalaVersion matching the one defined in | ||
* that and resolve `key`. | ||
*/ | ||
def resolve[T]( | ||
matrix: ProjectMatrix, | ||
key: SettingKey[T] | ||
): Def.Initialize[T] = | ||
Def.settingDyn { | ||
val sv = targetScalaVersion(virtualAxes.value) | ||
val project = matrix.finder().apply(sv) | ||
Def.setting((project / key).value) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
resolvers += Resolver.sonatypeRepo("snapshots") | ||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.27+39-c332bbde-SNAPSHOT") | ||
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0") |