-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
build.sbt
180 lines (165 loc) · 8.05 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
173
174
175
176
177
178
179
180
import com.typesafe.sbt.SbtGit.GitCommand
import sbt._
import sbtassembly.AssemblyKeys.assembly
import sbtassembly.MergeStrategy
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
import scoverage.ScoverageKeys._
////////////////////////////////////////////////////////////////////////////////////////////////
// We have the following "settings" in this build.sbt:
// - versioning with sbt-release
// - custom JAR name for the root project
// - settings to publish to Sonatype
// - scaladoc settings
// - custom merge strategy for assembly
////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
// Use sbt-release to bupm the version numbers.
//
// see: http://blog.byjean.eu/2015/07/10/painless-release-with-sbt.html
////////////////////////////////////////////////////////////////////////////////////////////////
// Release settings
releaseVersionBump := sbtrelease.Version.Bump.Next
releasePublishArtifactsAction := PgpKeys.publishSigned.value
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommand("publishSigned"),
setNextVersion,
commitNextVersion,
releaseStepCommand("sonatypeReleaseAll"),
pushChanges
)
////////////////////////////////////////////////////////////////////////////////////////////////
// For the aggregate (root) jar, override the name. For the sub-projects,
// see the build.sbt in each project folder.
////////////////////////////////////////////////////////////////////////////////////////////////
assembly / assemblyJarName := "fgbio-" + version.value + ".jar"
////////////////////////////////////////////////////////////////////////////////////////////////
// Sonatype settings
////////////////////////////////////////////////////////////////////////////////////////////////
publishMavenStyle := true
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")
}
Test / publishArtifact := false
pomIncludeRepository := { _ => false }
// For Travis CI - see http://www.cakesolutions.net/teamblogs/publishing-artefacts-to-oss-sonatype-nexus-using-sbt-and-travis-ci
credentials ++= (for {
username <- Option(System.getenv().get("SONATYPE_USER"))
password <- Option(System.getenv().get("SONATYPE_PASS"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq
////////////////////////////////////////////////////////////////////////////////////////////////
// Coverage settings: don't include personal packages in coverage counts
////////////////////////////////////////////////////////////////////////////////////////////////
coverageExcludedPackages := "com.fulcrumgenomics.personal.*;com.fulcrumgenomics.internal.*"
val htmlReportsDirectory: String = "target/test-reports"
////////////////////////////////////////////////////////////////////////////////////////////////
// scaladoc options
////////////////////////////////////////////////////////////////////////////////////////////////
val docScalacOptions = Seq("-groups", "-implicits")
////////////////////////////////////////////////////////////////////////////////////////////////
// Common settings
////////////////////////////////////////////////////////////////////////////////////////////////
val primaryScalaVersion = "2.13.8"
lazy val commonSettings = Seq(
organization := "com.fulcrumgenomics",
organizationName := "Fulcrum Genomics LLC",
homepage := Some(url("http://github.com/fulcrumgenomics/fgbio")),
startYear := Some(2015),
scalaVersion := primaryScalaVersion,
crossScalaVersions := Seq(primaryScalaVersion),
scalacOptions ++= Seq("-target:jvm-1.8", "-deprecation", "-unchecked"),
Compile / doc / scalacOptions ++= docScalacOptions,
Test / doc / scalacOptions ++= docScalacOptions,
useCoursier := false,
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-h", Option(System.getenv("TEST_HTML_REPORTS")).getOrElse(htmlReportsDirectory)),
// uncomment for full stack traces
// Test / testOptions += Tests.Argument("-oDF"),
Test / fork := true,
resolvers += Resolver.sonatypeRepo("public"),
resolvers += Resolver.mavenLocal,
resolvers += "broad-snapshots" at "https://broadinstitute.jfrog.io/artifactory/libs-snapshot/",
shellPrompt := { state => "%s| %s> ".format(GitCommand.prompt.apply(state), version.value) },
updateOptions := updateOptions.value.withCachedResolution(true)
) ++ Defaults.coreDefaultSettings
////////////////////////////////////////////////////////////////////////////////////////////////
// root project
////////////////////////////////////////////////////////////////////////////////////////////////
lazy val htsjdkExcludes = Seq(
ExclusionRule(organization="org.apache.ant"),
ExclusionRule(organization="gov.nih.nlm.ncbi"),
ExclusionRule(organization="org.testng"),
ExclusionRule(organization="com.google.cloud.genomics")
)
lazy val assemblySettings = Seq(
assembly / test := {},
assembly / logLevel := Level.Info
)
lazy val root = Project(id="fgbio", base=file("."))
.settings(commonSettings: _*)
.settings(assemblySettings: _*)
.settings(description := "fgbio")
.settings(mainClass := Some("com.fulcrumgenomics.cmdline.FgBioMain"))
.settings(
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-xml" % "2.1.0",
"com.fulcrumgenomics" %% "commons" % "1.4.0",
"com.fulcrumgenomics" %% "sopt" % "1.1.0",
"com.github.samtools" % "htsjdk" % "2.24.1-26-ga38c78d-SNAPSHOT" excludeAll(htsjdkExcludes: _*),
"org.apache.commons" % "commons-math3" % "3.6.1",
"com.beachape" %% "enumeratum" % "1.7.0",
"com.intel.gkl" % "gkl" % "0.8.10",
//---------- Test libraries -------------------//
"org.scalatest" %% "scalatest" % "3.1.3" % "test->*" excludeAll ExclusionRule(organization="org.junit", name="junit")
))
.settings(dependencyOverrides ++= Seq(
"org.apache.logging.log4j" % "log4j-api" % "[2.17.0,)",
"org.apache.logging.log4j" % "log4j-core" % "[2.17.0,)",
"org.xerial.snappy" % "snappy-java" % "[1.1.8.4,)"
))
////////////////////////////////////////////////////////////////////////////////////////////////
// Merge strategy for assembly
////////////////////////////////////////////////////////////////////////////////////////////////
val customMergeStrategy: String => MergeStrategy = {
case x if Assembly.isConfigFile(x) =>
MergeStrategy.concat
case PathList(ps@_*) if Assembly.isReadme(ps.last) || Assembly.isLicenseFile(ps.last) =>
MergeStrategy.rename
case PathList("META-INF", xs@_*) =>
xs map {
_.toLowerCase
} match {
case ("manifest.mf" :: Nil) | ("index.list" :: Nil) | ("dependencies" :: Nil) =>
MergeStrategy.discard
case ps@(x :: xt) if ps.last.endsWith(".sf") || ps.last.endsWith(".dsa") =>
MergeStrategy.discard
case "plexus" :: xt =>
MergeStrategy.discard
case "spring.tooling" :: xt =>
MergeStrategy.discard
case "com.google.guava" :: xt =>
MergeStrategy.discard
case "services" :: xt =>
MergeStrategy.filterDistinctLines
case ("spring.schemas" :: Nil) | ("spring.handlers" :: Nil) =>
MergeStrategy.filterDistinctLines
case _ => MergeStrategy.deduplicate
}
case "asm-license.txt" | "overview.html" =>
MergeStrategy.discard
case "logback.xml" =>
MergeStrategy.first
case _ => MergeStrategy.deduplicate
}
assembly / assemblyMergeStrategy := customMergeStrategy