forked from foodpanda/api-first-hand
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
162 lines (144 loc) · 5.1 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
151
152
153
154
155
156
157
158
159
160
161
162
import bintray.Keys._
import sbt._
val PlayVersion = "2.5.4"
val Scala10 = "2.10.5"
val Scala11 = "2.11.8"
val ProjectVersion = "0.2.1"
val deps = new Dependencies(PlayVersion, ProjectVersion)
javacOptions ++= Seq("-source", "1.8", "-target", "1.8")
lazy val common = (project in file("common"))
.settings(commonSettings: _*)
.settings(
scalaVersion := Scala10,
name := "api-first-hand-common",
libraryDependencies ++= deps.jacksonsJava ++ deps.test
)
// This is the API project, it gets added to the runtime dependencies of any
// project using play-swagger
lazy val api = (project in file("api"))
.settings(commonSettings: _*)
.settings(
scalaVersion := Scala11,
name := "api-first-hand-api",
libraryDependencies ++= deps.api ++ deps.test
)
lazy val swaggerModel = (project in file("swagger-model"))
.settings(commonSettings: _*)
.settings(
name := "swagger-model",
scalaVersion := Scala10,
crossScalaVersions := Seq(Scala10, Scala11),
libraryDependencies ++= deps.swaggerModel ++ deps.test
)
lazy val apiFirstCore = (project in file("api-first-core"))
.settings(commonSettings: _*)
.settings(
scalaVersion := Scala10,
name := "api-first-core",
libraryDependencies ++= deps.test
)
lazy val swaggerParser = (project in file("swagger-parser"))
.settings(commonSettings: _*)
.settings(
scalaVersion := Scala10,
name := "swagger-parser",
libraryDependencies ++= deps.swaggerParser(scalaVersion.value) ++ deps.test
)
.dependsOn(swaggerModel, apiFirstCore)
lazy val playScalaGenerator = (project in file("play-scala-generator"))
.settings(commonSettings: _*)
.settings(
scalaVersion := Scala10,
name := "play-scala-generator",
libraryDependencies ++= deps.playScalaGenerator ++ deps.test
)
.dependsOn(apiFirstCore)
// This is the sbt plugin
lazy val plugin = (project in file("plugin"))
.enablePlugins(BuildInfoPlugin)
.settings(commonSettings: _*)
.settings(scriptedSettings: _*)
.settings(
libraryDependencies ++= deps.test,
name := "sbt-api-first-hand",
sbtPlugin := true,
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % PlayVersion),
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Seq(
"-Dproject.version=" + version.value,
"-Dscala.version=" + Scala11,
"-Xmx1024M",
"-XX:ReservedCodeCacheSize=256M"
)
},
scriptedDependencies := {
val ap = (publishLocal in api).value
val a = (publishLocal in swaggerModel).value
val b = (publishLocal in common).value
val c = (publishLocal in apiFirstCore).value
val d = (publishLocal in swaggerParser).value
val e = (publishLocal in playScalaGenerator).value
val f = publishLocal.value
},
scriptedBufferLog := false,
logLevel := Level.Warn,
coverageExcludedPackages := "<empty>;de\\.zalando\\.play\\.apifirst\\.sbt\\.ApiFirstCore"
)
.dependsOn(common, apiFirstCore, playScalaGenerator, swaggerParser, swaggerModel)
lazy val root = (project in file("."))
// Use sbt-doge cross building since we have different projects with different scala versions
.settings(commonSettings: _*)
.settings(
name := "api-first-hand-root",
aggregate in update := false
)
.aggregate(common, swaggerModel, api, swaggerParser, apiFirstCore, playScalaGenerator, plugin)
def commonSettings: Seq[Setting[_]] = bintrayPublishSettings ++ Seq(
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
ivyLoggingLevel := UpdateLogging.DownloadOnly,
version := ProjectVersion,
sbtPlugin := false,
buildInfoPackage := "de.zalando",
organization := "de.zalando",
fork in(Test, run) := true,
autoScalaLibrary := true,
resolvers ++= Seq(
Resolver.typesafeRepo("releases"),
Resolver.typesafeIvyRepo("releases"),
Resolver.bintrayRepo("zalando", "sbt-plugins"),
"scalaz-bintray" at "https://dl.bintray.com/scalaz/releases",
"zalando-maven" at "https://dl.bintray.com/zalando/maven",
"jeffmay" at "https://dl.bintray.com/jeffmay/maven"
),
licenses +=("MIT", url("http://opensource.org/licenses/MIT")),
publishMavenStyle := false,
repository in bintray := "sbt-plugins",
bintrayOrganization in bintray := Some("zalando"),
scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8", // yes, this is 2 args
"-feature",
"-unchecked",
"-Ywarn-numeric-widen",
"-Ywarn-value-discard",
// "-Xfatal-warnings",
// "-Xlint",
"-Yno-adapted-args",
"-Xfuture"
),
scalastyleFailOnError := false,
coverageEnabled := false,
excludeFilter in scalariformFormat := (excludeFilter in scalariformFormat).value || dontFormatTestModels
) ++ Lint.all ++ scalariformSettings
// https://github.com/sbt/sbt-scalariform#advanced-configuration for more options.
val dontFormatTestModels = new sbt.FileFilter {
def accept(f: File) = ".*/model/.*".r.pattern.matcher(f.getAbsolutePath).matches
}
coverageMinimum := 80
coverageFailOnMinimum := false
coverageHighlighting := {
if (scalaBinaryVersion.value == "2.10") false
else false
}