-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sbt
108 lines (95 loc) · 2.97 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
organization in ThisBuild := "io.gloriousfuture"
organizationName in ThisBuild := "The Glorious Future"
version in ThisBuild := "0.0.1"
scalaVersion in ThisBuild := "2.11.8"
crossScalaVersions in ThisBuild := Seq("2.10.6", "2.11.8")
licenses in ThisBuild += ("Apache-2.0", url("http://opensource.org/licenses/apache-2.0"))
lazy val root = Project("genspec-openapi", file("."))
.aggregate(
`genspec-openapi-core`,
`genspec-openapi-circe`,
`genspec-openapi-play`,
`genspec-openapi-yaml`
)
.settings(
publish := {},
publishLocal := {}
)
def commonProject(id: String, path: String): Project = {
Project(id, file(path)).settings(
name := id,
scalaVersion := "2.11.8",
crossScalaVersions := Seq("2.11.8"),
scalacOptions ++= {
// the deprecation:false flag is only supported by scala >= 2.11.3, but needed for scala >= 2.11.0 to avoid warnings
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, scalaMinor)) if scalaMinor >= 11 =>
// For scala versions >= 2.11.3
Seq("-deprecation:false", "-target:jvm-1.8", "-Ywarn-unused")
case Some((2, scalaMinor)) if scalaMinor < 11 =>
// For scala versions 2.10.x we can't use certain flags
Seq.empty
}) ++ Seq(
"-feature",
"-unchecked",
"-Xfatal-warnings",
"-Xfuture",
"-Ywarn-value-discard"
)
},
// Every project gets scalatest
libraryDependencies += Libraries.scalatest % Test
)
}
/**
* Generic code to allow converting models to OpenAPI specs.
*/
lazy val `genspec-openapi-core` = commonProject("genspec-openapi-core", "core")
.settings(
// Cross-compile for sbt plugin
crossScalaVersions := Seq("2.10.6", "2.11.8"),
libraryDependencies ++= Seq(
Libraries.scalacheck,
Libraries.scalacheckShapeless
)
)
/**
* Build OpenAPI specs from circe model serializers.
*/
lazy val `genspec-openapi-circe` = commonProject("genspec-openapi-circe", "circe")
.settings(
Plugins.macroParadise,
libraryDependencies ++= Seq(
Libraries.circeGeneric,
Libraries.circeOptics,
Libraries.circeParser
)
)
.dependsOn(`genspec-openapi-core`)
/**
* Print YAML for circe projects.
*/
lazy val `genspec-openapi-yaml` = commonProject("genspec-openapi-yaml", "yaml")
.settings(
resolvers ++= Seq(
Resolvers.circeYaml
),
libraryDependencies ++= Seq(
Libraries.circeYaml
) ++ Seq(
// Test-only dependencies
Libraries.scalacheckOps
).map(_ % Test)
)
.dependsOn(`genspec-openapi-core`, `genspec-openapi-circe`)
/**
* Build OpenAPI specs from Play routes, controllers, and play model serializers.
*/
lazy val `genspec-openapi-play` = commonProject("genspec-openapi-play", "play")
.settings(
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/",
libraryDependencies ++= Seq(
Libraries.playServer
)
)
.dependsOn(`genspec-openapi-core`)