-
Notifications
You must be signed in to change notification settings - Fork 323
/
build.sbt
5227 lines (5021 loc) · 211 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 LibraryManifestGenerator.BundledLibrary
import org.enso.build.BenchTasks._
import org.enso.build.WithDebugCommand
import org.apache.commons.io.FileUtils
import sbt.Keys.{libraryDependencies, scalacOptions}
import sbt.addCompilerPlugin
import sbt.complete.DefaultParsers._
import sbt.complete.Parser
import sbt.nio.file.FileTreeView
import sbt.internal.util.ManagedLogger
import src.main.scala.licenses.{
DistributionDescription,
SBTDistributionComponent
}
// This import is unnecessary, but bit adds a proper code completion features
// to IntelliJ.
import JPMSPlugin.autoImport._
import PackageListPlugin.autoImport._
import java.io.File
import java.nio.file.Files
import java.nio.file.Paths
// ============================================================================
// === Global Configuration ===================================================
// ============================================================================
val scalacVersion = "2.13.11"
// source version of the Java language
val javaVersion = "21"
// version of the GraalVM JDK
val graalVersion = "21.0.2"
// Version used for the Graal/Truffle related Maven packages
// Keep in sync with GraalVM.version. Do not change the name of this variable,
// it is used by the Rust build script via regex matching.
val graalMavenPackagesVersion = "24.0.0"
val targetJavaVersion = "17"
val defaultDevEnsoVersion = "0.0.0-dev"
val ensoVersion = sys.env.getOrElse(
"ENSO_VERSION",
defaultDevEnsoVersion
) // Note [Engine And Launcher Version]
val currentEdition = sys.env.getOrElse(
"ENSO_EDITION",
defaultDevEnsoVersion
) // Note [Default Editions]
// Note [Stdlib Version]
val stdLibVersion = defaultDevEnsoVersion
val targetStdlibVersion = ensoVersion
val mavenUploadVersion = "0.2-SNAPSHOT"
// Inspired by https://www.scala-sbt.org/1.x/docs/Howto-Startup.html#How+to+take+an+action+on+startup
lazy val startupStateTransition: State => State = { s: State =>
GraalVM.versionCheck(
graalVersion,
graalMavenPackagesVersion,
javaVersion,
s
)
}
Global / onLoad := {
val old = (Global / onLoad).value
startupStateTransition compose old
}
/* 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.
*/
/* Note [Default Editions]
* ~~~~~~~~~~~~~~~~~~~~~~~
* Currently, the default edition to use is inferred based on the engine
* version. Each Enso version has an associated default edition name and the
* `currentEdition` field specifies the default edition name for the upcoming
* release.
*
* Thus the `library-manager` needs to depend on the `version-output` to get
* this defaults from the build metadata.
*
* In the future we may automate generating this edition number when cutting a
* release.
*/
/* Note [Stdlib Version]
* ~~~~~~~~~~~~~~~~~~~~~
* The `stdlibVersion` variable stores the version at which standard library is
* stored within the source tree, which is currently set to a constant of
* `0.0.0-dev`.
*
* When distributions are built, the library versions are updated to match the
* current Enso version.
*/
ThisBuild / organization := "org.enso"
ThisBuild / scalaVersion := scalacVersion
ThisBuild / publish / skip := true
/* Tag limiting the concurrent access to tools/simple-library-server in tests.
*/
val simpleLibraryServerTag = Tags.Tag("simple-library-server")
Global / concurrentRestrictions += Tags.limit(simpleLibraryServerTag, 1)
/** Tag limiting the concurrent spawning of `native-image` subprocess.
*/
val nativeImageBuildTag = NativeImage.nativeImageBuildTag
Global / concurrentRestrictions += Tags.limit(nativeImageBuildTag, 1)
lazy val gatherLicenses =
taskKey[Unit](
"Gathers licensing information for relevant dependencies of all distributions"
)
gatherLicenses := {
val _ = GatherLicenses.run.toTask("").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
def makeStdLibDistribution(
name: String,
components: Seq[SBTDistributionComponent]
): DistributionDescription =
Distribution(
name,
file(s"distribution/lib/Standard/$name/$stdLibVersion/THIRD-PARTY"),
components
)
GatherLicenses.distributions := Seq(
Distribution(
"launcher",
file("distribution/launcher/THIRD-PARTY"),
Distribution.sbtProjects(launcher)
),
Distribution(
"engine",
file("distribution/engine/THIRD-PARTY"),
Distribution.sbtProjects(
`runtime-and-langs`,
`engine-runner`,
`language-server`
)
),
Distribution(
"project-manager",
file("distribution/project-manager/THIRD-PARTY"),
Distribution.sbtProjects(`project-manager`)
),
makeStdLibDistribution("Base", Distribution.sbtProjects(`std-base`)),
makeStdLibDistribution(
"Google_Api",
Distribution.sbtProjects(`std-google-api`)
),
makeStdLibDistribution("Table", Distribution.sbtProjects(`std-table`)),
makeStdLibDistribution("Database", Distribution.sbtProjects(`std-database`)),
makeStdLibDistribution("Image", Distribution.sbtProjects(`std-image`)),
makeStdLibDistribution("AWS", Distribution.sbtProjects(`std-aws`)),
makeStdLibDistribution(
"Snowflake",
Distribution.sbtProjects(`std-snowflake`)
),
makeStdLibDistribution(
"Microsoft",
Distribution.sbtProjects(`std-microsoft`)
),
makeStdLibDistribution("Tableau", Distribution.sbtProjects(`std-tableau`))
)
GatherLicenses.licenseConfigurations := Set("compile")
GatherLicenses.configurationRoot := file("tools/legal-review")
lazy val openLegalReviewReport =
inputKey[Unit](
"Gathers licensing information for relevant dependencies and opens the " +
"report in review mode in the browser. Specify names of distributions to process, separated by spaces. If no names are provided, all distributions are processed."
)
openLegalReviewReport := {
GatherLicenses.run.evaluated
GatherLicenses.runReportServer()
}
lazy val analyzeDependency = inputKey[Unit]("...")
analyzeDependency := GatherLicenses.analyzeDependency.evaluated
val packageBuilder = new DistributionPackage.Builder(
ensoVersion = ensoVersion,
graalVersion = graalMavenPackagesVersion,
graalJavaVersion = graalVersion,
artifactRoot = file("built-distribution")
)
Global / onChangedBuildSource := ReloadOnSourceChanges
Global / excludeLintKeys += logManager
// ============================================================================
// === 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
"-g", // Include debugging information
"-Xlint:unchecked", // Enable additional warnings
"-proc:full" // Annotation processing is enabled
)
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:[email protected]", // 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.
)
ThisBuild / Test / testOptions ++=
Seq(
Tests.Argument(TestFrameworks.ScalaTest, "-oID"),
Tests.Argument(TestFrameworks.JUnit, "--verbosity=1")
) ++
sys.env
.get("ENSO_TEST_JUNIT_DIR")
.map { junitDir =>
Tests.Argument(TestFrameworks.ScalaTest, "-u", junitDir)
}
Compile / console / scalacOptions ~= (_ filterNot (_ == "-Xfatal-warnings"))
lazy val frgaalShouldNotLimitModules = Def.settingKey[Boolean](
"Whether --limit-modules cmd line option should be passed to the java process that runs " +
"the frgaal compiler"
)
// ============================================================================
// === 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.")
// ============================================================================
// === Global Project =========================================================
// ============================================================================
lazy val enso = (project in file("."))
.settings(version := "0.1")
.aggregate(
`akka-native`,
`akka-wrapper`,
`benchmark-java-helpers`,
`benchmarks-common`,
`bench-processor`,
cli,
`common-polyglot-core-utils`,
`connected-lock-manager`,
`connected-lock-manager-server`,
`desktop-environment`,
`directory-watcher-wrapper`,
`distribution-manager`,
downloader,
editions,
`edition-updater`,
`edition-uploader`,
`engine-common`,
`engine-runner-common`,
`engine-runner`,
`enso-test-java-helpers`,
`exploratory-benchmark-java-helpers`,
`fansi-wrapper`,
filewatcher,
`http-test-helper`,
`interpreter-dsl`,
`interpreter-dsl-test`,
`jna-wrapper`,
`json-rpc-server-test`,
`json-rpc-server`,
`language-server`,
`language-server-deps-wrapper`,
launcher,
`library-manager`,
`library-manager-test`,
`locking-test-helper`,
`logging-config`,
`logging-service`,
`logging-service-logback`,
`logging-truffle-connector`,
`logging-utils`,
`logging-utils-akka`,
`persistance`,
`persistance-dsl`,
pkg,
`polyglot-api`,
`polyglot-api-macros`,
`process-utils`,
`profiling-utils`,
`project-manager`,
`refactoring-utils`,
runtime,
`runtime-and-langs`,
`runtime-benchmarks`,
`runtime-compiler`,
`runtime-integration-tests`,
`runtime-parser`,
`runtime-language-arrow`,
`runtime-language-epb`,
`runtime-instrument-common`,
`runtime-instrument-id-execution`,
`runtime-instrument-repl-debugger`,
`runtime-instrument-runtime-server`,
`runtime-integration-tests`,
`runtime-parser`,
`runtime-suggestions`,
`runtime-version-manager`,
`runtime-version-manager-test`,
`runtime-test-instruments`,
`scala-libs-wrapper`,
`scala-yaml`,
searcher,
semver,
`std-aws`,
`std-base`,
`std-benchmarks`,
`std-database`,
`std-google-api`,
`std-image`,
`std-microsoft`,
`std-snowflake`,
`std-table`,
`std-tableau`,
`syntax-rust-definition`,
`task-progress-notifications`,
testkit,
`test-utils`,
`text-buffer`,
`version-output`,
`ydoc-server`,
`zio-wrapper`
)
.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.20"
val akkaHTTPVersion = "10.2.10"
val akkaMockSchedulerVersion = "0.5.5"
val reactiveStreamsVersion = "1.0.3"
val sprayJsonVersion = "1.3.6"
val logbackClassicVersion = JPMSUtils.logbackClassicVersion
val javaDiffVersion = "4.12"
val logbackPkg = Seq(
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
"ch.qos.logback" % "logback-core" % logbackClassicVersion
)
val akkaActor = akkaPkg("actor")
val akkaStream = akkaPkg("stream")
val akkaTestkit = akkaPkg("testkit")
val akkaSLF4J = akkaPkg("slf4j")
val akkaHttp = akkaHTTPPkg("http")
val logbackTest = logbackPkg.map(_ % Test)
val akka =
Seq(
akkaActor,
akkaStream,
akkaHttp
)
// === Cats ===================================================================
val catsVersion = "2.10.0"
val jawnParserVersion = "1.5.1"
// === Circe ==================================================================
val circeVersion = "0.14.7"
val circeGenericExtrasVersion = "0.14.3"
val circe = Seq("circe-core", "circe-generic", "circe-parser")
.map("io.circe" %% _ % circeVersion)
val snakeyamlVersion = "2.3"
// === Commons ================================================================
val commonsCollectionsVersion = "4.4"
val commonsLangVersion = "3.12.0"
val commonsIoVersion = "2.12.0"
val commonsTextVersion = "1.10.0"
val commonsMathVersion = "3.6.1"
val commonsCompressVersion = "1.23.0"
val commonsCliVersion = "1.5.0"
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
)
// === Helidon ================================================================
val jakartaVersion = "2.0.1"
val helidonVersion = "4.1.2"
val helidon = Seq(
"io.helidon" % "helidon" % helidonVersion,
"io.helidon.builder" % "helidon-builder-api" % helidonVersion,
"io.helidon.common" % "helidon-common" % helidonVersion,
"io.helidon.common" % "helidon-common-buffers" % helidonVersion,
"io.helidon.common" % "helidon-common-config" % helidonVersion,
"io.helidon.common" % "helidon-common-configurable" % helidonVersion,
"io.helidon.common" % "helidon-common-context" % helidonVersion,
"io.helidon.common" % "helidon-common-key-util" % helidonVersion,
"io.helidon.common" % "helidon-common-mapper" % helidonVersion,
"io.helidon.common" % "helidon-common-media-type" % helidonVersion,
"io.helidon.common" % "helidon-common-parameters" % helidonVersion,
"io.helidon.common" % "helidon-common-socket" % helidonVersion,
"io.helidon.common" % "helidon-common-security" % helidonVersion,
"io.helidon.common" % "helidon-common-task" % helidonVersion,
"io.helidon.common" % "helidon-common-types" % helidonVersion,
"io.helidon.common" % "helidon-common-tls" % helidonVersion,
"io.helidon.common" % "helidon-common-uri" % helidonVersion,
"io.helidon.common.features" % "helidon-common-features" % helidonVersion,
"io.helidon.common.features" % "helidon-common-features-api" % helidonVersion,
"io.helidon.config" % "helidon-config" % helidonVersion,
"io.helidon.logging" % "helidon-logging-common" % helidonVersion,
"io.helidon.inject" % "helidon-inject-api" % helidonVersion,
"io.helidon.http" % "helidon-http" % helidonVersion,
"io.helidon.http.encoding" % "helidon-http-encoding" % helidonVersion,
"io.helidon.http.media" % "helidon-http-media" % helidonVersion,
"io.helidon.webclient" % "helidon-webclient" % helidonVersion,
"io.helidon.webclient" % "helidon-webclient-api" % helidonVersion,
"io.helidon.webclient" % "helidon-webclient-http1" % helidonVersion,
"io.helidon.webclient" % "helidon-webclient-websocket" % helidonVersion,
"io.helidon.webserver" % "helidon-webserver" % helidonVersion,
"io.helidon.webserver" % "helidon-webserver-websocket" % helidonVersion,
"io.helidon.websocket" % "helidon-websocket" % helidonVersion,
"jakarta.inject" % "jakarta.inject-api" % jakartaVersion
)
// === Jackson ================================================================
val jacksonVersion = "2.15.2"
// === JAXB ================================================================
val jaxbVersion = "4.0.0"
val jaxb = Seq(
"jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion % Benchmark,
"com.sun.xml.bind" % "jaxb-impl" % jaxbVersion % Benchmark
)
val jaActivationVersion = "2.1.0"
// === JMH ====================================================================
val jmhVersion = "1.36"
val jmh = Seq(
"org.openjdk.jmh" % "jmh-core" % jmhVersion % Benchmark,
"org.openjdk.jmh" % "jmh-generator-annprocess" % jmhVersion % Benchmark
)
// === Scala Compiler =========================================================
val scalaCompiler = Seq(
"org.scala-lang" % "scala-reflect" % scalacVersion,
"org.scala-lang" % "scala-compiler" % scalacVersion
)
val scalaLibrary = Seq(
"org.scala-lang" % "scala-library" % scalacVersion
)
val scalaParserCombinatorsVersion = "1.1.2"
val scalaJavaCompatVersion = "1.0.0"
val scalaCollectionCompatVersion = "2.8.1"
// === std-lib ================================================================
val antlrVersion = "4.13.0"
val awsJavaSdkV1Version = "1.12.480"
val awsJavaSdkV2Version = "2.25.36"
val icuVersion = "73.1"
val poiOoxmlVersion = "5.2.3"
val redshiftVersion = "2.1.0.15"
val univocityParsersVersion = "2.9.1"
val xmlbeansVersion = "5.1.1"
val tableauVersion = "0.0.19691.r2d7e5bc8"
// === ZIO ====================================================================
val zioVersion = "2.0.14"
val zioInteropCatsVersion = "23.0.0.6"
val zioIzumiReflectVersion = "2.3.8"
val zio = Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion
)
// === Sentry =================================================================
val ioSentryVersion = "6.28.0"
val ioSentry = Seq(
"io.sentry" % "sentry-logback" % ioSentryVersion,
"io.sentry" % "sentry" % ioSentryVersion
)
// === Bouncy Castle ==========================================================
val bouncyCastleVersion = "1.76"
val bouncyCastle = Seq(
"org.bouncycastle" % "bcutil-jdk18on" % bouncyCastleVersion,
"org.bouncycastle" % "bcpkix-jdk18on" % bouncyCastleVersion,
"org.bouncycastle" % "bcprov-jdk18on" % bouncyCastleVersion
)
// === Google =================================================================
val googleApiClientVersion = "2.2.0"
val googleApiServicesSheetsVersion = "v4-rev612-1.25.0"
val googleAnalyticsAdminVersion = "0.62.0"
val googleAnalyticsDataVersion = "0.63.0"
// === Other ==================================================================
val bcpkixJdk15Version = "1.70"
val declineVersion = "2.4.1"
val diffsonVersion = "4.4.0"
val directoryWatcherVersion = "0.18.0"
val flatbuffersVersion = "24.3.25"
val guavaVersion = "32.0.0-jre"
val jlineVersion = "3.23.0"
val jgitVersion = "6.7.0.202309050840-r"
val kindProjectorVersion = "0.13.2"
val mockitoScalaVersion = "1.17.14"
val newtypeVersion = "0.4.4"
val pprintVersion = "0.8.1"
val pureconfigVersion = "0.17.4"
val scalacheckVersion = "1.17.0"
val scalacticVersion = "3.3.0-SNAP4"
val scalaLoggingVersion = "3.9.4"
val scalameterVersion = "0.19"
val scalatestVersion = "3.3.0-SNAP4"
val slf4jVersion = JPMSUtils.slf4jVersion
val sqliteVersion = "3.46.1.0"
val tikaVersion = "2.4.1"
val typesafeConfigVersion = "1.4.2"
val junitVersion = "4.13.2"
val junitIfVersion = "0.13.2"
val hamcrestVersion = "1.3"
val netbeansApiVersion = "RELEASE180"
val opencvVersion = "4.7.0-0"
val fansiVersion = "0.4.0"
val httpComponentsVersion = "4.4.1"
val apacheArrowVersion = "14.0.1"
val snowflakeJDBCVersion = "3.15.0"
val mssqlserverJDBCVersion = "12.6.2.jre11"
val jsoniterVersion = "2.28.5"
val jnaVersion = "5.14.0"
val googleProtobufVersion = "3.25.1"
val shapelessVersion = "2.3.10"
val postgresVersion = "42.4.0"
// ============================================================================
// === Utility methods =====================================================
// ============================================================================
// TODO: Remove
lazy val componentModulesIds =
taskKey[Seq[ModuleID]](
"Gather all sbt module IDs that will be put on the module-path for the engine runner"
)
(ThisBuild / componentModulesIds) := {
GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.toolsPkgs ++ helidon ++ logbackPkg ++ Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion,
(`runtime-language-arrow` / projectID).value,
(`syntax-rust-definition` / projectID).value,
(`ydoc-server` / projectID).value,
(`profiling-utils` / projectID).value
)
}
lazy val componentModulesPaths =
taskKey[Seq[File]](
"Gathers all component modules (Jar archives that should be put on module-path" +
" as files"
)
(ThisBuild / componentModulesPaths) := {
val runnerCp = (`engine-runner` / Runtime / fullClasspath).value
val runtimeCp = (`runtime` / Runtime / fullClasspath).value
val langServerCp = (`language-server` / Runtime / fullClasspath).value
val akkaWrapperCp = (`akka-wrapper` / Compile / fullClasspath).value
val fullCp = (runnerCp ++ runtimeCp ++ langServerCp ++ akkaWrapperCp).distinct
val log = streams.value.log
val thirdPartyModIds =
GraalVM.modules ++
GraalVM.langsPkgs ++
GraalVM.toolsPkgs ++
helidon ++
scalaLibrary ++
ioSentry ++
logbackPkg ++
Seq(
"org.scala-lang" % "scala-reflect" % scalacVersion,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion,
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion,
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
"com.google.protobuf" % "protobuf-java" % googleProtobufVersion,
"commons-cli" % "commons-cli" % commonsCliVersion,
"commons-io" % "commons-io" % commonsIoVersion,
"org.yaml" % "snakeyaml" % snakeyamlVersion,
"org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion,
"com.typesafe" % "config" % typesafeConfigVersion,
"org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion,
"org.jline" % "jline" % jlineVersion,
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
"org.apache.commons" % "commons-compress" % commonsCompressVersion,
"org.apache.tika" % "tika-core" % tikaVersion,
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.yaml" % "snakeyaml" % snakeyamlVersion,
"com.ibm.icu" % "icu4j" % icuVersion
)
val thirdPartyMods = JPMSUtils.filterModulesFromClasspath(
fullCp,
thirdPartyModIds,
log,
projName = moduleName.value,
scalaBinaryVersion.value,
shouldContainAll = true
)
val thirdPartyModFiles = thirdPartyMods.map(_.data)
val ourMods = Seq(
(`common-polyglot-core-utils` / Compile / exportedModuleBin).value,
(`engine-common` / Compile / exportedModuleBin).value,
(`engine-runner` / Compile / exportedModuleBin).value,
(`engine-runner-common` / Compile / exportedModuleBin).value,
(`polyglot-api` / Compile / exportedModuleBin).value,
(`polyglot-api-macros` / Compile / exportedModuleBin).value,
(`runtime` / Compile / exportedModuleBin).value,
(`syntax-rust-definition` / Compile / exportedModuleBin).value,
(`runtime-compiler` / Compile / exportedModuleBin).value,
(`runtime-parser` / Compile / exportedModuleBin).value,
(`runtime-suggestions` / Compile / exportedModuleBin).value,
(`runtime-instrument-common` / Compile / exportedModuleBin).value,
(`runtime-instrument-id-execution` / Compile / exportedModuleBin).value,
(`runtime-instrument-repl-debugger` / Compile / exportedModuleBin).value,
(`runtime-instrument-runtime-server` / Compile / exportedModuleBin).value,
(`runtime-language-arrow` / Compile / exportedModuleBin).value,
(`runtime-language-epb` / Compile / exportedModuleBin).value,
(`persistance` / Compile / exportedModuleBin).value,
(`cli` / Compile / exportedModuleBin).value,
(`json-rpc-server` / Compile / exportedModuleBin).value,
(`connected-lock-manager` / Compile / exportedModuleBin).value,
(`connected-lock-manager-server` / Compile / exportedModuleBin).value,
(`distribution-manager` / Compile / exportedModuleBin).value,
(`downloader` / Compile / exportedModuleBin).value,
(`filewatcher` / Compile / exportedModuleBin).value,
(`editions` / Compile / exportedModuleBin).value,
(`language-server` / Compile / exportedModuleBin).value,
(`library-manager` / Compile / exportedModuleBin).value,
(`akka-wrapper` / Compile / exportedModuleBin).value,
(`zio-wrapper` / Compile / exportedModuleBin).value,
(`language-server-deps-wrapper` / Compile / exportedModuleBin).value,
(`directory-watcher-wrapper` / Compile / exportedModuleBin).value,
(`jna-wrapper` / Compile / exportedModuleBin).value,
(`ydoc-server` / Compile / exportedModuleBin).value,
(`library-manager` / Compile / exportedModuleBin).value,
(`logging-config` / Compile / exportedModuleBin).value,
(`logging-utils` / Compile / exportedModuleBin).value,
(`logging-utils-akka` / Compile / exportedModuleBin).value,
(`logging-service` / Compile / exportedModuleBin).value,
(`logging-service-logback` / Compile / exportedModuleBin).value,
(`pkg` / Compile / exportedModuleBin).value,
(`refactoring-utils` / Compile / exportedModuleBin).value,
(`task-progress-notifications` / Compile / exportedModuleBin).value,
(`semver` / Compile / exportedModuleBin).value,
(`searcher` / Compile / exportedModuleBin).value,
(`text-buffer` / Compile / exportedModuleBin).value,
(`version-output` / Compile / exportedModuleBin).value,
(`scala-yaml` / Compile / exportedModuleBin).value,
(`scala-libs-wrapper` / Compile / exportedModuleBin).value,
(`fansi-wrapper` / Compile / exportedModuleBin).value,
(`edition-updater` / Compile / exportedModuleBin).value,
(`profiling-utils` / Compile / exportedModuleBin).value
)
ourMods ++ thirdPartyModFiles
}
/** Common settings for our wrappers of some *problematic* dependencies that are not
* compatible with the JPMS system, i.e., these dependencies cannot be put on module-path.
* These projects contain only single `module-info.java` source.
* Before this source is compiled, all the dependencies are gathered via the `assembly`
* task into a Jar.
* The `module-info.java` exports all the packages from these dependencies.
* Note that this is the recommended way how to handle dependencies that are not
* JPMS-friendly.
*
* `exportedModule` of these projects return path to the assembled modular Jar.
* The projects should define:
* - `moduleDependencies`
* - `patchModules`
* - `assembly / assemblyExcludedJars`
*/
lazy val modularFatJarWrapperSettings = frgaalJavaCompilerSetting ++ Seq(
Compile / forceModuleInfoCompilation := true,
Compile / exportedModuleBin := assembly
.dependsOn(Compile / compileModuleInfo)
.value,
Compile / exportedModule := (Compile / exportedModuleBin).value
)
// ============================================================================
// === Internal Libraries =====================================================
// ============================================================================
lazy val `text-buffer` = project
.in(file("lib/scala/text-buffer"))
.enablePlugins(JPMSPlugin)
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
scalaModuleDependencySetting,
mixedJavaScalaProjectSetting,
commands += WithDebugCommand.withDebug,
javaModuleName := "org.enso.text.buffer",
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
)
)
lazy val rustParserTargetDirectory =
SettingKey[File]("target directory for the Rust parser")
(`syntax-rust-definition` / rustParserTargetDirectory) := {
target.value / "rust" / "parser-jni"
}
val generateRustParserLib =
TaskKey[Seq[File]]("generateRustParserLib", "Generates parser native library")
`syntax-rust-definition` / generateRustParserLib := {
val log = state.value.log
val libGlob =
(`syntax-rust-definition` / rustParserTargetDirectory).value.toGlob / "libenso_parser.so"
val allLibs = FileTreeView.default.list(Seq(libGlob)).map(_._1)
if (
sys.env.get("CI").isDefined ||
allLibs.isEmpty ||
(`syntax-rust-definition` / generateRustParserLib).inputFileChanges.hasChanges
) {
val os = System.getProperty("os.name")
val target = os.toLowerCase() match {
case DistributionPackage.OS.Linux.name =>
Some("x86_64-unknown-linux-musl")
case _ =>
None
}
target.foreach { t =>
Cargo.rustUp(t, log)
}
val profile = if (BuildInfo.isReleaseMode) "release" else "fuzz"
val arguments = Seq(
"build",
"-p",
"enso-parser-jni",
"--profile",
profile,
"-Z",
"unstable-options"
) ++ target.map(t => Seq("--target", t)).getOrElse(Seq()) ++
Seq(
"--out-dir",
(`syntax-rust-definition` / rustParserTargetDirectory).value.toString
)
val envVars = target
.map(_ => Seq(("RUSTFLAGS", "-C target-feature=-crt-static")))
.getOrElse(Seq())
Cargo.run(arguments, log, envVars)
}
FileTreeView.default.list(Seq(libGlob)).map(_._1.toFile)
}
`syntax-rust-definition` / generateRustParserLib / fileInputs +=
(`syntax-rust-definition` / baseDirectory).value.toGlob / "jni" / "src" / ** / "*.rs"
`syntax-rust-definition` / generateRustParserLib / fileInputs +=
(`syntax-rust-definition` / baseDirectory).value.toGlob / "src" / ** / "*.rs"
val generateParserJavaSources = TaskKey[Seq[File]](
"generateParserJavaSources",
"Generates Java sources for Rust parser"
)
`syntax-rust-definition` / generateParserJavaSources := {
generateRustParser(
(`syntax-rust-definition` / Compile / sourceManaged).value,
(`syntax-rust-definition` / generateParserJavaSources).inputFileChanges,
state.value.log
)
}
`syntax-rust-definition` / generateParserJavaSources / fileInputs +=
(`syntax-rust-definition` / baseDirectory).value.toGlob / "generate-java" / "src" / ** / "*.rs"
`syntax-rust-definition` / generateParserJavaSources / fileInputs +=
(`syntax-rust-definition` / baseDirectory).value.toGlob / "src" / ** / "*.rs"
def generateRustParser(
base: File,
changes: sbt.nio.FileChanges,
log: ManagedLogger
): Seq[File] = {
import scala.jdk.CollectionConverters._
import java.nio.file.Paths
val syntaxPkgs = Paths.get("org", "enso", "syntax2").toString
val fullPkg = Paths.get(base.toString, syntaxPkgs).toFile
if (!fullPkg.exists()) {
fullPkg.mkdirs()
}
if (changes.hasChanges) {
val args = Seq(
"run",
"-p",
"enso-parser-generate-java",
"--bin",
"enso-parser-generate-java",
fullPkg.toString
)
Cargo.run(args, log)
}
FileUtils.listFiles(fullPkg, Array("scala", "java"), true).asScala.toSeq
}
lazy val `syntax-rust-definition` = project
.in(file("lib/rust/parser"))
.enablePlugins(JPMSPlugin)
.configs(Test)
.settings(
version := mavenUploadVersion,
Compile / exportJars := true,
javadocSettings,
publish / skip := false,
autoScalaLibrary := false,
crossPaths := false,
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion
),
Compile / moduleDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion
),
javaModuleName := "org.enso.syntax",
Compile / sourceGenerators += generateParserJavaSources,
Compile / resourceGenerators += generateRustParserLib,
Compile / javaSource := baseDirectory.value / "generate-java" / "java",
Compile / compile / javacOptions ++= Seq("-source", "11", "-target", "11")
)
lazy val `scala-yaml` = (project in file("lib/scala/yaml"))
.enablePlugins(JPMSPlugin)
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
scalaModuleDependencySetting,
mixedJavaScalaProjectSetting,
libraryDependencies ++= Seq(
"org.yaml" % "snakeyaml" % snakeyamlVersion % "provided"
),
Compile / moduleDependencies ++= Seq(
"org.yaml" % "snakeyaml" % snakeyamlVersion
),
Compile / internalModuleDependencies := Seq(
(`scala-libs-wrapper` / Compile / exportedModule).value
)
)
.dependsOn(`scala-libs-wrapper`)
lazy val pkg = (project in file("lib/scala/pkg"))
.enablePlugins(JPMSPlugin)
.settings(
frgaalJavaCompilerSetting,
scalaModuleDependencySetting,
compileOrder := CompileOrder.ScalaThenJava,
version := "0.1",
Compile / run / mainClass := Some("org.enso.pkg.Main"),
libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion % "provided",
"org.yaml" % "snakeyaml" % snakeyamlVersion % "provided",
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.apache.commons" % "commons-compress" % commonsCompressVersion
),
Compile / moduleDependencies ++= Seq(
"org.apache.commons" % "commons-compress" % commonsCompressVersion,
"org.yaml" % "snakeyaml" % snakeyamlVersion
),
Compile / internalModuleDependencies := Seq(
(`editions` / Compile / exportedModule).value,
(`semver` / Compile / exportedModule).value,
(`scala-yaml` / Compile / exportedModule).value,
(`scala-libs-wrapper` / Compile / exportedModule).value
)
)
.dependsOn(editions)
lazy val `akka-native` = project
.in(file("lib/scala/akka-native"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
akkaActor
),
// Note [Native Image Workaround for GraalVM 20.2]
libraryDependencies += "org.graalvm.nativeimage" % "svm" % graalMavenPackagesVersion % "provided"
)
lazy val `profiling-utils` = project
.in(file("lib/scala/profiling-utils"))
.enablePlugins(JPMSPlugin)
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
compileOrder := CompileOrder.JavaThenScala,
javaModuleName := "org.enso.profiling",
Compile / exportJars := true,
version := "0.1",
libraryDependencies ++= Seq(
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion