Skip to content

Commit b300f0d

Browse files
authored
update scala 3 version (#271)
- also update sclafmt
1 parent 8ac3190 commit b300f0d

File tree

18 files changed

+61
-56
lines changed

18 files changed

+61
-56
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v2
1515
- uses: olafurpg/setup-scala@v10
1616
- run: sbt test
17-
# - run: sbt compileScalafixOutputinScala3
17+
- run: sbt compileScalafixOutputinScala3
1818
jdk11:
1919
name: test jdk11
2020
runs-on: ubuntu-latest
@@ -26,7 +26,7 @@ jobs:
2626
with:
2727
java-version: [email protected]
2828
- run: sbt test
29-
# - run: sbt compileScalafixOutputinScala3
29+
- run: sbt compileScalafixOutputinScala3
3030
windows_213:
3131
name: Windows tests
3232
runs-on: windows-latest

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ align.preset = most
44
align.multiline = false
55
continuationIndent.defnSite = 2
66
assumeStandardLibraryStripMargin = true
7-
docstrings = JavaDoc
7+
docstrings.style = Asterisk
88
lineEndings = preserve
99
includeCurlyBraceInSelectChains = false
1010
danglingParentheses.preset = true

bin/scalafmt

11.3 KB
Binary file not shown.

build.sbt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import sbt.Keys.libraryDependencies
33

44
inThisBuild(
55
List(
6-
scalaVersion := V.scala213,
7-
semanticdbEnabled := true,
8-
semanticdbVersion := V.scalameta,
6+
scalaVersion := V.scala213,
7+
semanticdbEnabled := true,
8+
semanticdbVersion := V.scalameta,
99
scalafixScalaBinaryVersion := V.scala213BinaryVersion,
1010
scalafixDependencies ++= List("com.github.liancheng" %% "organize-imports" % V.organizeImports),
1111
organization := "ch.epfl.scala",
12-
homepage := Some(url("https://github.com/scalacenter/scala3-migrate")),
13-
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
14-
developers := Developers.list,
12+
homepage := Some(url("https://github.com/scalacenter/scala3-migrate")),
13+
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
14+
developers := Developers.list,
1515
version ~= { dynVer =>
1616
if (isCI) dynVer
1717
else V.localSnapshotVersion // only for local publishing
@@ -24,19 +24,19 @@ lazy val `compiler-interfaces` = project
2424
.settings(
2525
scalaVersion := V.scala3,
2626
libraryDependencies ++= Seq("org.scala-lang" %% "scala3-compiler" % V.scala3),
27-
crossPaths := false,
27+
crossPaths := false,
2828
autoScalaLibrary := false,
29-
moduleName := "migrate-compiler-interfaces"
29+
moduleName := "migrate-compiler-interfaces"
3030
)
3131
.dependsOn(`migrate-interfaces`)
3232

3333
lazy val `migrate-interfaces` = project
3434
.in(file("interfaces/migrate"))
3535
.settings(
3636
libraryDependencies ++= Seq("io.get-coursier" % "interface" % V.coursierInterface),
37-
crossPaths := false,
37+
crossPaths := false,
3838
autoScalaLibrary := false,
39-
moduleName := "migrate-core-interfaces"
39+
moduleName := "migrate-core-interfaces"
4040
)
4141

4242
lazy val migrate = project
@@ -53,8 +53,8 @@ lazy val migrate = project
5353
"org.scalatest" %% "scalatest" % V.scalatest % Test,
5454
"ch.epfl.scala" % "scalafix-testkit" % V.scalafix % Test cross CrossVersion.full
5555
),
56-
Test / test := (Test / test).dependsOn(`scalafix-rules` / publishLocal).value,
57-
Test / testOnly := (Test / testOnly).dependsOn(`scalafix-rules` / publishLocal).evaluated,
56+
Test / test := (Test / test).dependsOn(`scalafix-rules` / publishLocal).value,
57+
Test / testOnly := (Test / testOnly).dependsOn(`scalafix-rules` / publishLocal).evaluated,
5858
Test / buildInfoPackage := "migrate.test",
5959
Test / buildInfoKeys := Seq(
6060
"version" -> version.value,
@@ -92,7 +92,7 @@ lazy val `sbt-plugin` = project
9292
.enablePlugins(SbtPlugin)
9393
.settings(
9494
scalaVersion := V.scala212,
95-
name := "sbt-scala3-migrate",
95+
name := "sbt-scala3-migrate",
9696
scriptedLaunchOpts ++= Seq(s"-Dplugin.version=${version.value}"),
9797
scriptedDependencies := {
9898
scriptedDependencies
@@ -104,7 +104,7 @@ lazy val `sbt-plugin` = project
104104
)
105105
.value
106106
},
107-
buildInfoPackage := "migrate",
107+
buildInfoPackage := "migrate",
108108
scriptedBufferLog := false,
109109
buildInfoKeys := Seq[BuildInfoKey](
110110
name,
@@ -122,8 +122,8 @@ lazy val output = project
122122
.in(file("output"))
123123
.settings(
124124
publish / skip := true,
125-
scalaVersion := V.scala3,
126-
scalacOptions := Seq("-Ykind-projector"),
125+
scalaVersion := V.scala3,
126+
scalacOptions := Seq("-Ykind-projector"),
127127
libraryDependencies ++= Seq("org.typelevel" % "cats-core_2.13" % V.catsCore)
128128
)
129129
.disablePlugins(ScalafixPlugin)
@@ -157,7 +157,7 @@ lazy val `scalafix-input` = project
157157
lazy val `scalafix-output` = project
158158
.in(file("scalafix/output"))
159159
.settings(
160-
publish / skip := true,
160+
publish / skip := true,
161161
crossScalaVersions := List(V.scala213, V.scala3),
162162
scalacOptions ++= (if (scalaVersion.value.startsWith("3")) Seq("-Ykind-projector") else Seq()),
163163
libraryDependencies ++= {
@@ -208,7 +208,7 @@ lazy val V = new {
208208
val scala213BinaryVersion = "2.13"
209209
val scala212 = "2.12.14"
210210
val scalatest = "3.2.10"
211-
val scala3 = "3.0.0"
211+
val scala3 = "3.0.2"
212212
val scalafix = "0.9.31"
213213
val scribe = "3.6.0"
214214
val organizeImports = "0.4.3"

migrate/src/main/scala/migrate/internal/FileMigration.scala

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import migrate.utils.Timer._
1111
import scalafix.interfaces.ScalafixPatch
1212

1313
/**
14-
* Given a [[FileMigrationState]] and a [[Scala3Compiler]], the [[FileMigration]] class
15-
* tries to find the minimum set of patches that makes the code compile
14+
* Given a [[FileMigrationState]] and a [[Scala3Compiler]], the [[FileMigration]] class tries to find the minimum set of
15+
* patches that makes the code compile
1616
*/
1717
private[migrate] class FileMigration(fileToMigrate: FileMigrationState.Initial, compiler: Scala3Compiler) {
1818

@@ -43,8 +43,10 @@ private[migrate] class FileMigration(fileToMigrate: FileMigrationState.Initial,
4343
/**
4444
* A instance of [[CompilingState]] is a set of patches that are sufficient to make the code compiles.
4545
*
46-
* @param candidates A set of patches that may or may not be necessary
47-
* @param necessaryPatches A set of necessary patches
46+
* @param candidates
47+
* A set of patches that may or may not be necessary
48+
* @param necessaryPatches
49+
* A set of necessary patches
4850
*/
4951
private case class CompilingState(candidates: Seq[ScalafixPatch], necessaryPatches: Seq[ScalafixPatch]) {
5052

@@ -78,9 +80,12 @@ private[migrate] class FileMigration(fileToMigrate: FileMigrationState.Initial,
7880
/**
7981
* A [[CompilationStep]] is an intermediate step at which we try to compile the code
8082
*
81-
* @param kept The patches that we keep to make the code compile
82-
* @param removed The patches that we try to remove
83-
* @param necessary Some patch that is necessary or none
83+
* @param kept
84+
* The patches that we keep to make the code compile
85+
* @param removed
86+
* The patches that we try to remove
87+
* @param necessary
88+
* Some patch that is necessary or none
8489
*/
8590
private case class CompilationStep(
8691
kept: Seq[ScalafixPatch],

output/src/main/scala/migrate/Incompat1.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ object Incompat1 {
88

99
def inner(foo: Foo): foo.Inner = ???
1010

11-
def bar(f: String => Int): Option[Int] = Some.apply[String](inner(foo)).map(f)
11+
def bar(f: String => Int): Option[Int] = Some(inner(foo)).map(f)
1212
}
1313
}

plugin/src/main/scala/migrate/ScalaMigratePlugin.scala

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,18 @@ object ScalaMigratePlugin extends AutoPlugin {
7777
if (actual > migrateScalametaVersion) actual else migrateScalametaVersion
7878
} else semanticdbVersion.value
7979
},
80-
migrationConfigs := migrationConfigsImpl.value,
81-
migrationConfigs / aggregate := false,
82-
storeScala2Inputs := storeScala2InputsImpl.value,
83-
storeScala2Inputs / aggregate := false,
84-
internalMigrateScalacOptions := ScalacOptionsMigration.internalImpl.value,
80+
migrationConfigs := migrationConfigsImpl.value,
81+
migrationConfigs / aggregate := false,
82+
storeScala2Inputs := storeScala2InputsImpl.value,
83+
storeScala2Inputs / aggregate := false,
84+
internalMigrateScalacOptions := ScalacOptionsMigration.internalImpl.value,
8585
internalMigrateScalacOptions / aggregate := false,
86-
internalMigrateSyntax := SyntaxMigration.internalImpl.value,
87-
internalMigrateSyntax / aggregate := false,
88-
internalMigrate := TypeInferenceMigration.internalImpl.value,
89-
internalMigrate / aggregate := false,
90-
internalMigrateLibs := LibsMigration.internalImpl.value,
91-
internalMigrateLibs / aggregate := false,
86+
internalMigrateSyntax := SyntaxMigration.internalImpl.value,
87+
internalMigrateSyntax / aggregate := false,
88+
internalMigrate := TypeInferenceMigration.internalImpl.value,
89+
internalMigrate / aggregate := false,
90+
internalMigrateLibs := LibsMigration.internalImpl.value,
91+
internalMigrateLibs / aggregate := false,
9292
commands ++= Seq(migrateSyntax, migrateScalacOptions, migrateLibDependencies, migrate, fallback),
9393
inConfig(Compile)(configSettings),
9494
inConfig(Test)(configSettings)
@@ -154,9 +154,8 @@ object ScalaMigratePlugin extends AutoPlugin {
154154
}
155155

156156
/**
157-
* Return all configurations that can be migrated in a project.
158-
* If config A extends config B then B appears first
159-
* ex: List(Compile, Test) because Test extends Runtime which extends Compile
157+
* Return all configurations that can be migrated in a project. If config A extends config B then B appears first ex:
158+
* List(Compile, Test) because Test extends Runtime which extends Compile
160159
*/
161160
private def migrationConfigsImpl = Def.setting {
162161
val project = thisProject.value

plugin/src/main/scala/migrate/SyntaxMigration.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package migrate
22

33
import migrate.ScalaMigratePlugin.Keys._
4-
import migrate.ScalaMigratePlugin.{ scala3Version }
4+
import migrate.ScalaMigratePlugin.scala3Version
55
import ScalaMigratePlugin.migrateAPI
66

77
import sbt.Keys._

plugin/src/sbt-test/sbt-scala3-migrate/aggregate-project/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ lazy val subproject = project
99
lazy val `aggregate-project` = project
1010
.in(file("."))
1111
.settings(TaskKey[Unit]("checkMigration") := {
12-
assert(scalaVersion.value == "3.0.0")
12+
assert(scalaVersion.value == "3.0.2", s"Wrong scala version ${scalaVersion.value}. Expected 3.0.2")
1313
(Compile / compile).value
1414
})
1515
.aggregate(subproject)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version=1.5.3

0 commit comments

Comments
 (0)