diff --git a/project/BuildSettings.scala b/project/BuildSettings.scala index 29aa4a7a1..bf32d7388 100644 --- a/project/BuildSettings.scala +++ b/project/BuildSettings.scala @@ -1,6 +1,6 @@ import sbt.Def -import sbt._ -import sbt.Keys._ +import sbt.* +import sbt.Keys.* object BuildSettings { @@ -16,9 +16,9 @@ object BuildSettings { lazy val checkLicenseHeaders = taskKey[Unit]("Check the license headers for all source files.") lazy val formatLicenseHeaders = taskKey[Unit]("Fix the license headers for all source files.") - lazy val baseSettings: Seq[Def.Setting[_]] = GitVersion.settings + lazy val baseSettings: Seq[Def.Setting[?]] = GitVersion.settings - lazy val buildSettings: Seq[Def.Setting[_]] = baseSettings ++ Seq( + lazy val buildSettings: Seq[Def.Setting[?]] = baseSettings ++ Seq( organization := "com.netflix.atlas_v1", scalaVersion := Dependencies.Versions.scala, scalacOptions := { @@ -36,8 +36,8 @@ object BuildSettings { // Evictions: https://github.com/sbt/sbt/issues/1636 // Linting: https://github.com/sbt/sbt/pull/5153 (update / evictionWarningOptions).withRank(KeyRanks.Invisible) := EvictionWarningOptions.empty, - checkLicenseHeaders := License.checkLicenseHeaders(streams.value.log, sourceDirectory.value), - formatLicenseHeaders := License.formatLicenseHeaders(streams.value.log, sourceDirectory.value), + checkLicenseHeaders := LicenseCheck.checkLicenseHeaders(streams.value.log, sourceDirectory.value), + formatLicenseHeaders := LicenseCheck.formatLicenseHeaders(streams.value.log, sourceDirectory.value), packageBin / packageOptions += Package.ManifestAttributes( "Build-Date" -> java.time.Instant.now().toString, "Build-Number" -> sys.env.getOrElse("GITHUB_RUN_ID", "unknown"), @@ -64,7 +64,7 @@ object BuildSettings { def profile: Project => Project = p => { p.settings(SonatypeSettings.settings) - .settings(buildSettings: _*) + .settings(buildSettings *) .settings(libraryDependencies ++= commonDeps) } } diff --git a/project/Dependencies.scala b/project/Dependencies.scala index a78c2148b..1c7e95fc7 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -1,4 +1,4 @@ -import sbt._ +import sbt.* // format: off @@ -17,7 +17,7 @@ object Dependencies { val crossScala = Seq(scala, "3.5.1") } - import Versions._ + import Versions.* val pekkoActor = "org.apache.pekko" %% "pekko-actor" % pekko val pekkoHttp = "org.apache.pekko" %% "pekko-http" % pekkoHttpV diff --git a/project/GitVersion.scala b/project/GitVersion.scala index 621222d82..cec06d255 100644 --- a/project/GitVersion.scala +++ b/project/GitVersion.scala @@ -1,7 +1,7 @@ -import sbt._ -import sbt.Keys._ +import sbt.* +import sbt.Keys.* import sbtrelease.Version -import com.github.sbt.git.SbtGit._ +import com.github.sbt.git.SbtGit.* object GitVersion { @@ -9,18 +9,18 @@ object GitVersion { private val baseVersion = "v1.8.x" // 0.1.x - private val versionBranch = """v?([0-9\.]+)(?:\.x)?""".r + private val versionBranch = """v?([0-9.]+)(?:\.x)?""".r // v0.1.47-31-g230560c // v0.1.47-20150807.161518-9 - private val snapshotVersion = """v?([0-9\.]+)-(?:\d+)-(?:[0-9a-z]+)""".r + private val snapshotVersion = """v?([0-9.]+)-\d+-[0-9a-z]+""".r // 1.5.0-rc.1-123-gcbfe51a - private val candidateVersion = """v?([0-9\.]+)(?:-rc\.\d+)?-(?:\d+)-(?:[0-9a-z]+)""".r + private val candidateVersion = """v?([0-9.]+)(?:-rc\.\d+)?-\d+-[0-9a-z]+""".r // v0.1.47 // 1.5.0-rc.1 - private val releaseVersion = """v?([0-9\.]+(?:-rc\.\d+)?)""".r + private val releaseVersion = """v?([0-9.]+(?:-rc\.\d+)?)""".r /** * Needs to check for "false", don't assume it will ever be set to "true". @@ -34,11 +34,11 @@ object GitVersion { * version to start with. */ private def toSnapshotVersion(branch: String, v: String): String = { - val v2 = Version(v).map(_.bump.string).getOrElse(v) + val v2 = Version(v).map(_.bumpNext.unapply).getOrElse(v) val suffix = "-SNAPSHOT" branch match { case versionBranch(b) if !v2.startsWith(b) => - s"${Version(s"$b.0").map(_.string).getOrElse(v2)}$suffix" + s"${Version(s"$b.0").map(_.unapply).getOrElse(v2)}$suffix" case _ => s"$v2$suffix" } @@ -53,7 +53,7 @@ object GitVersion { parts(parts.length - 1) } - lazy val settings: Seq[Def.Setting[_]] = Seq( + lazy val settings: Seq[Def.Setting[?]] = Seq( ThisBuild / version := { val branch = extractBranchName(git.gitCurrentBranch.value) val branchVersion = if (branch == "main" || branch == "master") baseVersion else branch diff --git a/project/License.scala b/project/LicenseCheck.scala similarity index 96% rename from project/License.scala rename to project/LicenseCheck.scala index 9bf44d6ea..ddc0fdaff 100644 --- a/project/License.scala +++ b/project/LicenseCheck.scala @@ -3,7 +3,7 @@ import java.io.PrintStream import java.time.ZonedDateTime import java.time.ZoneOffset import scala.io.Source -import sbt._ +import sbt.* import scala.util.Using @@ -15,8 +15,8 @@ import scala.util.Using * - supports both test and main source files * - add target to check which can fail the build */ -object License { - private val lineSeparator = System.getProperty("line.separator") +object LicenseCheck { + private val lineSeparator = java.lang.System.lineSeparator() def year: Int = ZonedDateTime.now(ZoneOffset.UTC).getYear