-
Notifications
You must be signed in to change notification settings - Fork 36
/
build.sbt
226 lines (202 loc) · 7.45 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name := "apibuilder-generator"
organization := "io.apibuilder.generator"
ThisBuild / scalaVersion := "2.13.11"
ThisBuild / javacOptions ++= Seq("-source", "17", "-target", "17")
lazy val allScalacOptions = Seq(
"-deprecation",
"-feature",
"-Xfatal-warnings",
"-unchecked",
"-Xcheckinit",
"-Xlint:adapted-args",
"-Ycache-plugin-class-loader:last-modified",
"-Ycache-macro-class-loader:last-modified",
"-Ypatmat-exhaust-depth", "100", // Fixes: Exhaustivity analysis reached max recursion depth, not all missing cases are reported.
"-Wconf:src=generated/.*:silent",
"-Wconf:src=target/.*:silent", // silence the unused imports errors generated by the Play Routes
)
lazy val resolversSettings = Seq(
resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/",
resolvers += "Flow repository" at "https://flow.jfrog.io/flow/libs-release/",
)
lazy val generated = project
.in(file("generated"))
.enablePlugins(PlayScala)
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
ws,
"org.scalacheck" %% "scalacheck" % "1.15.4" % Test
),
scalacOptions ++= allScalacOptions
)
// TODO: lib will eventually be published as a jar if it turns out
// that we need it. For now it is here mostly for reference - hoping
// we end up not needing it.
lazy val lib = project
.in(file("lib"))
.dependsOn(generated % "compile; test->test")
.settings(commonSettings: _*)
lazy val generator = project
.in(file("generator"))
.dependsOn(elmGenerator, csharpGenerator, scalaGenerator, rubyGenerator, javaGenerator, goGenerator, androidGenerator, kotlinGenerator, graphQLGenerator, javaAwsLambdaPojos, postmanGenerator, csvGenerator)
.aggregate(elmGenerator, csharpGenerator, scalaGenerator, rubyGenerator, javaGenerator, goGenerator, androidGenerator, kotlinGenerator, graphQLGenerator, javaAwsLambdaPojos, postmanGenerator, csvGenerator)
.enablePlugins(PlayScala)
.enablePlugins(JavaAgent)
.settings(commonSettings: _*)
.settings(
javaAgents += "com.datadoghq" % "dd-java-agent" % "1.8.0",
routesImport += "io.apibuilder.generator.v0.Bindables.Core._",
routesImport += "io.apibuilder.generator.v0.Bindables.Models._",
routesGenerator := InjectedRoutesGenerator,
libraryDependencies ++= Seq(
ws,
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % "test"
),
scalacOptions ++= allScalacOptions,
Test / javaOptions ++= Seq(
"--add-exports=java.base/sun.security.x509=ALL-UNNAMED",
"--add-opens=java.base/sun.security.ssl=ALL-UNNAMED"
)
)
lazy val javaAwsLambdaPojos = project
.in(file("java-aws-lambda-pojos"))
.dependsOn(lib, lib % "test->test")
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"com.amazonaws" % "aws-java-sdk-dynamodb" % "1.11.461",
"me.geso" % "tinyvalidator" % "0.9.1",
"org.projectlombok" % "lombok" % "1.18.24"
)
)
lazy val scalaGenerator = project
.in(file("scala-generator"))
.dependsOn(lib, lib % "test->test")
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"org.scalameta" %% "scalafmt-core" % "2.3.2"
)
)
lazy val csharpGenerator = project
.in(file("csharp-generator"))
.dependsOn(lib, lib % "test->test")
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.10.0"
)
)
lazy val elmGenerator = project
.in(file("elm-generator"))
.dependsOn(lib, lib % "test->test")
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % "2.10.0"
)
)
lazy val rubyGenerator = project
.in(file("ruby-generator"))
.dependsOn(lib, lib % "test->test")
.settings(commonSettings: _*)
lazy val javaGenerator = project
.in(file("java-generator"))
.dependsOn(lib, lib % "test->test")
.settings(commonSettings: _*)
lazy val goGenerator = project
.in(file("go-generator"))
.dependsOn(lib, lib % "test->test")
.settings(commonSettings: _*)
lazy val androidGenerator = project
.in(file("android-generator"))
.dependsOn(lib, lib % "test->test")
.settings(
commonSettings: _*
)
lazy val graphQLGenerator = project
.in(file("graphql-generator"))
.dependsOn(lib, lib % "test->test")
.settings(commonSettings: _*)
.settings(resolversSettings)
.settings(
libraryDependencies ++= Seq(
"io.apibuilder" %% "apibuilder-graphql" % "0.0.10",
),
)
val kotlinLangVersion = "1.3.72"
val mockitoVersion = "4.5.1"
val scalatestVersion = "3.2.12"
lazy val kotlinGenerator = project
.in(file("kotlin-generator"))
.dependsOn(lib, lib % "test->test")
.settings(
Test / fork := true,
Test / baseDirectory := file("."),
libraryDependencies ++= Seq(
"com.fasterxml.jackson.module" % "jackson-module-kotlin" % "2.9.9",
"com.fasterxml.jackson.core" % "jackson-annotations" % "2.9.9",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.9.9",
"com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.9.9",
"org.threeten" % "threetenbp" % "1.3.8",
"com.squareup" % "kotlinpoet" % "1.3.0",
"com.squareup.retrofit2" % "retrofit" % "2.5.0",
"com.jakewharton.retrofit" % "retrofit2-rxjava2-adapter" % "1.0.0",
"org.jetbrains.kotlin" % "kotlin-stdlib" % kotlinLangVersion % "test",
"org.jetbrains.kotlin" % "kotlin-stdlib-jdk8" % kotlinLangVersion % "test",
"org.jetbrains.kotlin" % "kotlin-reflect" % kotlinLangVersion % "test",
"org.jetbrains.kotlin" % "kotlin-compiler" % kotlinLangVersion % "test",
"io.github.sullis" % "kotlin-compiler-util" % "0.0.2" % "test",
"org.scalatest" %% "scalatest" % scalatestVersion % "test",
"org.mockito" % "mockito-core" % mockitoVersion % "test"
)
)
lazy val csvGenerator = project
.in(file("csv-generator"))
.dependsOn(lib, lib % "test->test")
.settings(
Test / fork := true,
Test / baseDirectory := file("."),
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-csv" % "1.7"
)
)
lazy val postmanGenerator = project
.in(file("postman-generator"))
.dependsOn(lib, lib % "test->test")
.settings(commonSettings: _*)
.settings(
libraryDependencies ++= Seq(
"com.lihaoyi" %% "ammonite-ops" % "2.0.4",
)
)
lazy val commonSettings: Seq[Setting[_]] = Seq(
name ~= ("apibuilder-generator-" + _),
organization := "io.apibuilder",
testOptions += Tests.Argument("-oF"),
libraryDependencies ++= Seq(
guice,
"com.google.inject" % "guice" % "5.1.0",
"com.google.inject.extensions" % "guice-assistedinject" % "5.1.0",
"org.atteo" % "evo-inflector" % "1.2.2",
"com.squareup.retrofit2" % "retrofit" % "2.5.0",
"io.reactivex.rxjava2" % "rxjava" % "2.2.4",
"org.typelevel" %% "cats-core" % "2.10.0",
"org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalatestplus" %% "scalacheck-1-15" % "3.2.7.0" % Test,
"org.mockito" % "mockito-core" % mockitoVersion % Test,
"com.github.javaparser" % "javaparser-core" % "3.24.2" % Test,
"org.scalameta" %% "scalameta" % "4.4.3" % Test,
"com.squareup" % "javapoet" % "1.13.0",
),
scalacOptions ++= allScalacOptions,
Test / javaOptions ++= Seq(
"--add-exports=java.base/sun.security.x509=ALL-UNNAMED",
"--add-opens=java.base/sun.security.ssl=ALL-UNNAMED"
),
Compile / doc / sources := Seq.empty,
Compile / packageDoc / publishArtifact := false,
)
version := "0.10.19"