forked from BlueBrain/nexus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
executable file
·1022 lines (974 loc) · 43.2 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 scala.io.Source
/*
scalafmt: {
maxColumn = 150
align.tokens."+" = [
{ code = ":=", owner = "Term.ApplyInfix" }
{ code = "+=", owner = "Term.ApplyInfix" }
{ code = "++=", owner = "Term.ApplyInfix" }
{ code = "~=", owner = "Term.ApplyInfix" }
]
}
*/
val scalacScapegoatVersion = "2.1.0"
val scalaCompilerVersion = "2.13.10"
val akkaHttpVersion = "10.2.10"
val akkaHttpCirceVersion = "1.39.2"
val akkaCorsVersion = "1.1.3"
val akkaVersion = "2.6.20"
val alpakkaVersion = "3.0.4"
val apacheCompressVersion = "1.22"
val awsSdkVersion = "2.17.184"
val byteBuddyAgentVersion = "1.10.17"
val betterMonadicForVersion = "0.3.1"
val caffeineVersion = "3.1.2"
val catsEffectVersion = "2.5.5"
val catsRetryVersion = "2.1.1"
val catsVersion = "2.9.0"
val circeVersion = "0.14.3"
val circeOpticsVersion = "0.14.1"
val classgraphVersion = "4.8.154"
val distageVersion = "1.0.10"
val doobieVersion = "0.13.4"
val fs2Version = "2.5.11"
val googleAuthClientVersion = "1.34.1"
val handleBarsVersion = "4.3.1"
val hikariVersion = "5.0.1"
val jenaVersion = "4.2.0"
val jsonldjavaVersion = "0.13.4"
val kamonVersion = "2.5.12"
val kanelaAgentVersion = "1.0.17"
val kindProjectorVersion = "0.13.2"
val logbackVersion = "1.4.5"
val magnoliaVersion = "1.1.3"
val mockitoVersion = "1.17.12"
val monixVersion = "3.4.1"
val monixBioVersion = "1.2.0"
val munitVersion = "1.0.0-M7"
val nimbusJoseJwtVersion = "9.29"
val postgresJdbcVersion = "42.5.1"
val pureconfigVersion = "0.17.2"
val scalaLoggingVersion = "3.9.5"
val scalaTestVersion = "3.2.15"
val scalaXmlVersion = "2.1.0"
val topBraidVersion = "1.3.2" // 1.4.1 fails to validate some test schemas
val testContainersVersion = "1.17.6"
lazy val akkaActorTyped = "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion
lazy val akkaHttp = "com.typesafe.akka" %% "akka-http" % akkaHttpVersion
lazy val akkaHttpCore = "com.typesafe.akka" %% "akka-http-core" % akkaHttpVersion
lazy val akkaHttpCirce = "de.heikoseeberger" %% "akka-http-circe" % akkaHttpCirceVersion
lazy val akkaHttpCors = "ch.megard" %% "akka-http-cors" % akkaCorsVersion
lazy val akkaHttpTestKit = "com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion
lazy val akkaHttpXml = "com.typesafe.akka" %% "akka-http-xml" % akkaHttpVersion
lazy val akkaSlf4j = "com.typesafe.akka" %% "akka-slf4j" % akkaVersion
lazy val akkaStream = "com.typesafe.akka" %% "akka-stream" % akkaVersion
lazy val akkaTestKit = "com.typesafe.akka" %% "akka-testkit" % akkaVersion
lazy val akkaTestKitTyped = "com.typesafe.akka" %% "akka-actor-testkit-typed" % akkaVersion
lazy val alpakkaFile = "com.lightbend.akka" %% "akka-stream-alpakka-file" % alpakkaVersion
lazy val alpakkaSse = "com.lightbend.akka" %% "akka-stream-alpakka-sse" % alpakkaVersion
lazy val alpakkaS3 = "com.lightbend.akka" %% "akka-stream-alpakka-s3" % alpakkaVersion
lazy val apacheCompress = "org.apache.commons" % "commons-compress" % apacheCompressVersion
lazy val awsSdk = "software.amazon.awssdk" % "s3" % awsSdkVersion
lazy val betterMonadicFor = "com.olegpy" %% "better-monadic-for" % betterMonadicForVersion
lazy val byteBuddyAgent = "net.bytebuddy" % "byte-buddy-agent" % byteBuddyAgentVersion
lazy val caffeine = "com.github.ben-manes.caffeine" % "caffeine" % caffeineVersion
lazy val catsCore = "org.typelevel" %% "cats-core" % catsVersion
lazy val catsEffect = "org.typelevel" %% "cats-effect" % catsEffectVersion
lazy val catsEffectLaws = "org.typelevel" %% "cats-effect-laws" % catsEffectVersion
lazy val catsRetry = "com.github.cb372" %% "cats-retry" % catsRetryVersion
lazy val circeCore = "io.circe" %% "circe-core" % circeVersion
lazy val circeGeneric = "io.circe" %% "circe-generic" % circeVersion
lazy val circeGenericExtras = "io.circe" %% "circe-generic-extras" % circeVersion
lazy val circeLiteral = "io.circe" %% "circe-literal" % circeVersion
lazy val circeOptics = "io.circe" %% "circe-optics" % circeOpticsVersion
lazy val circeParser = "io.circe" %% "circe-parser" % circeVersion
lazy val classgraph = "io.github.classgraph" % "classgraph" % classgraphVersion
lazy val distageCore = "io.7mind.izumi" %% "distage-core" % distageVersion
lazy val doobiePostgres = "org.tpolecat" %% "doobie-postgres" % doobieVersion
lazy val doobie = Seq(
doobiePostgres,
"org.tpolecat" %% "doobie-hikari" % doobieVersion,
"com.zaxxer" % "HikariCP" % hikariVersion exclude ("org.slf4j", "slf4j-api"),
"org.postgresql" % "postgresql" % postgresJdbcVersion
)
lazy val fs2 = "co.fs2" %% "fs2-core" % fs2Version
lazy val fs2io = "co.fs2" %% "fs2-io" % fs2Version
lazy val googleAuthClient = "com.google.oauth-client" % "google-oauth-client" % googleAuthClientVersion
lazy val handleBars = "com.github.jknack" % "handlebars" % handleBarsVersion
lazy val jenaArq = "org.apache.jena" % "jena-arq" % jenaVersion
lazy val jsonldjava = "com.github.jsonld-java" % "jsonld-java" % jsonldjavaVersion
lazy val kamonAkkaHttp = "io.kamon" %% "kamon-akka-http" % kamonVersion
lazy val kamonCore = "io.kamon" %% "kamon-core" % kamonVersion
lazy val kanelaAgent = "io.kamon" % "kanela-agent" % kanelaAgentVersion
lazy val kindProjector = "org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
lazy val logback = "ch.qos.logback" % "logback-classic" % logbackVersion
lazy val magnolia = "com.softwaremill.magnolia1_2" %% "magnolia" % magnoliaVersion
lazy val mockito = "org.mockito" %% "mockito-scala" % mockitoVersion
lazy val monixBio = "io.monix" %% "monix-bio" % monixBioVersion
lazy val monixEval = "io.monix" %% "monix-eval" % monixVersion
lazy val munit = "org.scalameta" %% "munit" % munitVersion
lazy val nimbusJoseJwt = "com.nimbusds" % "nimbus-jose-jwt" % nimbusJoseJwtVersion
lazy val pureconfig = "com.github.pureconfig" %% "pureconfig" % pureconfigVersion
lazy val scalaLogging = "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion
lazy val scalaTest = "org.scalatest" %% "scalatest" % scalaTestVersion
lazy val scalaXml = "org.scala-lang.modules" %% "scala-xml" % scalaXmlVersion
lazy val topBraidShacl = "org.topbraid" % "shacl" % topBraidVersion
lazy val testContainers = "org.testcontainers" % "testcontainers" % testContainersVersion
val javaSpecificationVersion = SettingKey[String](
"java-specification-version",
"The java specification version to be used for source and target compatibility."
)
lazy val checkJavaVersion = taskKey[Unit]("Verifies the current Java version is compatible with the code java version")
lazy val copyPlugins = taskKey[Unit]("Assembles and copies the plugin files plugins directory")
lazy val docs = project
.in(file("docs"))
.enablePlugins(ParadoxMaterialThemePlugin, ParadoxSitePlugin)
.disablePlugins(ScapegoatSbtPlugin)
.settings(shared, compilation, assertJavaVersion, noPublish)
.settings(ParadoxMaterialThemePlugin.paradoxMaterialThemeSettings(Compile))
.settings(
name := "docs",
moduleName := "docs",
// paradox settings
paradoxValidationIgnorePaths ++= {
val source = Source.fromFile(file("docs/ignore-paths.txt"))
val ignorePaths = source.getLines().map(_.r).toList
source.close()
ignorePaths
},
Compile / paradoxMaterialTheme := {
ParadoxMaterialTheme()
.withColor("light-blue", "cyan")
.withFavicon("./assets/img/favicon-32x32.png")
.withLogo("./assets/img/logo.png")
.withCustomStylesheet("./assets/css/docs.css")
.withRepository(uri("https://github.com/BlueBrain/nexus"))
.withSocial(
uri("https://github.com/BlueBrain"),
uri("https://github.com/BlueBrain/nexus/discussions")
)
.withCustomJavaScript("./public/js/gtm.js")
.withCopyright(s"""Nexus is Open Source and available under the Apache 2 License.<br/>
|© 2017-${java.time.LocalDate.now.getYear()} <a href="https://epfl.ch/">EPFL</a>
| <a href="https://bluebrain.epfl.ch/">The Blue Brain Project</a>
|""".stripMargin)
},
Compile / paradoxNavigationDepth := 4,
Compile / paradoxProperties ++=
Map(
"github.base_url" -> "https://github.com/BlueBrain/nexus/tree/master",
"project.version.short" -> "Snapshot",
"current.url" -> "https://bluebrainnexus.io/docs/",
"version.snapshot" -> "true",
"git.branch" -> "master"
),
paradoxRoots := List("docs/index.html"),
previewPath := "docs/index.html",
previewFixedPort := Some(4001),
// copy contexts
makeSite / mappings ++= {
def fileSources(base: File): Seq[File] = (base * "*.json").get
val contextDirs = Seq(
(rdf / Compile / resourceDirectory).value / "contexts",
(sdk / Compile / resourceDirectory).value / "contexts",
(archivePlugin / Compile / resourceDirectory).value / "contexts",
(blazegraphPlugin / Compile / resourceDirectory).value / "contexts",
(graphAnalyticsPlugin / Compile / resourceDirectory).value / "contexts",
(compositeViewsPlugin / Compile / resourceDirectory).value / "contexts",
(searchPlugin / Compile / resourceDirectory).value / "contexts",
(elasticsearchPlugin / Compile / resourceDirectory).value / "contexts",
(storagePlugin / Compile / resourceDirectory).value / "contexts"
)
contextDirs.flatMap { dir =>
fileSources(dir).map(file => file -> s"contexts/${file.getName}")
}
}
)
lazy val kernel = project
.in(file("delta/kernel"))
.settings(name := "delta-kernel", moduleName := "delta-kernel")
.settings(shared, compilation, coverage, release, assertJavaVersion)
.settings(
javaSpecificationVersion := "1.8",
libraryDependencies ++= Seq(
caffeine,
catsRetry,
circeCore,
circeParser,
handleBars,
monixBio,
kamonCore,
pureconfig,
scalaLogging,
scalaTest % Test
) ++ doobie,
addCompilerPlugin(kindProjector),
coverageFailOnMinimum := false
)
lazy val testkit = project
.dependsOn(kernel)
.in(file("delta/testkit"))
.settings(name := "delta-testkit", moduleName := "delta-testkit")
.settings(shared, compilation, coverage, release, assertJavaVersion)
.settings(
javaSpecificationVersion := "1.8",
coverageMinimumStmtTotal := 0,
libraryDependencies ++= Seq(
akkaActorTyped, // Needed to create Uri
akkaHttpCore,
catsRetry,
doobiePostgres,
monixBio,
munit,
scalaTest,
testContainers
),
addCompilerPlugin(kindProjector)
)
lazy val sourcingPsql = project
.in(file("delta/sourcing-psql"))
.dependsOn(rdf, testkit % "test->compile")
.settings(
name := "delta-sourcing-psql",
moduleName := "delta-sourcing-psql"
)
.settings(shared, compilation, assertJavaVersion, coverage, release)
.settings(
libraryDependencies ++= Seq(
catsCore,
circeCore,
circeGenericExtras,
circeParser,
distageCore,
fs2,
fs2io,
monixBio,
munit % Test,
catsEffectLaws % Test,
logback % Test
) ++ doobie,
Test / fork := true,
addCompilerPlugin(kindProjector)
)
lazy val rdf = project
.in(file("delta/rdf"))
.dependsOn(kernel, testkit % "test->compile")
.settings(shared, compilation, assertJavaVersion, coverage, release)
.settings(
name := "delta-rdf",
moduleName := "delta-rdf"
)
.settings(
javaSpecificationVersion := "1.8",
libraryDependencies ++= Seq(
akkaActorTyped, // Needed to create Uri
akkaHttpCore,
catsCore,
circeParser,
circeGeneric,
circeGenericExtras,
jenaArq,
jsonldjava,
magnolia,
monixBio,
topBraidShacl,
akkaSlf4j % Test,
akkaTestKit % Test,
logback % Test,
scalaTest % Test
),
Test / fork := true,
addCompilerPlugin(betterMonadicFor)
)
lazy val sdk = project
.in(file("delta/sdk"))
.settings(
name := "delta-sdk",
moduleName := "delta-sdk"
)
.dependsOn(kernel, sourcingPsql % "compile->compile;test->test", rdf % "compile->compile;test->test", testkit % "test->compile")
.settings(shared, compilation, assertJavaVersion, coverage, release)
.settings(
coverageFailOnMinimum := false,
libraryDependencies ++= Seq(
akkaStream,
akkaHttp,
akkaHttpXml exclude ("org.scala-lang.modules", "scala-xml_2.13"),
scalaXml,
circeLiteral,
circeGenericExtras,
distageCore,
fs2,
monixBio,
nimbusJoseJwt,
akkaTestKitTyped % Test,
akkaHttpTestKit % Test,
munit % Test,
scalaTest % Test
),
addCompilerPlugin(kindProjector),
addCompilerPlugin(betterMonadicFor)
)
lazy val migration = project
.in(file("delta/migration"))
.settings(
name := "delta-migration",
moduleName := "delta-migration"
)
.settings(shared, compilation, assertJavaVersion, coverage, release)
.dependsOn(sdk, testkit % "test->compile")
.settings(
libraryDependencies ++= Seq(
circeOptics,
"com.lightbend.akka" %% "akka-stream-alpakka-cassandra" % "4.0.0",
"org.lz4" % "lz4-java" % "1.4.1"
)
)
lazy val app = project
.in(file("delta/app"))
.settings(
name := "delta-app",
moduleName := "delta-app"
)
.enablePlugins(UniversalPlugin, JavaAppPackaging, JavaAgent, DockerPlugin, BuildInfoPlugin)
.settings(shared, compilation, servicePackaging, assertJavaVersion, kamonSettings, coverage, release)
.dependsOn(sdk % "compile->compile;test->test", testkit % "test->compile", migration)
.settings(Test / compile := (Test / compile).dependsOn(testPlugin / assembly).value)
.settings(
libraryDependencies ++= Seq(
akkaHttpCors,
akkaSlf4j,
classgraph,
logback,
akkaHttpTestKit % Test,
scalaTest % Test
),
addCompilerPlugin(betterMonadicFor),
run / fork := true,
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.config",
Docker / packageName := "nexus-delta",
copyPlugins := {
val esFile = (elasticsearchPlugin / assembly).value
val bgFile = (blazegraphPlugin / assembly).value
val graphAnalyticsFile = (graphAnalyticsPlugin / assembly).value
val storageFile = (storagePlugin / assembly).value
val archiveFile = (archivePlugin / assembly).value
val compositeViewsFile = (compositeViewsPlugin / assembly).value
val searchFile = (searchPlugin / assembly).value
val projectDeletionFile = (projectDeletionPlugin / assembly).value
val jiraFile = (jiraPlugin / assembly).value
val pluginsTarget = target.value / "plugins"
IO.createDirectory(pluginsTarget)
IO.copy(
Set(
esFile -> (pluginsTarget / esFile.getName),
bgFile -> (pluginsTarget / bgFile.getName),
graphAnalyticsFile -> (pluginsTarget / graphAnalyticsFile.getName),
storageFile -> (pluginsTarget / storageFile.getName),
archiveFile -> (pluginsTarget / archiveFile.getName),
compositeViewsFile -> (pluginsTarget / compositeViewsFile.getName),
searchFile -> (pluginsTarget / searchFile.getName),
projectDeletionFile -> (pluginsTarget / projectDeletionFile.getName),
jiraFile -> (pluginsTarget / jiraFile.getName)
)
)
},
Test / fork := true,
Test / test := {
val _ = copyPlugins.value
(Test / test).value
},
Test / testOnly := {
val _ = copyPlugins.value
(Test / testOnly).evaluated
},
Test / testQuick := {
val _ = copyPlugins.value
(Test / testQuick).evaluated
},
Universal / mappings ++= {
val esFile = (elasticsearchPlugin / assembly).value
val bgFile = (blazegraphPlugin / assembly).value
val graphAnalytics = (graphAnalyticsPlugin / assembly).value
val storageFile = (storagePlugin / assembly).value
val archiveFile = (archivePlugin / assembly).value
val compositeViewsFile = (compositeViewsPlugin / assembly).value
val searchFile = (searchPlugin / assembly).value
val projectDeletionFile = (projectDeletionPlugin / assembly).value
val jiraFile = (jiraPlugin / assembly).value
Seq(
(esFile, "plugins/" + esFile.getName),
(bgFile, "plugins/" + bgFile.getName),
(graphAnalytics, "plugins/" + graphAnalytics.getName),
(storageFile, "plugins/" + storageFile.getName),
(archiveFile, "plugins/" + archiveFile.getName),
(compositeViewsFile, "plugins/" + compositeViewsFile.getName),
(searchFile, "plugins/" + searchFile.getName),
(jiraFile, "plugins/" + jiraFile.getName),
(projectDeletionFile, "plugins/disabled/" + projectDeletionFile.getName)
)
}
)
lazy val testPlugin = project
.in(file("delta/plugins/test-plugin"))
.dependsOn(sdk % Provided, testkit % Provided)
.settings(shared, compilation, noPublish)
.settings(
name := "delta-test-plugin",
moduleName := "delta-test-plugin",
assembly / assemblyOutputPath := target.value / "delta-test-plugin.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
Test / fork := true
)
lazy val elasticsearchPlugin = project
.in(file("delta/plugins/elasticsearch"))
.enablePlugins(BuildInfoPlugin)
.settings(shared, compilation, assertJavaVersion, discardModuleInfoAssemblySettings, coverage, release)
.dependsOn(
sdk % "provided;test->test"
)
.settings(
name := "delta-elasticsearch-plugin",
moduleName := "delta-elasticsearch-plugin",
assembly / assemblyJarName := "elasticsearch.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
akkaTestKitTyped % Test,
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.elasticsearch",
addCompilerPlugin(betterMonadicFor),
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
assembly / test := {},
addArtifact(Artifact("delta-elasticsearch-plugin", "plugin"), assembly),
Test / fork := true
)
lazy val blazegraphPlugin = project
.in(file("delta/plugins/blazegraph"))
.enablePlugins(BuildInfoPlugin)
.settings(shared, compilation, assertJavaVersion, discardModuleInfoAssemblySettings, coverage, release)
.dependsOn(
sdk % "provided;test->test"
)
.settings(
name := "delta-blazegraph-plugin",
moduleName := "delta-blazegraph-plugin",
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.blazegraph",
addCompilerPlugin(betterMonadicFor),
assembly / assemblyJarName := "blazegraph.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
assembly / test := {},
addArtifact(Artifact("delta-blazegraph-plugin", "plugin"), assembly),
Test / fork := true
)
lazy val compositeViewsPlugin = project
.in(file("delta/plugins/composite-views"))
.enablePlugins(BuildInfoPlugin)
.settings(shared, compilation, assertJavaVersion, discardModuleInfoAssemblySettings, coverage, release)
.dependsOn(
sdk % "provided;test->test",
elasticsearchPlugin % "provided;test->test",
blazegraphPlugin % "provided;test->test"
)
.settings(
name := "delta-composite-views-plugin",
moduleName := "delta-composite-views-plugin",
libraryDependencies ++= Seq(
alpakkaSse excludeAll (
ExclusionRule(organization = "com.typesafe.akka", name = "akka-stream_2.13"),
ExclusionRule(organization = "com.typesafe.akka", name = "akka-http_2.13")
),
kamonAkkaHttp % Provided,
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.compositeviews",
addCompilerPlugin(betterMonadicFor),
coverageFailOnMinimum := false, // TODO: Remove this line when coverage increases
assembly / assemblyJarName := "composite-views.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
assembly / test := {},
addArtifact(Artifact("delta-composite-views-plugin", "plugin"), assembly),
Test / fork := true
)
lazy val searchPlugin = project
.in(file("delta/plugins/search"))
.enablePlugins(BuildInfoPlugin)
.settings(shared, compilation, assertJavaVersion, discardModuleInfoAssemblySettings, coverage, release)
.dependsOn(
sdk % "provided;test->test",
blazegraphPlugin % "provided;test->compile;test->test",
elasticsearchPlugin % "provided;test->compile;test->test",
compositeViewsPlugin % "provided;test->compile;test->test"
)
.settings(
name := "delta-search-plugin",
moduleName := "delta-search-plugin",
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.search",
addCompilerPlugin(betterMonadicFor),
coverageFailOnMinimum := false, // TODO: Remove this line when coverage increases
assembly / assemblyJarName := "search.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
assembly / test := {},
addArtifact(Artifact("delta-search-plugin", "plugin"), assembly),
Test / fork := true
)
lazy val storagePlugin = project
.enablePlugins(BuildInfoPlugin)
.in(file("delta/plugins/storage"))
.settings(shared, compilation, assertJavaVersion, discardModuleInfoAssemblySettings, coverage, release)
.dependsOn(
sdk % "provided;test->test",
elasticsearchPlugin % "provided;test->compile;test->test",
testkit % "test->compile"
)
.settings(
name := "delta-storage-plugin",
moduleName := "delta-storage-plugin",
libraryDependencies ++= Seq(
alpakkaS3 excludeAll (
ExclusionRule(organization = "com.typesafe.akka", name = "akka-stream_2.13"),
ExclusionRule(organization = "com.typesafe.akka", name = "akka-http_2.13"),
ExclusionRule(organization = "com.typesafe.akka", name = "akka-http-xml_2.13"),
ExclusionRule(organization = "org.slf4j", name = "slf4j-api")
),
kamonAkkaHttp % Provided,
akkaSlf4j % Test,
akkaTestKitTyped % Test,
akkaHttpTestKit % Test,
logback % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.storage",
addCompilerPlugin(betterMonadicFor),
addCompilerPlugin(kindProjector),
coverageFailOnMinimum := false, // TODO: Remove this line when coverage increases
assembly / assemblyJarName := "storage.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
assembly / test := {},
addArtifact(Artifact("delta-storage-plugin", "plugin"), assembly),
Test / fork := true
)
lazy val archivePlugin = project
.in(file("delta/plugins/archive"))
.enablePlugins(BuildInfoPlugin)
.settings(shared, compilation, assertJavaVersion, discardModuleInfoAssemblySettings, coverage, release)
.dependsOn(
sdk % Provided,
storagePlugin % "provided;test->test"
)
.settings(
name := "delta-archive-plugin",
moduleName := "delta-archive-plugin",
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
alpakkaFile excludeAll (
ExclusionRule(organization = "com.typesafe.akka", name = "akka-stream_2.13")
),
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
),
addCompilerPlugin(betterMonadicFor),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.archive",
assembly / assemblyJarName := "archive.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
assembly / test := {},
addArtifact(Artifact("delta-archive-plugin", "plugin"), assembly),
Test / fork := true
)
lazy val projectDeletionPlugin = project
.in(file("delta/plugins/project-deletion"))
.enablePlugins(BuildInfoPlugin)
.settings(shared, compilation, assertJavaVersion, discardModuleInfoAssemblySettings, coverage, release)
.dependsOn(
sdk % "provided;test->test"
)
.settings(
name := "delta-project-deletion-plugin",
moduleName := "delta-project-deletion-plugin",
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
scalaTest % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.projectdeletion",
addCompilerPlugin(betterMonadicFor),
assembly / assemblyJarName := "project-deletion.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
assembly / test := {},
addArtifact(Artifact("delta-project-deletion-plugin", "plugin"), assembly),
Test / fork := true,
coverageFailOnMinimum := false
)
lazy val graphAnalyticsPlugin = project
.in(file("delta/plugins/graph-analytics"))
.enablePlugins(BuildInfoPlugin)
.settings(shared, compilation, assertJavaVersion, discardModuleInfoAssemblySettings, coverage, release)
.dependsOn(
sdk % Provided,
storagePlugin % "provided;test->test",
elasticsearchPlugin % "provided;test->test"
)
.settings(
name := "delta-graph-analytics-plugin",
moduleName := "delta-graph-analytics-plugin",
libraryDependencies ++= Seq(
kamonAkkaHttp % Provided,
akkaSlf4j % Test,
logback % Test,
scalaTest % Test
),
addCompilerPlugin(betterMonadicFor),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.graph.analytics",
assembly / assemblyJarName := "graph-analytics.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
assembly / test := {},
addArtifact(Artifact("delta-graph-analytics-plugin", "plugin"), assembly),
Test / fork := true,
coverageFailOnMinimum := false
)
lazy val jiraPlugin = project
.in(file("delta/plugins/jira"))
.enablePlugins(BuildInfoPlugin)
.settings(shared, compilation, assertJavaVersion, discardModuleInfoAssemblySettings, coverage, release)
.dependsOn(
sdk % "provided;test->test"
)
.settings(
name := "delta-jira-plugin",
moduleName := "delta-jira-plugin",
libraryDependencies ++= Seq(
googleAuthClient,
kamonAkkaHttp % Provided,
scalaTest % Test
),
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.delta.plugins.jira",
addCompilerPlugin(betterMonadicFor),
assembly / assemblyJarName := "jira.jar",
assembly / assemblyOption := (assembly / assemblyOption).value.withIncludeScala(false),
assembly / test := {},
addArtifact(Artifact("jira", "plugin"), assembly),
Test / fork := true,
coverageFailOnMinimum := false
)
lazy val plugins = project
.in(file("delta/plugins"))
.settings(shared, compilation, noPublish)
.aggregate(
elasticsearchPlugin,
blazegraphPlugin,
compositeViewsPlugin,
searchPlugin,
storagePlugin,
archivePlugin,
projectDeletionPlugin,
testPlugin,
graphAnalyticsPlugin,
jiraPlugin
)
lazy val delta = project
.in(file("delta"))
.settings(shared, compilation, noPublish)
.aggregate(kernel, testkit, sourcingPsql, rdf, sdk, app, plugins)
lazy val cargo = taskKey[(File, String)]("Run Cargo to build 'nexus-fixer'")
lazy val storage = project
.in(file("storage"))
.enablePlugins(UniversalPlugin, JavaAppPackaging, JavaAgent, DockerPlugin, BuildInfoPlugin)
.settings(shared, compilation, assertJavaVersion, kamonSettings, storageAssemblySettings, coverage, release, servicePackaging)
.dependsOn(rdf)
.settings(cargo := {
import scala.sys.process._
val log = streams.value.log
val cmd = Process(Seq("cargo", "build", "--release"), baseDirectory.value / "permissions-fixer")
if (cmd.! == 0) {
log.success("Cargo build successful.")
(baseDirectory.value / "permissions-fixer" / "target" / "release" / "nexus-fixer") -> "bin/nexus-fixer"
} else {
log.error("Cargo build failed.")
throw new RuntimeException
}
})
.settings(
name := "storage",
moduleName := "storage",
buildInfoKeys := Seq[BuildInfoKey](version),
buildInfoPackage := "ch.epfl.bluebrain.nexus.storage.config",
Docker / packageName := "nexus-storage",
javaSpecificationVersion := "1.8",
libraryDependencies ++= Seq(
apacheCompress,
akkaHttp,
akkaHttpCirce,
akkaStream,
akkaSlf4j,
alpakkaFile,
catsCore,
catsEffect,
circeCore,
circeGenericExtras,
logback,
monixEval,
scalaLogging,
akkaHttpTestKit % Test,
akkaTestKit % Test,
mockito % Test,
scalaTest % Test
),
cleanFiles ++= Seq(
baseDirectory.value / "permissions-fixer" / "target" / "**",
baseDirectory.value / "nexus-storage.jar"
),
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-o", "-u", "target/test-reports"),
Test / parallelExecution := false,
Universal / mappings := {
(Universal / mappings).value :+ cargo.value
}
)
lazy val tests = project
.in(file("tests"))
.dependsOn(testkit)
.settings(noPublish)
.settings(shared, compilation, coverage, release)
.settings(
name := "tests",
moduleName := "tests",
coverageFailOnMinimum := false,
libraryDependencies ++= Seq(
akkaHttp,
akkaStream,
circeOptics,
circeGenericExtras,
fs2,
logback,
monixBio,
scalaLogging,
akkaTestKit % Test,
akkaHttpTestKit % Test,
awsSdk % Test,
scalaTest % Test,
akkaSlf4j % Test,
alpakkaSse % Test
),
Test / parallelExecution := false,
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-o", "-u", "target/test-reports"),
// Scalate gets errors with layering with this project so we disable it
Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.Flat,
Test / fork := true
)
lazy val root = project
.in(file("."))
.settings(name := "nexus", moduleName := "nexus")
.settings(compilation, shared, noPublish)
.aggregate(docs, delta, storage, tests)
lazy val noPublish = Seq(
publish / skip := true,
Test / publish / skip := true,
publishLocal := {},
publish := {},
publishArtifact := false,
packageDoc / publishArtifact := false,
Compile / packageSrc / publishArtifact := false,
Compile / packageDoc / publishArtifact := false,
Test / packageBin / publishArtifact := false,
Test / packageDoc / publishArtifact := false,
Test / packageSrc / publishArtifact := false,
sonatypeCredentialHost := "s01.oss.sonatype.org",
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
versionScheme := Some("strict")
)
lazy val assertJavaVersion =
Seq(
checkJavaVersion := {
val current = VersionNumber(sys.props("java.specification.version"))
val required = VersionNumber(javaSpecificationVersion.value)
assert(CompatibleJavaVersion(current, required), s"Java '$required' or above required; current '$current'")
},
Compile / compile := (Compile / compile).dependsOn(checkJavaVersion).value
)
lazy val shared = Seq(
organization := "ch.epfl.bluebrain.nexus",
// TODO: remove when https://github.com/djspiewak/sbt-github-packages/issues/28 is fixed
githubTokenSource := TokenSource.Or(
TokenSource.Environment("GITHUB_TOKEN"), // Injected during a github workflow for publishing
TokenSource.Or(
TokenSource.Environment("CI"), // available in GH Actions
TokenSource.Environment("SHELL") // safe to assume this will be set in all our devs environments
)
)
)
lazy val kamonSettings = Seq(
libraryDependencies ++= Seq(
kamonAkkaHttp,
"io.kamon" %% "kamon-akka" % kamonVersion,
"io.kamon" %% "kamon-cassandra" % kamonVersion,
"io.kamon" %% "kamon-core" % kamonVersion,
"io.kamon" %% "kamon-executors" % kamonVersion,
"io.kamon" %% "kamon-jaeger" % kamonVersion,
"io.jaegertracing" % "jaeger-thrift" % "1.6.0", // included jaeger-thrift causes a NoSuchMethod error
"io.kamon" %% "kamon-jdbc" % kamonVersion,
"io.kamon" %% "kamon-logback" % kamonVersion,
"io.kamon" %% "kamon-prometheus" % kamonVersion,
"io.kamon" %% "kamon-scala-future" % kamonVersion,
"io.kamon" %% "kamon-status-page" % kamonVersion,
"io.kamon" %% "kamon-system-metrics" % kamonVersion
),
javaAgents += kanelaAgent
)
lazy val storageAssemblySettings = Seq(
assembly / test := {},
assembly / assemblyOutputPath := baseDirectory.value / "nexus-storage.jar",
assembly / assemblyMergeStrategy := {
case PathList("org", "apache", "commons", "logging", xs @ _*) => MergeStrategy.last
case PathList("org", "apache", "commons", "codec", xs @ _*) => MergeStrategy.last
case PathList("akka", "remote", "kamon", xs @ _*) => MergeStrategy.last
case PathList("kamon", "instrumentation", "akka", "remote", xs @ _*) => MergeStrategy.last
case PathList("javax", "annotation", xs @ _*) => MergeStrategy.first
case x if x.endsWith("module-info.class") => MergeStrategy.discard
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}
)
lazy val discardModuleInfoAssemblySettings = Seq(
assembly / assemblyMergeStrategy := {
case x if x.contains("io.netty.versions.properties") => MergeStrategy.discard
case "module-info.class" => MergeStrategy.discard
case x =>
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}
)
lazy val compilation = {
import sbt.Keys._
import sbt._
Seq(
scalaVersion := scalaCompilerVersion,
scalacOptions ~= { options: Seq[String] => options.filterNot(Set("-Wself-implicit", "-Xlint:infer-any", "-Wnonunit-statement")) },
javaSpecificationVersion := "11",
javacOptions ++= Seq(
"-source",
javaSpecificationVersion.value,
"-target",
javaSpecificationVersion.value,
"-Xlint"
),
excludeDependencies ++= Seq(
ExclusionRule("log4j", "log4j"),
ExclusionRule("org.apache.logging.log4j ", "log4j-api"),
ExclusionRule("org.apache.logging.log4j ", "log4j-core")
),
Compile / packageSrc / publishArtifact := !isSnapshot.value,
Compile / packageDoc / publishArtifact := !isSnapshot.value,
Compile / doc / scalacOptions ++= Seq("-no-link-warnings"),
Compile / doc / javacOptions := Seq("-source", javaSpecificationVersion.value),
autoAPIMappings := true,
apiMappings += {
val scalaDocUrl = s"http://scala-lang.org/api/${scalaVersion.value}/"
ApiMappings.apiMappingFor((Compile / fullClasspath).value)("scala-library", scalaDocUrl)
},
Scapegoat / dependencyClasspath := (Compile / dependencyClasspath).value
)
}
lazy val coverage = Seq(
coverageMinimumStmtTotal := 80,
coverageFailOnMinimum := true
)
lazy val release = Seq(
Test / publish / skip := true,
Test / packageBin / publishArtifact := false,
Test / packageDoc / publishArtifact := false,
Test / packageSrc / publishArtifact := false,
// removes compile time only dependencies from the resulting pom
pomPostProcess := { node =>
XmlTransformer.transformer(moduleFilter("org.scoverage") | moduleFilter("com.sksamuel.scapegoat")).transform(node).head
},
publishTo := {
val original = publishTo.value
val ghTo = githubPublishTo.value
val RELEASE_TO_SONATYPE = sys.env.getOrElse("RELEASE_TO_SONATYPE", "false").toBoolean
if (RELEASE_TO_SONATYPE) original else ghTo
},
sonatypeCredentialHost := "s01.oss.sonatype.org",
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
versionScheme := Some("strict")
)
lazy val servicePackaging = {
import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport.{Docker, dockerChmodType}
import com.typesafe.sbt.packager.docker.{DockerChmodType, DockerVersion}
import com.typesafe.sbt.packager.universal.UniversalPlugin.autoImport.Universal
Seq(
Universal / mappings += (WaitForIt.download(target.value) -> "bin/wait-for-it.sh"),
// docker publishing settings
Docker / maintainer := "Nexus Team <[email protected]>",
Docker / version := {
if (isSnapshot.value) "latest"
else version.value
},
Docker / daemonUser := "nexus",
dockerBaseImage := "eclipse-temurin:11-jre",
dockerBuildxPlatforms := Seq("linux/arm64/v8", "linux/amd64"),
dockerExposedPorts := Seq(8080),
dockerUsername := Some("bluebrain"),
dockerUpdateLatest := false,
dockerChmodType := DockerChmodType.UserGroupWriteExecute
)
}
ThisBuild / scapegoatVersion := scalacScapegoatVersion
ThisBuild / scapegoatDisabledInspections := Seq(
"AsInstanceOf",
"ClassNames",
"IncorrectlyNamedExceptions",
"ObjectNames",
"RedundantFinalModifierOnCaseClass",
"RedundantFinalModifierOnMethod",
"VariableShadowing"
)
ThisBuild / homepage := Some(url("https://bluebrainnexus.io"))
ThisBuild / licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
ThisBuild / scmInfo := Some(ScmInfo(url("https://github.com/BlueBrain/nexus"), "scm:git:[email protected]:BlueBrain/nexus.git"))