forked from lagom/lagom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
1074 lines (967 loc) · 37.3 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
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import java.net.InetSocketAddress
import java.nio.channels.ServerSocketChannel
import sbt.ScriptedPlugin
import com.typesafe.sbt.SbtMultiJvm
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
import lagom.Protobuf
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
import de.heikoseeberger.sbtheader.HeaderPattern
import com.typesafe.tools.mima.core._
def common: Seq[Setting[_]] = releaseSettings ++ bintraySettings ++ Seq(
organization := "com.lightbend.lagom",
// Must be "Apache-2.0", because bintray requires that it is a license that it knows about
licenses := Seq(("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html"))),
homepage := Some(url("https://www.lagomframework.com/")),
sonatypeProfileName := "com.lightbend",
headers := headers.value ++ Map(
"scala" -> (
HeaderPattern.cStyleBlockComment,
"""|/*
| * Copyright (C) 2016-2017 Lightbend Inc. <https://www.lightbend.com>
| */
|""".stripMargin
),
"java" -> (
HeaderPattern.cStyleBlockComment,
"""|/*
| * Copyright (C) 2016-2017 Lightbend Inc. <https://www.lightbend.com>
| */
|""".stripMargin
)
),
pomExtra := {
<scm>
<url>https://github.com/lagom/lagom</url>
<connection>scm:git:[email protected]:lagom/lagom.git</connection>
</scm>
<developers>
<developer>
<id>lagom</id>
<name>Lagom Contributors</name>
<url>https://github.com/lagom</url>
</developer>
</developers>
},
pomIncludeRepository := { _ => false },
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),
// Setting javac options in common allows IntelliJ IDEA to import them automatically
javacOptions in compile ++= Seq(
"-encoding", "UTF-8",
"-source", "1.8",
"-target", "1.8",
"-parameters",
"-Xlint:unchecked",
"-Xlint:deprecation"
),
ScalariformKeys.preferences in Compile := formattingPreferences,
ScalariformKeys.preferences in Test := formattingPreferences,
ScalariformKeys.preferences in MultiJvm := formattingPreferences
)
def bintraySettings: Seq[Setting[_]] = Seq(
bintrayOrganization := Some("lagom"),
bintrayRepository := "sbt-plugin-releases",
bintrayPackage := "lagom-sbt-plugin",
bintrayReleaseOnPublish := false
)
def releaseSettings: Seq[Setting[_]] = Seq(
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
releaseTagName := (version in ThisBuild).value,
releaseProcess := {
import ReleaseTransformations._
Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
publishArtifacts,
releaseStepTask(bintrayRelease in thisProjectRef.value),
releaseStepCommand("sonatypeRelease"),
setNextVersion,
commitNextVersion,
pushChanges
)
}
)
def runtimeLibCommon: Seq[Setting[_]] = common ++ Seq(
crossScalaVersions := Seq(Dependencies.ScalaVersion),
scalaVersion := crossScalaVersions.value.head,
crossVersion := CrossVersion.binary,
crossPaths := false,
Dependencies.validateDependenciesSetting,
Dependencies.dependencyWhitelistSetting,
// compile options
scalacOptions in Compile ++= Seq("-encoding", "UTF-8", "-target:jvm-1.8", "-feature", "-unchecked", "-Xlog-reflective-calls", "-Xlint", "-deprecation"),
incOptions := incOptions.value.withNameHashing(true),
// show full stack traces and test case durations
testOptions in Test += Tests.Argument("-oDF"),
// -v Log "test run started" / "test started" / "test run finished" events on log level "info" instead of "debug".
// -a Show stack traces and exception class name for AssertionErrors.
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v", "-a")
)
def formattingPreferences = {
import scalariform.formatter.preferences._
FormattingPreferences()
.setPreference(RewriteArrowSymbols, false)
.setPreference(AlignParameters, true)
.setPreference(AlignSingleLineCaseStatements, true)
.setPreference(SpacesAroundMultiImports, true)
}
val defaultMultiJvmOptions: List[String] = {
import scala.collection.JavaConverters._
// multinode.D= and multinode.X= makes it possible to pass arbitrary
// -D or -X arguments to the forked jvm, e.g.
// -Djava.net.preferIPv4Stack=true or -Dmultinode.Xmx512m
val MultinodeJvmArgs = "multinode\\.(D|X)(.*)".r
val knownPrefix = Set("akka.", "lagom.")
val properties = System.getProperties.propertyNames.asScala.toList.collect {
case MultinodeJvmArgs(a, b) =>
val value = System.getProperty("multinode." + a + b)
"-" + a + b + (if (value == "") "" else "=" + value)
case key: String if knownPrefix.exists(pre => key.startsWith(pre)) => "-D" + key + "=" + System.getProperty(key)
}
"-Xmx128m" :: properties
}
def databasePortSetting: String = {
val serverSocket = ServerSocketChannel.open().socket()
serverSocket.bind(new InetSocketAddress("127.0.0.1", 0))
val port = serverSocket.getLocalPort
serverSocket.close()
s"-Ddatabase.port=$port"
}
def multiJvmTestSettings: Seq[Setting[_]] = SbtMultiJvm.multiJvmSettings ++ Seq(
parallelExecution in Test := false,
MultiJvmKeys.jvmOptions in MultiJvm := databasePortSetting :: defaultMultiJvmOptions,
// make sure that MultiJvm test are compiled by the default test compilation
compile in MultiJvm <<= (compile in MultiJvm) triggeredBy (compile in Test),
// tag MultiJvm tests so that we can use concurrentRestrictions to disable parallel tests
executeTests in MultiJvm := ((executeTests in MultiJvm) tag Tags.Test).value,
// make sure that MultiJvm tests are executed by the default test target,
// and combine the results from ordinary test and multi-jvm tests
executeTests in Test := {
val testResults = (executeTests in Test).value
val multiNodeResults = (executeTests in MultiJvm).value
val overall =
if (testResults.overall.id < multiNodeResults.overall.id)
multiNodeResults.overall
else
testResults.overall
Tests.Output(overall,
testResults.events ++ multiNodeResults.events,
testResults.summaries ++ multiNodeResults.summaries)
}
)
def macroCompileSettings: Seq[Setting[_]] = Seq(
compile in Test ~= { a =>
// Delete classes in "compile" packages after compiling.
// These are used for compile-time tests and should be recompiled every time.
val products = a.relations.allProducts.toSeq ** new SimpleFileFilter(_.getParentFile.getName == "compile")
IO.delete(products.get)
a
}
)
def mimaSettings(versions: Seq[String]): Seq[Setting[_]] = {
Seq(
mimaPreviousArtifacts := {
versions.map { version =>
organization.value % s"${moduleName.value}_${scalaBinaryVersion.value}" % version
}.toSet
},
mimaBinaryIssueFilters += ProblemFilters.excludePackage("com.lightbend.lagom.internal")
)
}
def since10 = Seq("1.0.0") ++ since11
def since11 = Seq("1.1.0") ++ since12
def since12 = Seq("1.2.2")
val javadslProjects = Seq[Project](
`api-javadsl`,
`server-javadsl`,
`client-javadsl`,
`broker-javadsl`,
`kafka-client-javadsl`,
`kafka-broker-javadsl`,
`cluster-javadsl`,
`persistence-javadsl`,
`persistence-cassandra-javadsl`,
`persistence-jdbc-javadsl`,
`persistence-jpa-javadsl`,
`pubsub-javadsl`,
jackson,
`testkit-javadsl`,
immutables,
`integration-client-javadsl`
)
val scaladslProjects = Seq[Project](
`api-scaladsl`,
`client-scaladsl`,
`broker-scaladsl`,
`kafka-client-scaladsl`,
`kafka-broker-scaladsl`,
`server-scaladsl`,
`cluster-scaladsl`,
`persistence-scaladsl`,
`persistence-cassandra-scaladsl`,
`persistence-jdbc-scaladsl`,
`pubsub-scaladsl`,
`testkit-scaladsl`,
`devmode-scaladsl`,
`play-json`
)
val coreProjects = Seq[Project](
`api-tools`,
api,
client,
server,
spi,
`cluster-core`,
`kafka-client`,
`kafka-broker`,
`persistence-core`,
`persistence-cassandra-core`,
`persistence-jdbc-core`,
`testkit-core`,
logback,
log4j2
)
val otherProjects = Seq[Project](
`dev-environment`,
`integration-tests-javadsl`,
`integration-tests-scaladsl`
)
lazy val root = (project in file("."))
.settings(name := "lagom")
.settings(runtimeLibCommon: _*)
.settings(
PgpKeys.publishSigned := {},
publishLocal := {},
publishArtifact in Compile := false,
publish := {}
)
.enablePlugins(lagom.UnidocRoot)
.settings(UnidocRoot.settings(javadslProjects.map(Project.projectToRef), scaladslProjects.map(Project.projectToRef)): _*)
.aggregate(javadslProjects.map(Project.projectToRef): _*)
.aggregate(scaladslProjects.map(Project.projectToRef): _*)
.aggregate(coreProjects.map(Project.projectToRef): _*)
.aggregate(otherProjects.map(Project.projectToRef): _*)
def RuntimeLibPlugins = AutomateHeaderPlugin && Sonatype && PluginsAccessor.exclude(BintrayPlugin)
def SbtPluginPlugins = AutomateHeaderPlugin && BintrayPlugin && PluginsAccessor.exclude(Sonatype)
lazy val api = (project in file("service/core/api"))
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-api",
Dependencies.api
)
lazy val `api-javadsl` = (project in file("service/javadsl/api"))
.settings(name := "lagom-javadsl-api")
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since10): _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
Dependencies.`api-javadsl`
).dependsOn(api)
lazy val `api-scaladsl` = (project in file("service/scaladsl/api"))
.settings(name := "lagom-scaladsl-api")
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
Dependencies.`api-scaladsl`
).dependsOn(api)
lazy val immutables = (project in file("immutables"))
.settings(name := "lagom-javadsl-immutables")
.settings(mimaSettings(since10): _*)
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
Dependencies.immutables
)
lazy val spi = (project in file("spi"))
.settings(name := "lagom-spi")
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
lazy val jackson = (project in file("jackson"))
.settings(name := "lagom-javadsl-jackson")
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
Dependencies.jackson
)
.dependsOn(`api-javadsl`, immutables % "test->compile")
lazy val `play-json` = (project in file("play-json"))
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-scaladsl-play-json",
Dependencies.`play-json`
)
lazy val `api-tools` = (project in file("api-tools"))
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
Dependencies.`api-tools`
)
.dependsOn(
spi,
`server-javadsl` % Test,
`server-scaladsl` % Test
)
lazy val client = (project in file("service/core/client"))
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-client",
Dependencies.client
).dependsOn(api, spi)
lazy val `client-javadsl` = (project in file("service/javadsl/client"))
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since10): _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-javadsl-client",
Dependencies.`client-javadsl`
)
.dependsOn(client, `api-javadsl`, jackson)
lazy val `client-scaladsl` = (project in file("service/scaladsl/client"))
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(macroCompileSettings: _*)
.settings(
name := "lagom-scaladsl-client",
Dependencies.`client-scaladsl`
)
.dependsOn(client, `api-scaladsl`, `macro-testkit` % Test)
lazy val `integration-client-javadsl` = (project in file("service/javadsl/integration-client"))
.settings(
name := "lagom-javadsl-integration-client",
Dependencies.`integration-client-javadsl`
)
.settings(mimaSettings(since10): _*)
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.dependsOn(`client-javadsl`, `service-registry-client-javadsl`, `kafka-client-javadsl`)
lazy val server = (project in file("service/core/server"))
.settings(
name := "lagom-server",
Dependencies.server
)
.enablePlugins(RuntimeLibPlugins)
.settings(runtimeLibCommon: _*)
.dependsOn(client)
lazy val `server-javadsl` = (project in file("service/javadsl/server"))
.settings(
name := "lagom-javadsl-server",
Dependencies.`server-javadsl`
)
.enablePlugins(RuntimeLibPlugins)
.settings(mimaSettings(since10): _*)
.settings(runtimeLibCommon: _*)
.dependsOn(server, `client-javadsl`, immutables % "provided")
// bring jackson closer to the root of the dependency tree to prompt Maven to choose the right version
.dependsOn(jackson)
lazy val `server-scaladsl` = (project in file("service/scaladsl/server"))
.settings(
name := "lagom-scaladsl-server",
Dependencies.`server-scaladsl`
)
.enablePlugins(RuntimeLibPlugins)
.settings(runtimeLibCommon: _*)
.dependsOn(server, `client-scaladsl`, `play-json`)
lazy val `testkit-core` = (project in file("testkit/core"))
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-core-testkit",
Dependencies.`testkit-core`
).settings(forkedTests: _*)
lazy val `testkit-javadsl` = (project in file("testkit/javadsl"))
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since10): _*)
.enablePlugins(RuntimeLibPlugins)
.settings(forkedTests: _*)
.settings(
name := "lagom-javadsl-testkit",
Dependencies.`testkit-javadsl`,
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[IncompatibleTemplateDefProblem]("com.lightbend.lagom.javadsl.testkit.ServiceTest$Setup"),
ProblemFilters.exclude[MissingClassProblem]("com.lightbend.lagom.javadsl.testkit.ServiceTest$Setup$")
)
)
.dependsOn(`testkit-core`, `server-javadsl`, `pubsub-javadsl`, `broker-javadsl`,
`persistence-core` % "compile;test->test",
`persistence-cassandra-javadsl` % "test->test",
`jackson` % "test->test"
)
lazy val `testkit-scaladsl` = (project in file("testkit/scaladsl"))
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(forkedTests: _*)
.settings(
name := "lagom-scaladsl-testkit",
Dependencies.`testkit-scaladsl`
)
.dependsOn(`testkit-core`, `server-scaladsl`, `broker-scaladsl`, `persistence-core` % "compile;test->test",
`persistence-scaladsl` % "compile;test->test", `persistence-cassandra-scaladsl` % "compile;test->test")
lazy val `integration-tests-javadsl` = (project in file("service/javadsl/integration-tests"))
.settings(runtimeLibCommon: _*)
.enablePlugins(AutomateHeaderPlugin)
.settings(forkedTests: _*)
.settings(
name := "lagom-javadsl-integration-tests",
Dependencies.`integration-tests-javadsl`,
PgpKeys.publishSigned := {},
publish := {}
)
.dependsOn(`server-javadsl`, `persistence-cassandra-javadsl`, `pubsub-javadsl`, `testkit-javadsl`, logback,
`integration-client-javadsl`)
lazy val `integration-tests-scaladsl` = (project in file("service/scaladsl/integration-tests"))
.settings(runtimeLibCommon: _*)
.enablePlugins(AutomateHeaderPlugin)
.settings(forkedTests: _*)
.settings(
name := "lagom-scaladsl-integration-tests",
Dependencies.`integration-tests-scaladsl`,
PgpKeys.publishSigned := {},
publish := {}
)
.dependsOn(`server-scaladsl`, logback, `testkit-scaladsl`)
// for forked tests
def forkedTests: Seq[Setting[_]] = Seq(
fork in Test := true,
concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),
javaOptions in Test ++= Seq("-Xms256M", "-Xmx512M"),
testGrouping in Test := singleTestsGrouping((definedTests in Test).value)
)
// group tests, a single test per group
def singleTestsGrouping(tests: Seq[TestDefinition]) = {
// We could group non Cassandra tests into another group
// to avoid new JVM for each test, see http://www.scala-sbt.org/release/docs/Testing.html
val javaOptions = Seq("-Xms256M", "-Xmx512M")
tests map { test =>
new Tests.Group(
name = test.name,
tests = Seq(test),
runPolicy = Tests.SubProcess(ForkOptions(runJVMOptions = javaOptions)))
}
}
lazy val `cluster-core` = (project in file("cluster/core"))
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-cluster-core",
Dependencies.`cluster-core`
)
lazy val `cluster-javadsl` = (project in file("cluster/javadsl"))
.dependsOn(`cluster-core`, jackson)
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since10): _*)
.settings(multiJvmTestSettings: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-javadsl-cluster",
Dependencies.`cluster-javadsl`
) configs (MultiJvm)
lazy val `cluster-scaladsl` = (project in file("cluster/scaladsl"))
.dependsOn(`cluster-core`, `play-json`)
.settings(runtimeLibCommon: _*)
.settings(multiJvmTestSettings: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-scaladsl-cluster",
Dependencies.`cluster-scaladsl`
) configs (MultiJvm)
lazy val `pubsub-javadsl` = (project in file("pubsub/javadsl"))
.dependsOn(`cluster-javadsl`)
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since10): _*)
.settings(multiJvmTestSettings: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-javadsl-pubsub",
Dependencies.`pubsub-javadsl`
) configs (MultiJvm)
lazy val `pubsub-scaladsl` = (project in file("pubsub/scaladsl"))
.dependsOn(`cluster-scaladsl`)
.settings(runtimeLibCommon: _*)
.settings(multiJvmTestSettings: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-scaladsl-pubsub",
Dependencies.`pubsub-scaladsl`
) configs (MultiJvm)
lazy val `persistence-core` = (project in file("persistence/core"))
.dependsOn(`cluster-core`)
.settings(runtimeLibCommon: _*)
.settings(Protobuf.settings)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-persistence-core",
Dependencies.`persistence-core`
)
lazy val `persistence-javadsl` = (project in file("persistence/javadsl"))
.settings(
name := "lagom-javadsl-persistence",
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[MissingClassProblem]("com.lightbend.lagom.javadsl.persistence.PersistenceModule$InitServiceLocatorHolder"),
ProblemFilters.exclude[MissingClassProblem]("com.lightbend.lagom.javadsl.persistence.PersistenceModule$"),
// See https://github.com/lagom/lagom/pull/405 for justification for this breaking change,
// and verification that it causes no binary compatibility problems in practice.
ProblemFilters.exclude[IncompatibleTemplateDefProblem]("com.lightbend.lagom.javadsl.persistence.PersistentEntity$Persist"),
ProblemFilters.exclude[MissingTypesProblem]("com.lightbend.lagom.javadsl.persistence.PersistentEntity$PersistOne"),
ProblemFilters.exclude[MissingTypesProblem]("com.lightbend.lagom.javadsl.persistence.PersistentEntity$PersistAll"),
ProblemFilters.exclude[MissingTypesProblem]("com.lightbend.lagom.javadsl.persistence.PersistentEntity$PersistNone")
),
Dependencies.`persistence-javadsl`
)
.dependsOn(`persistence-core` % "compile;test->test", jackson, `cluster-javadsl`)
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since12): _*)
.settings(Protobuf.settings)
.enablePlugins(RuntimeLibPlugins)
lazy val `persistence-scaladsl` = (project in file("persistence/scaladsl"))
.settings(
name := "lagom-scaladsl-persistence",
Dependencies.`persistence-scaladsl`
)
.dependsOn(`persistence-core` % "compile;test->test", `play-json`, `cluster-scaladsl`)
.settings(runtimeLibCommon: _*)
.settings(Protobuf.settings)
.enablePlugins(RuntimeLibPlugins)
lazy val `persistence-cassandra-core` = (project in file("persistence-cassandra/core"))
.dependsOn(`persistence-core` % "compile;test->test")
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-persistence-cassandra-core",
Dependencies.`persistence-cassandra-core`
)
lazy val `persistence-cassandra-javadsl` = (project in file("persistence-cassandra/javadsl"))
.settings(
name := "lagom-javadsl-persistence-cassandra",
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[DirectMissingMethodProblem]("com.lightbend.lagom.javadsl.persistence.cassandra.CassandraSession.this"),
ProblemFilters.exclude[FinalClassProblem]("com.lightbend.lagom.javadsl.persistence.cassandra.CassandraSession")
),
Dependencies.`persistence-cassandra-javadsl`
)
.dependsOn(`persistence-core` % "compile;test->test", `persistence-javadsl` % "compile;test->test",
`persistence-cassandra-core` % "compile;test->test", `api-javadsl`)
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since12): _*)
.settings(multiJvmTestSettings: _*)
.enablePlugins(RuntimeLibPlugins)
.settings() configs (MultiJvm)
lazy val `persistence-cassandra-scaladsl` = (project in file("persistence-cassandra/scaladsl"))
.settings(
name := "lagom-scaladsl-persistence-cassandra",
Dependencies.`persistence-cassandra-scaladsl`
)
.dependsOn(`persistence-core` % "compile;test->test", `persistence-scaladsl` % "compile;test->test",
`persistence-cassandra-core` % "compile;test->test", `api-scaladsl`)
.settings(runtimeLibCommon: _*)
.settings(multiJvmTestSettings: _*)
.enablePlugins(RuntimeLibPlugins)
.settings() configs (MultiJvm)
lazy val `persistence-jdbc-core` = (project in file("persistence-jdbc/core"))
.dependsOn(`persistence-core` % "compile;test->test")
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(forkedTests: _*)
.settings(
name := "lagom-persistence-jdbc-core",
Dependencies.`persistence-jdbc-core`
)
lazy val `persistence-jdbc-javadsl` = (project in file("persistence-jdbc/javadsl"))
.settings(
name := "lagom-javadsl-persistence-jdbc",
Dependencies.`persistence-jdbc-javadsl`
)
.dependsOn(`persistence-jdbc-core`, `persistence-core` % "compile;test->test", `persistence-javadsl` % "compile;test->test")
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since12): _*)
.settings(multiJvmTestSettings: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(forkedTests: _*) configs (MultiJvm)
lazy val `persistence-jdbc-scaladsl` = (project in file("persistence-jdbc/scaladsl"))
.settings(
name := "lagom-scaladsl-persistence-jdbc",
Dependencies.`persistence-jdbc-scaladsl`
)
.dependsOn(`persistence-jdbc-core`, `persistence-core` % "compile;test->test", `persistence-scaladsl` % "compile;test->test")
.settings(runtimeLibCommon: _*)
.settings(multiJvmTestSettings: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(forkedTests: _*) configs (MultiJvm)
lazy val `persistence-jpa-javadsl` = (project in file("persistence-jpa/javadsl"))
.dependsOn(`persistence-jdbc-javadsl` % "compile;test->test")
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(forkedTests: _*)
.settings(
name := "lagom-javadsl-persistence-jpa",
Dependencies.`persistence-jpa-javadsl`,
Dependencies.dependencyWhitelist ++= Dependencies.JpaTestWhitelist
)
lazy val `broker-javadsl` = (project in file("service/javadsl/broker"))
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-javadsl-broker",
Dependencies.`broker-javadsl`
)
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since12): _*)
.dependsOn(`api-javadsl`, `persistence-javadsl`)
lazy val `broker-scaladsl` = (project in file("service/scaladsl/broker"))
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-scaladsl-broker",
Dependencies.`broker-scaladsl`
)
.settings(runtimeLibCommon: _*)
.dependsOn(`api-scaladsl`, `persistence-scaladsl`)
lazy val `kafka-client` = (project in file("service/core/kafka/client"))
.enablePlugins(RuntimeLibPlugins)
.settings(runtimeLibCommon: _*)
.settings(forkedTests: _*)
.settings(
name := "lagom-kafka-client",
Dependencies.`kafka-client`
)
.dependsOn(`api`)
lazy val `kafka-client-javadsl` = (project in file("service/javadsl/kafka/client"))
.enablePlugins(RuntimeLibPlugins)
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since12): _*)
.settings(
name := "lagom-javadsl-kafka-client",
Dependencies.`kafka-client-javadsl`,
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[MissingTypesProblem]("com.lightbend.lagom.javadsl.broker.kafka.KafkaTopicFactory"),
// Needed to add service locator to Kafka topic factory, which required changing
// the public constructor. Since this will generally only ever be invoked by Guice,
// there should be no bin compat problem here.
ProblemFilters.exclude[DirectMissingMethodProblem]("com.lightbend.lagom.javadsl.broker.kafka.KafkaTopicFactory.this")
)
)
.dependsOn(`api-javadsl`, `kafka-client`)
lazy val `kafka-client-scaladsl` = (project in file("service/scaladsl/kafka/client"))
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-scaladsl-kafka-client",
Dependencies.`kafka-client-scaladsl`
)
.settings(runtimeLibCommon: _*)
.dependsOn(`api-scaladsl`, `kafka-client`)
lazy val `kafka-broker` = (project in file("service/core/kafka/server"))
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-kafka-broker",
Dependencies.`kafka-broker`
)
.settings(runtimeLibCommon: _*)
.dependsOn(`api`, `persistence-core`, `kafka-client`)
lazy val `kafka-broker-javadsl` = (project in file("service/javadsl/kafka/server"))
.enablePlugins(RuntimeLibPlugins)
.settings(runtimeLibCommon: _*)
.settings(mimaSettings(since12): _*)
.settings(forkedTests: _*)
.settings(
name := "lagom-javadsl-kafka-broker",
Dependencies.`kafka-broker-javadsl`,
Dependencies.dependencyWhitelist ++= Dependencies.KafkaTestWhitelist
)
.dependsOn(`broker-javadsl`, `kafka-broker`, `kafka-client-javadsl`, `server-javadsl`, `kafka-server` % Test, logback % Test)
lazy val `kafka-broker-scaladsl` = (project in file("service/scaladsl/kafka/server"))
.enablePlugins(RuntimeLibPlugins)
.settings(runtimeLibCommon: _*)
.settings(forkedTests: _*)
.settings(
name := "lagom-scaladsl-kafka-broker",
Dependencies.`kafka-broker-scaladsl`,
Dependencies.dependencyWhitelist ++= Dependencies.KafkaTestWhitelist
)
.dependsOn(`broker-scaladsl`, `kafka-broker`, `kafka-client-scaladsl`, `server-scaladsl`, `kafka-server` % Test, logback % Test)
lazy val logback = (project in file("logback"))
.enablePlugins(RuntimeLibPlugins)
.settings(runtimeLibCommon: _*)
.settings(
name := "lagom-logback",
Dependencies.logback
)
lazy val log4j2 = (project in file("log4j2"))
.enablePlugins(RuntimeLibPlugins)
.settings(runtimeLibCommon: _*)
.settings(
name := "lagom-log4j2",
Dependencies.log4j2
)
lazy val `dev-environment` = (project in file("dev"))
.settings(name := "lagom-dev")
.settings(common: _*)
.enablePlugins(AutomateHeaderPlugin)
.aggregate(`build-link`, `reloadable-server`, `build-tool-support`, `sbt-plugin`, `maven-plugin`, `service-locator`,
`service-registration-javadsl`, `cassandra-server`, `play-integration-javadsl`, `devmode-scaladsl`,
`service-registry-client-javadsl`,
`maven-java-archetype`, `maven-dependencies`, `kafka-server`)
.settings(
publish := {},
PgpKeys.publishSigned := {}
)
lazy val `build-link` = (project in file("dev") / "build-link")
.settings(common: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
crossPaths := false,
autoScalaLibrary := false,
EclipseKeys.projectFlavor := EclipseProjectFlavor.Java,
Dependencies.`build-link`
)
lazy val `reloadable-server` = (project in file("dev") / "reloadable-server")
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-reloadable-server",
Dependencies.`reloadable-server`
)
.dependsOn(`build-link`)
lazy val `build-tool-support` = (project in file("dev") / "build-tool-support")
.settings(common: _*)
.settings(
name := "lagom-build-tool-support",
publishMavenStyle := true,
crossPaths := false,
sourceGenerators in Compile += Def.task {
Generators.version(version.value, (sourceManaged in Compile).value)
}.taskValue,
Dependencies.`build-tool-support`
).dependsOn(`build-link`)
lazy val `sbt-plugin` = (project in file("dev") / "sbt-plugin")
.settings(common: _*)
.settings(scriptedSettings: _*)
.enablePlugins(SbtPluginPlugins)
.settings(
name := "lagom-sbt-plugin",
sbtPlugin := true,
Dependencies.`sbt-plugin`,
addSbtPlugin(("com.typesafe.play" % "sbt-plugin" % Dependencies.PlayVersion).exclude("org.slf4j","slf4j-simple")),
scriptedDependencies := {
val () = scriptedDependencies.value
val () = publishLocal.value
val () = (publishLocal in `service-locator`).value
val () = (publishLocal in LocalProject("sbt-scripted-tools")).value
val () = (publishLocal in `sbt-scripted-library`).value
},
publishTo := {
if (isSnapshot.value) {
// Bintray doesn't support publishing snapshots, publish to Sonatype snapshots instead
Some(Opts.resolver.sonatypeSnapshots)
} else publishTo.value
},
publishMavenStyle := isSnapshot.value
).dependsOn(`build-tool-support`)
lazy val `maven-plugin` = (project in file("dev") / "maven-plugin")
.enablePlugins(lagom.SbtMavenPlugin)
.settings(common: _*)
.settings(
name := "Lagom Maven Plugin",
description := "Provides Lagom development environment support to maven.",
Dependencies.`maven-plugin`,
publishMavenStyle := true,
crossPaths := false,
mavenClasspath := (externalDependencyClasspath in (`maven-launcher`, Compile)).value.map(_.data),
mavenTestArgs := Seq(
"-Xmx768m",
"-XX:MaxMetaspaceSize=384m",
s"-Dlagom.version=${version.value}",
s"-DarchetypeVersion=${version.value}",
s"-Dplay.version=${Dependencies.PlayVersion}",
s"-Dakka.version=${Dependencies.AkkaVersion}",
s"-Dscala.binary.version=${(scalaBinaryVersion in `api-javadsl`).value}",
"-Dorg.slf4j.simpleLogger.showLogName=false",
"-Dorg.slf4j.simpleLogger.showThreadName=false"
)
).dependsOn(`build-tool-support`)
lazy val `maven-launcher` = (project in file("dev") / "maven-launcher")
.settings(
name := "lagom-maven-launcher",
description := "Dummy project, exists only to resolve the maven launcher classpath",
EclipseKeys.projectFlavor := EclipseProjectFlavor.Java,
Dependencies.`maven-launcher`
)
def scriptedSettings: Seq[Setting[_]] = ScriptedPlugin.scriptedSettings ++
Seq(scriptedLaunchOpts += s"-Dproject.version=${version.value}") ++
Seq(
scripted := scripted.tag(Tags.Test).evaluated,
scriptedLaunchOpts ++= Seq(
"-Xmx768m",
"-XX:MaxMetaspaceSize=384m",
"-Dscala.version=" + sys.props.get("scripted.scala.version").getOrElse((scalaVersion in `reloadable-server`).value)
)
)
def archetypeVariables(lagomVersion: String) = Map(
"LAGOM-VERSION" -> lagomVersion
)
val ArchetypeVariablePattern = "%([A-Z-]+)%".r
def archetypeProject(archetypeName: String) =
Project(s"maven-$archetypeName-archetype", file("dev") / "archetypes" / s"maven-$archetypeName")
.settings(common: _*)
.settings(
name := s"maven-archetype-lagom-$archetypeName",
autoScalaLibrary := false,
publishMavenStyle := true,
crossPaths := false,
copyResources in Compile := {
val pomFile = (classDirectory in Compile).value / "archetype-resources" / "pom.xml"
if (pomFile.exists()) {
val pomXml = IO.read(pomFile)
val variables = archetypeVariables(version.value)
val newPomXml = ArchetypeVariablePattern.replaceAllIn(pomXml, m =>
variables.get(m.group(1)) match {
case Some(replacement) => replacement
case None => m.matched
}
)
IO.write(pomFile, newPomXml)
}
(copyResources in Compile).value
}
).disablePlugins(EclipsePlugin)
lazy val `maven-java-archetype` = archetypeProject("java")
lazy val `maven-dependencies` = (project in file("dev") / "maven-dependencies")
.settings(common: _*)
.settings(
name := "lagom-maven-dependencies",
crossPaths := false,
autoScalaLibrary := false,
scalaVersion := Dependencies.ScalaVersion,
pomExtra := pomExtra.value :+ {
val lagomDeps = Def.settingDyn {
val sv = scalaVersion.value
val sbv = scalaBinaryVersion.value
(javadslProjects ++ coreProjects).map { project =>
Def.setting {
val cross = CrossVersion((crossVersion in project).value, sv, sbv)
val artifactName = (artifact in project).value.name
val artifactId = cross.fold(artifactName)(_(artifactName))
<dependency>
<groupId>{(organization in project).value}</groupId>
<artifactId>{artifactId}</artifactId>
<version>{(version in project).value}</version>
</dependency>
}
}.join
}.value
<dependencyManagement>
<dependencies>
{lagomDeps}
{Dependencies.DependencyWhitelist.value.map { dep =>
val crossDep = CrossVersion(scalaVersion.value, scalaBinaryVersion.value)(dep)
<dependency>
<groupId>{crossDep.organization}</groupId>
<artifactId>{crossDep.name}</artifactId>
<version>{crossDep.revision}</version>
</dependency>
}}
</dependencies>
</dependencyManagement>
}
).settings(
// This disables creating jar, source jar and javadocs, and will cause the packaging type to be "pom" when the
// pom is created
Classpaths.defaultPackageKeys.map(key => publishArtifact in key := false): _*
)
// This project doesn't get aggregated, it is only executed by the sbt-plugin scripted dependencies
lazy val `sbt-scripted-tools` = (project in file("dev") / "sbt-scripted-tools")
.settings(name := "lagom-sbt-scripted-tools")
.settings(common: _*)
.settings(
sbtPlugin := true
).dependsOn(`sbt-plugin`)
// This project also get aggregated, it is only executed by the sbt-plugin scripted dependencies
lazy val `sbt-scripted-library` = (project in file("dev") / "sbt-scripted-library")
.settings(name := "lagom-sbt-scripted-library")
.settings(runtimeLibCommon: _*)
.dependsOn(`server-javadsl`)
lazy val `service-locator` = (project in file("dev") / "service-registry"/ "service-locator")
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.settings(
name := "lagom-service-locator",
Dependencies.`service-locator`
)
.dependsOn(`server-javadsl`, logback, `service-registry-client-javadsl`)
lazy val `service-registry-client-javadsl` = (project in file("dev") / "service-registry" / "client-javadsl")
.settings(
name := "lagom-service-registry-client",
Dependencies.`service-registry-client-javadsl`
)
.settings(runtimeLibCommon: _*)
.enablePlugins(RuntimeLibPlugins)
.dependsOn(`client-javadsl`, immutables % "provided")