-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.sbt
172 lines (129 loc) · 5.06 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
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
import ReleaseTransformations._
name := "exist-xqts-runner"
organization := "org.exist-db"
scalaVersion := "2.13.8"
semanticdbEnabled := true
semanticdbVersion := scalafixSemanticdb.revision
description := "An XQTS driver for eXist-db"
homepage := Some(url("https://github.com/exist-db/exist-xqts-runner"))
startYear := Some(2018)
organizationName := "The eXist Project"
organizationHomepage := Some(url("https://www.exist-db.org"))
licenses := Seq("LGPL-3.0" -> url("http://opensource.org/licenses/lgpl-3.0"))
headerLicense := Some(HeaderLicense.LGPLv3(startYear.value.map(_.toString).get, organizationName.value))
scmInfo := Some(ScmInfo(
url(homepage.value.map(_.toString).get),
"scm:git@github.com:exist-db/exist-xqts-runner.git",
"scm:git@github.com:exist-db/exist-xqts-runner.git"
))
developers := List(
Developer(
id = "adamretter",
name = "Adam Retter",
email = "adam@evolvedbinary.com",
url = url("https://www.evolvedbinary.com")
)
)
versionScheme := Some("semver-spec")
libraryDependencies ++= {
val existV = "6.1.0"
Seq(
"com.typesafe.akka" %% "akka-actor" % "2.6.20",
"com.github.scopt" %% "scopt" % "4.0.1",
"org.typelevel" %% "cats-effect" % "3.4.5",
//"com.fasterxml" % "aalto-xml" % "1.1.0-SNAPSHOT",
"org.exist-db.thirdparty.com.fasterxml" % "aalto-xml" % "1.1.0-20180330",
"org.parboiled" %% "parboiled" % "2.4.1",
"org.clapper" %% "grizzled-slf4j" % "1.3.4" exclude("org.slf4j", "slf4j-api"),
"org.apache.ant" % "ant-junit" % "1.10.13", // used for formatting junit style report
"net.sf.saxon" % "Saxon-HE" % "9.9.1-8",
"org.exist-db" % "exist-core" % existV,
"org.xmlunit" % "xmlunit-core" % "2.9.1",
"org.slf4j" % "slf4j-api" % "2.0.6" % "runtime",
"org.apache.logging.log4j" % "log4j-slf4j2-impl" % "2.19.0" % "runtime"
)
}
// we prefer Saxon over Xalan
excludeDependencies ++= Seq(
ExclusionRule("xalan", "xalan"),
ExclusionRule("org.hamcrest", "hamcrest-core"),
ExclusionRule("org.hamcrest", "hamcrest-library")
)
resolvers ++= Seq(
Resolver.mavenLocal,
"eXist-db Releases" at "https://repo.evolvedbinary.com/repository/exist-db/",
"eXist-db Snapshots" at "https://repo.evolvedbinary.com/repository/exist-db-snapshots/",
"eXist-db Maven Repo" at "https://raw.github.com/eXist-db/mvn-repo/master/"
)
scalacOptions ++= Seq("-encoding", "utf-8", "-deprecation", "-feature", "-Ywarn-unused")
// Fancy up the Assembly JAR
Compile / packageBin / packageOptions += {
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.jar.Manifest
import scala.sys.process._
val gitCommit = "git rev-parse HEAD".!!.trim
val gitTag = s"git name-rev --tags --name-only $gitCommit".!!.trim
val additional = Map(
"Build-Timestamp" -> new SimpleDateFormat("yyyyMMddHHmmss").format(Calendar.getInstance.getTime),
"Built-By" -> sys.props("user.name"),
"Build-Tag" -> gitTag,
"Source-Repository" -> "scm:git:https://github.com/exist-db/exist-xqts-runner.git",
"Git-Commit-Abbrev" -> gitCommit.substring(0, 7),
"Git-Commit" -> gitCommit,
"Build-Jdk" -> sys.props("java.runtime.version"),
"Description" -> "An XQTS driver for eXist-db",
"Build-Version" -> "N/A",
"License" -> "GNU Lesser General Public License, version 3"
)
val manifest = new Manifest
val attributes = manifest.getMainAttributes
for((k, v) <- additional)
attributes.putValue(k, v)
Package.JarManifest(manifest)
}
// assembly merge strategy for duplicate files from dependencies
assembly / assemblyMergeStrategy := {
case PathList("org", "exist", "xquery", "lib", "xqsuite", "xqsuite.xql") => MergeStrategy.first
case x if x.equals("module-info.class") || x.endsWith(s"${java.io.File.separatorChar}module-info.class") => MergeStrategy.discard
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}
// make the assembly executable with basic shell scripts
import sbtassembly.AssemblyPlugin.defaultUniversalScript
assemblyPrependShellScript := Some(defaultUniversalScript(shebang = false))
// Add assembly to publish step
Compile / assembly / artifact := {
val art = (Compile / assembly / artifact).value
art.withClassifier(Some("assembly"))
}
addArtifact(Compile / assembly / artifact, assembly)
// Publish to Maven Repo
publishMavenStyle := true
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
publishTo := {
val eb = "https://repo.evolvedbinary.com/"
if (isSnapshot.value)
Some("snapshots" at eb + "repository/exist-db-snapshots/")
else
Some(Opts.resolver.sonatypeStaging)
}
Test / publishArtifact := false
releaseCrossBuild := false
releaseVersionBump := sbtrelease.Version.Bump.Minor
releaseTagName := s"${if (releaseUseGlobalVersion.value) (ThisBuild / version).value else version.value}"
releaseIgnoreUntrackedFiles := true
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommand("publishSigned"),
setNextVersion,
commitNextVersion,
pushChanges
)