-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
117 lines (109 loc) · 4.32 KB
/
build.sbt
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
showCurrentGitBranch
inThisBuild(Seq(
organization := "org.hathitrust.htrc",
organizationName := "HathiTrust Research Center",
organizationHomepage := Some(url("https://www.hathitrust.org/htrc")),
scalaVersion := "2.13.14",
scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-language:postfixOps",
"-language:implicitConversions"
),
resolvers ++= Seq(
Resolver.mavenLocal,
"HTRC Nexus Repository" at "https://nexus.htrc.illinois.edu/repository/maven-public"
),
externalResolvers := Resolver.combineDefaultResolvers(resolvers.value.toVector, mavenCentral = false),
Compile / packageBin / packageOptions += Package.ManifestAttributes(
("Git-Sha", git.gitHeadCommit.value.getOrElse("N/A")),
("Git-Branch", git.gitCurrentBranch.value),
("Git-Version", git.gitDescribedVersion.value.getOrElse("N/A")),
("Git-Dirty", git.gitUncommittedChanges.value.toString),
("Build-Date", new java.util.Date().toString)
),
versionScheme := Some("semver-spec"),
credentials += Credentials(
"Sonatype Nexus Repository Manager", // realm
"nexus.htrc.illinois.edu", // host
"drhtrc", // user
sys.env.getOrElse("HTRC_NEXUS_DRHTRC_PWD", "abc123") // password
)
))
lazy val ammoniteSettings = Seq(
libraryDependencies +=
{
val version = scalaBinaryVersion.value match {
case "2.10" => "1.0.3"
case "2.11" => "1.6.7"
case _ ⇒ "3.0.0-M1-19-a7973e17"
}
"com.lihaoyi" % "ammonite" % version % Test cross CrossVersion.full
},
Test / sourceGenerators += Def.task {
val file = (Test / sourceManaged).value / "amm.scala"
IO.write(file, """object amm extends App { ammonite.AmmoniteMain.main(args) }""")
Seq(file)
}.taskValue,
connectInput := true,
outputStrategy := Some(StdoutOutput)
)
lazy val buildInfoSettings = Seq(
buildInfoOptions ++= Seq(BuildInfoOption.BuildTime),
buildInfoPackage := "utils",
buildInfoKeys ++= Seq[BuildInfoKey](
"gitSha" -> git.gitHeadCommit.value.getOrElse("N/A"),
"gitBranch" -> git.gitCurrentBranch.value,
"gitVersion" -> git.gitDescribedVersion.value.getOrElse("N/A"),
"gitDirty" -> git.gitUncommittedChanges.value,
"nameWithVersion" -> s"${name.value} ${version.value}"
)
)
lazy val dockerSettings = Seq(
Docker / maintainer := "Boris Capitanu <[email protected]>",
dockerBaseImage := "eclipse-temurin:21-jre",
dockerExposedPorts := Seq(9000),
dockerRepository := Some("docker.htrc.illinois.edu"),
dockerUpdateLatest := true,
Universal / javaOptions ++= Seq(
"-J-Xmx8G",
"-J-Xss1M",
// don't write any pid files
"-Dpidfile.path=/dev/null",
// reference a logback config file that has no file appenders
"-Dlogback.configurationFile=conf/logback-prod.xml",
// https://www.playframework.com/documentation/2.8.x/SettingsLogger#Using-an-external-configuration-file
"-Dlogger.file=conf/logback-prod.xml"
)
)
lazy val swaggerSettings = Seq(
swaggerPlayConfiguration := Some(Map(
"api.version" -> version.value,
"swagger.api.basepath" -> "/ef-api",
"swagger.api.info.contact" -> "[email protected]",
"swagger.api.info.title" -> "EF API",
"swagger.api.info.description" -> "This is the Extracted Features Web API",
"swagger.api.info.license" -> "Apache License 2.0",
"swagger.api.info.licenseUrl" -> "https://www.apache.org/licenses/LICENSE-2.0"
))
)
lazy val `torchlite-ef-api` = (project in file("."))
.enablePlugins(PlayScala, BuildInfoPlugin, GitVersioning, GitBranchPrompt, JavaAppPackaging, DockerPlugin)
.settings(buildInfoSettings)
.settings(ammoniteSettings)
.settings(dockerSettings)
.settings(swaggerSettings)
.settings(
name := "HTRC-Torchlite-EFAPI",
libraryDependencies ++= Seq(
guice,
filters,
"com.typesafe.play" %% "play-streams" % "2.9.3",
"org.reactivemongo" %% "play2-reactivemongo" % "1.1.0.play29-RC12",
"org.reactivemongo" %% "reactivemongo-akkastream" % "1.0.10",
"io.swagger" % "swagger-annotations" % "1.6.14",
"org.webjars" % "swagger-ui" % "5.17.2",
"org.scalatestplus.play" %% "scalatestplus-play" % "7.0.1" % Test
),
routesGenerator := InjectedRoutesGenerator
)