Skip to content

Commit ff218b3

Browse files
authored
Merge pull request #11757 from adpi2/sbt-slash-syntax
Move to sbt slash syntax
2 parents 1687698 + 7375f0f commit ff218b3

File tree

8 files changed

+203
-203
lines changed

8 files changed

+203
-203
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ object projects:
328328
project = "stdLib213",
329329
extraSbtArgs = List("-Dscala.build.compileWithDotty=true"),
330330
sbtTestCommand = """library/compile""",
331-
sbtPublishCommand = """set publishArtifact in (library, Compile, packageDoc) := false ;library/publishLocal""",
331+
sbtPublishCommand = """set library/Compile/packageDoc/publishArtifact := false; library/publishLocal""",
332332
// sbtDocCommand = "library/doc" // Does no compile? No idea :/
333333
)
334334

project/Build.scala

Lines changed: 168 additions & 168 deletions
Large diffs are not rendered by default.

project/NoBloopExport.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ object NoBloopExport {
2323
Nil
2424
case Some(key) =>
2525
Seq(
26-
key in Compile := None,
27-
key in Test := None,
26+
Compile / key := None,
27+
Test / key := None,
2828
)
2929
}
3030
}

project/build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ libraryDependencies += "org.eclipse.jgit" % "org.eclipse.jgit" % "4.11.0.2018030
55
// so that we can use the current in-development version of the plugin
66
// in our build instead of a released version.
77

8-
unmanagedSourceDirectories in Compile += baseDirectory.value / "../sbt-dotty/src"
8+
Compile / unmanagedSourceDirectories += baseDirectory.value / "../sbt-dotty/src"
99

1010
// Keep in sync with `sbt-dotty` config in Build.scala
1111
libraryDependencies ++= Seq(
1212
Dependencies.`jackson-databind`,
1313
Dependencies.newCompilerInterface
1414
)
15-
unmanagedSourceDirectories in Compile +=
15+
Compile / unmanagedSourceDirectories +=
1616
baseDirectory.value / "../language-server/src/dotty/tools/languageserver/config"

sbt-dotty/sbt-test/compilerReporter/i7442/project/Reporter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object Reporter {
2323
}
2424

