Skip to content

Commit 89871d8

Browse files
authored
Merge pull request #10498 from dotty-staging/upgrade/sbt-1.4.4
2 parents 96c8bca + 99e2b4e commit 89871d8

File tree

44 files changed

+376
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+376
-126
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
Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,25 @@
1+
import sbt.internal.inc.Analysis
12
import complete.DefaultParsers._
23

3-
InputKey[Unit]("check-number-of-compiler-iterations") := {
4-
val args = spaceDelimited("<arg>").parsed
5-
val a = (compile in Compile).value.asInstanceOf[sbt.internal.inc.Analysis]
6-
assert(args.size == 1)
7-
val expectedIterationsNumber = args(0).toInt
8-
assert(a.compilations.allCompilations.size == expectedIterationsNumber, "a.compilations.allCompilations.size = %d (expected %d)".format(a.compilations.allCompilations.size, expectedIterationsNumber))
4+
// Reset compiler iterations, necessary because tests run in batch mode
5+
val recordPreviousIterations = taskKey[Unit]("Record previous iterations.")
6+
recordPreviousIterations := {
7+
val log = streams.value.log
8+
CompileState.previousIterations = {
9+
val previousAnalysis = (previousCompile in Compile).value.analysis.asScala
10+
previousAnalysis match {
11+
case None =>
12+
log.info("No previous analysis detected")
13+
0
14+
case Some(a: Analysis) => a.compilations.allCompilations.size
15+
}
16+
}
17+
}
18+
19+
val checkIterations = inputKey[Unit]("Verifies the accumulated number of iterations of incremental compilation.")
20+
21+
checkIterations := {
22+
val expected: Int = (Space ~> NatBasic).parsed
23+
val actual: Int = ((compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
24+
assert(expected == actual, s"Expected $expected compilations, got $actual")
925
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is necessary because tests are run in batch mode
2+
object CompileState {
3+
@volatile var previousIterations: Int = -1
4+
}

sbt-dotty/sbt-test/source-dependencies/abstract-type-override/test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
> recordPreviousIterations
12
# Test for separate compilation and proper value of
23
# the OVERRIDE flag when abstract types, type alias
34
# and structural type are involved
@@ -11,4 +12,4 @@ $ copy-file changes/Bar1.scala src/main/scala/Bar.scala
1112
# second iteration
1213
#> compile
1314
# check if there are only two compile iterations performed
14-
> checkNumberOfCompilerIterations 2
15+
> checkIterations 2

sbt-dotty/sbt-test/source-dependencies/canon/build.sbt

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1+
import sbt.internal.inc.Analysis
12
import complete.DefaultParsers._
23

3-
val checkIterations = inputKey[Unit]("Verifies the accumlated number of iterations of incremental compilation.")
4+
// Reset compiler iterations, necessary because tests run in batch mode
5+
val recordPreviousIterations = taskKey[Unit]("Record previous iterations.")
6+
recordPreviousIterations := {
7+
val log = streams.value.log
8+
CompileState.previousIterations = {
9+
val previousAnalysis = (previousCompile in Compile).value.analysis.asScala
10+
previousAnalysis match {
11+
case None =>
12+
log.info("No previous analysis detected")
13+
0
14+
case Some(a: Analysis) => a.compilations.allCompilations.size
15+
}
16+
}
17+
}
418

5-
checkIterations := {
6-
val analysis = (compile in Compile).value.asInstanceOf[sbt.internal.inc.Analysis]
19+
val checkIterations = inputKey[Unit]("Verifies the accumulated number of iterations of incremental compilation.")
720

21+
checkIterations := {
822
val expected: Int = (Space ~> NatBasic).parsed
9-
val actual: Int = analysis.compilations.allCompilations.size
23+
val actual: Int = ((compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
1024
assert(expected == actual, s"Expected $expected compilations, got $actual")
1125
}
12-
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is necessary because tests are run in batch mode
2+
object CompileState {
3+
@volatile var previousIterations: Int = -1
4+
}

sbt-dotty/sbt-test/source-dependencies/canon/test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
> recordPreviousIterations
12
# Tests that classpath entries that are different than their canonical representation are
23
# handled properly. In particular, a symlink from lib/a.jar to lib/../actual/a.jar.0 is
34
# available on the classpath and read by scalac. scalac 2.10.x does not interpret .jar.0

sbt-dotty/sbt-test/source-dependencies/constructors-unrelated/build.sbt

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1+
import sbt.internal.inc.Analysis
12
import complete.DefaultParsers._
23

3-
val checkIterations = inputKey[Unit]("Verifies the accumlated number of iterations of incremental compilation.")
4+
// Reset compiler iterations, necessary because tests run in batch mode
5+
val recordPreviousIterations = taskKey[Unit]("Record previous iterations.")
6+
recordPreviousIterations := {
7+
val log = streams.value.log
8+
CompileState.previousIterations = {
9+
val previousAnalysis = (previousCompile in Compile).value.analysis.asScala
10+
previousAnalysis match {
11+
case None =>
12+
log.info("No previous analysis detected")
13+
0
14+
case Some(a: Analysis) => a.compilations.allCompilations.size
15+
}
16+
}
17+
}
418

5-
checkIterations := {
6-
val analysis = (compile in Compile).value.asInstanceOf[sbt.internal.inc.Analysis]
19+
val checkIterations = inputKey[Unit]("Verifies the accumulated number of iterations of incremental compilation.")
720

21+
checkIterations := {
822
val expected: Int = (Space ~> NatBasic).parsed
9-
val actual: Int = analysis.compilations.allCompilations.size
23+
val actual: Int = ((compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
1024
assert(expected == actual, s"Expected $expected compilations, got $actual")
1125
}
12-
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is necessary because tests are run in batch mode
2+
object CompileState {
3+
@volatile var previousIterations: Int = -1
4+
}

sbt-dotty/sbt-test/source-dependencies/constructors-unrelated/test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
> recordPreviousIterations
12
> compile
23
$ copy-file changes/A2.scala A.scala
34
# Second compilation round, there should be no third round (we don't need to recompile B.scala)

sbt-dotty/sbt-test/source-dependencies/inline-inherited/build.sbt

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1+
import sbt.internal.inc.Analysis
12
import complete.DefaultParsers._
23

3-
val checkIterations = inputKey[Unit]("Verifies the accumlated number of iterations of incremental compilation.")
4+
// Reset compiler iterations, necessary because tests run in batch mode
5+
val recordPreviousIterations = taskKey[Unit]("Record previous iterations.")
6+
recordPreviousIterations := {
7+
val log = streams.value.log
8+
CompileState.previousIterations = {
9+
val previousAnalysis = (previousCompile in Compile).value.analysis.asScala
10+
previousAnalysis match {
11+
case None =>
12+
log.info("No previous analysis detected")
13+
0
14+
case Some(a: Analysis) => a.compilations.allCompilations.size
15+
}
16+
}
17+
}
418

5-
checkIterations := {
6-
val analysis = (compile in Compile).value.asInstanceOf[sbt.internal.inc.Analysis]
19+
val checkIterations = inputKey[Unit]("Verifies the accumulated number of iterations of incremental compilation.")
720

21+
checkIterations := {
822
val expected: Int = (Space ~> NatBasic).parsed
9-
val actual: Int = analysis.compilations.allCompilations.size
23+
val actual: Int = ((compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
1024
assert(expected == actual, s"Expected $expected compilations, got $actual")
1125
}
12-
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is necessary because tests are run in batch mode
2+
object CompileState {
3+
@volatile var previousIterations: Int = -1
4+
}

sbt-dotty/sbt-test/source-dependencies/inline-inherited/test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
> recordPreviousIterations
12
> compile
23
# Force recompilation of B, B.getInline hasn't changed so C shouldn't be recompiled.
34
$ copy-file changes/B1.scala B.scala

sbt-dotty/sbt-test/source-dependencies/inner-class/build.sbt

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1+
import sbt.internal.inc.Analysis
12
import complete.DefaultParsers._
23

3-
val checkIterations = inputKey[Unit]("Verifies the accumlated number of iterations of incremental compilation.")
4+
// Reset compiler iterations, necessary because tests run in batch mode
5+
val recordPreviousIterations = taskKey[Unit]("Record previous iterations.")
6+
recordPreviousIterations := {
7+
val log = streams.value.log
8+
CompileState.previousIterations = {
9+
val previousAnalysis = (previousCompile in Compile).value.analysis.asScala
10+
previousAnalysis match {
11+
case None =>
12+
log.info("No previous analysis detected")
13+
0
14+
case Some(a: Analysis) => a.compilations.allCompilations.size
15+
}
16+
}
17+
}
418

5-
checkIterations := {
6-
val analysis = (compile in Compile).value.asInstanceOf[sbt.internal.inc.Analysis]
19+
val checkIterations = inputKey[Unit]("Verifies the accumulated number of iterations of incremental compilation.")
720

21+
checkIterations := {
822
val expected: Int = (Space ~> NatBasic).parsed
9-
val actual: Int = analysis.compilations.allCompilations.size
23+
val actual: Int = ((compile in Compile).value match { case a: Analysis => a.compilations.allCompilations.size }) - CompileState.previousIterations
1024
assert(expected == actual, s"Expected $expected compilations, got $actual")
1125
}
12-
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// This is necessary because tests are run in batch mode
2+
object CompileState {
3+
@volatile var previousIterations: Int = -1
4+
}

sbt-dotty/sbt-test/source-dependencies/inner-class/test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
> recordPreviousIterations
12
> run
23

34
# Recompile B (no meaningful change, this is just so that the dependencies on A.InnerClass are

0 commit comments

Comments
 (0)