-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathbuild.sbt
678 lines (645 loc) · 29 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
import Dependencies.Kalix
import com.jsuereth.sbtpgp.PgpKeys.publishSignedConfiguration
lazy val `kalix-jvm-sdk` = project
.in(file("."))
.aggregate(
devTools,
devToolsInternal,
coreSdk,
javaSdkProtobuf,
javaSdkProtobufTestKit,
javaSdkSpring,
javaSdkSpringTestKit,
springBootStarter,
springBootStarterTest,
scalaSdkProtobuf,
scalaSdkProtobufTestKit,
javaTck,
scalaTck,
codegenCore,
codegenJava,
codegenJavaCompilationTest,
codegenScala,
codegenScalaCompilationTest,
sbtPlugin)
.settings(
(publish / skip) := true,
// https://github.com/sbt/sbt/issues/3465
// Libs and plugins must share a version. The root project must use that
// version (and set the crossScalaVersions as empty list) so each sub-project
// can then decide which scalaVersion and crossScalaVersions they use.
crossScalaVersions := Nil,
scalaVersion := Dependencies.ScalaVersion)
def commonCompilerSettings: Seq[Setting[_]] =
Seq(
Compile / javacOptions ++= Seq("-encoding", "UTF-8"),
Compile / scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation"))
lazy val sharedScalacOptions =
Seq("-feature", "-unchecked")
lazy val fatalWarnings = Seq(
"-Xfatal-warnings", // discipline only in Scala 2 for now
"-Wconf:src=.*/target/.*:s",
// silence warnings from generated sources
"-Wconf:src=.*/src_managed/.*:s",
// silence warnings from deprecated protobuf fields
"-Wconf:src=.*/akka-grpc/.*:s")
lazy val scala212Options = sharedScalacOptions ++ fatalWarnings
lazy val scala213Options = scala212Options ++
Seq("-Wunused:imports,privates,locals")
// -Wconf configs will be available once https://github.com/scala/scala3/pull/20282 is merged and 3.3.4 is released
lazy val scala3Options = sharedScalacOptions ++ Seq("-Wunused:imports,privates,locals")
def disciplinedScalacSettings: Seq[Setting[_]] = {
if (sys.props.get("kalix.no-discipline").isEmpty) {
Seq(Compile / scalacOptions ++= {
if (scalaVersion.value.startsWith("3.")) scala3Options
else if (scalaVersion.value.startsWith("2.13")) scala213Options
else scala212Options
})
} else Seq.empty
}
lazy val coreSdk = project
.in(file("sdk/core"))
.enablePlugins(Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.dependsOn(devTools)
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-jvm-core-sdk",
// only packages that are to be released with scala 3 should have the _3 appended
// i.e. java sdk package names should remain without suffix
crossPaths := scalaVersion.value.startsWith("3."),
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
crossScalaVersions := Dependencies.CrossScalaVersions,
// Generate javadocs by just including non generated Java sources
Compile / doc / sources := {
val javaSourceDir = (Compile / javaSource).value.getAbsolutePath
(Compile / doc / sources).value.filter(_.getAbsolutePath.startsWith(javaSourceDir))
})
lazy val javaSdkProtobuf = project
.in(file("sdk/java-sdk-protobuf"))
.dependsOn(coreSdk)
.enablePlugins(AkkaGrpcPlugin, BuildInfoPlugin, Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-java-sdk-protobuf",
// only packages that are to be released with scala 3 should have the _3 appended
// i.e. java sdk package names should remain without suffix
crossPaths := scalaVersion.value.startsWith("3."),
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"runtimeImage" -> Kalix.RuntimeImage,
"runtimeVersion" -> Kalix.RuntimeVersion,
"protocolMajorVersion" -> Kalix.ProtocolVersionMajor,
"protocolMinorVersion" -> Kalix.ProtocolVersionMinor,
"scalaVersion" -> scalaVersion.value,
"akkaVersion" -> Dependencies.AkkaVersion),
buildInfoPackage := "kalix.javasdk",
crossScalaVersions := Dependencies.CrossScalaVersions,
// Generate javadocs by just including non generated Java sources
Compile / doc / sources := {
val javaSourceDir = (Compile / javaSource).value.getAbsolutePath
(Compile / doc / sources).value.filter(_.getAbsolutePath.startsWith(javaSourceDir))
},
// javadoc (I think java 9 onwards) refuses to compile javadocs if it can't compile the entire source path.
// but since we have java files depending on Scala files, we need to include ourselves on the classpath.
Compile / doc / dependencyClasspath := (Compile / fullClasspath).value,
Compile / doc / javacOptions ++= Seq(
"-Xdoclint:none",
"-overview",
((Compile / javaSource).value / "overview.html").getAbsolutePath,
"-notimestamp",
"-doctitle",
"Kalix Java Protobuf SDK",
"-noqualifier",
"java.lang"),
Compile / akkaGrpcGeneratedSources := Seq(AkkaGrpc.Server, AkkaGrpc.Client),
Compile / akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Scala), // FIXME should be Java, but here be dragons
// We need to generate the java files for things like entity_key.proto so that downstream libraries can use them
// without needing to generate them themselves
Compile / PB.targets += PB.gens.java -> crossTarget.value / "akka-grpc" / "main",
Test / javacOptions ++= Seq("-parameters"), // for Jackson
Test / akkaGrpcGeneratedSources := Seq(AkkaGrpc.Client),
Test / PB.protoSources ++= (Compile / PB.protoSources).value,
Test / PB.targets += PB.gens.java -> crossTarget.value / "akka-grpc" / "test")
.settings(Dependencies.javaSdk)
lazy val javaSdkProtobufTestKit = project
.in(file("sdk/java-sdk-protobuf-testkit"))
.dependsOn(javaSdkProtobuf)
.enablePlugins(AkkaGrpcPlugin, BuildInfoPlugin, Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(commonCompilerSettings)
.settings(
name := "kalix-java-sdk-protobuf-testkit",
// only packages that are to be released with scala 3 should have the _3 appended
// i.e. java sdk package names should remain without suffix
crossPaths := scalaVersion.value.startsWith("3."),
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"runtimeImage" -> Kalix.RuntimeImage,
"runtimeVersion" -> Kalix.RuntimeVersion,
"scalaVersion" -> scalaVersion.value),
buildInfoPackage := "kalix.javasdk.testkit",
crossScalaVersions := Dependencies.CrossScalaVersions,
// Generate javadocs by just including non generated Java sources
Compile / doc / sources := {
val javaSourceDir = (Compile / javaSource).value.getAbsolutePath
(Compile / doc / sources).value.filter(_.getAbsolutePath.startsWith(javaSourceDir))
},
// javadoc (I think java 9 onwards) refuses to compile javadocs if it can't compile the entire source path.
// but since we have java files depending on Scala files, we need to include ourselves on the classpath.
Compile / doc / dependencyClasspath := (Compile / fullClasspath).value,
Compile / doc / javacOptions ++= Seq(
"-Xdoclint:none",
"-overview",
((Compile / javaSource).value / "overview.html").getAbsolutePath,
"-notimestamp",
"-doctitle",
"Kalix Java Protobuf SDK Testkit",
"-noqualifier",
"java.lang"))
.settings(Dependencies.javaSdkTestKit)
lazy val javaSdkSpring = project
.in(file("sdk/java-sdk-spring"))
.dependsOn(javaSdkProtobuf % "compile->compile;test->test")
.dependsOn(devTools % IntegrationTest)
.dependsOn(javaSdkProtobufTestKit % IntegrationTest)
.enablePlugins(AkkaGrpcPlugin, BuildInfoPlugin, Publish, IntegrationTests)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-java-sdk-spring",
crossPaths := false,
Compile / javacOptions ++= Seq("--release", "17"),
Compile / scalacOptions ++= Seq("-release", "17"),
scalaVersion := Dependencies.ScalaVersion,
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"protocolMajorVersion" -> Kalix.ProtocolVersionMajor,
"protocolMinorVersion" -> Kalix.ProtocolVersionMinor,
"scalaVersion" -> scalaVersion.value,
"akkaVersion" -> Dependencies.AkkaVersion),
buildInfoPackage := "kalix.spring",
Compile / akkaGrpcGeneratedSources := Seq(AkkaGrpc.Server),
Compile / akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Scala),
Test / javacOptions ++= Seq("-parameters"), // for Jackson
IntegrationTest / javacOptions += "-parameters", // for Jackson
// Generate javadocs by just including non generated Java sources
Compile / doc / sources := {
val javaSourceDir = (Compile / javaSource).value.getAbsolutePath
(Compile / doc / sources).value.filter(_.getAbsolutePath.startsWith(javaSourceDir))
},
// javadoc (I think java 9 onwards) refuses to compile javadocs if it can't compile the entire source path.
// but since we have java files depending on Scala files, we need to include ourselves on the classpath.
Compile / doc / dependencyClasspath := (Compile / fullClasspath).value,
Compile / doc / javacOptions ++= Seq(
"-Xdoclint:none",
"-overview",
((Compile / javaSource).value / "overview.html").getAbsolutePath,
"-notimestamp",
"-doctitle",
"Kalix Java SDK for Spring",
"-noqualifier",
"java.lang"))
.settings(inConfig(IntegrationTest)(JupiterPlugin.scopedSettings): _*)
.settings(Dependencies.javaSdkSpring)
lazy val javaSdkSpringTestKit = project
.in(file("sdk/java-sdk-spring-testkit"))
.dependsOn(javaSdkSpring)
.dependsOn(javaSdkProtobufTestKit)
.enablePlugins(BuildInfoPlugin, Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-java-sdk-spring-testkit",
crossPaths := false,
Compile / javacOptions ++= Seq("--release", "17"),
Compile / scalacOptions ++= Seq("-release", "17"),
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"runtimeImage" -> Kalix.RuntimeImage,
"runtimeVersion" -> Kalix.RuntimeVersion,
"scalaVersion" -> scalaVersion.value),
buildInfoPackage := "kalix.spring.testkit",
// Generate javadocs by just including non generated Java sources
Compile / doc / sources := {
val javaSourceDir = (Compile / javaSource).value.getAbsolutePath
(Compile / doc / sources).value.filter(_.getAbsolutePath.startsWith(javaSourceDir))
},
// javadoc (I think java 9 onwards) refuses to compile javadocs if it can't compile the entire source path.
// but since we have java files depending on Scala files, we need to include ourselves on the classpath.
Compile / doc / dependencyClasspath := (Compile / fullClasspath).value,
Compile / doc / javacOptions ++= Seq(
"-Xdoclint:none",
"-overview",
((Compile / javaSource).value / "overview.html").getAbsolutePath,
"-notimestamp",
"-doctitle",
"Kalix Java SDK Testkit for Spring",
"-noqualifier",
"java.lang"))
.settings(Dependencies.javaSdkSpringTestKit)
lazy val springBootStarter = project
.in(file("sdk/spring-boot-starter"))
.dependsOn(javaSdkSpring)
.enablePlugins(BuildInfoPlugin, Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-spring-boot-starter",
crossPaths := false,
Compile / javacOptions ++= Seq("--release", "17"),
Compile / scalacOptions ++= Seq("-release", "17"),
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"protocolMajorVersion" -> Kalix.ProtocolVersionMajor,
"protocolMinorVersion" -> Kalix.ProtocolVersionMinor,
"scalaVersion" -> scalaVersion.value),
buildInfoPackage := "kalix.spring.boot",
// Generate javadocs by just including non generated Java sources
Compile / doc / sources := {
val javaSourceDir = (Compile / javaSource).value.getAbsolutePath
(Compile / doc / sources).value.filter(_.getAbsolutePath.startsWith(javaSourceDir))
},
// javadoc (I think java 9 onwards) refuses to compile javadocs if it can't compile the entire source path.
// but since we have java files depending on Scala files, we need to include ourselves on the classpath.
Compile / doc / dependencyClasspath := (Compile / fullClasspath).value,
Compile / doc / javacOptions ++= Seq(
"-Xdoclint:none",
"-overview",
((Compile / javaSource).value / "overview.html").getAbsolutePath,
"-notimestamp",
"-doctitle",
"Kalix Spring Boot Starter",
"-noqualifier",
"java.lang"))
lazy val springBootStarterTest = project
.in(file("sdk/spring-boot-starter-test"))
.dependsOn(javaSdkSpring)
.dependsOn(javaSdkSpringTestKit)
.enablePlugins(BuildInfoPlugin, Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-spring-boot-starter-test",
crossPaths := false,
Compile / javacOptions ++= Seq("--release", "17"),
Compile / scalacOptions ++= Seq("-release", "17"),
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"runtimeImage" -> Kalix.RuntimeImage,
"runtimeVersion" -> Kalix.RuntimeVersion,
"scalaVersion" -> scalaVersion.value),
buildInfoPackage := "kalix.spring.boot.test",
// Generate javadocs by just including non generated Java sources
Compile / doc / sources := {
val javaSourceDir = (Compile / javaSource).value.getAbsolutePath
(Compile / doc / sources).value.filter(_.getAbsolutePath.startsWith(javaSourceDir))
},
// javadoc (I think java 9 onwards) refuses to compile javadocs if it can't compile the entire source path.
// but since we have java files depending on Scala files, we need to include ourselves on the classpath.
Compile / doc / dependencyClasspath := (Compile / fullClasspath).value,
Compile / doc / javacOptions ++= Seq(
"-Xdoclint:none",
"-overview",
((Compile / javaSource).value / "overview.html").getAbsolutePath,
"-notimestamp",
"-doctitle",
"Kalix Spring Boot Starter Test",
"-noqualifier",
"java.lang"))
lazy val scalaSdkProtobuf = project
.in(file("sdk/scala-sdk-protobuf"))
.dependsOn(javaSdkProtobuf)
.enablePlugins(AkkaGrpcPlugin, BuildInfoPlugin, Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-scala-sdk-protobuf",
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
buildInfoObject := "ScalaSdkBuildInfo",
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"protocolMajorVersion" -> Kalix.ProtocolVersionMajor,
"protocolMinorVersion" -> Kalix.ProtocolVersionMinor,
"scalaVersion" -> scalaVersion.value,
"akkaVersion" -> Dependencies.AkkaVersion),
crossScalaVersions := Dependencies.CrossScalaVersions,
buildInfoPackage := "kalix.scalasdk",
Compile / akkaGrpcGeneratedSources := Seq(AkkaGrpc.Server),
Compile / akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Scala),
Test / javacOptions += "-parameters", // for Jackson
inTask(doc)(
Seq(
Compile / scalacOptions ++= scaladocOptions(
"Kalix Scala Protobuf SDK",
version.value,
(ThisBuild / baseDirectory).value))))
.settings(Dependencies.scalaSdk)
lazy val scalaSdkProtobufTestKit = project
.in(file("sdk/scala-sdk-protobuf-testkit"))
.dependsOn(scalaSdkProtobuf)
.dependsOn(javaSdkProtobufTestKit)
.enablePlugins(BuildInfoPlugin, Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-scala-sdk-protobuf-testkit",
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"protocolMajorVersion" -> Kalix.ProtocolVersionMajor,
"protocolMinorVersion" -> Kalix.ProtocolVersionMinor,
"scalaVersion" -> scalaVersion.value),
crossScalaVersions := Dependencies.CrossScalaVersions,
buildInfoPackage := "kalix.scalasdk.testkit",
inTask(doc)(
Seq(
Compile / scalacOptions ++= scaladocOptions(
"Kalix Scala Protobuf SDK TestKit",
version.value,
(ThisBuild / baseDirectory).value))))
.settings(Dependencies.scalaSdkTestKit)
def scaladocOptions(title: String, ver: String, base: File): List[String] = {
val urlString = githubUrl(ver) + "/€{FILE_PATH_EXT}#L€{FILE_LINE}"
List(
"-implicits",
"-groups",
"-doc-source-url",
urlString,
"-sourcepath",
base.getAbsolutePath,
"-doc-title",
title,
"-doc-version",
ver)
}
def githubUrl(v: String): String = {
val branch = if (v.endsWith("SNAPSHOT")) "main" else "v" + v
"https://github.com/lightbend/kalix-jvm-sdk/tree/" + branch
}
lazy val devTools = devToolsCommon(
project
.in(file("devtools"))
.settings(
name := "kalix-devtools",
scalaVersion := Dependencies.ScalaVersion,
crossScalaVersions := Dependencies.CrossScalaVersions))
/*
This variant devTools compiles with Scala 2.12, but uses the same source files as the 2.13 version (above).
This is needed because the devTools artifact is also used by the sbt and mvn plugins and therefore needs a 2.12 version.
Note that crossbuilding is not an option, because when the built selects 2.13, it will try to build sbt-kalix with 2.13
*/
lazy val devToolsInternal =
devToolsCommon(
project
.in(file("devtools"))
.settings(
name := "kalix-devtools-internal",
scalaVersion := Dependencies.ScalaVersionForTooling,
// to avoid overwriting the 2.13 version
target := baseDirectory.value / "target-2.12"))
/*
Common configuration to be applied to devTools modules (both 2.12 and 2.13)
We need to have this 'split' module because compilation of sbt plugins don't play nice with cross-compiled modules.
Instead, it's easier to have a separate module for each Scala version, but share the same source files.
*/
def devToolsCommon(project: Project): Project =
project
.enablePlugins(BuildInfoPlugin, Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(commonCompilerSettings)
// TODO: need fix in KalixPlugin
// .settings(disciplinedScalacSettings)
.settings(
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"runtimeImage" -> Kalix.RuntimeImage,
"runtimeVersion" -> Kalix.RuntimeVersion),
buildInfoPackage := "kalix.devtools",
// Generate javadocs by just including non generated Java sources
Compile / doc / sources := {
val javaSourceDir = (Compile / javaSource).value.getAbsolutePath
(Compile / doc / sources).value.filter(_.getAbsolutePath.startsWith(javaSourceDir))
},
// javadoc (I think java 9 onwards) refuses to compile javadocs if it can't compile the entire source path.
// but since we have java files depending on Scala files, we need to include ourselves on the classpath.
Compile / doc / dependencyClasspath := (Compile / fullClasspath).value,
Compile / doc / javacOptions ++= Seq(
"-Xdoclint:none",
"-overview",
((Compile / javaSource).value / "overview.html").getAbsolutePath,
"-notimestamp",
"-doctitle",
"Kalix Dev Tools",
"-noqualifier",
"java.lang"))
.settings(Dependencies.devTools)
lazy val javaTck = project
.in(file("tck/java-tck"))
.dependsOn(javaSdkProtobuf, javaSdkProtobufTestKit)
.enablePlugins(AkkaGrpcPlugin, PublicDockerImage, ReflectiveCodeGen)
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-tck-java-sdk",
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
crossScalaVersions := Dependencies.CrossScalaVersions,
akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Java),
ReflectiveCodeGen.copyUnmanagedSources := true,
Compile / mainClass := Some("kalix.javasdk.tck.JavaSdkTck"),
dockerEnvVars += "HOST" -> "0.0.0.0",
dockerExposedPorts += 8080)
.settings(Dependencies.tck)
lazy val scalaTck = project
.in(file("tck/scala-tck"))
.dependsOn(scalaSdkProtobuf, scalaSdkProtobufTestKit)
.enablePlugins(AkkaGrpcPlugin, PublicDockerImage, ReflectiveCodeGen)
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-tck-scala-sdk",
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
crossScalaVersions := Dependencies.CrossScalaVersions,
akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Scala),
libraryDependencies ++= Seq(Dependencies.kalixSdkProtocol % "protobuf-src"),
ReflectiveCodeGen.copyUnmanagedSources := true,
Compile / mainClass := Some("kalix.scalasdk.tck.ScalaSdkTck"),
dockerEnvVars += "HOST" -> "0.0.0.0",
dockerExposedPorts += 8080)
.settings(Dependencies.tck)
lazy val codegenCore =
project
.in(file("codegen/core"))
.enablePlugins(sbtprotoc.ProtocPlugin, Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-codegen-core",
testFrameworks += new TestFramework("munit.Framework"),
Test / fork := false)
.settings(Dependencies.codegenCore)
.settings(
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
scalaVersion := Dependencies.ScalaVersionForTooling,
crossScalaVersions := Seq(Dependencies.ScalaVersionForTooling),
Compile / PB.targets := Seq(PB.gens.java -> (Compile / sourceManaged).value))
lazy val codegenJava =
project
.in(file("codegen/java-gen"))
.configs(IntegrationTest)
.dependsOn(codegenCore % "compile->compile;test->test")
.enablePlugins(Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(
Test / fork := false, // needed to pass -D properties to ExampleSuite
// to provide access to protoc to tests
Test / buildInfoPackage := "kalix.codegen.java",
Test / buildInfoKeys := Seq(
BuildInfoKey(PB.protocExecutable),
BuildInfoKey(codegenCore / PB.externalIncludePath),
BuildInfoKey(codegenCore / PB.externalSourcePath),
BuildInfoKey(Test / resourceDirectory)))
// only need BuildInfo in Test scope so some manual setup here
.settings(BuildInfoPlugin.buildInfoScopedSettings(Test) ++ BuildInfoPlugin.buildInfoDefaultSettings)
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(Defaults.itSettings)
.settings(name := "kalix-codegen-java", testFrameworks += new TestFramework("munit.Framework"))
.settings(Dependencies.codegenJava)
.settings(
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
scalaVersion := Dependencies.ScalaVersionForTooling,
crossScalaVersions := Seq(Dependencies.ScalaVersionForTooling))
lazy val codegenJavaCompilationTest = project
.in(file("codegen/java-gen-compilation-tests"))
.enablePlugins(ReflectiveCodeGen)
.dependsOn(javaSdkProtobuf)
// code generated by the codegen requires the testkit, junit4
// Note: we don't use test scope since all code is generated in src_managed
// and the goal is to verify if it compiles
.dependsOn(javaSdkProtobufTestKit)
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(libraryDependencies ++= Seq(Dependencies.junit4))
.settings(
scalaVersion := Dependencies.ScalaVersion,
akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Java),
(publish / skip) := true,
name := "kalix-codegen-java-compilation-tests",
Compile / PB.protoSources += baseDirectory.value / ".." / ".." / "sbt-plugin" / "src" / "sbt-test" / "sbt-kalix" / "compile-only" / "src" / "main" / "protobuf",
ReflectiveCodeGen.copyUnmanagedSources := false)
lazy val codegenScala =
project
.in(file("codegen/scala-gen"))
.enablePlugins(BuildInfoPlugin)
.enablePlugins(Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(Dependencies.codegenScala)
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(
name := "kalix-codegen-scala",
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
scalaVersion := Dependencies.ScalaVersionForTooling,
crossScalaVersions := Seq(Dependencies.ScalaVersionForTooling),
Test / fork := false, // needed to pass -D properties to ExampleSuite
buildInfoKeys := Seq[BuildInfoKey](
name,
organization,
version,
scalaVersion,
sbtVersion,
"akkaVersion" -> Dependencies.AkkaVersion,
"protocolVersion" -> Kalix.RuntimeVersion,
BuildInfoKey(PB.protocExecutable),
BuildInfoKey(codegenCore / PB.externalIncludePath),
BuildInfoKey(codegenCore / PB.externalSourcePath),
BuildInfoKey(Test / resourceDirectory)),
buildInfoPackage := "kalix.codegen.scalasdk",
testFrameworks += new TestFramework("munit.Framework"))
.dependsOn(codegenCore % "compile->compile;test->test")
lazy val codegenScalaCompilationTest = project
.in(file("codegen/scala-gen-compilation-tests"))
.enablePlugins(ReflectiveCodeGen)
.dependsOn(scalaSdkProtobuf)
// code generated by the codegen requires the testkit, scalatest
// Note: we don't use test scope since all code is generated in src_managed
// and the goal is to verify if it compiles
.dependsOn(scalaSdkProtobufTestKit)
.settings(commonCompilerSettings)
.settings(disciplinedScalacSettings)
.settings(libraryDependencies ++= Seq(Dependencies.kalixSdkProtocol % "protobuf-src"))
.settings(
akkaGrpcGeneratedLanguages := Seq(AkkaGrpc.Scala),
(publish / skip) := true,
name := "kalix-codegen-scala-compilation-tests",
Compile / PB.protoSources += baseDirectory.value / ".." / ".." / "sbt-plugin" / "src" / "sbt-test" / "sbt-kalix" / "compile-only" / "src" / "main" / "protobuf",
ReflectiveCodeGen.copyUnmanagedSources := false)
lazy val codegenJavaCompilationExampleSuite: CompositeProject =
ExampleSuiteCompilationProject.compilationProject(AkkaGrpc.Java, "codegen/java-gen/src/test/resources/tests") {
testProject =>
testProject.dependsOn(javaSdkProtobuf % "compile", javaSdkProtobufTestKit % "test")
}
lazy val codegenScalaCompilationExampleSuite: CompositeProject =
ExampleSuiteCompilationProject.compilationProject(AkkaGrpc.Scala, "codegen/scala-gen/src/test/resources/tests") {
testProject =>
testProject
.dependsOn(scalaSdkProtobuf % "compile", scalaSdkProtobufTestKit % "test")
.settings(
akkaGrpcCodeGeneratorSettings += "flat_package",
libraryDependencies ++= Seq(Dependencies.kalixSdkProtocol % "protobuf-src"))
}
lazy val sbtPlugin = Project(id = "sbt-kalix", base = file("sbt-plugin"))
.enablePlugins(SbtPlugin)
.enablePlugins(Publish)
.disablePlugins(CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(Dependencies.sbtPlugin)
.settings(commonCompilerSettings)
.settings(
Compile / javacOptions ++= Seq("--release", "11"),
Compile / scalacOptions ++= Seq("-release", "11"),
scalaVersion := Dependencies.ScalaVersionForTooling,
crossScalaVersions := Seq(Dependencies.ScalaVersionForTooling),
publishSignedConfiguration := publishSignedConfiguration.value.withArtifacts(
// avoid publishing the plugin jar twice
publishSignedConfiguration.value.artifacts.filter(!_._1.name.contains("2.12_1.0"))),
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++
Seq("-Xmx1024M", "-Dplugin.version=" + version.value)
},
scriptedBufferLog := false)
.dependsOn(codegenScala, devToolsInternal)
addCommandAlias("formatAll", "scalafmtAll; javafmtAll")