Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 2.6.4 #328

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Scala Steward: Reformat with scalafmt 2.6.4
4580deb2f74c86fdde68ec483e413af4e2ddc7ff
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "2.6.2"
version = "2.6.4"
project.git = true
34 changes: 22 additions & 12 deletions plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import java.nio.charset.StandardCharsets
import java.util.Base64
import sbt.Def
import sbt.Keys.*
import sbt.{ given, * }
import sbt.{given, *}
import sbt.plugins.JvmPlugin
import sbtdynver.DynVerPlugin
import sbtdynver.DynVerPlugin.autoImport.*

import scala.deprecated
import scala.sys.process.{ given, * }
import scala.sys.process.{given, *}
import scala.util.control.NonFatal
import xerial.sbt.Sonatype
import xerial.sbt.Sonatype.autoImport.*
Expand Down Expand Up @@ -143,14 +143,15 @@ object CiReleasePlugin extends AutoPlugin {
case None => backPubVersionToCommand(v)
}
},
version ~= dropBackPubCommand,
version ~= dropBackPubCommand
)

override lazy val globalSettings: Seq[Def.Setting[_]] = List(
(Test / publishArtifact) := false,
publishMavenStyle := true,
commands += Command.command("ci-release") { currentState =>
val shouldDeployToSonatypeCentral = isDeploySetToSonatypeCentral(currentState)
val shouldDeployToSonatypeCentral =
isDeploySetToSonatypeCentral(currentState)
val version = getVersion(currentState)
val isSnapshot = isSnapshotVersion(version)
if (!isSecure) {
Expand All @@ -170,17 +171,22 @@ object CiReleasePlugin extends AutoPlugin {

if (shouldDeployToSonatypeCentral) {
if (isSnapshot) {
println(s"Sonatype Central does not accept snapshots, only official releases. Aborting release.")
println(
s"Sonatype Central does not accept snapshots, only official releases. Aborting release."
)
currentState
} else if (!isTag) {
println(s"No tag published. Cannot publish an official release without a tag and Sonatype Central does not accept snapshot releases. Aborting release.")
println(
s"No tag published. Cannot publish an official release without a tag and Sonatype Central does not accept snapshot releases. Aborting release."
)
currentState
} else {
println("Tag push detected, publishing a stable release")
reloadKeyFiles ::
sys.env.getOrElse("CI_CLEAN", "; clean ; sonatypeBundleClean") ::
publishCommand ::
sys.env.getOrElse("CI_SONATYPE_RELEASE", "sonatypeCentralRelease") ::
sys.env
.getOrElse("CI_SONATYPE_RELEASE", "sonatypeCentralRelease") ::
currentState
}
} else {
Expand All @@ -203,7 +209,8 @@ object CiReleasePlugin extends AutoPlugin {
reloadKeyFiles ::
sys.env.getOrElse("CI_CLEAN", "; clean ; sonatypeBundleClean") ::
publishCommand ::
sys.env.getOrElse("CI_SONATYPE_RELEASE", "sonatypeBundleRelease") ::
sys.env
.getOrElse("CI_SONATYPE_RELEASE", "sonatypeBundleRelease") ::
currentState
}
}
Expand All @@ -220,7 +227,9 @@ object CiReleasePlugin extends AutoPlugin {
)

def isDeploySetToSonatypeCentral(state: State): Boolean = {
(ThisBuild / sonatypeCredentialHost).get(Project.extract(state).structure.data) match {
(ThisBuild / sonatypeCredentialHost).get(
Project.extract(state).structure.data
) match {
case Some(value) if value == Sonatype.sonatypeCentralHost => {
true
}
Expand All @@ -235,7 +244,9 @@ object CiReleasePlugin extends AutoPlugin {
}

def getPublishCommand(state: State): String =
(ThisBuild / cireleasePublishCommand).get(Project.extract(state).structure.data) match {
(ThisBuild / cireleasePublishCommand).get(
Project.extract(state).structure.data
) match {
case Some(v) => v
case None => throw new NoSuchFieldError("cireleasePublishCommand")
}
Expand All @@ -255,8 +266,7 @@ object CiReleasePlugin extends AutoPlugin {
if (!cmd.head.isDigit) {
nonDigit = true
cmd
}
else if (cmd.contains(".x")) s"++${cmd}"
} else if (cmd.contains(".x")) s"++${cmd}"
else s"++${cmd}!"
}
}) ::: (if (nonDigit) Nil else List("publishSigned"))
Expand Down