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

Move Servlet spec in front of the version suffix #1001

Merged
merged 2 commits into from
Nov 17, 2024
Merged
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
27 changes: 23 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,23 @@ ThisBuild / scalacOptions += s"-P:semanticdb:sourceroot:${baseDirectory.value}"
ThisBuild / libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.19" % "test"
ThisBuild / Test / fork := true

def warRunnerVersion(servletSpec: String) =
Def.setting {
version.value
.split("-")
.toList match {
case v :: Nil => s"""${v}_${servletSpec}"""
case v :: t => s"""${v}_${servletSpec}-${t.mkString("-")}"""
case _ => throw new Exception("wat")
}
}

lazy val warRunner_3_0 =
project
.in(file("runners/3.0"))
.settings(
name := "war-runner",
version := version.value + "_3.0",
version := warRunnerVersion("3.0").value,
Compile / compile / javacOptions ++=
Seq(
"-source",
Expand All @@ -35,7 +46,7 @@ lazy val warRunner_3_1 =
.in(file("runners/3.1"))
.settings(
name := "war-runner",
version := version.value + "_3.1",
version := warRunnerVersion("3.1").value,
Compile / compile / javacOptions ++=
Seq(
"-source",
Expand All @@ -54,7 +65,7 @@ lazy val warRunner_4_0 =
.in(file("runners/4.0"))
.settings(
name := "war-runner",
version := version.value + "_4.0",
version := warRunnerVersion("4.0").value,
Compile / compile / javacOptions ++=
Seq(
"-source",
Expand All @@ -73,7 +84,7 @@ lazy val warRunner_6_0 =
.in(file("runners/6.0"))
.settings(
name := "war-runner",
version := version.value + "_6.0",
version := warRunnerVersion("6.0").value,
Compile / compile / javacOptions ++=
Seq(
"-source",
Expand Down Expand Up @@ -144,6 +155,14 @@ ThisBuild / publishMavenStyle := true
ThisBuild / publishTo := Some(
"releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"
)
ThisBuild / publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value) {
Some("snapshots" at nexus + "content/repositories/snapshots")
} else {
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
}
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/earldouglas/sbt-war"),
Expand Down
12 changes: 11 additions & 1 deletion src/main/scala/com/earldouglas/sbt/war/SbtWar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,18 @@ object SbtWar extends AutoPlugin {

val runnerLibrary: Initialize[ModuleID] =
Def.setting {

val warRunnerVersion: String =
s"${BuildInfo.version}_${servletSpec.value}"
BuildInfo.version
.split("-")
.toList match {
case v :: Nil =>
s"""${v}_${servletSpec.value}"""
case v :: t =>
s"""${v}_${servletSpec.value}-${t.mkString("-")}"""
case _ => throw new Exception("wat")
}

"com.earldouglas" % s"war-runner" % warRunnerVersion % War
}

Expand Down
Loading