Skip to content

Commit 63cce1a

Browse files
xuwei-krtimush
authored andcommitted
add sbt 2.x cross build setting
1 parent 6716735 commit 63cce1a

8 files changed

Lines changed: 20 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ jobs:
3636
strategy:
3737
matrix:
3838
include:
39-
- { sbt: 1_0_0, java: 8 }
39+
- { sbt: 2_x, java: 8 }
4040
- { sbt: latest, java: 8 }
41-
- { sbt: 1_0_0, java: 11 }
4241
- { sbt: latest, java: 11 }
4342
- { sbt: latest, java: 14 }
4443
fail-fast: false

build.sbt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,25 @@ sonatypeProfileName := "com.timushev"
1919

2020
ThisBuild / scalacOptions := Seq("-deprecation", "-unchecked", "-feature")
2121

22+
lazy val `sbt-2` = SbtAxis("2.x", "2.0.0-M2")
23+
2224
lazy val `sbt-1.x` = SbtAxis("1.x", "1.1.5")
2325
lazy val `sbt-latest` = SbtAxis()
24-
lazy val `sbt-1.0.0` = SbtAxis("1.0.0")
2526

2627
lazy val `sbt-updates` = (projectMatrix in file("."))
2728
.settings(libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.19" % "test")
2829
.sbtPluginRow(`sbt-1.x`)
29-
.sbtScriptedRow(`sbt-1.0.0`, `sbt-1.x`)
3030
.sbtScriptedRow(`sbt-latest`, `sbt-1.x`)
31+
.sbtPluginRow(`sbt-2`)
32+
33+
lazy val `sbt-updates-2_x` = `sbt-updates`
34+
.finder(`sbt-2`)(false)
35+
.settings(
36+
scripted := {
37+
// TODO enable scripted test
38+
(Test / test).value
39+
}
40+
)
3141

3242
lazy val root = (project in file("."))
3343
.withId("sbt-updates")

project/SbtAxis.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ case class SbtAxis(fullVersion: Option[String], idSuffix: String, directorySuffi
88
extends VirtualAxis.WeakAxis {
99
val scalaVersion: String =
1010
fullVersion.map(VersionNumber(_)) match {
11-
case Some(VersionNumber(Seq(1, _*), _, _)) | None => "2.12.10"
11+
case Some(VersionNumber(Seq(1, _*), _, _)) | None => "2.12.20"
12+
case Some(VersionNumber(Seq(2, _*), _, _)) => "3.3.4"
1213
case _ => sys.error(s"Unsupported sbt version: $fullVersion")
1314
}
1415
}

src/main/scala-2.12/com/timushev/sbt/updates/Compat.scala renamed to src/main/scala/com/timushev/sbt/updates/Compat.scala

File renamed without changes.

src/main/scala/com/timushev/sbt/updates/DependencyPositions.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.timushev.sbt.updates
22

33
import sbt.Keys._
4-
import sbt._
4+
import sbt.{given, _}
55

66
import scala.util.control.NonFatal
77

@@ -12,7 +12,7 @@ object DependencyPositions {
1212
try {
1313
val projRef = thisProjectRef.value
1414
val st = state.value
15-
val sk = libraryDependencies.in(GlobalScope.in(projRef)).scopedKey
15+
val sk = (GlobalScope / (projRef / libraryDependencies)).scopedKey
1616
val extracted = Project.extract(st)
1717
val empty = extracted.structure.data.set(sk.scope, sk.key, Nil)
1818
val settings = extracted.structure.settings.filter { s =>

src/main/scala/com/timushev/sbt/updates/UpdatesFinder.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object UpdatesFinder {
3131
case (_, _) => false
3232
}
3333

34-
private def isUpdate(current: Version) = current < _
34+
private def isUpdate(current: Version): Version => Boolean = current < _
3535

3636
private val withEmpty: PartialFunction[Throwable, Seq[Version]] = { case _ =>
3737
Seq.empty

src/main/scala/com/timushev/sbt/updates/UpdatesPlugin.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ object UpdatesPlugin extends AutoPlugin {
3434
dependencyUpdatesExclusions.value,
3535
dependencyUpdatesFilter.value,
3636
dependencyAllowPreRelease.value,
37-
(baseDirectory in ThisBuild).value,
37+
(ThisBuild / baseDirectory).value,
3838
streams.value
3939
)
4040
},

src/main/scala/com/timushev/sbt/updates/metadata/extractor/HtmlVersionExtractor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ class HtmlVersionExtractor extends VersionExtractor {
1414
Pattern.findAllIn(data).nonEmpty
1515

1616
override def apply(data: String): Seq[Version] =
17-
Pattern.findAllMatchIn(data).map(_.group(1)).map(Version.apply).to[Vector]
17+
Pattern.findAllMatchIn(data).map(_.group(1)).map(Version.apply).toVector
1818
}

0 commit comments

Comments
 (0)