Skip to content

Commit d640c72

Browse files
committed
Upgrade to sbt 1.4.4
Theo following projects failed to compile: minitest, scopt, squants and stdlib213: - Scopt and squants still do not support Scala 3 upstream, I decided to drop them because the alternatives (staying with an old fork and cherry-picking changes, or continuously rebasing our fork on top of upstream) requires too much on-going maintenance work, we can add them back when they officially support Scala 3. - Minitest was upgraded to the latest upstream commit (I made a PR upstream to support 3.0.0-M2), at the same time I enabled running the tests (both JVM and JS) of minitest instead of just compiling it. - The new minitest required a new scalacheck, upgrading scalacheck broke other projects in the community build which depended on an old version of it. I fixed the issue by using `dependencyOverrides` to force all projects to use the same version of scalacheck, we can use this mechanism for other projects upgrade in the future. - stdlib213 was rebased on the latest upstream commit, I opened a PR with the necessary changes so we don't need to keep a fork anymore: scala/scala#9345 Some of our sbt scripted tests started failing after upgrading sbt, I traced this to an unintentional behavior change in sbt which now uses always run scripted tests in batch mode (sbt/sbt#5913 (comment)). The next two commits add batch modes support to our scripted tests by porting fixes made in sbt itself when it switched its own tests to batch modes a while ago. The good news is that the batch mode makes the scripted tests much faster.
1 parent 1c3538a commit d640c72

File tree

11 files changed

+45
-36
lines changed

11 files changed

+45
-36
lines changed

.gitmodules

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
[submodule "community-build/community-projects/scalatest"]
1414
path = community-build/community-projects/scalatest
1515
url = https://github.com/dotty-staging/scalatest
16-
[submodule "community-build/community-projects/scopt"]
17-
path = community-build/community-projects/scopt
18-
url = https://github.com/dotty-staging/scopt
19-
[submodule "community-build/community-projects/squants"]
20-
path = community-build/community-projects/squants
21-
url = https://github.com/dotty-staging/squants
2216
[submodule "community-build/community-projects/scalap"]
2317
path = community-build/community-projects/scalap
2418
url = https://github.com/dotty-staging/scala
Submodule minitest updated 35 files
Submodule scalacheck updated 65 files
Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 0 additions & 1 deletion
This file was deleted.
Submodule stdLib213 updated 858 files

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,18 @@ final case class SbtCommunityProject(
7272
dependencies: List[CommunityProject] = Nil,
7373
sbtPublishCommand: String = null) extends CommunityProject:
7474
override val binaryName: String = "sbt"
75-
private val baseCommand = s";clean ;set logLevel in Global := Level.Error ;set updateOptions in Global ~= (_.withLatestSnapshots(false)) ;++$compilerVersion! "
75+
76+
val dependencyOverrides = List(
77+
// dependencyOverrides doesn't seem to understand `%%%`
78+
""""org.scalacheck" %% "scalacheck" % "1.15.2-SNAPSHOT"""",
79+
""""org.scalacheck" %% "scalacheck_sjs1" % "1.15.2-SNAPSHOT""""
80+
)
81+
82+
private val baseCommand =
83+
"clean; set logLevel in Global := Level.Error; set updateOptions in Global ~= (_.withLatestSnapshots(false)); "
84+
++ s"""set dependencyOverrides in ThisBuild ++= ${dependencyOverrides.mkString("Seq(", ", ", ")")}; """
85+
++ s"++$compilerVersion!; "
86+
7687
override val testCommand = s"$baseCommand$sbtTestCommand"
7788
override val publishCommand = s"$baseCommand$sbtPublishCommand"
7889