2525
lazy val checkSettings = Seq(
26-
compilerReporter in (Compile, compile) := reporter,
26+
Compile / compile / compilerReporter := reporter,
2727
check := (compile in Compile).failure.map(_ => {
2828
println(reporter.problems.toList)
2929
assert(reporter.problems.length == 1)

sbt-dotty/sbt-test/compilerReporter/simple/project/Reporter.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object Reporter {
2323
}
2424

2525
lazy val checkSettings = Seq(
26-
compilerReporter in (Compile, compile) := reporter,
26+
Compile / compile / compilerReporter := reporter,
2727
check := (compile in Compile).failure.map(_ => {
2828
val problems = reporter.problems
2929
println(problems.toList)
@@ -32,11 +32,11 @@ object Reporter {
3232
// make sure position reported by zinc are proper
3333
val mainProblem = problems.head
3434

35-
val line = mainProblem.position().line()
35+
val line = mainProblem.position().line()
3636
assert(line.isPresent() == true)
3737
assert(line.get() == 9)
3838

39-
val pointer = mainProblem.position().pointer()
39+
val pointer = mainProblem.position().pointer()
4040
assert(pointer.isPresent() == true)
4141
assert(pointer.get() == 10)
4242

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ object DottyIDEPlugin extends AutoPlugin {
5151
val extracted = Project.extract(state)
5252
val settings = extracted.structure.data
5353

54-
if (projRefs.forall(projRef => scalaVersion.in(projRef).get(settings).get == newScalaVersion))
54+
if (projRefs.forall(projRef => (projRef / scalaVersion).get(settings).get == newScalaVersion))
5555
state
5656
else {
5757
def matchingSetting(setting: Setting[_]) =
@@ -60,7 +60,7 @@ object DottyIDEPlugin extends AutoPlugin {
6060

6161
val newSettings = extracted.session.mergeSettings.collect {
6262
case setting if matchingSetting(setting) =>
63-
scalaVersion in setting.key.scope := newScalaVersion
63+
setting.key.scope / scalaVersion := newScalaVersion
6464
}
6565
val newSession = extracted.session.appendRaw(newSettings)
6666
BuiltinCommands.reapply(newSession, extracted.structure, state)
@@ -82,14 +82,14 @@ object DottyIDEPlugin extends AutoPlugin {
8282

8383
val (dottyVersions, dottyProjRefs) =
8484
structure.allProjectRefs.flatMap { projRef =>
85-
if (excludeFromIDE.in(projRef).get(settings) == Some(true))
85+
if ((projRef / excludeFromIDE).get(settings) == Some(true))
8686
None
8787
else {
88-
val version = scalaVersion.in(projRef).get(settings).get
88+
val version = (projRef / scalaVersion).get(settings).get
8989
if (isDottyVersion(version))
9090
Some((version, projRef))
9191
else
92-
crossScalaVersions.in(projRef).get(settings).get.filter(isDottyVersion).sorted.lastOption match {
92+
(projRef / crossScalaVersions).get(settings).get.filter(isDottyVersion).sorted.lastOption match {
9393
case Some(v) =>
9494
Some((v, projRef))
9595
case _ =>
@@ -134,11 +134,11 @@ object DottyIDEPlugin extends AutoPlugin {
134134
val joinedTask = projRefs.flatMap { projRef =>
135135
val project = Project.getProjectForReference(projRef, structure).get
136136
project.configurations.flatMap { config =>
137-
excludeFromIDE.in(projRef, config).get(settings) match {
137+
(projRef / config / excludeFromIDE).get(settings) match {
138138
case Some(true) =>
139139
None // skip this configuration
140140
case _ =>
141-
key.in(projRef, config).get(settings)
141+
(projRef / config / key).get(settings)
142142
}
143143
}
144144
}.join
@@ -288,7 +288,7 @@ object DottyIDEPlugin extends AutoPlugin {
288288
private def makeId(name: String, config: String): String = s"$name/$config"
289289

290290
private def projectConfigTask(config: Configuration): Initialize[Task[Option[ProjectConfig]]] = Def.taskDyn {
291-
val depClasspath = Attributed.data((dependencyClasspath in config).value)
291+
val depClasspath = Attributed.data((config / dependencyClasspath).value)
292292
val projectName = name.value
293293

294294
// Try to detect if this is a real Scala project or not. This is pretty
@@ -314,14 +314,14 @@ object DottyIDEPlugin extends AutoPlugin {
314314
// Not needed to generate the config, but this guarantees that the
315315
// generated config is usable by an IDE without any extra compilation
316316
// step.
317-
val _ = (compile in config).value
317+
val _ = (config / compile).value
318318

319319
val project = thisProject.value
320320
val id = makeId(project.id, config.name)
321-
val compilerVersion = (scalaVersion in config).value
322-
val compilerArguments = (scalacOptions in config).value
323-
val sourceDirectories = (unmanagedSourceDirectories in config).value ++ (managedSourceDirectories in config).value
324-
val classDir = (classDirectory in config).value
321+
val compilerVersion = (config / scalaVersion).value
322+
val compilerArguments = (config / scalacOptions).value
323+
val sourceDirectories = (config / unmanagedSourceDirectories).value ++ (config / managedSourceDirectories).value
324+
val classDir = (config / classDirectory).value
325325
val extracted = Project.extract(state.value)
326326
val settings = extracted.structure.data
327327

@@ -331,7 +331,7 @@ object DottyIDEPlugin extends AutoPlugin {
331331
// We filter out dependencies that do not compile using Dotty
332332
val classpathProjectDependencies =
333333
project.dependencies.filter { d =>
334-
val version = scalaVersion.in(d.project).get(settings).get
334+
val version = (d.project / scalaVersion).get(settings).get
335335
isDottyVersion(version)
336336
}.map(d => projectDependencyName(d, config, project, logger))
337337
val configDependencies =
@@ -361,8 +361,8 @@ object DottyIDEPlugin extends AutoPlugin {
361361
// TODO: It would be better to use Def.derive to define projectConfig in
362362
// every configuration where the keys it depends on exist, however this
363363
// currently breaks aggregated tasks: https://github.com/sbt/sbt/issues/3580
364-
projectConfig in Compile := projectConfigTask(Compile).value,
365-
projectConfig in Test := projectConfigTask(Test).value
364+
Compile / projectConfig := projectConfigTask(Compile).value,
365+
Test / projectConfig := projectConfigTask(Test).value
366366
)
367367

368368
override def buildSettings: Seq[Setting[_]] = Seq(
@@ -432,7 +432,7 @@ object DottyIDEPlugin extends AutoPlugin {
432432
val eligibleConfigs = activeProjectConfigs.filter { c =>
433433
val configKey = ConfigKey.configurationToKey(c)
434434
// Consider only configurations where the `compile` key is defined
435-
val eligibleKey = compile in (thisProjectRef, configKey)
435+
val eligibleKey = (thisProjectRef / configKey / compile)
436436
eligibleKey.get(data) match {
437437
case Some(t) =>
438438
// Sbt seems to return tasks for the extended configurations (looks like a big bug)

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ object DottyPlugin extends AutoPlugin {
173173
}
174174

175175
override val globalSettings: Seq[Def.Setting[_]] = Seq(
176-
onLoad in Global := onLoad.in(Global).value.andThen { state =>
176+
Global / onLoad := (Global / onLoad).value.andThen { state =>
177177

178178
val requiredVersion = ">=1.4.4"
179179

@@ -231,8 +231,8 @@ object DottyPlugin extends AutoPlugin {
231231
scalaOrganization.value
232232
},
233233

234-
incOptions in Compile := {
235-
val inc = (incOptions in Compile).value
234+
Compile / incOptions := {
235+
val inc = (Compile / incOptions).value
236236
if (isDotty.value)
237237
dottyPatchIncOptions(inc)
238238
else
@@ -246,7 +246,7 @@ object DottyPlugin extends AutoPlugin {
246246
dependencyResolution.value,
247247
scalaModuleInfo.value,
248248
updateConfiguration.value,
249-
(unresolvedWarningConfiguration in update).value,
249+
(update / unresolvedWarningConfiguration).value,
250250
streams.value.log,
251251
)
252252
Option(getJar(updateReport, scalaOrganization.value, scala3Artefact(scalaVersion.value, "sbt-bridge"), scalaVersion.value))
@@ -318,11 +318,11 @@ object DottyPlugin extends AutoPlugin {
318318
// so we need to manually set `classpathOptions in console` to something sensible,
319319
// ideally this would be "whatever would be set if this plugin was not enabled",
320320
// but I can't find a way to do this, so we default to whatever is set in ThisBuild.
321-
classpathOptions in console := {
321+
console / classpathOptions := {
322322
if (isDotty.value)
323323
classpathOptions.value // The Dotty REPL doesn't require anything special on its classpath
324324
else
325-
(classpathOptions in console in ThisBuild).value
325+
(ThisBuild / console / classpathOptions).value
326326
},
327327
classpathOptions := {
328328
val old = classpathOptions.value
@@ -377,7 +377,7 @@ object DottyPlugin extends AutoPlugin {
377377
v.startsWith("3.0.0") && !v.startsWith("3.0.0-M1") && !v.startsWith("3.0.0-M2")
378378
},
379379
// We need to add doctool classes to the classpath so they can be called
380-
scalaInstance in doc := Def.taskDyn {
380+
doc / scalaInstance := Def.taskDyn {
381381
if (isDotty.value)
382382
if (useScaladoc.value) {
383383
val v = scalaVersion.value
@@ -387,7 +387,7 @@ object DottyPlugin extends AutoPlugin {
387387
dottyScalaInstanceTask(name)
388388
} else dottyScalaInstanceTask(scala3Artefact(scalaVersion.value, "doc"))
389389
else
390-
Def.valueStrict { (scalaInstance in doc).taskValue }
390+
Def.valueStrict { (doc / scalaInstance).taskValue }
391391
}.value,
392392

393393
// Because managedScalaInstance is false, sbt won't add the standard library to our dependencies for us
@@ -525,7 +525,7 @@ object DottyPlugin extends AutoPlugin {
525525
dependencyResolution.value,
526526
scalaModuleInfo.value,
527527
updateConfiguration.value,
528-
(unresolvedWarningConfiguration in update).value,
528+
(update / unresolvedWarningConfiguration).value,
529529
streams.value.log)
530530
val scalaLibraryJar = getJar(updateReport,
531531
"org.scala-lang", "scala-library", revision = AllPassFilter)

0 commit comments

Comments
 (0)