-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
197 lines (184 loc) · 6.61 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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
import Merging.customMergeStrategy
import sbt.Keys._
import sbt.{ThisBuild, project}
import sbtassembly.AssemblyPlugin.autoImport._
import com.typesafe.config._
import sbtghpackages.GitHubPackagesPlugin.autoImport.githubOwner
name := "cwlScala"
def getVersion: String = {
val confPath =
Option(System.getProperty("config.file")).getOrElse("src/main/resources/application.conf")
val conf = ConfigFactory.parseFile(new File(confPath)).resolve()
conf.getString("cwlScala.version")
}
ThisBuild / organization := "com.dnanexus"
ThisBuild / scalaVersion := "2.13.7"
ThisBuild / developers := List(
Developer(
"jdidion",
"jdidion",
url("https://github.com/dnanexus")
)
)
ThisBuild / homepage := Some(url("https://github.com/dnanexus/cwlScala"))
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/dnanexus/cwlScala"),
"[email protected]:dnanexus/cwlScala"
)
)
ThisBuild / licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
lazy val root = project
.in(file("."))
.settings(
name := "cwlScala",
version := getVersion,
settings,
assemblySettings,
libraryDependencies ++= dependencies,
assembly / assemblyJarName := "cwlScala.jar"
)
lazy val dependencies = {
val dxCommonVersion = "0.11.3"
val dxYamlVersion = "0.1.1"
val typesafeVersion = "1.4.1"
val sprayVersion = "1.3.6"
val scalatestVersion = "3.2.9"
val yamlVersion = "2.3"
val jacksonDatabindVersion = "2.13.2.2"
val jacksonDataformatYamlVersion = "2.13.2"
val rhinoVersion = "1.7.13"
val antlr4Version = "4.13.1"
//val junitVersion = "4.13.2"
val dxCommon = "com.dnanexus" % "dxcommon" % dxCommonVersion
val dxYaml = "com.dnanexus" % "dxyaml" % dxYamlVersion
val typesafe = "com.typesafe" % "config" % typesafeVersion
val spray = "io.spray" %% "spray-json" % sprayVersion
// cwljava dependencies
val snakeyaml = "org.snakeyaml" % "snakeyaml-engine" % yamlVersion
val jacksonDatabind = "com.fasterxml.jackson.core" % "jackson-databind" % jacksonDatabindVersion
val jacksonDataformatYaml = "com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % jacksonDataformatYamlVersion
// rhino dependencies
val rhino = "org.mozilla" % "rhino" % rhinoVersion
// antlr4 dependencies
val antlr = "org.antlr" % "antlr4" % antlr4Version
//---------- Test libraries -------------------//
//val junit = "junit" % "junit" % junitVersion % Test
val scalatest = "org.scalatest" % "scalatest_2.13" % scalatestVersion % Test
Seq(
dxCommon,
dxYaml,
typesafe,
spray,
rhino,
antlr,
scalatest,
snakeyaml,
jacksonDatabind,
jacksonDataformatYaml
)
}
val githubDxScalaResolver = Resolver.githubPackages("dnanexus", "dxScala")
val githubCwlScalaResolver = Resolver.githubPackages("dnanexus", "cwlScala")
resolvers ++= Vector(githubCwlScalaResolver, githubDxScalaResolver)
val releaseTarget = Option(System.getProperty("releaseTarget")).getOrElse("github")
lazy val settings = Seq(
scalacOptions ++= compilerOptions,
Compile / unmanagedSourceDirectories += baseDirectory.value / "cwljava" / "src" / "main" / "java",
Compile / compile / javacOptions ++= Seq("-Xlint:deprecation",
"-source",
"1.8",
"-target",
"1.8"),
Compile / doc / scalacOptions ++= Seq("-no-java-comments", "-no-link-warnings"),
Compile / doc / sources := Seq((Compile / scalaSource).value),
// reduce the maximum number of errors shown by the Scala compiler
maxErrors := 20,
// disable publish with scala version, otherwise artifact name will include scala version e.g wdlTools_2.11
crossPaths := false,
publishMavenStyle := true,
// scalafmt
scalafmtConfig := file(".") / ".scalafmt.conf",
// add sonatype repository settings
// snapshot versions publish to sonatype snapshot repository
// other versions publish to sonatype staging repository
publishTo := Some(
if (isSnapshot.value || releaseTarget == "github") {
githubCwlScalaResolver
} else {
Opts.resolver.sonatypeStaging
}
),
githubOwner := "dnanexus",
githubRepository := "cwlScala",
// If an exception is thrown during tests, show the full
// stack trace, by adding the "-oF" option to the list.
//
// exclude the native tests, they are slow.
// to do this from the command line:
// sbt testOnly -- -l native
//
// comment out this line in order to allow native
// tests
// Test / testOptions += Tests.Argument("-l", "native")
Test / testOptions += Tests.Argument("-oF"),
Test / parallelExecution := false
// Coverage
//
// sbt clean coverage test
// sbt coverageReport
// To turn it off do:
// sbt coverageOff
//coverageEnabled := true
// Ignore code parts that cannot be checked in the unit
// test environment
//coverageExcludedPackages := "dxWDL.Main;dxWDL.compiler.DxNI;dxWDL.compiler.DxObjectDirectory;dxWDL.compiler.Native"
)
// Show deprecation warnings
val compilerOptions = Seq(
"-unchecked",
"-deprecation",
"-feature",
"-explaintypes",
"-encoding",
"UTF-8",
"-Xlint:constant",
"-Xlint:delayedinit-select",
"-Xlint:doc-detached",
"-Xlint:inaccessible",
"-Xlint:infer-any",
"-Xlint:nullary-unit",
"-Xlint:option-implicit",
"-Xlint:package-object-classes",
"-Xlint:poly-implicit-overload",
"-Xlint:private-shadow",
"-Xlint:stars-align",
"-Xlint:type-parameter-shadow",
"-Ywarn-dead-code",
"-Ywarn-unused:implicits",
"-Ywarn-unused:privates",
"-Ywarn-unused:locals",
"-Ywarn-unused:imports", // warns about every unused import on every command.
"-Xfatal-warnings" // makes those warnings fatal.
)
// Assembly
lazy val assemblySettings = Seq(
assembly / logLevel := Level.Info,
// comment out this line to enable tests in assembly
assembly / test := {},
assembly / assemblyMergeStrategy := {
{
case PathList("javax", "xml", _ @_*) => MergeStrategy.first
case PathList("org", "w3c", "dom", "TypeInfo.class") => MergeStrategy.first
case PathList("META-INF", xs @ _*) =>
xs map { _.toLowerCase } match {
case "manifest.mf" :: Nil | "index.list" :: Nil | "dependencies" :: Nil =>
MergeStrategy.discard
case _ => MergeStrategy.last
}
case x =>
customMergeStrategy.value(x)
}
}
)