@@ -85,7 +96,7 @@ final case class SbtCommunityProject(
8596
if (forceUpgradeSbtScalajsPlugin) List(s"--addPluginSbtFile=$sbtScalaJSPluginFilePath")
8697
else Nil
8798
extraSbtArgs ++ sbtProps ++ List(
88-
"-sbt-version", "1.3.8",
99+
"-sbt-version", "1.4.4",
89100
"-Dsbt.supershell=false",
90101
s"--addPluginSbtFile=$sbtPluginFilePath"
91102
) ++ scalaJSPluginArgs
@@ -172,14 +183,14 @@ object projects:
172183

173184
lazy val scalacheck = SbtCommunityProject(
174185
project = "scalacheck",
175-
sbtTestCommand = "jvm/test",
176-
sbtPublishCommand = ";set jvm/publishArtifact in (Compile, packageDoc) := false ;jvm/publishLocal"
186+
sbtTestCommand = "jvm/test;js/test",
187+
sbtPublishCommand = "jvm/publishLocal;js/publishLocal"
177188
)
178189

179190
lazy val scalatest = SbtCommunityProject(
180191
project = "scalatest",
181-
sbtTestCommand = ";scalacticDotty/clean;scalacticTestDotty/test;scalatestTestDotty/test",
182-
sbtPublishCommand = ";scalacticDotty/publishLocal; scalatestDotty/publishLocal"
192+
sbtTestCommand = "scalacticDotty/clean;scalacticTestDotty/test; scalatestTestDotty/test",
193+
sbtPublishCommand = "scalacticDotty/publishLocal; scalatestDotty/publishLocal"
183194
)
184195

185196
lazy val scalatestplusScalacheck = SbtCommunityProject(
@@ -194,21 +205,11 @@ object projects:
194205
sbtTestCommand = "xml/test",
195206
)
196207

197-
lazy val scopt = SbtCommunityProject(
198-
project = "scopt",
199-
sbtTestCommand = "scoptJVM/compile",
200-
)
201-
202208
lazy val scalap = SbtCommunityProject(
203209
project = "scalap",
204210
sbtTestCommand = "scalap/compile",
205211
)
206212

207-
lazy val squants = SbtCommunityProject(
208-
project = "squants",
209-
sbtTestCommand = "squantsJVM/compile",
210-
)
211-
212213
lazy val betterfiles = SbtCommunityProject(
213214
project = "betterfiles",
214215
sbtTestCommand = "dotty-community-build/compile",
@@ -221,7 +222,8 @@ object projects:
221222

222223
lazy val minitest = SbtCommunityProject(
223224
project = "minitest",
224-
sbtTestCommand = "dotty-community-build/compile",
225+
sbtTestCommand = "test",
226+
dependencies = List(scalacheck)
225227
)
226228

227229
lazy val fastparse = SbtCommunityProject(
@@ -233,7 +235,7 @@ object projects:
233235
project = "stdLib213",
234236
extraSbtArgs = List("-Dscala.build.compileWithDotty=true"),
235237
sbtTestCommand = """library/compile""",
236-
sbtPublishCommand = """;set publishArtifact in (library, Compile, packageDoc) := false ;library/publishLocal""",
238+
sbtPublishCommand = """set publishArtifact in (library, Compile, packageDoc) := false ;library/publishLocal""",
237239
)
238240

239241
lazy val shapeless = SbtCommunityProject(
@@ -256,9 +258,9 @@ object projects:
256258
// has not been updated since 2018, so no 2.13 compat. Some akka tests are dropped due to MutableBehaviour being
257259
// dropped in the 2.13 compatible release
258260

259-
// sbtTestCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:compile; plugin/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile",
261+
// sbtTestCommand = "set ThisBuild / useEffpiPlugin := false; effpi/test:compile; plugin/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile",
260262

261-
sbtTestCommand = ";set ThisBuild / useEffpiPlugin := false; effpi/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile",
263+
sbtTestCommand = "set ThisBuild / useEffpiPlugin := false; effpi/test:compile; benchmarks/test:compile; examples/test:compile; pluginBenchmarks/test:compile",
262264
)
263265

264266
// TODO @odersky? It got broken by #5458
@@ -313,7 +315,7 @@ object projects:
313315

314316
lazy val endpoints4s = SbtCommunityProject(
315317
project = "endpoints4s",
316-
sbtTestCommand = ";json-schemaJVM/compile;algebraJVM/compile;openapiJVM/compile;http4s-server/compile;http4s-client/compile;play-server/compile;play-client/compile;akka-http-server/compile;akka-http-client/compile"
318+
sbtTestCommand = "json-schemaJVM/compile;algebraJVM/compile;openapiJVM/compile;http4s-server/compile;http4s-client/compile;play-server/compile;play-client/compile;akka-http-server/compile;akka-http-client/compile"
317319
)
318320

319321
lazy val catsEffect2 = SbtCommunityProject(

community-build/test/scala/dotty/communitybuild/CommunityBuildTest.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,7 @@ class CommunityBuildTestB extends CommunityBuildTest:
123123
@Test def scalaz = projects.scalaz.run()
124124
@Test def scas = projects.scas.run()
125125
@Test def sconfig = projects.sconfig.run()
126-
@Test def scopt = projects.scopt.run()
127126
@Test def shapeless = projects.shapeless.run()
128-
@Test def squants = projects.squants.run()
129127
@Test def stdLib213 = projects.stdLib213.run()
130128
@Test def xmlInterpolator = projects.xmlInterpolator.run()
131129
@Test def zio = projects.zio.run()

project/Build.scala

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,14 @@ object Build {
211211
}
212212
// Do not cut off the bottom of large stack traces (default is 1024)
213213
"-XX:MaxJavaStackTraceDepth=1000000" :: agentOptions ::: ciOptions
214-
}
214+
},
215+
216+
excludeLintKeys ++= Set(
217+
// We set these settings in `commonSettings`, if a project
218+
// uses `commonSettings` but overrides `unmanagedSourceDirectories`,
219+
// sbt will complain if we don't exclude them here.
220+
Keys.scalaSource, Keys.javaSource
221+
),
215222
)
216223

217224
lazy val disableDocSetting =
@@ -1197,6 +1204,12 @@ object Build {
11971204
unmanagedSourceDirectories in Compile +=
11981205
baseDirectory.value / "../language-server/src/dotty/tools/languageserver/config",
11991206
sbtTestDirectory := baseDirectory.value / "sbt-test",
1207+
1208+
// The batch mode accidentally became the default with no way to disable
1209+
// it in sbt 1.4 (https://github.com/sbt/sbt/issues/5913#issuecomment-716003195).
1210+
// We enable it explicitly here to make it clear that we're using it.
1211+
scriptedBatchExecution := true,
1212+
12001213
scriptedLaunchOpts ++= Seq(
12011214
"-Dplugin.version=" + version.value,
12021215
"-Dplugin.scalaVersion=" + dottyVersion,

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.3.12
1+
sbt.version=1.4.4

sbt-dotty/src/dotty/tools/sbtplugin/DottyIDEPlugin.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ object DottyIDEPlugin extends AutoPlugin {
394394

395395
) ++ addCommandAlias("launchIDE", ";configureIDE;runCode")
396396

397+
override def globalSettings: Seq[Setting[_]] = Seq(
398+
excludeLintKeys += excludeFromIDE
399+
)
400+
397401
// Ported from Bloop
398402
/**
399403
* Detect the eligible configuration dependencies from a given configuration.

0 commit comments

Comments
 (0)