-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
132 lines (117 loc) · 3.65 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
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
import scoverage._
import xerial.sbt.Sonatype._
def scala213 = Def.setting(scalaVersion.value.startsWith("2.13"))
def scala3 = Def.setting(scalaVersion.value.startsWith("3."))
lazy val crossVersionSourcesSettings =
Seq(Compile, Test).map { sc =>
(sc / unmanagedSourceDirectories) ++= {
(sc / unmanagedSourceDirectories).value.flatMap { dir =>
if (dir.getPath.endsWith("scala"))
Seq(new File(dir.getPath + (if (scala213.value || scala3.value) "_2.13+" else "_2.13-")))
else
Seq.empty
}
}
}
val coverageSettings = Seq(
CoverallsKeys.coverallsTokenFile := Some("./token.txt"),
ScoverageKeys.coverageMinimumStmtTotal := 100,
ScoverageKeys.coverageFailOnMinimum := true,
ScoverageKeys.coverageHighlighting := true
)
val releaseSettings = Seq(
releaseCrossBuild := true,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges
)
)
val publishSettings = sonatypeSettings ++ Seq(
startYear := Some(2015),
homepage := Some(url("http://github.com/jozic/scalaj")),
developers := List(
Developer("jozic", "Eugene Platonov", "[email protected]", url("http://github.com/jozic"))
),
scmInfo := homepage.value.map(ScmInfo(_, "scm:git:[email protected]:jozic/scalaj.git")),
licenses := Seq("BSD-style" -> url("http://www.opensource.org/licenses/BSD-3-Clause")),
publishTo := sonatypePublishToBundle.value
)
val commonSettings = Seq(
organization := "com.daodecode",
scalaVersion := "2.13.11",
crossScalaVersions := Seq(scalaVersion.value, "2.12.18", "3.3.0"),
scalafmtConfig := Some(scalaj.base / "scalafmt-config/.scalafmt.conf")
) ++ releaseSettings ++ crossVersionSourcesSettings
val Scala212ScalacOptions = Seq(
"-Xlint",
"-unchecked",
"-deprecation",
"-Xfatal-warnings",
"-Ywarn-inaccessible",
"-Ywarn-dead-code",
"-Ywarn-adapted-args",
"-Ywarn-nullary-unit",
"-feature",
"-Ywarn-unused",
"-Ywarn-unused-import",
"-encoding", "UTF-8"
)
val Scala213ScalacOptions = Seq(
"-Xlint",
"-unchecked",
"-deprecation",
"-Xfatal-warnings",
"-Ywarn-dead-code",
"-feature",
"-Ywarn-unused",
"-encoding", "UTF-8",
"-Wconf:origin=scala.collection.compat.*:s"
)
val Scala3ScalacOptions = Seq(
"-unchecked",
"-deprecation",
"-Werror",
"-feature",
"-encoding", "UTF-8"
)
val moduleSettings = commonSettings ++ Seq(
scalacOptions := (
if (scala3.value) Scala3ScalacOptions
else if (scala213.value) Scala213ScalacOptions
else Scala212ScalacOptions
),
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.2.16" % "test"
)
) ++ publishSettings ++ coverageSettings
lazy val scalaj: Project =
project
.in(file("."))
.aggregate(`scalaj-collection`, `scalaj-google-optional`)
.settings(
publishArtifact := false,
publishTo := Some(Resolver.file("Unused transient repository", file("target/unusedrepo"))),
commonSettings
)
lazy val `scalaj-collection` = project.settings(
moduleSettings ++ Seq(
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-collection-compat" % "2.10.0"
)
)
)
lazy val `scalaj-google-optional` =
project.settings(moduleSettings).dependsOn(`scalaj-collection` % "compile->compile;test->test")
addCommandAlias("scoverage", ";clean;coverage;test;coverageReport")
addCommandAlias("checkFormatting", ";scalafmtCheck;test:scalafmtCheck")