forked from zalando/grafter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
139 lines (123 loc) · 4.47 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
lazy val grafter = (project in file(".")).
settings(
rootSettings ++
compilationSettings ++
commonSettings ++
publishSettings
).aggregate(core, macros)
lazy val core = (project in file("core")).
settings(
compilationSettings ++
testSettings ++
Seq(publishArtifact := false)
)
lazy val macros = project.in(file("macros")).
settings(
compilationSettings ++
Seq(publishArtifact := false)
).dependsOn(core)
lazy val examples = (project in file("examples")).
settings(
compilationSettings ++
testSettings ++
Seq(publishArtifact := false)
).dependsOn(core, macros)
lazy val tests = (project in file("tests")).
settings(
compilationSettings ++
testSettings ++
Seq(publishArtifact := false)
).dependsOn(core, core % "test->test", macros)
lazy val guide = (project in file("guide")).
settings(
compilationSettings ++
testSettings ++
Seq(git.remoteRepo := "[email protected]:zalando/grafter.git",
siteSourceDirectory := target.value / "specs2-reports") ++
Seq(publishArtifact := false)
).dependsOn(core, core % "test->test", macros).
enablePlugins(GhpagesPlugin)
lazy val rootSettings = Seq(
unmanagedSourceDirectories in Compile := unmanagedSourceDirectories.all(aggregateCompile).value.flatten,
unmanagedSourceDirectories in Test := unmanagedSourceDirectories.all(aggregateTest).value.flatten,
sources in Compile := sources.all(aggregateCompile).value.flatten,
sources in Test := sources.all(aggregateTest).value.flatten,
mappings in (Test, packageBin) ~= (_.filter(mappingFilter)),
libraryDependencies := libraryDependencies.all(aggregateCompile).value.flatten
)
def mappingFilter(mapping: (File, String)): Boolean =
mapping._1.getPath.contains("org/zalando/grafter/specs2")
lazy val aggregateCompile = ScopeFilter(
inProjects(core, macros),
inConfigurations(Compile))
lazy val aggregateTest = ScopeFilter(
inProjects(core, macros, tests, examples),
inConfigurations(Test))
lazy val commonSettings = Seq(
organization := "org.zalando",
name := "grafter"
)
lazy val testSettings = Seq(
fork in Test := true,
scalacOptions in Test ++= Seq("-Yrangepos"),
scalacOptions in Test -= "-Ywarn-unused",
scalacOptions in Test -= "-Xlint",
testFrameworks in Test := Seq(TestFrameworks.Specs2),
testOptions in Test += Tests.Filter(s => !s.endsWith("Specification")),
coverageEnabled := false
)
lazy val compilationSettings = Seq(
scalaVersion := "2.12.6",
crossScalaVersions := Seq("2.11.11", scalaVersion.value),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full),
scalacOptions ++= Seq(
"-unchecked",
"-feature",
"-deprecation:false",
"-Xfatal-warnings",
"-Xcheckinit",
"-Xlint",
"-Xlint:-nullary-unit",
"-Ywarn-unused-import",
"-Ywarn-numeric-widen",
"-Ywarn-dead-code",
"-Yno-adapted-args",
// to debug the macros
//"-Ymacro-debug-lite",
"-language:_",
"-target:jvm-1.8",
"-encoding", "UTF-8"
)
)
lazy val publishSettings = Seq(
publishTo := Option("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
publishMavenStyle := true,
homepage := Some(url("https://github.com/zalando/grafter")),
licenses := Seq("MIT" -> url("http://opensource.org/licenses/MIT")),
scmInfo := Some(ScmInfo(url("https://github.com/zalando/grafter"), "scm:git:[email protected]:zalando/grafter.git")),
autoAPIMappings := true,
pomExtra := (
<developers>
<developer>
<id>etorreborre</id>
<name>Eric Torreborre</name>
<url>https://github.com/etorreborre/</url>
</developer>
</developers>
),
publishArtifact in (Test, packageBin) := true,
publishArtifact in (Test, packageDoc) := true,
publishArtifact in (Test, packageSrc) := true
) ++
credentialSettings
lazy val credentialSettings = Seq(
// For Travis CI - see http://www.cakesolutions.net/teamblogs/publishing-artefacts-to-oss-sonatype-nexus-using-sbt-and-travis-ci
credentials ++= (for {
username <- Option(System.getenv().get("SONATYPE_USERNAME"))
password <- Option(System.getenv().get("SONATYPE_PASSWORD"))
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)).toSeq
)
shellPrompt in ThisBuild := { state =>
val name = Project.extract(state).currentRef.project
(if (name == "grafter") "" else name) + "> "
}