-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
109 lines (100 loc) · 3.5 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
import sbt._
import sbt.Keys._
import java.nio.file.Paths
ThisBuild / credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
"raw-labs",
sys.env.getOrElse("GITHUB_TOKEN", "")
)
lazy val commonSettings = Seq(
homepage := Some(url("https://www.raw-labs.com/")),
organization := "com.raw-labs",
organizationName := "RAW Labs SA",
organizationHomepage := Some(url("https://www.raw-labs.com/")),
// Use cached resolution of dependencies
// http://www.scala-sbt.org/0.13/docs/Cached-Resolution.html
updateOptions := updateOptions.in(Global).value.withCachedResolution(true),
resolvers += "RAW Labs GitHub Packages" at "https://maven.pkg.github.com/raw-labs/_"
)
lazy val buildSettings = Seq(
scalaVersion := "2.12.18",
javacOptions ++= Seq(
"-source",
"21",
"-target",
"21"
),
scalacOptions ++= Seq(
"-feature",
"-unchecked",
// When compiling in encrypted drives in Linux, the max size of a name is reduced to around 140
// https://unix.stackexchange.com/a/32834
"-Xmax-classfile-name",
"140",
"-deprecation",
"-Xlint:-stars-align,_",
"-Ywarn-dead-code",
"-Ywarn-macros:after", // Fix for false warning of unused implicit arguments in traits/interfaces.
"-Ypatmat-exhaust-depth",
"160"
)
)
lazy val compileSettings = Seq(
Compile / doc / sources := Seq.empty,
Compile / packageDoc / mappings := Seq(),
Compile / packageSrc / publishArtifact := true,
Compile / packageDoc / publishArtifact := false,
Compile / packageBin / packageOptions += Package.ManifestAttributes(
"Automatic-Module-Name" -> name.value.replace('-', '.')
),
// Ensure Java annotations get compiled first, so that they are accessible from Scala.
compileOrder := CompileOrder.JavaThenScala
)
lazy val testSettings = Seq(
// Ensuring tests are run in a forked JVM for isolation.
Test / fork := true,
// Disabling parallel execution of tests.
//Test / parallelExecution := false,
// Pass system properties starting with "raw." to the forked JVMs.
Test / javaOptions ++= {
import scala.collection.JavaConverters._
val props = System.getProperties
props
.stringPropertyNames()
.asScala
.filter(_.startsWith("raw."))
.map(key => s"-D$key=${props.getProperty(key)}")
.toSeq
},
// Set up heap dump options for out-of-memory errors.
Test / javaOptions ++= Seq(
"-XX:+HeapDumpOnOutOfMemoryError",
s"-XX:HeapDumpPath=${Paths.get(sys.env.getOrElse("SBT_FORK_OUTPUT_DIR", "target/test-results")).resolve("heap-dumps")}"
),
Test / publishArtifact := true
)
val isCI = sys.env.getOrElse("CI", "false").toBoolean
lazy val publishSettings = Seq(
versionScheme := Some("early-semver"),
publish / skip := false,
publishMavenStyle := true,
publishTo := Some("GitHub raw-labs Apache Maven Packages" at "https://maven.pkg.github.com/raw-labs/das-sdk-scala"),
publishConfiguration := publishConfiguration.value.withOverwrite(isCI)
)
lazy val strictBuildSettings = commonSettings ++ compileSettings ++ buildSettings ++ testSettings ++ Seq(
scalacOptions ++= Seq(
"-Xfatal-warnings"
)
)
lazy val root = (project in file("."))
.settings(
name := "das-sdk-scala",
strictBuildSettings,
publishSettings,
libraryDependencies ++= Seq(
"com.raw-labs" %% "protocol-raw" % "0.50.0" % "compile->compile;test->test",
"com.raw-labs" %% "utils-core" % "0.50.0" % "compile->compile;test->test",
"com.raw-labs" %% "protocol-das" % "0.1.4" % "compile->compile;test->test"
)
)