Skip to content

Commit 4931f21

Browse files
committed
Upgrade to the latest sbt
The diff is unusually large because I have resisted to start using the slash-syntax that was introduced ~2 years. The sbt v1.5 release deprecated the old syntax that I've been using so now it's time to get used to the new syntax. Fortunately, there's an automated migration script so it was easy to create this PR
1 parent 3d2b21c commit 4931f21

File tree

3 files changed

+48
-48
lines changed

3 files changed

+48
-48
lines changed

build.sbt

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ inThisBuild(
5353
)
5454

5555
name := "root"
56-
bloopGenerate.in(Compile) := None
57-
bloopGenerate.in(Test) := None
58-
skip.in(publish) := true
56+
(Compile / bloopGenerate) := None
57+
(Test / bloopGenerate) := None
58+
(publish / skip) := true
5959

6060
commands +=
6161
Command.command("fixAll") { s =>
@@ -74,7 +74,7 @@ lazy val semanticdb = project
7474
.settings(
7575
moduleName := "semanticdb-java",
7676
javaOnlySettings,
77-
PB.targets.in(Compile) :=
77+
(Compile / PB.targets) :=
7878
Seq(PB.gens.java(V.protobuf) -> (Compile / sourceManaged).value)
7979
)
8080

@@ -106,7 +106,7 @@ lazy val plugin = project
106106
moduleName := "semanticdb-javac",
107107
javaToolchainVersion := "8",
108108
javacOptions += "-g",
109-
assemblyShadeRules.in(assembly) :=
109+
(assembly / assemblyShadeRules) :=
110110
Seq(
111111
ShadeRule
112112
.rename(
@@ -127,7 +127,7 @@ lazy val lsif = project
127127
javaOnlySettings,
128128
libraryDependencies +=
129129
"com.google.protobuf" % "protobuf-java-util" % V.protobuf,
130-
PB.targets.in(Compile) :=
130+
(Compile / PB.targets) :=
131131
Seq(PB.gens.java(V.protobuf) -> (Compile / sourceManaged).value),
132132
Compile / PB.protocOptions := Seq("--experimental_allow_proto3_optional")
133133
)
@@ -137,8 +137,8 @@ lazy val cli = project
137137
.in(file("lsif-java"))
138138
.settings(
139139
moduleName := "lsif-java",
140-
mainClass.in(Compile) := Some("com.sourcegraph.lsif_java.LsifJava"),
141-
baseDirectory.in(run) := baseDirectory.in(ThisBuild).value,
140+
(Compile / mainClass) := Some("com.sourcegraph.lsif_java.LsifJava"),
141+
(run / baseDirectory) := (ThisBuild / baseDirectory).value,
142142
buildInfoKeys :=
143143
Seq[BuildInfoKey](
144144
version,
@@ -150,27 +150,27 @@ lazy val cli = project
150150
libraryDependencies ++=
151151
List(
152152
"io.get-coursier" %% "coursier" % V.coursier,
153-
"org.scala-lang.modules" %% "scala-xml" % "2.0.0-RC1",
153+
"org.scala-lang.modules" %% "scala-xml" % "1.3.0",
154154
"com.lihaoyi" %% "requests" % V.requests,
155155
"org.scalameta" %% "moped" % V.moped,
156156
"org.scalameta" %% "ascii-graphs" % "0.1.2"
157157
),
158-
resourceGenerators.in(Compile) +=
158+
(Compile / resourceGenerators) +=
159159
Def
160160
.task[Seq[File]] {
161161
val outs = ListBuffer.empty[(File, File)]
162-
val out = resourceManaged.in(Compile).value.toPath
162+
val out = (Compile / resourceManaged).value.toPath
163163
IO.delete(out.toFile)
164164
def addJar(jar: File, filename: String): Unit = {
165165
outs += jar -> out.resolve(filename).toFile
166166
}
167167

168168
addJar(
169-
Keys.`package`.in(plugin, Compile).value,
169+
(plugin / Compile / Keys.`package`).value,
170170
"semanticdb-plugin.jar"
171171
)
172172
addJar(
173-
Keys.`package`.in(agent, Compile).value,
173+
(agent / Compile / Keys.`package`).value,
174174
"semanticdb-agent.jar"
175175
)
176176

@@ -192,7 +192,7 @@ lazy val cli = project
192192
"-H:IncludeResources=^semanticdb-.*jar$",
193193
s"-H:ReflectionConfigurationFiles=${target.value / "native-image-configs" / "reflect-config.json"}"
194194
),
195-
nativeImageOutput := target.in(NativeImage).value / "lsif-java"
195+
nativeImageOutput := (NativeImage / target).value / "lsif-java"
196196
)
197197
.enablePlugins(NativeImagePlugin, BuildInfoPlugin)
198198
.dependsOn(lsif)
@@ -217,7 +217,7 @@ lazy val packagehub = project
217217
.in(file("packagehub"))
218218
.settings(
219219
moduleName := "packagehub",
220-
mainClass.in(Compile) := Some("com.sourcegraph.packagehub.PackageHub"),
220+
(Compile / mainClass) := Some("com.sourcegraph.packagehub.PackageHub"),
221221
TaskKey[Unit]("dockerfileUpdate") := {
222222
val template = IO.read(file("Dockerfile.template"))
223223
IO.write(file("Dockerfile"), template.replace("VERSION", version.value))
@@ -251,18 +251,18 @@ def minimizedSourceDirectory =
251251
file("tests/minimized/src/main/java").getAbsoluteFile
252252
lazy val minimizedSettings = List[Def.Setting[_]](
253253
autoScalaLibrary := false,
254-
skip.in(publish) := true,
255-
fork.in(run) := true,
256-
unmanagedSourceDirectories.in(Compile) += minimizedSourceDirectory,
257-
javacOptions.in(Compile) ++=
254+
(publish / skip) := true,
255+
(run / fork) := true,
256+
(Compile / unmanagedSourceDirectories) += minimizedSourceDirectory,
257+
(Compile / javacOptions) ++=
258258
List[String](
259259
s"-Arandomtimestamp=${System.nanoTime()}",
260260
List(
261261
s"-Xplugin:semanticdb",
262262
s"-text:on",
263263
s"-verbose",
264-
s"-sourceroot:${baseDirectory.in(ThisBuild).value}",
265-
s"-targetroot:${semanticdbTargetRoot.in(Compile).value}"
264+
s"-sourceroot:${(ThisBuild / baseDirectory).value}",
265+
s"-targetroot:${(Compile / semanticdbTargetRoot).value}"
266266
).mkString(" ")
267267
)
268268
)
@@ -288,7 +288,7 @@ lazy val minimized15 = project
288288
lazy val minimizedScala = project
289289
.in(file("tests/minimized-scala"))
290290
.settings(
291-
skip.in(publish) := true,
291+
(publish / skip) := true,
292292
semanticdbOptions ++= List("-P:semanticdb:text:on")
293293
)
294294
.dependsOn(minimized)
@@ -303,14 +303,14 @@ lazy val unit = project
303303
version,
304304
scalaVersion,
305305
"temporaryDirectory" -> target.value / "tmpdir",
306-
"sourceroot" -> baseDirectory.in(ThisBuild).value,
306+
"sourceroot" -> (ThisBuild / baseDirectory).value,
307307
"minimizedJavaSourceDirectory" -> minimizedSourceDirectory,
308308
"minimizedJavaTargetroot" ->
309-
semanticdbTargetRoot.in(minimized, Compile).value,
309+
(minimized / Compile / semanticdbTargetRoot).value,
310310
"minimizedScalaSourceDirectory" ->
311-
sourceDirectory.in(minimizedScala, Compile).value / "scala",
311+
(minimizedScala / Compile / sourceDirectory).value / "scala",
312312
"minimizedScalaTargetroot" ->
313-
semanticdbTargetRoot.in(minimizedScala, Compile).value
313+
(minimizedScala / Compile / semanticdbTargetRoot).value
314314
),
315315
buildInfoPackage := "tests"
316316
)
@@ -321,12 +321,12 @@ lazy val buildTools = project
321321
.in(file("tests/buildTools"))
322322
.settings(
323323
testSettings,
324-
javaOptions.in(Test) ++=
324+
(Test / javaOptions) ++=
325325
List(
326-
s"-javaagent:${Keys.`package`.in(agent, Compile).value}",
327-
s"-Dsemanticdb.pluginpath=${Keys.`package`.in(plugin, Compile).value}",
328-
s"-Dsemanticdb.sourceroot=${baseDirectory.in(ThisBuild).value}",
329-
s"-Dsemanticdb.targetroot=${target.in(agent, Compile).value / "semanticdb-targetroot"}"
326+
s"-javaagent:${(agent / Compile / Keys.`package`).value}",
327+
s"-Dsemanticdb.pluginpath=${(plugin / Compile / Keys.`package`).value}",
328+
s"-Dsemanticdb.sourceroot=${(ThisBuild / baseDirectory).value}",
329+
s"-Dsemanticdb.targetroot=${(agent / Compile / target).value / "semanticdb-targetroot"}"
330330
)
331331
)
332332
.dependsOn(agent, unit)
@@ -337,7 +337,7 @@ lazy val snapshots = project
337337
testSettings,
338338
buildInfoKeys :=
339339
Seq[BuildInfoKey](
340-
"snapshotDirectory" -> sourceDirectory.in(Compile).value / "generated"
340+
"snapshotDirectory" -> (Compile / sourceDirectory).value / "generated"
341341
),
342342
buildInfoPackage := "tests.snapshots"
343343
)
@@ -348,8 +348,8 @@ lazy val bench = project
348348
.in(file("tests/benchmarks"))
349349
.settings(
350350
moduleName := "lsif-java-bench",
351-
fork.in(run) := true,
352-
skip.in(publish) := true
351+
(run / fork) := true,
352+
(publish / skip) := true
353353
)
354354
.dependsOn(unit)
355355
.enablePlugins(JmhPlugin)
@@ -358,7 +358,7 @@ lazy val docs = project
358358
.in(file("lsif-java-docs"))
359359
.settings(
360360
mdocOut :=
361-
baseDirectory.in(ThisBuild).value / "website" / "target" / "docs",
361+
(ThisBuild / baseDirectory).value / "website" / "target" / "docs",
362362
fork := false,
363363
mdocVariables :=
364364
Map[String, String](
@@ -379,7 +379,7 @@ lazy val javaOnlySettings = List[Def.Setting[_]](
379379
)
380380

381381
lazy val testSettings = List(
382-
skip.in(publish) := true,
382+
(publish / skip) := true,
383383
autoScalaLibrary := true,
384384
testFrameworks := List(new TestFramework("munit.Framework")),
385385
libraryDependencies ++=
@@ -395,7 +395,7 @@ lazy val testSettings = List(
395395
)
396396

397397
lazy val fatjarPackageSettings = List[Def.Setting[_]](
398-
assemblyMergeStrategy in assembly := {
398+
(assembly / assemblyMergeStrategy) := {
399399
case PathList("javax", _ @_*) =>
400400
MergeStrategy.discard
401401
case PathList("com", "sun", _ @_*) =>
@@ -405,20 +405,20 @@ lazy val fatjarPackageSettings = List[Def.Setting[_]](
405405
case PathList("META-INF", "versions", "9", "module-info.class") =>
406406
MergeStrategy.discard
407407
case x =>
408-
val oldStrategy = (assemblyMergeStrategy in assembly).value
408+
val oldStrategy = (assembly / assemblyMergeStrategy).value
409409
oldStrategy(x)
410410
},
411-
Keys.`package`.in(Compile) := {
412-
val slimJar = Keys.`package`.in(Compile).value
413-
val fatJar = crossTarget.value / assemblyJarName.in(assembly).value
411+
(Compile / Keys.`package`) := {
412+
val slimJar = (Compile / Keys.`package`).value
413+
val fatJar = crossTarget.value / (assembly / assemblyJarName).value
414414
val _ = assembly.value
415415
IO.copyFile(fatJar, slimJar, CopyOptions().withOverwrite(true))
416416
slimJar
417417
},
418-
packagedArtifact.in(Compile).in(packageBin) := {
419-
val (art, slimJar) = packagedArtifact.in(Compile).in(packageBin).value
418+
(Compile / packageBin / packagedArtifact) := {
419+
val (art, slimJar) = (Compile / packageBin / packagedArtifact).value
420420
val fatJar =
421-
new File(crossTarget.value + "/" + assemblyJarName.in(assembly).value)
421+
new File(crossTarget.value + "/" + (assembly / assemblyJarName).value)
422422
val _ = assembly.value
423423
IO.copy(List(fatJar -> slimJar), CopyOptions().withOverwrite(true))
424424
(art, slimJar)

project/JavaToolchainPlugin.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ object JavaToolchainPlugin extends AutoPlugin {
3333
"-bootclasspath",
3434
java8Bootclasspath()
3535
),
36-
javacOptions.in(doc) --= List("-target", "1.8"),
37-
javacOptions.in(doc) --= bootclasspathSettings(javaToolchainVersion.value),
38-
javacOptions.in(doc) --= List("-g"),
36+
(doc / javacOptions) --= List("-target", "1.8"),
37+
(doc / javacOptions) --= bootclasspathSettings(javaToolchainVersion.value),
38+
(doc / javacOptions) --= List("-g"),
3939
javaHome := Some(getJavaHome(javaToolchainVersion.value)),
4040
javacOptions ++= bootclasspathSettings(javaToolchainVersion.value),
4141
javaOptions ++= bootclasspathSettings(javaToolchainVersion.value)

project/build.properties

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

0 commit comments

Comments
 (0)