-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
79 lines (74 loc) · 2.59 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
def scala212 = "2.12.11"
def scala210 = "2.10.7"
ThisBuild / git.baseVersion := "0.1"
ThisBuild / organization := "com.taisukeoe"
ThisBuild / description := "Define multiple sbt sub-projects which share sources, resources and jars"
ThisBuild / licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html"))
ThisBuild / scalaVersion := scala212
import SettingTransformer._
def ifScala212[T](binVersion: String)(ifTrue: T)(ifFalse: T): T =
if (binVersion == "2.12") ifTrue else ifFalse
lazy val sbtShadowyProject = (project in file("."))
.enablePlugins(SbtPlugin)
.enablePlugins(GitVersioning)
.disablePlugins(ScalafixPlugin)
.settings(
name := "sbt-shadowyproject",
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked"),
scalacOptions ++= ifScala212(scalaBinaryVersion.value)(
Seq(
// Avoid unused warnings flag here, and let them manage by my shadow/scalafix.
"-Xlint:adapted-args",
"-Xlint:nullary-unit",
"-Xlint:inaccessible",
"-Xlint:nullary-override",
"-Xlint:infer-any",
"-Xlint:missing-interpolator",
"-Xlint:doc-detached",
"-Xlint:private-shadow",
"-Xlint:type-parameter-shadow",
"-Xlint:poly-implicit-overload",
"-Xlint:option-implicit",
"-Xlint:delayedinit-select",
"-Xlint:package-object-classes",
"-Xlint:stars-align",
"-Xlint:constant"
)
)(
Seq(
"-Xlint",
"-language:existentials"
)
),
Compile / compile / scalacOptions += "-Xfatal-warnings",
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.1.0" % Test,
"org.scalacheck" %% "scalacheck" % "1.14.0" % Test
),
sbtPlugin := true,
crossScalaVersions := Seq(scala212, scala210),
sbtVersion in pluginCrossBuild :=
ifScala212(scalaBinaryVersion.value)("1.2.8")("0.13.17"),
publishMavenStyle := false,
bintrayRepository := "sbt-ShadowyProject",
bintrayOrganization in bintray := None,
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
},
scriptedBufferLog := false
)
.settings(Seq(Compile, Test).map(_ / console / scalacOptions -= "-Xlint"))
lazy val shadow = project
.shadow(sbtShadowyProject) //dog-fooding!
/*
* Since Scalafix won't work well with `-Xfatal-warnings` or Scala 2.10,
* this shadow project is nicer to run scalafix.
*/
.modify(
RemoveXFatalWarnings + ExcludeKeyNames(
Set(crossScalaVersions.key.label)
)
)
.settings(ScalafixSettings.permanent: _*)
.light