-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathbuild.sbt
More file actions
198 lines (187 loc) · 6.36 KB
/
Copy pathbuild.sbt
File metadata and controls
198 lines (187 loc) · 6.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// General
ThisBuild / organization := "com.earldouglas"
ThisBuild / scalacOptions ++=
Seq(
"-feature",
"-deprecation"
)
ThisBuild / scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) =>
Seq(
"-Xsource:3",
"-Ywarn-unused-import",
s"-P:semanticdb:sourceroot:${baseDirectory.value}"
)
case Some((3, _)) =>
Seq(
"-Wunused:imports"
)
case v =>
throw new Exception(s"Unsupported Scala version ${v}")
}
}
ThisBuild / scalaVersion := "2.12.21"
ThisBuild / crossScalaVersions := Seq("2.12.21", "3.8.4")
ThisBuild / javafmtFormatterCompatibleJavaVersion := 17
// Scalafix
ThisBuild / semanticdbEnabled := true
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision
// Testing
ThisBuild / libraryDependencies +=
("org.scalameta" %% "munit" % "1.3.5" % Test)
.exclude("org.scala-lang", "scala3_library_3")
.exclude("org.scala-lang", "scala-library")
ThisBuild / libraryDependencies += {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) =>
"org.scala-lang" % "scala-library" % scalaVersion.value % Test
case Some((3, _)) =>
"org.scala-lang" % "scala3-library_3" % scalaVersion.value % Test
case v =>
throw new Exception(s"Unsupported Scala version: ${v}")
}
}
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(s"Unparseable version: ${version.value}")
}
}
lazy val warRunner_3_0 =
project
.in(file("runners/3.0"))
.settings(
name := "war-runner",
version := warRunnerVersion("3.0").value,
Compile / compile / javacOptions += "-g:lines",
crossPaths := false, // exclude Scala suffix from artifact names
autoScalaLibrary := false, // exclude scala-library from dependencies
libraryDependencies += "com.github.jsimone" % "webapp-runner" % "7.0.91.0"
)
lazy val warRunner_3_1 =
project
.in(file("runners/3.1"))
.settings(
name := "war-runner",
version := warRunnerVersion("3.1").value,
Compile / compile / javacOptions += "-g:lines",
crossPaths := false, // exclude Scala suffix from artifact names
autoScalaLibrary := false, // exclude scala-library from dependencies
libraryDependencies += "com.heroku" % "webapp-runner" % "8.5.68.1"
)
lazy val warRunner_4_0 =
project
.in(file("runners/4.0"))
.settings(
name := "war-runner",
version := warRunnerVersion("4.0").value,
Compile / compile / javacOptions += "-g:lines",
crossPaths := false, // exclude Scala suffix from artifact names
autoScalaLibrary := false, // exclude scala-library from dependencies
libraryDependencies += "com.heroku" % "webapp-runner" % "9.0.113.0"
)
lazy val warRunner_6_0 =
project
.in(file("runners/6.0"))
.settings(
name := "war-runner",
version := warRunnerVersion("6.0").value,
Compile / compile / javacOptions += "-g:lines",
crossPaths := false, // exclude Scala suffix from artifact names
autoScalaLibrary := false, // exclude scala-library from dependencies
libraryDependencies += "com.heroku" % "webapp-runner" % "10.1.56.0"
)
lazy val warRunner_6_1 =
project
.in(file("runners/6.1"))
.settings(
name := "war-runner",
version := warRunnerVersion("6.1").value,
Compile / compile / javacOptions += "-g:lines",
crossPaths := false, // exclude Scala suffix from artifact names
autoScalaLibrary := false, // exclude scala-library from dependencies
libraryDependencies += "org.apache.tomcat.embed" % "tomcat-embed-core" % "11.0.24",
libraryDependencies += "org.apache.tomcat.embed" % "tomcat-embed-el" % "11.0.24",
libraryDependencies += "org.apache.tomcat.embed" % "tomcat-embed-jasper" % "11.0.24",
libraryDependencies += "org.apache.tomcat.embed" % "tomcat-embed-websocket" % "11.0.24"
)
lazy val sbtWar =
project
.in(file("."))
.enablePlugins(SbtPlugin)
.enablePlugins(BuildInfoPlugin)
.settings(
name := "sbt-war",
sbtPlugin := true,
pluginCrossBuild / sbtVersion := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 12)) =>
(pluginCrossBuild / sbtVersion).value
case Some((3, _)) =>
"2.0.0"
case v =>
throw new Exception(s"Unsupported Scala version ${v}")
}
},
//
// scripted-plugin
scriptedBufferLog := false,
watchSources ++= { (sourceDirectory.value ** "*").get },
scriptedLaunchOpts += "-DtemplateDirectory=" + (sourceDirectory.value / "test" / "template"),
scriptedBatchExecution := true,
scriptedParallelInstances := 8,
//
// sbt-buildinfo
buildInfoPackage := "com.earldouglas.sbt.war",
buildInfoKeys := Seq[BuildInfoKey](version)
)
.aggregate(
warRunner_3_0,
warRunner_3_1,
warRunner_4_0,
warRunner_6_0,
warRunner_6_1
)
// Publish to Sonatype, https://www.scala-sbt.org/release/docs/Using-Sonatype.html
ThisBuild / description := "Package and run WAR files with sbt"
ThisBuild / developers := List(
Developer(
id = "earldouglas",
name = "James Earl Douglas",
email = "james@earldouglas.com",
url = url("https://earldouglas.com/")
)
)
ThisBuild / homepage := Some(
url("https://github.com/earldouglas/sbt-war")
)
ThisBuild / licenses := List(
"BSD New" -> url("https://opensource.org/licenses/BSD-3-Clause")
)
ThisBuild / organizationHomepage := Some(
url("https://earldouglas.com/")
)
ThisBuild / organizationName := "James Earl Douglas"
ThisBuild / pomIncludeRepository := { _ => false }
ThisBuild / publishMavenStyle := true
ThisBuild / sbtPluginPublishLegacyMavenStyle := false
ThisBuild / publishTo := {
val centralSnapshots =
"https://central.sonatype.com/repository/maven-snapshots/"
if (isSnapshot.value) Some("central-snapshots" at centralSnapshots)
else localStaging.value
}
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/earldouglas/sbt-war"),
"scm:git@github.com:earldouglas/sbt-war.git"
)
)
ThisBuild / versionScheme := Some("semver-spec")