Skip to content

Commit

Permalink
Release 1.2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
aiyanbo committed Mar 12, 2024
1 parent 9a7aab0 commit 3022fcf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Add the following line to one of these files:

```scala

addSbtPlugin("org.jmotor.sbt" % "sbt-dependency-updates" % "1.2.8")
addSbtPlugin("org.jmotor.sbt" % "sbt-dependency-updates" % "1.2.9")

```

Expand Down
9 changes: 4 additions & 5 deletions src/main/scala/org/jmotor/sbt/artifact/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import org.apache.maven.artifact.versioning.{ArtifactVersion, DefaultArtifactVer
* Component: Description: Date: 2018/2/8
*
* @author
* AI
* AI
*/
object Versions {

private final lazy val ReleaseFlags: Set[String] = Set("prod")
private final lazy val ReleaseFlags: Set[String] = Set("prod")
private final lazy val UnReleaseFlags: Set[String] = Set("pr", "m", "beta", "rc", "alpha", "snapshot", "snap")

private[this] final lazy val jrePattern = s"jre\\d+".r.pattern
Expand Down Expand Up @@ -41,7 +41,7 @@ object Versions {
case av if isReleaseVersion(av) =>
Option(av.getQualifier).fold(av) {
case q if isJreQualifier(q) => new DefaultArtifactVersion(av.toString.replace(q, ""))
case _ => av
case _ => av
}
}
if (releases.nonEmpty) {
Expand All @@ -51,8 +51,7 @@ object Versions {
}
}

def isJreQualifier(qualifier: String): Boolean = {
def isJreQualifier(qualifier: String): Boolean =
jrePattern.matcher(qualifier).matches()
}

}
28 changes: 14 additions & 14 deletions src/main/scala/org/jmotor/sbt/service/VersionServiceImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,43 @@ import scala.util.{Failure, Success}
* Component: Description: Date: 2018/2/9
*
* @author
* AI
* AI
*/
class VersionServiceImpl(logger: Logger, scalaVersion: String, scalaBinaryVersion: String, resolvers: Seq[Resolver])
extends VersionService {
extends VersionService {

private[this] lazy val groups = getLoaderGroups(resolvers)

override def checkForUpdates(module: ModuleID): Future[ModuleStatus] = check(module)

override def checkPluginForUpdates(
module: ModuleID,
sbtBinaryVersion: String,
sbtScalaBinaryVersion: String
): Future[ModuleStatus] =
module: ModuleID,
sbtBinaryVersion: String,
sbtScalaBinaryVersion: String
): Future[ModuleStatus] =
check(module, Option(sbtBinaryVersion -> sbtScalaBinaryVersion))

private[this] def check(module: ModuleID, sbtSettings: Option[(String, String)] = None): Future[ModuleStatus] = {
val mv = new DefaultArtifactVersion(module.revision)
groups.foldLeft(Future.successful(Seq.empty[String] -> Option.empty[ModuleStatus])) { (future, group) =>
future.flatMap {
case (_, opt@Some(_)) => Future.successful(Seq.empty[String] -> opt)
case (_, opt @ Some(_)) => Future.successful(Seq.empty[String] -> opt)
case (errors, _) =>
group.getVersions(module, sbtSettings).map {
case Nil => errors -> None
case versions =>
val (max: ArtifactVersion, status: Status.Value) = getModuleStatus(mv, versions)
Seq.empty[String] -> Option(ModuleStatus(module, status, max.toString))
} recover {
case NonFatal(_: ArtifactNotFoundException) => errors -> None
case NonFatal(t: MultiException) => (errors ++ t.getMessages) -> None
case NonFatal(t) => (errors :+ t.getLocalizedMessage) -> None
case NonFatal(_: ArtifactNotFoundException) => errors -> None
case NonFatal(t: MultiException) => (errors ++ t.getMessages) -> None
case NonFatal(t) => (errors :+ t.getLocalizedMessage) -> None
}
}
} map {
case (_, Some(status)) => status
case (_, Some(status)) => status
case (errors, _) if errors.nonEmpty => ModuleStatus(module, Status.Error, errors)
case _ => ModuleStatus(module, Status.NotFound)
case _ => ModuleStatus(module, Status.NotFound)
}
}

Expand All @@ -74,7 +74,7 @@ class VersionServiceImpl(logger: Logger, scalaVersion: String, scalaBinaryVersio
} else {
mv.compareTo(latest) match {
case 0 | 1 => Status.Success
case _ => Status.Expired
case _ => Status.Expired
}
}
(latest, status)
Expand All @@ -86,7 +86,7 @@ class VersionServiceImpl(logger: Logger, scalaVersion: String, scalaBinaryVersio
case repo: MavenRepository =>
val url = repo.root
if (isRemote(url)) {
scala.util.Try(new java.net.URI(url).toURL()) match {
scala.util.Try(new java.net.URI(url).toURL) match {
case Failure(e) => logger.err(s"""Invalid URL "$url" for Maven repository: ${e.getMessage}"""); None
case Success(_) => Option(new MavenRepoMetadataLoader(url))
}
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ThisBuild / version := "1.2.9-SNAPSHOT"
ThisBuild / version := "1.2.9"

ThisBuild / versionScheme := Some("semver-spec")

0 comments on commit 3022fcf

Please sign in to comment.