forked from enso-org/enso
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
1520 lines (1417 loc) · 56.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 org.enso.build.BenchTasks._
import org.enso.build.WithDebugCommand
import sbt.Keys.{libraryDependencies, scalacOptions}
import sbt.addCompilerPlugin
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
import java.io.File
// ============================================================================
// === Global Configuration ===================================================
// ============================================================================
val scalacVersion = "2.13.6"
val rustVersion = "1.54.0-nightly"
val graalVersion = "21.1.0"
val javaVersion = "11"
val ensoVersion = "0.2.13-SNAPSHOT" // Note [Engine And Launcher Version]
/* Note [Engine And Launcher Version]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Currently both Engine and Launcher versions are tied to each other - each new
* releases contains the Engine and the Launcher and thus the version number is
* shared. If the version numbers ever diverge, make sure to update the build
* scripts at .github/workflows accordingly.
*/
ThisBuild / organization := "org.enso"
ThisBuild / scalaVersion := scalacVersion
lazy val gatherLicenses =
taskKey[Unit]("Gathers licensing information for relevant dependencies")
gatherLicenses := {
val _ = GatherLicenses.run.value
}
lazy val verifyLicensePackages =
taskKey[Unit](
"Verifies if the license package has been generated, " +
"has no warnings and is up-to-date with dependencies."
)
verifyLicensePackages := GatherLicenses.verifyReports.value
lazy val verifyGeneratedPackage =
inputKey[Unit](
"Verifies if the license package in a generated distribution is " +
"up-to-date with the one from the report."
)
verifyGeneratedPackage := GatherLicenses.verifyGeneratedPackage.evaluated
GatherLicenses.distributions := Seq(
Distribution(
"launcher",
file("distribution/launcher/THIRD-PARTY"),
Distribution.sbtProjects(launcher)
),
Distribution(
"engine",
file("distribution/engine/THIRD-PARTY"),
Distribution.sbtProjects(
runtime,
`engine-runner`,
`language-server`
)
),
Distribution(
"project-manager",
file("distribution/project-manager/THIRD-PARTY"),
Distribution.sbtProjects(`project-manager`)
),
Distribution(
"Base",
file("distribution/std-lib/Base/THIRD-PARTY"),
Distribution.sbtProjects(`std-base`)
),
Distribution(
"Table",
file("distribution/std-lib/Table/THIRD-PARTY"),
Distribution.sbtProjects(`std-table`)
),
Distribution(
"Database",
file("distribution/std-lib/Database/THIRD-PARTY"),
Distribution.sbtProjects(`std-database`)
),
Distribution(
"Image",
file("distribution/std-lib/Image/THIRD-PARTY"),
Distribution.sbtProjects(`std-image`)
)
)
GatherLicenses.licenseConfigurations := Set("compile")
GatherLicenses.configurationRoot := file("tools/legal-review")
lazy val openLegalReviewReport =
taskKey[Unit](
"Gathers licensing information for relevant dependencies and opens the " +
"report in review mode in the browser."
)
openLegalReviewReport := {
val _ = gatherLicenses.value
GatherLicenses.runReportServer()
}
lazy val analyzeDependency = inputKey[Unit]("...")
analyzeDependency := GatherLicenses.analyzeDependency.evaluated
val packageBuilder = new DistributionPackage.Builder(
ensoVersion = ensoVersion,
graalVersion = graalVersion,
graalJavaVersion = javaVersion,
artifactRoot = file("built-distribution")
)
Global / onChangedBuildSource := ReloadOnSourceChanges
// ============================================================================
// === Compiler Options =======================================================
// ============================================================================
ThisBuild / javacOptions ++= Seq(
"-encoding", // Provide explicit encoding (the next line)
"UTF-8", // Specify character encoding used by Java source files.
"-deprecation" // Shows a description of each use or override of a deprecated member or class.
)
ThisBuild / scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding", // Provide explicit encoding (the next line)
"utf-8", // Specify character encoding used by Scala source files.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-language:experimental.macros", // Allow macro definition (besides implementation and application)
"-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Vimplicits", // Prints implicit resolution chains when no implicit can be found.
"-Vtype-diffs", // Prints type errors as coloured diffs between types.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
"-Xfatal-warnings", // Make warnings fatal so they don't make it onto main (use @nowarn for local suppression)
"-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver.
"-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error.
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
"-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`.
"-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id.
"-Xlint:nullary-unit", // Warn when nullary methods return Unit.
"-Xlint:option-implicit", // Option.apply used implicit view.
"-Xlint:package-object-classes", // Class or object defined in package object.
"-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds.
"-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field.
"-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component.
"-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope.
"-Xmacro-settings:-logging@org.enso", // Disable the debug logging globally.
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-unused:locals", // Warn if a local definition is unused.
"-Ywarn-unused:params", // Warn if a value parameter is unused.
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates" // Warn if a private member is unused.
)
val jsSettings = Seq(
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }
)
Compile / console / scalacOptions ~= (_ filterNot (_ == "-Xfatal-warnings"))
// ============================================================================
// === Benchmark Configuration ================================================
// ============================================================================
lazy val Benchmark = config("bench") extend sbt.Test
// Native Image Generation
lazy val rebuildNativeImage = taskKey[Unit]("Force to rebuild native image")
lazy val buildNativeImage =
taskKey[Unit]("Ensure that the Native Image is built.")
// Bootstrap task
lazy val bootstrap =
taskKey[Unit]("Prepares Truffle JARs that are required by the sbt JVM")
bootstrap := {}
// ============================================================================
// === Global Project =========================================================
// ============================================================================
lazy val enso = (project in file("."))
.settings(version := "0.1")
.aggregate(
`core-definition`,
`interpreter-dsl`,
`json-rpc-server-test`,
`json-rpc-server`,
`language-server`,
`parser-service`,
`docs-generator`,
`polyglot-api`,
`project-manager`,
`syntax-definition`.jvm,
`text-buffer`,
flexer.jvm,
graph,
logger.jvm,
pkg,
cli,
`logging-utils`,
`logging-service`,
`akka-native`,
`version-output`,
`engine-runner`,
runtime,
searcher,
launcher,
`runtime-version-manager`,
`runtime-version-manager-test`,
syntax.jvm,
testkit
)
.settings(Global / concurrentRestrictions += Tags.exclusive(Exclusive))
.settings(
commands ++= Seq(packageBuilder.makePackages, packageBuilder.makeBundles)
)
// ============================================================================
// === Dependency Versions ====================================================
// ============================================================================
/* Note [Dependency Versions]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~
* Please maintain the following section in alphabetical order for the bundles
* of dependencies. Additionally, please keep the 'Other' subsection in
* alphabetical order.
*
* Furthermore, please keep the following in mind:
* - Wherever possible, we should use the same version of a dependency
* throughout the project.
* - If you need to include a new dependency, please define its version in this
* section.
* - If that version is not the latest, please include a note explaining why
* this is the case.
* - If, for some reason, you need to use a dependency version other than the
* global one, please include a note explaining why this is the case, and the
* circumstances under which the dependency could be upgraded to use the
* global version
*/
// === Akka ===================================================================
def akkaPkg(name: String) = akkaURL %% s"akka-$name" % akkaVersion
def akkaHTTPPkg(name: String) = akkaURL %% s"akka-$name" % akkaHTTPVersion
val akkaURL = "com.typesafe.akka"
val akkaVersion = "2.6.6"
val akkaHTTPVersion = "10.2.0-RC1"
val akkaMockSchedulerVersion = "0.5.5"
val logbackClassicVersion = "1.2.3"
val akkaActor = akkaPkg("actor")
val akkaStream = akkaPkg("stream")
val akkaTyped = akkaPkg("actor-typed")
val akkaTestkit = akkaPkg("testkit")
val akkaSLF4J = akkaPkg("slf4j")
val akkaTestkitTyped = akkaPkg("actor-testkit-typed") % Test
val akkaHttp = akkaHTTPPkg("http")
val akkaSpray = akkaHTTPPkg("http-spray-json")
val akkaTest = Seq(
"ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test
)
val akka =
Seq(
akkaActor,
akkaStream,
akkaHttp,
akkaSpray,
akkaTyped
)
// === Cats ===================================================================
val catsVersion = "2.2.0-M3"
val kittensVersion = "2.1.0"
val cats = {
Seq(
"org.typelevel" %% "cats-core" % catsVersion,
"org.typelevel" %% "cats-effect" % catsVersion,
"org.typelevel" %% "cats-free" % catsVersion,
"org.typelevel" %% "cats-macros" % catsVersion,
"org.typelevel" %% "kittens" % kittensVersion
)
}
// === Circe ==================================================================
val circeVersion = "0.14.0-M1"
val circeYamlVersion = "0.13.1"
val enumeratumCirceVersion = "1.6.1"
val circeGenericExtrasVersion = "0.13.0"
val circe = Seq("circe-core", "circe-generic", "circe-parser")
.map("io.circe" %% _ % circeVersion)
// === Commons ================================================================
val commonsCollectionsVersion = "4.4"
val commonsLangVersion = "3.10"
val commonsIoVersion = "2.7"
val commonsTextVersion = "1.8"
val commonsMathVersion = "3.6.1"
val commonsCompressVersion = "1.20"
val commonsCliVersion = "1.4"
val commons = Seq(
"org.apache.commons" % "commons-collections4" % commonsCollectionsVersion,
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
"commons-io" % "commons-io" % commonsIoVersion,
"org.apache.commons" % "commons-text" % commonsTextVersion,
"org.apache.commons" % "commons-math3" % commonsMathVersion,
"commons-cli" % "commons-cli" % commonsCliVersion
)
// === Jackson ================================================================
val jacksonVersion = "2.11.1"
val jackson = Seq(
"com.fasterxml.jackson.dataformat" % "jackson-dataformat-cbor" % jacksonVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion,
"com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion
)
// === JAXB ================================================================
val jaxbVersion = "2.3.3"
val jaxb = Seq(
"jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion % Benchmark,
"com.sun.xml.bind" % "jaxb-impl" % jaxbVersion % Benchmark
)
// === JMH ====================================================================
val jmhVersion = "1.23"
val jmh = Seq(
"org.openjdk.jmh" % "jmh-core" % jmhVersion % Benchmark,
"org.openjdk.jmh" % "jmh-generator-annprocess" % jmhVersion % Benchmark
)
// === Monocle ================================================================
val monocleVersion = "2.0.5"
val monocle = {
Seq(
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion,
"com.github.julien-truffaut" %% "monocle-macro" % monocleVersion,
"com.github.julien-truffaut" %% "monocle-law" % monocleVersion % "test"
)
}
// === Scala Compiler =========================================================
val scalaCompiler = Seq(
"org.scala-lang" % "scala-reflect" % scalacVersion,
"org.scala-lang" % "scala-compiler" % scalacVersion
)
// === std-lib ================================================================
val icuVersion = "67.1"
// === ZIO ====================================================================
val zioVersion = "1.0.1"
val zioInteropCatsVersion = "2.1.4.0"
val zio = Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion
)
// === Other ==================================================================
val bcpkixJdk15Version = "1.65"
val bumpVersion = "0.1.3"
val declineVersion = "1.2.0"
val directoryWatcherVersion = "0.9.10"
val flatbuffersVersion = "1.12.0"
val guavaVersion = "29.0-jre"
val jlineVersion = "3.19.0"
val kindProjectorVersion = "0.13.0"
val mockitoScalaVersion = "1.14.8"
val newtypeVersion = "0.4.4"
val pprintVersion = "0.5.9"
val pureconfigVersion = "0.15.0"
val refinedVersion = "0.9.14"
val scalacheckVersion = "1.14.3"
val scalacticVersion = "3.3.0-SNAP2"
val scalaLoggingVersion = "3.9.2"
val scalameterVersion = "0.19"
val scalatagsVersion = "0.9.1"
val scalatestVersion = "3.3.0-SNAP2"
val shapelessVersion = "2.4.0-M1"
val slf4jVersion = "1.7.30"
val slickVersion = "3.3.2"
val sqliteVersion = "3.31.1"
val tikaVersion = "1.24.1"
val typesafeConfigVersion = "1.4.1"
// ============================================================================
// === Internal Libraries =====================================================
// ============================================================================
lazy val logger = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("lib/scala/logger"))
.settings(
version := "0.1",
libraryDependencies ++= scalaCompiler
)
.jsSettings(jsSettings)
lazy val flexer = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("lib/scala/flexer"))
.dependsOn(logger)
.settings(
version := "0.1",
resolvers += Resolver.sonatypeRepo("releases"),
libraryDependencies ++= scalaCompiler ++ Seq(
"com.google.guava" % "guava" % guavaVersion exclude ("com.google.code.findbugs", "jsr305"),
"org.typelevel" %%% "cats-core" % catsVersion,
"org.typelevel" %%% "kittens" % kittensVersion
)
)
.jsSettings(jsSettings)
lazy val `syntax-definition` = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("lib/scala/syntax/definition"))
.dependsOn(logger, flexer)
.settings(
scalacOptions ++= Seq("-Ypatmat-exhaust-depth", "off"),
libraryDependencies ++= monocle ++ scalaCompiler ++ Seq(
"org.typelevel" %%% "cats-core" % catsVersion,
"org.typelevel" %%% "kittens" % kittensVersion,
"com.lihaoyi" %%% "scalatags" % scalatagsVersion,
"io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-generic" % circeVersion,
"io.circe" %%% "circe-parser" % circeVersion
)
)
.jsSettings(jsSettings)
lazy val syntax = crossProject(JVMPlatform, JSPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Full)
.in(file("lib/scala/syntax/specialization"))
.dependsOn(logger, flexer, `syntax-definition`)
.configs(Test)
.configs(Benchmark)
.settings(
commands += WithDebugCommand.withDebug,
Test / fork := true,
testFrameworks := Nil,
scalacOptions ++= Seq("-Ypatmat-exhaust-depth", "off"),
Compile / run / mainClass := Some("org.enso.syntax.text.Main"),
version := "0.1",
logBuffered := false,
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % scalatestVersion % Test,
"com.lihaoyi" %%% "pprint" % pprintVersion,
"io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-generic" % circeVersion,
"io.circe" %%% "circe-parser" % circeVersion
),
(Compile / compile) := (Compile / compile)
.dependsOn(RecompileParser.run(`syntax-definition`))
.value,
(Test / compile) := (Test / compile)
.dependsOn(RecompileParser.run(`syntax-definition`))
.value,
(Benchmark / compile) := (Benchmark / compile)
.dependsOn(RecompileParser.run(`syntax-definition`))
.value
)
.jvmSettings(
inConfig(Benchmark)(Defaults.testSettings),
Benchmark / unmanagedSourceDirectories +=
baseDirectory.value.getParentFile / "shared/src/bench/scala",
libraryDependencies +=
"com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
testFrameworks := List(
new TestFramework("org.scalatest.tools.Framework"),
new TestFramework("org.scalameter.ScalaMeterFramework")
),
bench := (Benchmark / test).tag(Exclusive).value
)
.jsSettings(
scalaJSUseMainModuleInitializer := false,
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) },
testFrameworks := List(new TestFramework("org.scalatest.tools.Framework")),
Compile / fullOptJS / artifactPath := file("target/scala-parser.js")
)
lazy val `lexer-bench` =
(project in file("lib/scala/syntax/specialization/lexer-bench"))
.settings(
commands += WithDebugCommand.withDebug,
inConfig(Compile)(truffleRunOptionsSettings),
inConfig(Benchmark)(Defaults.testSettings),
Test / parallelExecution := false,
Test / logBuffered := false,
Test / fork := true,
libraryDependencies ++= jmh
)
.configs(Test)
.configs(Benchmark)
.dependsOn(syntax.jvm)
.dependsOn(flexer.jvm)
.settings(
javaOptions ++= Seq(
"-Xms4096m",
"-Xmx4096m",
"-XX:+FlightRecorder"
),
Benchmark / mainClass := Some("org.openjdk.jmh.Main"),
bench := Def.task {
(Benchmark / run).toTask("").value
},
benchOnly := Def.inputTaskDyn {
import complete.Parsers.spaceDelimited
val name = spaceDelimited("<name>").parsed match {
case List(name) => name
case _ =>
throw new IllegalArgumentException("Expected one argument.")
}
Def.task {
(Benchmark / testOnly).toTask(" -- -z " + name).value
}
}.evaluated,
Benchmark / parallelExecution := false
)
lazy val `parser-service` = (project in file("lib/scala/parser-service"))
.dependsOn(syntax.jvm)
.settings(
libraryDependencies ++= akka ++ akkaTest,
mainClass := Some("org.enso.ParserServiceMain")
)
lazy val `docs-generator` = (project in file("lib/scala/docs-generator"))
.dependsOn(syntax.jvm)
.dependsOn(cli)
.settings(
libraryDependencies ++= Seq(
"commons-cli" % "commons-cli" % commonsCliVersion
),
mainClass := Some("org.enso.docs.generator.Main")
)
lazy val `text-buffer` = project
.in(file("lib/scala/text-buffer"))
.configs(Test)
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %% "cats-core" % catsVersion,
"org.bouncycastle" % "bcpkix-jdk15on" % bcpkixJdk15Version,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
)
)
lazy val graph = (project in file("lib/scala/graph/"))
.dependsOn(logger.jvm)
.configs(Test)
.settings(
version := "0.1",
resolvers ++= Seq(
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots")
),
scalacOptions += "-Ymacro-annotations",
libraryDependencies ++= scalaCompiler ++ Seq(
"com.chuusai" %% "shapeless" % shapelessVersion,
"io.estatico" %% "newtype" % newtypeVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion,
"org.apache.commons" % "commons-lang3" % commonsLangVersion
),
addCompilerPlugin(
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
)
)
lazy val pkg = (project in file("lib/scala/pkg"))
.settings(
Compile / run / mainClass := Some("org.enso.pkg.Main"),
version := "0.1",
libraryDependencies ++= circe ++ Seq(
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"io.circe" %% "circe-yaml" % circeYamlVersion, // separate from other circe deps because its independent project with its own versioning
"commons-io" % "commons-io" % commonsIoVersion
)
)
.dependsOn(editions)
lazy val `akka-native` = project
.in(file("lib/scala/akka-native"))
.configs(Test)
.settings(
version := "0.1",
libraryDependencies ++= Seq(
akkaActor
),
// Note [Native Image Workaround for GraalVM 20.2]
libraryDependencies += "org.graalvm.nativeimage" % "svm" % graalVersion % "provided"
)
lazy val `logging-utils` = project
.in(file("lib/scala/logging-utils"))
.configs(Test)
.settings(
version := "0.1",
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
lazy val `logging-service` = project
.in(file("lib/scala/logging-service"))
.configs(Test)
.settings(
version := "0.1",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"com.typesafe" % "config" % typesafeConfigVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
akkaStream,
akkaHttp,
"io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-parser" % circeVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.graalvm.nativeimage" % "svm" % graalVersion % "provided"
)
)
.settings(
if (Platform.isWindows)
(Compile / unmanagedSourceDirectories) += (Compile / sourceDirectory).value / "java-windows"
else
(Compile / unmanagedSourceDirectories) += (Compile / sourceDirectory).value / "java-unix"
)
.dependsOn(`akka-native`)
.dependsOn(`logging-utils`)
lazy val `logging-truffle-connector` = project
.in(file("lib/scala/logging-truffle-connector"))
.settings(
version := "0.1",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.graalvm.truffle" % "truffle-api" % graalVersion % "provided"
)
)
.dependsOn(`logging-utils`)
.dependsOn(`polyglot-api`)
lazy val cli = project
.in(file("lib/scala/cli"))
.configs(Test)
.settings(
version := "0.1",
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.typelevel" %% "cats-core" % catsVersion
),
Test / parallelExecution := false
)
lazy val `version-output` = (project in file("lib/scala/version-output"))
.settings(
version := "0.1"
)
.settings(
Compile / sourceGenerators += Def.task {
val file = (Compile / sourceManaged).value / "buildinfo" / "Info.scala"
BuildInfo
.writeBuildInfoFile(
file,
state.value.log,
ensoVersion,
scalacVersion,
graalVersion
)
}.taskValue
)
lazy val `project-manager` = (project in file("lib/scala/project-manager"))
.settings(
(Compile / mainClass) := Some("org.enso.projectmanager.boot.ProjectManager")
)
.settings(
(Compile / run / fork) := true,
(Test / fork) := true,
(Compile / run / connectInput) := true,
libraryDependencies ++= akka ++ Seq(akkaTestkit % Test),
libraryDependencies ++= circe,
libraryDependencies ++= Seq(
"com.typesafe" % "config" % typesafeConfigVersion,
"com.github.pureconfig" %% "pureconfig" % pureconfigVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion,
"commons-cli" % "commons-cli" % commonsCliVersion,
"commons-io" % "commons-io" % commonsIoVersion,
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
"com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion,
"com.miguno.akka" %% "akka-mock-scheduler" % akkaMockSchedulerVersion % Test,
"org.mockito" %% "mockito-scala" % mockitoScalaVersion % Test
),
addCompilerPlugin(
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
)
)
.settings(
assembly / assemblyJarName := "project-manager.jar",
assembly / test := {},
assembly / assemblyOutputPath := file("project-manager.jar"),
assembly / assemblyMergeStrategy := {
case PathList("META-INF", file, xs @ _*) if file.endsWith(".DSA") =>
MergeStrategy.discard
case PathList("META-INF", file, xs @ _*) if file.endsWith(".SF") =>
MergeStrategy.discard
case PathList("META-INF", "MANIFEST.MF", xs @ _*) =>
MergeStrategy.discard
case "application.conf" => MergeStrategy.concat
case "reference.conf" => MergeStrategy.concat
case _ => MergeStrategy.first
},
(Test / test) := (Test / test).dependsOn(`engine-runner` / assembly).value,
rebuildNativeImage := NativeImage
.buildNativeImage(
"project-manager",
staticOnLinux = true,
initializeAtRuntime = Seq("scala.util.Random")
)
.dependsOn(VerifyReflectionSetup.run)
.dependsOn(assembly)
.value,
buildNativeImage := NativeImage
.incrementalNativeImageBuild(
rebuildNativeImage,
"project-manager"
)
.value
)
.dependsOn(`akka-native`)
.dependsOn(`version-output`)
.dependsOn(editions)
.dependsOn(cli)
.dependsOn(`polyglot-api`)
.dependsOn(`runtime-version-manager`)
.dependsOn(`library-manager`)
.dependsOn(pkg)
.dependsOn(`json-rpc-server`)
.dependsOn(`json-rpc-server-test` % Test)
.dependsOn(testkit % Test)
.dependsOn(`runtime-version-manager-test` % Test)
/* Note [Classpath Separation]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~
* Projects using the language runtime do not depend on it directly, but instead
* the language runtime is put on the Truffle classpath, rather than the
* standard classpath. This is the recommended way of handling this and we
* strive to use such structure everywhere.
* See
* https://www.graalvm.org/docs/graalvm-as-a-platform/implement-language#graalvm
*
* Currently the only exception to this are the tests of the runtime project
* which have classpath separation disabled, because they need direct access to
* the runtime's instruments.
*
* To ensure correct handling of dependencies by sbt, the classpath appended to
* Java options, should be based on `(runtime / Compile / fullClasspath).value`
* wherever possible. Using a key from the runtime project enables sbt to see
* the dependency.
*
* Assembly tasks that build JAR files which need `runtime.jar` to run should
* also add a dependency on `runtime / assembly`.
*/
lazy val `json-rpc-server` = project
.in(file("lib/scala/json-rpc-server"))
.settings(
libraryDependencies ++= akka ++ akkaTest,
libraryDependencies ++= circe,
libraryDependencies ++= Seq(
"io.circe" %% "circe-literal" % circeVersion,
akkaTestkit % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
lazy val `json-rpc-server-test` = project
.in(file("lib/scala/json-rpc-server-test"))
.settings(
libraryDependencies ++= akka,
libraryDependencies ++= circe,
libraryDependencies ++= Seq(
"io.circe" %% "circe-literal" % circeVersion,
akkaTestkit,
"org.scalatest" %% "scalatest" % scalatestVersion
)
)
.dependsOn(`json-rpc-server`)
lazy val testkit = project
.in(file("lib/scala/testkit"))
.settings(
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
"org.scalatest" %% "scalatest" % scalatestVersion
)
)
lazy val `core-definition` = (project in file("lib/scala/core-definition"))
.configs(Benchmark)
.settings(
version := "0.1",
inConfig(Compile)(truffleRunOptionsSettings),
inConfig(Benchmark)(Defaults.testSettings),
Test / parallelExecution := false,
Test / logBuffered := false,
scalacOptions += "-Ymacro-annotations",
libraryDependencies ++= jmh ++ Seq(
"com.chuusai" %% "shapeless" % shapelessVersion,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.scalactic" %% "scalactic" % scalacticVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.typelevel" %% "cats-core" % catsVersion,
"com.github.julien-truffaut" %% "monocle-core" % monocleVersion
),
addCompilerPlugin(
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
)
)
.dependsOn(graph)
.dependsOn(syntax.jvm)
lazy val searcher = project
.in(file("lib/scala/searcher"))
.configs(Test)
.settings(
libraryDependencies ++= jmh ++ Seq(
"com.typesafe.slick" %% "slick" % slickVersion,
"org.xerial" % "sqlite-jdbc" % sqliteVersion,
"ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
.configs(Benchmark)
.settings(
inConfig(Benchmark)(Defaults.testSettings),
Benchmark / fork := true
)
.dependsOn(testkit % Test)
.dependsOn(`polyglot-api`)
lazy val `interpreter-dsl` = (project in file("lib/scala/interpreter-dsl"))
.settings(
version := "0.1",
libraryDependencies += "com.google.auto.service" % "auto-service" % "1.0-rc7" exclude ("com.google.code.findbugs", "jsr305")
)
// ============================================================================
// === Sub-Projects ===========================================================
// ============================================================================
val truffleRunOptions = Seq(
"-Dpolyglot.engine.IterativePartialEscape=true",
"-Dpolyglot.engine.BackgroundCompilation=false"
)
val truffleRunOptionsSettings = Seq(
fork := true,
javaOptions ++= truffleRunOptions
)
lazy val `polyglot-api` = project
.in(file("engine/polyglot-api"))
.settings(
Test / fork := true,
Test / javaOptions ++= {
// Note [Classpath Separation]
val runtimeClasspath =
(LocalProject("runtime") / Compile / fullClasspath).value
.map(_.data)
.mkString(File.pathSeparator)
Seq(s"-Dtruffle.class.path.append=$runtimeClasspath")
},
libraryDependencies ++= Seq(
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided",
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
),
libraryDependencies ++= jackson,
addCompilerPlugin(
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
),
GenerateFlatbuffers.flatcVersion := flatbuffersVersion,
Compile / sourceGenerators += GenerateFlatbuffers.task
)
.dependsOn(pkg)
.dependsOn(`text-buffer`)
.dependsOn(`logging-utils`)
.dependsOn(testkit % Test)
lazy val `language-server` = (project in file("engine/language-server"))
.settings(
libraryDependencies ++= akka ++ circe ++ Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"io.circe" %% "circe-generic-extras" % circeGenericExtrasVersion,
"io.circe" %% "circe-literal" % circeVersion,
"dev.zio" %% "zio" % zioVersion,
"io.methvin" % "directory-watcher" % directoryWatcherVersion,
"com.beachape" %% "enumeratum-circe" % enumeratumCirceVersion,
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
"commons-io" % "commons-io" % commonsIoVersion,
akkaTestkit % Test,
"com.typesafe.akka" %% "akka-http-testkit" % akkaHTTPVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.graalvm.sdk" % "polyglot-tck" % graalVersion % "provided"
),
Test / testOptions += Tests
.Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"),
GenerateFlatbuffers.flatcVersion := flatbuffersVersion,
Compile / sourceGenerators += GenerateFlatbuffers.task
)
.configs(Benchmark)
.settings(
inConfig(Benchmark)(Defaults.testSettings),
bench := (Benchmark / test).value,
libraryDependencies += "com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
testFrameworks ++= List(
new TestFramework("org.scalameter.ScalaMeterFramework")
)
)
.dependsOn(`json-rpc-server-test` % Test)
.dependsOn(`json-rpc-server`)
.dependsOn(`logging-service`)
.dependsOn(`polyglot-api`)
.dependsOn(`searcher`)
.dependsOn(`text-buffer`)
.dependsOn(`version-output`)
.dependsOn(pkg)
.dependsOn(testkit % Test)
lazy val ast = (project in file("lib/scala/ast"))
.settings(
version := ensoVersion,
Cargo.rustVersion := rustVersion,
Compile / sourceGenerators += GenerateAST.task
)
lazy val parser = (project in file("lib/scala/parser"))
.settings(
fork := true,
Cargo.rustVersion := rustVersion,
Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(Cargo("build --project parser"))
.value,
javaOptions += {
val root = baseDirectory.value.getParentFile.getParentFile.getParentFile
s"-Djava.library.path=$root/target/rust/debug"
},
libraryDependencies ++= Seq(
"com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
"org.scalatest" %%% "scalatest" % scalatestVersion % Test
),
testFrameworks := List(
new TestFramework("org.scalatest.tools.Framework"),
new TestFramework("org.scalameter.ScalaMeterFramework")
)
)
.dependsOn(ast)
lazy val cleanInstruments = taskKey[Unit](
"Cleans fragile class files to force a full recompilation and preserve" +
"consistency of instrumentation configuration."
)
lazy val runtime = (project in file("engine/runtime"))
.configs(Benchmark)
.settings(
version := ensoVersion,
commands += WithDebugCommand.withDebug,
cleanInstruments := FixInstrumentsGeneration.cleanInstruments.value,
inConfig(Compile)(truffleRunOptionsSettings),
inConfig(Benchmark)(Defaults.testSettings),
Test / parallelExecution := false,