This repository has been archived by the owner on Nov 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
114 lines (108 loc) · 3.6 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
import scalariform.formatter.preferences._
import ReleaseTransformations._
val scala210 = "2.10.6"
val scala211 = "2.11.11"
val scala212 = "2.12.3"
val scalaVersions = Seq(scala211, scala212)
val coreName = "extrawarts"
val wartremoverVersion = "2.2.1"
val scalatestVersion = "3.0.4"
lazy val commonSettings = Seq(
organization := "org.danielnixon",
licenses := Seq("The Apache Software License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://github.com/danielnixon/extrawarts")),
scmInfo := Some(
ScmInfo(url("https://github.com/danielnixon/extrawarts"), "git@github.com:danielnixon/extrawarts.git")),
developers := List(
Developer("danielnixon", "Daniel Nixon", "dan.nixon@gmail.com", url("https://danielnixon.org/"))
),
coverageMinimum := 90,
coverageFailOnMinimum := true,
scalariformPreferences := scalariformPreferences.value
.setPreference(DoubleIndentConstructorArguments, true)
.setPreference(PlaceScaladocAsterisksBeneathSecondAsterisk, true)
.setPreference(DanglingCloseParenthesis, Preserve),
scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-unchecked",
"-Xfatal-warnings",
"-Ywarn-dead-code",
"-Ywarn-inaccessible",
"-Ywarn-value-discard",
"-Ywarn-numeric-widen",
"-Ywarn-nullary-override"),
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n >= 11 => Seq("-Xlint:_")
case _ => Seq("-Xlint")
}
},
scalaVersion := scala212,
sbtVersion := {
scalaBinaryVersion.value match {
case "2.10" => "0.13.16"
case _ => "1.0.2"
}
}
)
lazy val root = Project(
id = "root",
base = file("."),
aggregate = Seq(core, sbtPlug)
).settings(commonSettings ++ Seq(
publishArtifact := false,
releaseCrossBuild := true,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
releaseStepCommandAndRemaining("+test"),
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
setNextVersion,
commitNextVersion,
releaseStepCommandAndRemaining("sonatypeReleaseAll"),
pushChanges
)
): _*).enablePlugins(CrossPerProjectPlugin)
lazy val core = Project(
id = "core",
base = file("core")
).settings(commonSettings ++ Seq(
name := coreName,
crossScalaVersions := scalaVersions,
libraryDependencies ++= Seq(
"org.wartremover" %% "wartremover" % wartremoverVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
),
dependencyOverrides ++= Set(
"org.scalatest" %% "scalatest" % scalatestVersion
),
scalacOptions ++= Seq("-Ywarn-unused", "-Ywarn-unused-import")
): _*).enablePlugins(CrossPerProjectPlugin)
/**
* Workaround for https://github.com/sbt/sbt/issues/3393.
*/
def addSbtPluginHack(dependency: ModuleID): Setting[Seq[ModuleID]] =
libraryDependencies += {
val sbtV = (sbtBinaryVersion in pluginCrossBuild).value
val scalaV = (scalaBinaryVersion in update).value
Defaults.sbtPluginExtra(dependency, sbtV, scalaV)
}
lazy val sbtPlug: Project = Project(
id = "sbt-plugin",
base = file("sbt-plugin")
).enablePlugins(
BuildInfoPlugin
).disablePlugins(
ScoverageSbtPlugin
).settings(commonSettings ++ Seq(
buildInfoKeys := Seq[BuildInfoKey](version, organization, "artifactID" -> coreName),
buildInfoPackage := s"${organization.value}.$coreName",
sbtPlugin := true,
name := s"sbt-$coreName",
crossScalaVersions := Seq(scala210, scala212),
addSbtPluginHack("org.wartremover" %% "sbt-wartremover" % wartremoverVersion)
): _*).enablePlugins(CrossPerProjectPlugin)