From fdda91da112bbe7c8b2def6e34bbe1a49adac818 Mon Sep 17 00:00:00 2001 From: Billy Autrey <40704452+BillyAutrey@users.noreply.github.com> Date: Mon, 7 Oct 2024 12:33:06 -0500 Subject: [PATCH] Prep for sbt 2, update to slash syntax --- build.sbt | 13 +++++++++++-- .../main/scala/com/geirsson/CiReleasePlugin.scala | 6 +++--- project/plugins.sbt | 4 ++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index e4340c0..b60e4a4 100644 --- a/build.sbt +++ b/build.sbt @@ -1,3 +1,6 @@ +lazy val scala212 = "2.12.20" +lazy val scala3 = "3.3.4" + inThisBuild( List( organization := "com.github.sbt", @@ -12,7 +15,8 @@ inThisBuild( "olafurpg@gmail.com", url("https://geirsson.com") ) - ) + ), + crossScalaVersions := Seq(scala212) ) ) @@ -24,7 +28,12 @@ lazy val plugin = project .enablePlugins(SbtPlugin) .settings( moduleName := "sbt-ci-release", - pluginCrossBuild / sbtVersion := "1.0.4", + (pluginCrossBuild / sbtVersion) := { + scalaBinaryVersion.value match { + case "2.12" => "1.5.8" + case _ => "2.0.0-M2" + } + }, addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1"), addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1"), addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1"), diff --git a/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala b/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala index cc0db7b..e9386fb 100644 --- a/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala +++ b/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala @@ -130,7 +130,7 @@ object CiReleasePlugin extends AutoPlugin { ) override lazy val globalSettings: Seq[Def.Setting[_]] = List( - publishArtifact.in(Test) := false, + (Test / publishArtifact) := false, publishMavenStyle := true, commands += Command.command("ci-release") { currentState => val shouldDeployToSonatypeCentral = isDeploySetToSonatypeCentral(currentState) @@ -200,7 +200,7 @@ object CiReleasePlugin extends AutoPlugin { ) def isDeploySetToSonatypeCentral(state: State): Boolean = { - sonatypeCredentialHost.in(ThisBuild).get(Project.extract(state).structure.data) match { + (ThisBuild / sonatypeCredentialHost).get(Project.extract(state).structure.data) match { case Some(value) if value == Sonatype.sonatypeCentralHost => { true } @@ -209,7 +209,7 @@ object CiReleasePlugin extends AutoPlugin { } def isSnapshotVersion(state: State): Boolean = { - version.in(ThisBuild).get(Project.extract(state).structure.data) match { + (ThisBuild / version).get(Project.extract(state).structure.data) match { case Some(v) => v.endsWith("-SNAPSHOT") case None => throw new NoSuchFieldError("version") } diff --git a/project/plugins.sbt b/project/plugins.sbt index 254efc0..9ac4205 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,5 @@ -unmanagedSourceDirectories.in(Compile) += - baseDirectory.in(ThisBuild).value.getParentFile / +Compile / unmanagedSourceDirectories += + (ThisBuild / baseDirectory).value.getParentFile / "plugin" / "src" / "main" / "scala" addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1") addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1")