-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support several scalafixScalaBinaryVersion within a build (#380)
- Loading branch information
Showing
12 changed files
with
115 additions
and
39 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
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
3 changes: 3 additions & 0 deletions
3
src/sbt-test/sbt-1.5/cross-build-scalafixScalaBinaryVersion/.scalafix-2.conf
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,3 @@ | ||
rules = [DisableSyntax, OrganizeImports, ExplicitResultTypes] | ||
OrganizeImports.removeUnused = true | ||
ExplicitResultTypes.skipSimpleDefinitions = false |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/sbt-1.5/cross-build-scalafixScalaBinaryVersion/.scalafix-3.conf
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,2 @@ | ||
rules = [DisableSyntax, OrganizeImports] | ||
OrganizeImports.removeUnused = false |
23 changes: 23 additions & 0 deletions
23
src/sbt-test/sbt-1.5/cross-build-scalafixScalaBinaryVersion/build.sbt
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,23 @@ | ||
import _root_.scalafix.sbt.{BuildInfo => Versions} | ||
|
||
val scala3Version = "3.3.0" | ||
ThisBuild / semanticdbEnabled := true | ||
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision | ||
|
||
lazy val root = project | ||
.in(file(".")) | ||
.settings( | ||
scalaVersion := Versions.scala212, | ||
crossScalaVersions := Seq(Versions.scala212, Versions.scala213, scala3Version), | ||
scalacOptions ++= (if (scalaVersion.value.startsWith("2")) Seq("-Ywarn-unused") else Seq()), | ||
scalafixScalaBinaryVersion := { | ||
if (scalaBinaryVersion.value == "3") scalafixScalaBinaryVersion.value | ||
else scalaBinaryVersion.value | ||
}, | ||
scalafixConfig := { | ||
if (scalaBinaryVersion.value == "3") | ||
Some(file(".scalafix-3.conf")) | ||
else | ||
Some(file(".scalafix-2.conf")) | ||
} | ||
) |
1 change: 1 addition & 0 deletions
1
src/sbt-test/sbt-1.5/cross-build-scalafixScalaBinaryVersion/project/build.properties
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 @@ | ||
sbt.version=1.5.8 |
2 changes: 2 additions & 0 deletions
2
src/sbt-test/sbt-1.5/cross-build-scalafixScalaBinaryVersion/project/plugins.sbt
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,2 @@ | ||
resolvers += Resolver.sonatypeRepo("public") | ||
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % sys.props("plugin.version")) |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/sbt-1.5/cross-build-scalafixScalaBinaryVersion/src/main/scala-2/Main.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,7 @@ | ||
import scala.Int | ||
import scala.collection.Seq | ||
import scala.collection.AbstractSeq | ||
|
||
object Main { | ||
def foo(a: Int) = a + 2.0f | ||
} |
5 changes: 5 additions & 0 deletions
5
...-test/sbt-1.5/cross-build-scalafixScalaBinaryVersion/src/main/scala-2/Main.scala.expected
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 @@ | ||
import scala.Int | ||
|
||
object Main { | ||
def foo(a: Int): Float = a + 2.0f | ||
} |
7 changes: 7 additions & 0 deletions
7
src/sbt-test/sbt-1.5/cross-build-scalafixScalaBinaryVersion/src/main/scala-3/Main.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,7 @@ | ||
import scala.Int | ||
import scala.collection.Seq | ||
import scala.collection.AbstractSeq | ||
|
||
object Main { | ||
def foo(a: Int) = a + 2.0f | ||
} |
7 changes: 7 additions & 0 deletions
7
...-test/sbt-1.5/cross-build-scalafixScalaBinaryVersion/src/main/scala-3/Main.scala.expected
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,7 @@ | ||
import scala.Int | ||
import scala.collection.AbstractSeq | ||
import scala.collection.Seq | ||
|
||
object Main { | ||
def foo(a: Int) = a + 2.0f | ||
} |
6 changes: 6 additions & 0 deletions
6
src/sbt-test/sbt-1.5/cross-build-scalafixScalaBinaryVersion/test
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,6 @@ | ||
> +compile | ||
|
||
> +scalafix | ||
|
||
$ must-mirror src/main/scala-2/Main.scala src/main/scala-2/Main.scala.expected | ||
$ must-mirror src/main/scala-3/Main.scala src/main/scala-3/Main.scala.expected |