forked from iheartradio/ficus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
150 lines (141 loc) · 5.4 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
import sbtrelease.Version
val gc = TaskKey[Unit]("gc", "runs garbage collector")
lazy val gcTask = gc := {
println("requesting garbage collection")
System gc ()
}
def Scala3 = "3.1.1"
ThisBuild / githubWorkflowBuild := Seq(
WorkflowStep.Sbt(List("mimaReportBinaryIssues"), name = Some("Report binary compatibility issues")),
WorkflowStep.Sbt(
List("clean", "test"),
name = Some("Build project"),
cond = Some(s"matrix.scala == '${Scala3}'")
),
WorkflowStep.Sbt(
List("clean", "coverage", "test"),
name = Some("Build project"),
cond = Some(s"matrix.scala != '${Scala3}'")
)
)
ThisBuild / githubWorkflowBuildPostamble ++= Seq(
// See https://github.com/scoverage/sbt-coveralls#github-actions-integration
WorkflowStep.Sbt(
List("coverageReport", "coveralls"),
name = Some("Upload coverage data to Coveralls"),
cond = Some(s"matrix.scala != '${Scala3}'"),
env = Map(
"COVERALLS_REPO_TOKEN" -> "${{ secrets.GITHUB_TOKEN }}",
"COVERALLS_FLAG_NAME" -> "Scala ${{ matrix.scala }}"
)
)
)
// This is causing problems with env variables being passed in, see
// https://github.com/sbt/sbt/issues/6468
ThisBuild / githubWorkflowUseSbtThinClient := false
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
ThisBuild / crossScalaVersions := Seq("2.10.7", "2.11.12", "2.13.6", "2.12.14", Scala3)
ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.last
// Coveralls doesn't really work with Scala 2.10.7 so we are disabling it for CI
ThisBuild / githubWorkflowScalaVersions -= "2.10.7"
lazy val root = project
.in(file("."))
.settings(
/* basic project info */
name := "ficus",
description := "A Scala-friendly wrapper companion for Typesafe config",
startYear := Some(2013),
scalacOptions ++= Seq(
"-language:implicitConversions",
"-feature",
"-deprecation",
"-unchecked",
"-encoding",
"UTF-8",
"-target:jvm-1." + {
CrossVersion
.partialVersion(scalaVersion.value)
.collect {
case (2, minor) if minor <= 10 & scalaVersion.value == "2.10.7" => "8"
case (2, minor) if minor <= 10 => "7"
}
.getOrElse("8")
}
) ++ (if (scalaVersion.value.startsWith("2.11") || scalaVersion.value.startsWith("2.10"))
Seq("-Yclosure-elim", "-Yinline")
else Seq.empty[String]),
javacOptions ++= Seq(
"-Xlint:unchecked",
"-Xlint:deprecation"
),
Compile / unmanagedSourceDirectories ++= {
(Compile / unmanagedSourceDirectories).value.map { dir =>
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13) | (3, _)) => file(dir.getPath ++ "-2.13+")
case _ => file(dir.getPath ++ "-2.13-")
}
}
},
Test / unmanagedSourceDirectories ++= {
(Test / unmanagedSourceDirectories).value.map { dir =>
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13) | (3, _)) => file(dir.getPath ++ "-2.13+")
case _ => file(dir.getPath ++ "-2.13-")
}
}
},
libraryDependencies ++= {
if (scalaBinaryVersion.value != "3") {
Seq(
"com.chuusai" %% "shapeless" % "2.3.3" % Test,
"org.scala-lang" % "scala-reflect" % scalaVersion.value % Provided,
"org.scala-lang" % "scala-compiler" % scalaVersion.value % Provided
)
} else {
Nil
}
},
libraryDependencies ++=
(if (scalaVersion.value.startsWith("2.10"))
Seq("org.specs2" %% "specs2-core" % "3.10.0" % Test, "org.specs2" %% "specs2-scalacheck" % "3.10.0" % Test)
else if (Set("2.11", "2.12", "2.13").contains(scalaBinaryVersion.value))
Seq("org.specs2" %% "specs2-core" % "4.8.3" % Test, "org.specs2" %% "specs2-scalacheck" % "4.8.3" % Test)
else
Seq("org.specs2" %% "specs2-core" % "5.0.0" % Test, "org.specs2" %% "specs2-scalacheck" % "5.0.0" % Test)) ++
Seq(
"com.typesafe" % "config" % "1.3.4"
) ++
(if (Set("2.10", "2.11", "2.12").contains(scalaBinaryVersion.value))
Seq(
compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full),
"org.typelevel" %% "macro-compat" % "1.1.1"
)
else
Seq.empty[ModuleID]),
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.bintrayRepo("iheartradio", "maven"),
Resolver.jcenterRepo
),
Test / parallelExecution := true,
/* sbt behavior */
compile / logLevel := Level.Warn,
traceLevel := 5,
offline := false,
Compile / packageBin / mappings := {
val ms = (Compile / packageBin / mappings).value
ms filter { case (_, toPath) =>
toPath != "application.conf"
}
},
Publish.settings,
releaseCrossBuild := true,
mimaPreviousArtifacts :=
Version(version.value)
.collect {
case Version(major, (minor :: bugfix :: _), _) if (scalaBinaryVersion.value != "2.10") && bugfix > 0 =>
Set(organization.value %% name.value % Seq(major, minor, bugfix - 1).mkString("."))
}
.getOrElse(Set.empty),
gcTask
)