2021-11-23 11:51:17 +03:00
import LibraryManifestGenerator.BundledLibrary
2024-05-11 10:51:11 +03:00
import org.enso.build.BenchTasks._
2019-09-10 19:53:23 +03:00
import org.enso.build.WithDebugCommand
2022-09-20 18:50:27 +03:00
import org.apache.commons.io.FileUtils
2020-08-10 13:14:39 +03:00
import sbt.Keys.{libraryDependencies, scalacOptions}
2020-03-20 11:01:03 +03:00
import sbt.addCompilerPlugin
2024-05-11 10:51:11 +03:00
import sbt.complete.DefaultParsers._
2022-05-11 13:12:18 +03:00
import sbt.complete.Parser
2022-09-20 18:50:27 +03:00
import sbt.nio.file.FileTreeView
2022-11-23 17:30:48 +03:00
import sbt.internal.util.ManagedLogger
2022-10-24 12:55:18 +03:00
import src.main.scala.licenses.{
DistributionDescription,
SBTDistributionComponent
}
2023-12-18 20:22:16 +03:00
// This import is unnecessary, but bit adds a proper code completion features
// to IntelliJ.
2024-05-11 10:51:11 +03:00
import JPMSPlugin.autoImport._
2020-03-24 13:28:03 +03:00
2021-02-22 16:32:55 +03:00
import java.io.File
2024-05-17 15:42:35 +03:00
import java.nio.file.Paths
2022-05-11 13:12:18 +03:00
2020-04-30 22:30:55 +03:00
// ============================================================================
// === Global Configuration ===================================================
// ============================================================================
2019-06-07 14:49:47 +03:00
2023-07-20 18:11:30 +03:00
val scalacVersion = "2.13.11"
2023-11-17 21:02:36 +03:00
// source version of the Java language
val javaVersion = "21"
// version of the GraalVM JDK
2024-02-19 15:08:59 +03:00
val graalVersion = "21.0.2"
2023-07-20 18:11:30 +03:00
// Version used for the Graal/Truffle related Maven packages
2023-11-17 21:02:36 +03:00
// 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.
2024-04-12 20:01:49 +03:00
val graalMavenPackagesVersion = "24.0.0"
2023-11-17 21:02:36 +03:00
val targetJavaVersion = "17"
2023-07-20 18:11:30 +03:00
val defaultDevEnsoVersion = "0.0.0-dev"
2022-02-07 17:14:32 +03:00
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
2024-06-14 17:01:37 +03:00
val mavenUploadVersion = "0.2-SNAPSHOT"
2020-08-07 12:18:09 +03:00
2024-03-13 15:16:13 +03:00
// 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 =>
Java and Graal versions are checked before the build starts (#9106)
Add checks of Java and GraalVM versions before the `sbt` project is fully loaded. This ensures that all the devs have exactly the version specified in our `build.sbt`.
# Important Notes
Trying to start `sbt` with a different java versions now results in:
```
$ java -version
openjdk version "21" 2023-09-19
OpenJDK Runtime Environment GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15)
OpenJDK 64-Bit Server VM GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15, mixed mode, sharing)
$ sbt
[info] welcome to sbt 1.9.7 (GraalVM Community Java 21)
[info] loading settings for project enso-build from plugins.sbt ...
[info] loading project definition from /home/pavel/dev/enso/project
[info] loading settings for project enso from build.sbt ...
[info] resolving key references (65272 settings) ...
[info] set current project to enso (in build file:/home/pavel/dev/enso/)
[error] Running on GraalVM version 21. Expected GraalVM version 21.0.2.
[error] Total time: 0 s, completed Feb 20, 2024, 1:06:18 PM
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)
```
```
$ java -version
openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment JBR-17.0.10+1-1087.17-jcef (build 17.0.10+1-b1087.17)
OpenJDK 64-Bit Server VM JBR-17.0.10+1-1087.17-jcef (build 17.0.10+1-b1087.17, mixed mode)
$ sbt
[info] welcome to sbt 1.9.7 (JetBrains s.r.o. Java 17.0.10)
[info] loading settings for project enso-build from plugins.sbt ...
[info] loading project definition from /home/pavel/dev/enso/project
[info] compiling 44 Scala sources to /home/pavel/dev/enso/project/target/scala-2.12/sbt-1.0/classes ...
[info] loading settings for project enso from build.sbt ...
[info] resolving key references (65272 settings) ...
[info] set current project to enso (in build file:/home/pavel/dev/enso/)
[warn] Running on non-GraalVM JVM (The actual java.vendor is JetBrains s.r.o.). Expected GraalVM Community java.vendor.
[error] Running on Java version 17. Expected Java version 21.
[error] Total time: 0 s, completed Feb 20, 2024, 1:07:40 PM
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)
```
2024-02-21 13:33:32 +03:00
GraalVM.versionCheck(
graalVersion,
graalMavenPackagesVersion,
javaVersion,
2024-03-13 15:16:13 +03:00
s
Java and Graal versions are checked before the build starts (#9106)
Add checks of Java and GraalVM versions before the `sbt` project is fully loaded. This ensures that all the devs have exactly the version specified in our `build.sbt`.
# Important Notes
Trying to start `sbt` with a different java versions now results in:
```
$ java -version
openjdk version "21" 2023-09-19
OpenJDK Runtime Environment GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15)
OpenJDK 64-Bit Server VM GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15, mixed mode, sharing)
$ sbt
[info] welcome to sbt 1.9.7 (GraalVM Community Java 21)
[info] loading settings for project enso-build from plugins.sbt ...
[info] loading project definition from /home/pavel/dev/enso/project
[info] loading settings for project enso from build.sbt ...
[info] resolving key references (65272 settings) ...
[info] set current project to enso (in build file:/home/pavel/dev/enso/)
[error] Running on GraalVM version 21. Expected GraalVM version 21.0.2.
[error] Total time: 0 s, completed Feb 20, 2024, 1:06:18 PM
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)
```
```
$ java -version
openjdk version "17.0.10" 2024-01-16
OpenJDK Runtime Environment JBR-17.0.10+1-1087.17-jcef (build 17.0.10+1-b1087.17)
OpenJDK 64-Bit Server VM JBR-17.0.10+1-1087.17-jcef (build 17.0.10+1-b1087.17, mixed mode)
$ sbt
[info] welcome to sbt 1.9.7 (JetBrains s.r.o. Java 17.0.10)
[info] loading settings for project enso-build from plugins.sbt ...
[info] loading project definition from /home/pavel/dev/enso/project
[info] compiling 44 Scala sources to /home/pavel/dev/enso/project/target/scala-2.12/sbt-1.0/classes ...
[info] loading settings for project enso from build.sbt ...
[info] resolving key references (65272 settings) ...
[info] set current project to enso (in build file:/home/pavel/dev/enso/)
[warn] Running on non-GraalVM JVM (The actual java.vendor is JetBrains s.r.o.). Expected GraalVM Community java.vendor.
[error] Running on Java version 17. Expected Java version 21.
[error] Total time: 0 s, completed Feb 20, 2024, 1:07:40 PM
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)
```
2024-02-21 13:33:32 +03:00
)
}
Global / onLoad := {
val old = (Global / onLoad).value
startupStateTransition compose old
}
2023-11-17 21:02:36 +03:00
2020-08-07 12:18:09 +03:00
/* 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
2021-01-05 17:14:08 +03:00
* shared. If the version numbers ever diverge, make sure to update the build
2020-08-07 12:18:09 +03:00
* scripts at .github/workflows accordingly.
*/
2021-07-08 16:38:20 +03:00
/* 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.
*/
2022-02-07 17:14:32 +03:00
/* 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.
*/
2021-05-14 15:08:39 +03:00
ThisBuild / organization := "org.enso"
ThisBuild / scalaVersion := scalacVersion
2024-06-10 15:00:51 +03:00
ThisBuild / publish / skip := true
2020-10-09 17:19:58 +03:00
2022-07-01 04:58:14 +03:00
/* 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)
2020-10-09 17:19:58 +03:00
lazy val gatherLicenses =
Add AWS SSO JARs to the `Standard.AWS` library (#9782)
As reported by our users, when using the AWS SSO, our code was failing with:
```
Execution finished with an error: To use Sso related properties in the 'xyz' profile, the 'sso' service module must be on the class path.
```
This PR adds the missing JARs to fix that.
Additionally it improves the license review tool UX a bit (parts of #9122):
- sorting the report by amount of problems, so that dependencies with unresolved problems appear at the top,
- semi-automatic helper button to rename package configurations after a version bump,
- button to remove stale entries from config (files or copyrights that disappeared after update),
- button to add custom copyright notice text straight from the report UI,
- button to set a file as the license for the project (creating the `custom-license` file automatically)
- ability to filter processed projects - e.g. `openLegalReviewReport AWS` will only run on the AWS subproject - saving time processing unchanged dependencies,
- updated the license search heuristic, fixing a problem with duplicates:
- if we had dependencies `netty-http` and `netty-http2`, because of a prefix-check logic, the notices for `netty-http` would also appear again for `netty-http2`, which is not valid. I have improved the heuristic to avoid these false positives and removed them from the current report.
- WIP: button to mark a license type as reviewed (not finished in this PR).
2024-04-25 21:44:51 +03:00
taskKey[Unit](
"Gathers licensing information for relevant dependencies of all distributions"
)
2020-10-22 17:12:28 +03:00
gatherLicenses := {
Add AWS SSO JARs to the `Standard.AWS` library (#9782)
As reported by our users, when using the AWS SSO, our code was failing with:
```
Execution finished with an error: To use Sso related properties in the 'xyz' profile, the 'sso' service module must be on the class path.
```
This PR adds the missing JARs to fix that.
Additionally it improves the license review tool UX a bit (parts of #9122):
- sorting the report by amount of problems, so that dependencies with unresolved problems appear at the top,
- semi-automatic helper button to rename package configurations after a version bump,
- button to remove stale entries from config (files or copyrights that disappeared after update),
- button to add custom copyright notice text straight from the report UI,
- button to set a file as the license for the project (creating the `custom-license` file automatically)
- ability to filter processed projects - e.g. `openLegalReviewReport AWS` will only run on the AWS subproject - saving time processing unchanged dependencies,
- updated the license search heuristic, fixing a problem with duplicates:
- if we had dependencies `netty-http` and `netty-http2`, because of a prefix-check logic, the notices for `netty-http` would also appear again for `netty-http2`, which is not valid. I have improved the heuristic to avoid these false positives and removed them from the current report.
- WIP: button to mark a license type as reviewed (not finished in this PR).
2024-04-25 21:44:51 +03:00
val _ = GatherLicenses.run.toTask("").value
2020-10-22 17:12:28 +03:00
}
2020-10-19 11:50:12 +03:00
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
2020-12-09 16:58:11 +03:00
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
2021-07-08 16:38:20 +03:00
def makeStdLibDistribution(
name: String,
components: Seq[SBTDistributionComponent]
): DistributionDescription =
Distribution(
name,
file(s"distribution/lib/Standard/$name/$stdLibVersion/THIRD-PARTY"),
components
)
2020-10-09 17:19:58 +03:00
GatherLicenses.distributions := Seq(
2020-10-22 17:12:28 +03:00
Distribution(
"launcher",
file("distribution/launcher/THIRD-PARTY"),
Distribution.sbtProjects(launcher)
),
Distribution(
"engine",
file("distribution/engine/THIRD-PARTY"),
Distribution.sbtProjects(
runtime,
`engine-runner`,
`language-server`
2020-10-09 17:19:58 +03:00
)
2020-10-22 17:12:28 +03:00
),
2020-12-09 16:58:11 +03:00
Distribution(
"project-manager",
file("distribution/project-manager/THIRD-PARTY"),
Distribution.sbtProjects(`project-manager`)
),
2021-07-08 16:38:20 +03:00
makeStdLibDistribution("Base", Distribution.sbtProjects(`std-base`)),
2021-09-03 22:41:12 +03:00
makeStdLibDistribution(
"Google_Api",
Distribution.sbtProjects(`std-google-api`)
),
2021-07-08 16:38:20 +03:00
makeStdLibDistribution("Table", Distribution.sbtProjects(`std-table`)),
makeStdLibDistribution("Database", Distribution.sbtProjects(`std-database`)),
2023-05-04 20:36:51 +03:00
makeStdLibDistribution("Image", Distribution.sbtProjects(`std-image`)),
2024-03-20 13:06:12 +03:00
makeStdLibDistribution("AWS", Distribution.sbtProjects(`std-aws`)),
2024-07-30 13:13:08 +03:00
makeStdLibDistribution(
"Snowflake",
Distribution.sbtProjects(`std-snowflake`)
),
makeStdLibDistribution("Microsoft", Distribution.sbtProjects(`std-microsoft`))
2020-10-22 17:12:28 +03:00
)
2021-07-08 16:38:20 +03:00
2020-10-09 17:19:58 +03:00
GatherLicenses.licenseConfigurations := Set("compile")
GatherLicenses.configurationRoot := file("tools/legal-review")
lazy val openLegalReviewReport =
Add AWS SSO JARs to the `Standard.AWS` library (#9782)
As reported by our users, when using the AWS SSO, our code was failing with:
```
Execution finished with an error: To use Sso related properties in the 'xyz' profile, the 'sso' service module must be on the class path.
```
This PR adds the missing JARs to fix that.
Additionally it improves the license review tool UX a bit (parts of #9122):
- sorting the report by amount of problems, so that dependencies with unresolved problems appear at the top,
- semi-automatic helper button to rename package configurations after a version bump,
- button to remove stale entries from config (files or copyrights that disappeared after update),
- button to add custom copyright notice text straight from the report UI,
- button to set a file as the license for the project (creating the `custom-license` file automatically)
- ability to filter processed projects - e.g. `openLegalReviewReport AWS` will only run on the AWS subproject - saving time processing unchanged dependencies,
- updated the license search heuristic, fixing a problem with duplicates:
- if we had dependencies `netty-http` and `netty-http2`, because of a prefix-check logic, the notices for `netty-http` would also appear again for `netty-http2`, which is not valid. I have improved the heuristic to avoid these false positives and removed them from the current report.
- WIP: button to mark a license type as reviewed (not finished in this PR).
2024-04-25 21:44:51 +03:00
inputKey[Unit](
2020-10-09 17:19:58 +03:00
"Gathers licensing information for relevant dependencies and opens the " +
Add AWS SSO JARs to the `Standard.AWS` library (#9782)
As reported by our users, when using the AWS SSO, our code was failing with:
```
Execution finished with an error: To use Sso related properties in the 'xyz' profile, the 'sso' service module must be on the class path.
```
This PR adds the missing JARs to fix that.
Additionally it improves the license review tool UX a bit (parts of #9122):
- sorting the report by amount of problems, so that dependencies with unresolved problems appear at the top,
- semi-automatic helper button to rename package configurations after a version bump,
- button to remove stale entries from config (files or copyrights that disappeared after update),
- button to add custom copyright notice text straight from the report UI,
- button to set a file as the license for the project (creating the `custom-license` file automatically)
- ability to filter processed projects - e.g. `openLegalReviewReport AWS` will only run on the AWS subproject - saving time processing unchanged dependencies,
- updated the license search heuristic, fixing a problem with duplicates:
- if we had dependencies `netty-http` and `netty-http2`, because of a prefix-check logic, the notices for `netty-http` would also appear again for `netty-http2`, which is not valid. I have improved the heuristic to avoid these false positives and removed them from the current report.
- WIP: button to mark a license type as reviewed (not finished in this PR).
2024-04-25 21:44:51 +03:00
"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."
2020-10-09 17:19:58 +03:00
)
openLegalReviewReport := {
Add AWS SSO JARs to the `Standard.AWS` library (#9782)
As reported by our users, when using the AWS SSO, our code was failing with:
```
Execution finished with an error: To use Sso related properties in the 'xyz' profile, the 'sso' service module must be on the class path.
```
This PR adds the missing JARs to fix that.
Additionally it improves the license review tool UX a bit (parts of #9122):
- sorting the report by amount of problems, so that dependencies with unresolved problems appear at the top,
- semi-automatic helper button to rename package configurations after a version bump,
- button to remove stale entries from config (files or copyrights that disappeared after update),
- button to add custom copyright notice text straight from the report UI,
- button to set a file as the license for the project (creating the `custom-license` file automatically)
- ability to filter processed projects - e.g. `openLegalReviewReport AWS` will only run on the AWS subproject - saving time processing unchanged dependencies,
- updated the license search heuristic, fixing a problem with duplicates:
- if we had dependencies `netty-http` and `netty-http2`, because of a prefix-check logic, the notices for `netty-http` would also appear again for `netty-http2`, which is not valid. I have improved the heuristic to avoid these false positives and removed them from the current report.
- WIP: button to mark a license type as reviewed (not finished in this PR).
2024-04-25 21:44:51 +03:00
GatherLicenses.run.evaluated
2020-10-09 17:19:58 +03:00
GatherLicenses.runReportServer()
}
2019-09-12 17:47:25 +03:00
2020-10-19 11:50:12 +03:00
lazy val analyzeDependency = inputKey[Unit]("...")
analyzeDependency := GatherLicenses.analyzeDependency.evaluated
2021-01-15 18:26:51 +03:00
val packageBuilder = new DistributionPackage.Builder(
ensoVersion = ensoVersion,
2023-07-20 18:11:30 +03:00
graalVersion = graalMavenPackagesVersion,
graalJavaVersion = graalVersion,
2021-01-15 18:26:51 +03:00
artifactRoot = file("built-distribution")
)
2019-10-29 17:32:50 +03:00
Global / onChangedBuildSource := ReloadOnSourceChanges
2022-06-01 16:50:46 +03:00
Global / excludeLintKeys += logManager
2019-10-29 17:32:50 +03:00
2020-04-30 22:30:55 +03:00
// ============================================================================
// === Compiler Options =======================================================
// ============================================================================
2019-09-12 17:47:25 +03:00
2021-05-14 15:08:39 +03:00
ThisBuild / javacOptions ++= Seq(
2023-11-20 11:43:32 +03:00
"-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
2020-10-22 17:12:28 +03:00
)
2019-11-05 02:22:49 +03:00
2021-05-14 15:08:39 +03:00
ThisBuild / scalacOptions ++= Seq(
2020-10-22 17:12:28 +03:00
"-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.
2021-05-20 16:03:14 +03:00
"-Vimplicits", // Prints implicit resolution chains when no implicit can be found.
"-Vtype-diffs", // Prints type errors as coloured diffs between types.
2020-10-22 17:12:28 +03:00
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
2021-05-20 16:03:14 +03:00
"-Xfatal-warnings", // Make warnings fatal so they don't make it onto main (use @nowarn for local suppression)
2020-10-22 17:12:28 +03:00
"-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.
2021-05-20 16:03:14 +03:00
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
2020-10-22 17:12:28 +03:00
"-Ywarn-unused:locals", // Warn if a local definition is unused.
"-Ywarn-unused:params", // Warn if a value parameter is unused.
2021-05-20 16:03:14 +03:00
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates" // Warn if a private member is unused.
2020-10-22 17:12:28 +03:00
)
2020-04-30 22:30:55 +03:00
2022-10-07 05:36:07 +03:00
ThisBuild / Test / testOptions ++=
Show JUnit info on test completion (#10097)
Show JUnit test execution info:
```
sbt:enso> ydoc-server/test
[info] Test run org.enso.ydoc.polyfill.web.EventEmitterTest finished: 0 failed, 0 ignored, 2 total, 1.017
[info] Test run org.enso.ydoc.polyfill.web.CryptoTest finished: 0 failed, 0 ignored, 3 total, 0.074s
[info] Test run org.enso.ydoc.polyfill.web.EventTargetTest finished: 0 failed, 0 ignored, 2 total, 0.038s
[info] Test run org.enso.ydoc.polyfill.web.AbortControllerTest finished: 0 failed, 0 ignored, 2 total, 0.041s
[info] Test run org.enso.ydoc.polyfill.ParserPolyfillTest finished: 0 failed, 0 ignored, 3 total, 0.042s
```
2024-05-27 17:40:45 +03:00
Seq(
Tests.Argument(TestFrameworks.ScalaTest, "-oID"),
Tests.Argument(TestFrameworks.JUnit, "--verbosity=1")
) ++
2022-10-07 05:36:07 +03:00
sys.env
.get("ENSO_TEST_JUNIT_DIR")
.map { junitDir =>
Tests.Argument(TestFrameworks.ScalaTest, "-u", junitDir)
}
2022-07-12 15:58:41 +03:00
2021-05-14 15:08:39 +03:00
Compile / console / scalacOptions ~= (_ filterNot (_ == "-Xfatal-warnings"))
2020-05-06 21:00:03 +03:00
2020-04-30 22:30:55 +03:00
// ============================================================================
// === Benchmark Configuration ================================================
// ============================================================================
2019-07-11 14:23:00 +03:00
2019-09-10 19:53:23 +03:00
lazy val Benchmark = config("bench") extend sbt.Test
// Native Image Generation
2020-12-09 16:58:11 +03:00
lazy val rebuildNativeImage = taskKey[Unit]("Force to rebuild native image")
2019-08-28 18:40:08 +03:00
lazy val buildNativeImage =
2020-12-09 16:58:11 +03:00
taskKey[Unit]("Ensure that the Native Image is built.")
2019-06-07 14:49:47 +03:00
2020-04-30 22:30:55 +03:00
// ============================================================================
// === Global Project =========================================================
// ============================================================================
2019-09-12 17:47:25 +03:00
2019-06-13 12:49:04 +03:00
lazy val enso = (project in file("."))
2019-06-14 18:26:49 +03:00
.settings(version := "0.1")
2019-11-08 20:32:48 +03:00
.aggregate(
2023-11-19 18:38:31 +03:00
`persistance-dsl`,
`persistance`,
2020-06-29 17:36:44 +03:00
`interpreter-dsl`,
2023-04-28 18:32:13 +03:00
`interpreter-dsl-test`,
2020-06-29 17:36:44 +03:00
`json-rpc-server-test`,
`json-rpc-server`,
2020-04-24 19:33:27 +03:00
`language-server`,
`polyglot-api`,
2024-06-11 18:03:12 +03:00
`polyglot-api-macros`,
2020-04-14 19:00:51 +03:00
`project-manager`,
2022-09-20 18:50:27 +03:00
`syntax-rust-definition`,
2020-04-24 19:33:27 +03:00
`text-buffer`,
2024-05-17 15:42:35 +03:00
yaml,
2024-07-05 10:32:45 +03:00
`scala-yaml`,
2020-04-24 19:33:27 +03:00
pkg,
2020-07-22 20:28:03 +03:00
cli,
2021-07-17 17:49:51 +03:00
`task-progress-notifications`,
2022-05-10 15:44:05 +03:00
`profiling-utils`,
2021-05-12 18:31:53 +03:00
`logging-utils`,
2023-09-04 12:40:16 +03:00
`logging-config`,
2020-10-02 19:17:21 +03:00
`logging-service`,
2023-09-04 12:40:16 +03:00
`logging-service-logback`,
`logging-utils-akka`,
filewatcher,
2021-07-22 09:24:06 +03:00
`logging-truffle-connector`,
`locking-test-helper`,
2020-10-02 19:17:21 +03:00
`akka-native`,
2020-07-10 13:57:42 +03:00
`version-output`,
2023-08-11 00:16:33 +03:00
`refactoring-utils`,
2024-07-12 18:17:07 +03:00
`engine-runner-common`,
2020-10-09 17:19:58 +03:00
`engine-runner`,
2020-04-24 19:33:27 +03:00
runtime,
2020-06-29 17:36:44 +03:00
searcher,
2020-07-10 13:57:42 +03:00
launcher,
2021-07-22 09:24:06 +03:00
downloader,
2024-02-13 12:05:31 +03:00
`runtime-integration-tests`,
`runtime-benchmarks`,
2023-06-24 07:34:21 +03:00
`runtime-parser`,
2023-11-01 14:42:34 +03:00
`runtime-compiler`,
2024-07-15 17:45:07 +03:00
`runtime-fat-jar`,
2024-04-26 16:14:22 +03:00
`runtime-suggestions`,
2022-06-13 17:09:08 +03:00
`runtime-language-epb`,
2024-01-12 21:19:36 +03:00
`runtime-language-arrow`,
2023-06-08 17:51:50 +03:00
`runtime-instrument-common`,
2022-06-13 17:09:08 +03:00
`runtime-instrument-id-execution`,
`runtime-instrument-repl-debugger`,
`runtime-instrument-runtime-server`,
2020-10-30 14:31:31 +03:00
`runtime-version-manager`,
`runtime-version-manager-test`,
2021-07-13 14:08:00 +03:00
editions,
2024-02-22 12:59:09 +03:00
semver,
2021-07-13 14:08:00 +03:00
`distribution-manager`,
2021-07-22 09:24:06 +03:00
`edition-updater`,
2021-08-12 17:55:23 +03:00
`edition-uploader`,
2021-07-13 14:08:00 +03:00
`library-manager`,
2021-08-09 17:00:04 +03:00
`library-manager-test`,
2021-08-27 15:01:13 +03:00
`connected-lock-manager`,
2024-02-19 19:39:05 +03:00
`connected-lock-manager-server`,
2024-07-26 19:01:44 +03:00
`process-utils`,
2022-05-25 12:26:50 +03:00
testkit,
2024-06-25 15:08:22 +03:00
`test-utils`,
2023-08-02 19:19:46 +03:00
`common-polyglot-core-utils`,
2022-05-25 12:26:50 +03:00
`std-base`,
`std-database`,
`std-google-api`,
`std-image`,
2022-11-18 14:27:27 +03:00
`std-table`,
2023-05-04 20:36:51 +03:00
`std-aws`,
2024-03-20 13:06:12 +03:00
`std-snowflake`,
2024-07-30 13:13:08 +03:00
`std-microsoft`,
2023-12-19 20:41:09 +03:00
`http-test-helper`,
2023-07-21 20:25:02 +03:00
`enso-test-java-helpers`,
2023-10-18 20:21:59 +03:00
`exploratory-benchmark-java-helpers`,
2023-10-27 18:32:04 +03:00
`benchmark-java-helpers`,
2024-02-13 12:05:31 +03:00
`benchmarks-common`,
2024-05-07 11:12:43 +03:00
`bench-processor`,
2024-06-25 07:10:07 +03:00
`ydoc-server`,
`desktop-environment`
2019-11-08 20:32:48 +03:00
)
2019-09-12 17:47:25 +03:00
.settings(Global / concurrentRestrictions += Tags.exclusive(Exclusive))
2021-01-15 18:26:51 +03:00
.settings(
commands ++= Seq(packageBuilder.makePackages, packageBuilder.makeBundles)
)
2019-09-12 17:47:25 +03:00
2020-04-30 22:30:55 +03:00
// ============================================================================
// === Dependency Versions ====================================================
// ============================================================================
2019-09-12 17:47:25 +03:00
2020-04-30 22:30:55 +03:00
/* 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
*/
2020-04-24 19:33:27 +03:00
2020-04-30 22:30:55 +03:00
// === Akka ===================================================================
2020-02-13 17:33:39 +03:00
2023-09-04 12:40:16 +03:00
def akkaPkg(name: String) = akkaURL %% s"akka-$name" % akkaVersion
def akkaHTTPPkg(name: String) = akkaURL %% s"akka-$name" % akkaHTTPVersion
2020-04-30 22:30:55 +03:00
val akkaURL = "com.typesafe.akka"
2023-06-14 16:15:57 +03:00
val akkaVersion = "2.6.20"
val akkaHTTPVersion = "10.2.10"
2020-04-30 22:30:55 +03:00
val akkaMockSchedulerVersion = "0.5.5"
2023-11-17 21:02:36 +03:00
val logbackClassicVersion = JPMSUtils.logbackClassicVersion
2023-09-04 12:40:16 +03:00
val logbackPkg = Seq(
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
"ch.qos.logback" % "logback-core" % logbackClassicVersion
2020-07-03 15:02:27 +03:00
)
2023-09-04 12:40:16 +03:00
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 logbackTest = logbackPkg.map(_ % Test)
2020-04-30 22:30:55 +03:00
val akka =
2020-07-01 14:21:13 +03:00
Seq(
akkaActor,
akkaStream,
akkaHttp,
akkaSpray,
akkaTyped
2020-11-16 20:49:59 +03:00
)
2020-04-30 22:30:55 +03:00
// === Cats ===================================================================
2023-06-19 11:28:31 +03:00
val catsVersion = "2.9.0"
2019-09-12 17:47:25 +03:00
2020-04-30 22:30:55 +03:00
// === Circe ==================================================================
2019-09-12 17:47:25 +03:00
2024-06-20 16:07:54 +03:00
val circeVersion = "0.14.7"
val circeGenericExtrasVersion = "0.14.3"
2019-11-18 16:12:16 +03:00
val circe = Seq("circe-core", "circe-generic", "circe-parser")
.map("io.circe" %% _ % circeVersion)
2024-07-05 10:32:45 +03:00
val snakeyamlVersion = "2.2"
2019-09-12 17:47:25 +03:00
2020-04-30 22:30:55 +03:00
// === Commons ================================================================
val commonsCollectionsVersion = "4.4"
2021-12-31 17:50:32 +03:00
val commonsLangVersion = "3.12.0"
2023-06-14 16:15:57 +03:00
val commonsIoVersion = "2.12.0"
val commonsTextVersion = "1.10.0"
2020-04-30 22:30:55 +03:00
val commonsMathVersion = "3.6.1"
2023-06-14 16:15:57 +03:00
val commonsCompressVersion = "1.23.0"
2021-12-31 17:50:32 +03:00
val commonsCliVersion = "1.5.0"
2020-04-30 22:30:55 +03:00
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
)
2024-05-28 16:51:42 +03:00
// === Helidon ================================================================
val jakartaVersion = "2.0.1"
val helidonVersion = "4.0.8"
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
)
2020-04-30 22:30:55 +03:00
// === Jackson ================================================================
2019-09-12 17:47:25 +03:00
2023-06-14 16:15:57 +03:00
val jacksonVersion = "2.15.2"
2020-04-30 22:30:55 +03:00
2020-07-01 14:21:13 +03:00
// === JAXB ================================================================
2022-08-08 22:32:55 +03:00
val jaxbVersion = "4.0.0"
2020-07-01 14:21:13 +03:00
val jaxb = Seq(
"jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion % Benchmark,
"com.sun.xml.bind" % "jaxb-impl" % jaxbVersion % Benchmark
)
2020-04-30 22:30:55 +03:00
// === JMH ====================================================================
2019-09-12 17:47:25 +03:00
2023-06-14 16:15:57 +03:00
val jmhVersion = "1.36"
2019-09-12 17:47:25 +03:00
val jmh = Seq(
2020-04-30 22:30:55 +03:00
"org.openjdk.jmh" % "jmh-core" % jmhVersion % Benchmark,
"org.openjdk.jmh" % "jmh-generator-annprocess" % jmhVersion % Benchmark
2019-09-12 17:47:25 +03:00
)
2019-06-07 14:49:47 +03:00
2020-04-30 22:30:55 +03:00
// === Scala Compiler =========================================================
val scalaCompiler = Seq(
"org.scala-lang" % "scala-reflect" % scalacVersion,
"org.scala-lang" % "scala-compiler" % scalacVersion
)
2024-04-22 14:02:17 +03:00
val scalaCollectionCompatVersion = "2.8.1"
2020-04-30 22:30:55 +03:00
2020-10-09 17:19:58 +03:00
// === std-lib ================================================================
2023-06-14 16:15:57 +03:00
val antlrVersion = "4.13.0"
2023-06-15 19:20:13 +03:00
val awsJavaSdkV1Version = "1.12.480"
Add AWS SSO JARs to the `Standard.AWS` library (#9782)
As reported by our users, when using the AWS SSO, our code was failing with:
```
Execution finished with an error: To use Sso related properties in the 'xyz' profile, the 'sso' service module must be on the class path.
```
This PR adds the missing JARs to fix that.
Additionally it improves the license review tool UX a bit (parts of #9122):
- sorting the report by amount of problems, so that dependencies with unresolved problems appear at the top,
- semi-automatic helper button to rename package configurations after a version bump,
- button to remove stale entries from config (files or copyrights that disappeared after update),
- button to add custom copyright notice text straight from the report UI,
- button to set a file as the license for the project (creating the `custom-license` file automatically)
- ability to filter processed projects - e.g. `openLegalReviewReport AWS` will only run on the AWS subproject - saving time processing unchanged dependencies,
- updated the license search heuristic, fixing a problem with duplicates:
- if we had dependencies `netty-http` and `netty-http2`, because of a prefix-check logic, the notices for `netty-http` would also appear again for `netty-http2`, which is not valid. I have improved the heuristic to avoid these false positives and removed them from the current report.
- WIP: button to mark a license type as reviewed (not finished in this PR).
2024-04-25 21:44:51 +03:00
val awsJavaSdkV2Version = "2.25.36"
2023-06-14 16:15:57 +03:00
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"
2020-10-09 17:19:58 +03:00
2020-04-30 22:30:55 +03:00
// === ZIO ====================================================================
2023-06-14 16:15:57 +03:00
val zioVersion = "2.0.14"
val zioInteropCatsVersion = "23.0.0.6"
2020-04-30 22:30:55 +03:00
val zio = Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion
)
// === Other ==================================================================
2021-12-31 17:50:32 +03:00
val bcpkixJdk15Version = "1.70"
2023-06-14 16:15:57 +03:00
val declineVersion = "2.4.1"
2024-05-02 09:28:57 +03:00
val diffsonVersion = "4.4.0"
2023-11-02 14:24:26 +03:00
val directoryWatcherVersion = "0.18.0"
2024-04-12 13:10:44 +03:00
val flatbuffersVersion = "24.3.25"
2023-06-14 16:15:57 +03:00
val guavaVersion = "32.0.0-jre"
val jlineVersion = "3.23.0"
2023-10-18 12:34:08 +03:00
val jgitVersion = "6.7.0.202309050840-r"
2021-12-31 17:50:32 +03:00
val kindProjectorVersion = "0.13.2"
2023-06-14 16:15:57 +03:00
val mockitoScalaVersion = "1.17.14"
2020-08-07 12:18:09 +03:00
val newtypeVersion = "0.4.4"
2023-06-14 16:15:57 +03:00
val pprintVersion = "0.8.1"
val pureconfigVersion = "0.17.4"
val scalacheckVersion = "1.17.0"
val scalacticVersion = "3.3.0-SNAP4"
2021-12-31 17:50:32 +03:00
val scalaLoggingVersion = "3.9.4"
2020-08-07 12:18:09 +03:00
val scalameterVersion = "0.19"
2023-06-14 16:15:57 +03:00
val scalatestVersion = "3.3.0-SNAP4"
2023-11-17 21:02:36 +03:00
val slf4jVersion = JPMSUtils.slf4jVersion
2023-06-15 14:00:18 +03:00
val sqliteVersion = "3.42.0.0"
2022-08-08 22:32:55 +03:00
val tikaVersion = "2.4.1"
val typesafeConfigVersion = "1.4.2"
val junitVersion = "4.13.2"
2023-07-19 22:07:20 +03:00
val junitIfVersion = "0.13.2"
2023-09-29 17:46:58 +03:00
val hamcrestVersion = "1.3"
2023-06-14 16:15:57 +03:00
val netbeansApiVersion = "RELEASE180"
2023-06-08 18:43:18 +03:00
val fansiVersion = "0.4.0"
2023-10-12 01:03:34 +03:00
val httpComponentsVersion = "4.4.1"
2024-01-12 21:19:36 +03:00
val apacheArrowVersion = "14.0.1"
2024-03-20 13:06:12 +03:00
val snowflakeJDBCVersion = "3.15.0"
2024-07-30 13:13:08 +03:00
val mssqlserverJDBCVersion = "12.6.2.jre11"
2024-06-11 18:03:12 +03:00
val jsoniterVersion = "2.28.5"
2020-04-30 22:30:55 +03:00
2023-11-17 21:02:36 +03:00
// ============================================================================
// === Utility methods =====================================================
// ============================================================================
lazy val componentModulesPaths =
2024-05-28 16:51:42 +03:00
taskKey[Seq[File]](
2023-11-17 21:02:36 +03:00
"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 = (LocalProject("runtime") / Runtime / fullClasspath).value
val fullCp = (runnerCp ++ runtimeCp).distinct
val log = streams.value.log
2024-05-28 16:51:42 +03:00
val thirdPartyModIds =
GraalVM.modules ++
GraalVM.langsPkgs ++
GraalVM.toolsPkgs ++
helidon ++
Seq(
2024-06-07 13:56:42 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
"ch.qos.logback" % "logback-core" % logbackClassicVersion,
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion
2024-05-28 16:51:42 +03:00
)
val thirdPartyMods = JPMSUtils.filterModulesFromClasspath(
2023-11-17 21:02:36 +03:00
fullCp,
2024-05-28 16:51:42 +03:00
thirdPartyModIds,
2023-11-17 21:02:36 +03:00
log,
shouldContainAll = true
)
2024-05-28 16:51:42 +03:00
val thirdPartyModFiles = thirdPartyMods.map(_.data)
val arrow = (`runtime-language-arrow` / Compile / packageBin).value
2024-06-07 13:56:42 +03:00
val syntax = (`syntax-rust-definition` / Compile / packageBin).value
val ydoc = (`ydoc-server` / Compile / packageBin).value
val profilingUtils = (`profiling-utils` / Compile / packageBin).value
2024-05-28 16:51:42 +03:00
val runtime = (`runtime-fat-jar` / assembly / assemblyOutputPath).value
val ourMods = Seq(
runtime,
2024-06-07 13:56:42 +03:00
arrow,
syntax,
ydoc,
profilingUtils
2024-05-28 16:51:42 +03:00
)
ourMods ++ thirdPartyModFiles
2023-11-17 21:02:36 +03:00
}
2023-12-18 20:22:16 +03:00
lazy val compileModuleInfo = taskKey[Unit]("Compiles `module-info.java`")
2020-04-30 22:30:55 +03:00
// ============================================================================
// === Internal Libraries =====================================================
// ============================================================================
2020-04-20 15:33:51 +03:00
lazy val `text-buffer` = project
2020-07-03 16:42:45 +03:00
.in(file("lib/scala/text-buffer"))
2020-04-20 15:33:51 +03:00
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2020-04-20 15:33:51 +03:00
libraryDependencies ++= Seq(
2024-01-04 19:16:41 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
2020-10-22 17:12:28 +03:00
)
2020-04-20 15:33:51 +03:00
)
2022-11-09 18:26:25 +03:00
lazy val rustParserTargetDirectory =
SettingKey[File]("target directory for the Rust parser")
(`syntax-rust-definition` / rustParserTargetDirectory) := {
// setting "debug" for release, because it isn't yet safely integrated into
// the parser definition
val versionName = if (BuildInfo.isReleaseMode) "debug" else "debug"
target.value / "rust" / versionName
}
2022-10-24 12:55:18 +03:00
val generateRustParserLib =
TaskKey[Seq[File]]("generateRustParserLib", "Generates parser native library")
2022-09-20 18:50:27 +03:00
`syntax-rust-definition` / generateRustParserLib := {
2023-02-08 13:46:40 +03:00
val log = state.value.log
2022-11-09 18:26:25 +03:00
val libGlob =
(`syntax-rust-definition` / rustParserTargetDirectory).value.toGlob / "libenso_parser.so"
2022-10-24 12:55:18 +03:00
val allLibs = FileTreeView.default.list(Seq(libGlob)).map(_._1)
if (
sys.env.get("CI").isDefined ||
allLibs.isEmpty ||
(`syntax-rust-definition` / generateRustParserLib).inputFileChanges.hasChanges
) {
2022-11-02 20:13:53 +03:00
val os = System.getProperty("os.name")
2024-04-29 16:22:41 +03:00
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)
}
2023-02-08 13:46:40 +03:00
val baseArguments = Seq(
2022-11-09 18:26:25 +03:00
"build",
"-p",
"enso-parser-jni",
"-Z",
2024-04-29 16:22:41 +03:00
"unstable-options"
) ++ target.map(t => Seq("--target", t)).getOrElse(Seq()) ++
Seq(
"--out-dir",
(`syntax-rust-definition` / rustParserTargetDirectory).value.toString
)
2023-02-08 13:46:40 +03:00
val adjustedArguments = baseArguments ++
2022-11-09 18:26:25 +03:00
(if (BuildInfo.isReleaseMode)
Seq("--release")
else Seq())
2024-04-29 16:22:41 +03:00
val envVars = target
.map(_ => Seq(("RUSTFLAGS", "-C target-feature=-crt-static")))
.getOrElse(Seq())
Cargo.run(adjustedArguments, log, envVars)
2022-10-24 12:55:18 +03:00
}
FileTreeView.default.list(Seq(libGlob)).map(_._1.toFile)
2022-09-20 18:50:27 +03:00
}
`syntax-rust-definition` / generateRustParserLib / fileInputs +=
2022-10-24 12:55:18 +03:00
(`syntax-rust-definition` / baseDirectory).value.toGlob / "jni" / "src" / "*.rs"
2022-09-20 18:50:27 +03:00
2022-10-24 12:55:18 +03:00
val generateParserJavaSources = TaskKey[Seq[File]](
"generateParserJavaSources",
"Generates Java sources for Rust parser"
)
2022-09-20 18:50:27 +03:00
`syntax-rust-definition` / generateParserJavaSources := {
2022-10-06 03:49:41 +03:00
generateRustParser(
(`syntax-rust-definition` / Compile / sourceManaged).value,
2023-02-08 13:46:40 +03:00
(`syntax-rust-definition` / generateParserJavaSources).inputFileChanges,
state.value.log
2022-10-24 12:55:18 +03:00
)
2022-09-20 18:50:27 +03:00
}
`syntax-rust-definition` / generateParserJavaSources / fileInputs +=
2022-10-24 12:55:18 +03:00
(`syntax-rust-definition` / baseDirectory).value.toGlob / "generate-java" / "src" / ** / "*.rs"
2022-10-15 10:06:20 +03:00
`syntax-rust-definition` / generateParserJavaSources / fileInputs +=
(`syntax-rust-definition` / baseDirectory).value.toGlob / "src" / ** / "*.rs"
2022-09-20 18:50:27 +03:00
2023-02-17 16:38:26 +03:00
def generateRustParser(
base: File,
changes: sbt.nio.FileChanges,
log: ManagedLogger
): Seq[File] = {
2022-09-20 18:50:27 +03:00
import scala.jdk.CollectionConverters._
import java.nio.file.Paths
val syntaxPkgs = Paths.get("org", "enso", "syntax2").toString
2022-10-24 12:55:18 +03:00
val fullPkg = Paths.get(base.toString, syntaxPkgs).toFile
2022-09-20 18:50:27 +03:00
if (!fullPkg.exists()) {
fullPkg.mkdirs()
}
if (changes.hasChanges) {
2023-02-08 13:46:40 +03:00
val args = Seq(
2022-10-24 12:55:18 +03:00
"run",
"-p",
"enso-parser-generate-java",
"--bin",
"enso-parser-generate-java",
fullPkg.toString
2023-02-08 13:46:40 +03:00
)
Cargo.run(args, log)
2022-09-20 18:50:27 +03:00
}
FileUtils.listFiles(fullPkg, Array("scala", "java"), true).asScala.toSeq
}
lazy val `syntax-rust-definition` = project
.in(file("lib/rust/parser"))
2024-05-02 09:28:57 +03:00
.enablePlugins(JPMSPlugin)
2022-09-20 18:50:27 +03:00
.configs(Test)
.settings(
2024-06-14 17:01:37 +03:00
version := mavenUploadVersion,
2024-06-07 13:56:42 +03:00
Compile / exportJars := true,
2024-06-14 17:01:37 +03:00
javadocSettings,
publish / skip := false,
autoScalaLibrary := false,
crossPaths := false,
2024-06-07 13:56:42 +03:00
javaModuleName := "org.enso.syntax",
2022-09-20 18:50:27 +03:00
Compile / sourceGenerators += generateParserJavaSources,
Compile / resourceGenerators += generateRustParserLib,
2024-06-14 17:01:37 +03:00
Compile / javaSource := baseDirectory.value / "generate-java" / "java",
Compile / compile / javacOptions ++= Seq("-source", "11", "-target", "11")
2022-09-20 18:50:27 +03:00
)
2024-05-17 15:42:35 +03:00
lazy val yaml = (project in file("lib/java/yaml"))
.settings(
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
2024-07-05 10:32:45 +03:00
"org.yaml" % "snakeyaml" % snakeyamlVersion % "provided"
)
)
lazy val `scala-yaml` = (project in file("lib/scala/yaml"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
libraryDependencies ++= Seq(
"org.yaml" % "snakeyaml" % snakeyamlVersion % "provided"
2024-05-17 15:42:35 +03:00
)
)
2020-07-03 16:42:45 +03:00
lazy val pkg = (project in file("lib/scala/pkg"))
2019-06-13 12:49:04 +03:00
.settings(
2021-05-14 15:08:39 +03:00
Compile / run / mainClass := Some("org.enso.pkg.Main"),
2023-05-31 18:14:57 +03:00
frgaalJavaCompilerSetting,
2019-09-12 17:47:25 +03:00
version := "0.1",
2024-04-26 16:14:22 +03:00
libraryDependencies ++= Seq(
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
2024-07-05 10:32:45 +03:00
"io.circe" %% "circe-core" % circeVersion % "provided",
"org.yaml" % "snakeyaml" % snakeyamlVersion % "provided",
2024-04-26 16:14:22 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.apache.commons" % "commons-compress" % commonsCompressVersion
2020-10-22 17:12:28 +03:00
)
2019-06-13 12:49:04 +03:00
)
2021-06-18 17:39:45 +03:00
.dependsOn(editions)
2020-07-10 13:57:42 +03:00
2020-10-02 19:17:21 +03:00
lazy val `akka-native` = project
.in(file("lib/scala/akka-native"))
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2020-10-02 19:17:21 +03:00
version := "0.1",
libraryDependencies ++= Seq(
2020-10-22 17:12:28 +03:00
akkaActor
),
2020-10-02 19:17:21 +03:00
// Note [Native Image Workaround for GraalVM 20.2]
2023-07-20 18:11:30 +03:00
libraryDependencies += "org.graalvm.nativeimage" % "svm" % graalMavenPackagesVersion % "provided"
2020-10-02 19:17:21 +03:00
)
2022-05-10 15:44:05 +03:00
lazy val `profiling-utils` = project
.in(file("lib/scala/profiling-utils"))
2024-05-02 09:28:57 +03:00
.enablePlugins(JPMSPlugin)
2022-05-10 15:44:05 +03:00
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2024-05-02 09:28:57 +03:00
compileOrder := CompileOrder.JavaThenScala,
2024-06-07 13:56:42 +03:00
javaModuleName := "org.enso.profiling",
Compile / exportJars := true,
2022-05-10 15:44:05 +03:00
version := "0.1",
libraryDependencies ++= Seq(
2022-08-08 22:32:55 +03:00
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion
2022-05-10 15:44:05 +03:00
exclude ("org.netbeans.api", "org-openide-loaders")
exclude ("org.netbeans.api", "org-openide-nodes")
2022-09-13 12:51:08 +03:00
exclude ("org.netbeans.api", "org-netbeans-api-progress-nb")
exclude ("org.netbeans.api", "org-netbeans-api-progress")
exclude ("org.netbeans.api", "org-openide-util-lookup")
exclude ("org.netbeans.api", "org-openide-util")
exclude ("org.netbeans.api", "org-openide-dialogs")
2022-05-10 15:44:05 +03:00
exclude ("org.netbeans.api", "org-openide-filesystems")
exclude ("org.netbeans.api", "org-openide-util-ui")
exclude ("org.netbeans.api", "org-openide-awt")
exclude ("org.netbeans.api", "org-openide-modules")
2023-11-20 14:41:01 +03:00
exclude ("org.netbeans.api", "org-netbeans-api-annotations-common"),
2024-05-16 23:59:13 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
2023-11-20 14:41:01 +03:00
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test
2024-05-02 09:28:57 +03:00
),
modulePath := {
JPMSUtils.filterModulesFromUpdate(
update.value,
Seq(
2024-05-16 23:59:13 +03:00
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion,
"org.slf4j" % "slf4j-api" % slf4jVersion
2024-05-02 09:28:57 +03:00
),
streams.value.log,
shouldContainAll = true
)
}
2022-05-10 15:44:05 +03:00
)
2021-05-12 18:31:53 +03:00
lazy val `logging-utils` = project
.in(file("lib/scala/logging-utils"))
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2021-05-12 18:31:53 +03:00
version := "0.1",
libraryDependencies ++= Seq(
2023-09-04 12:40:16 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.slf4j" % "slf4j-api" % slf4jVersion
) ++ logbackTest
2021-05-12 18:31:53 +03:00
)
2020-10-02 19:17:21 +03:00
lazy val `logging-service` = project
.in(file("lib/scala/logging-service"))
.configs(Test)
.settings(
2023-02-20 14:27:16 +03:00
frgaalJavaCompilerSetting,
2020-10-02 19:17:21 +03:00
version := "0.1",
libraryDependencies ++= Seq(
2023-09-04 12:40:16 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
"com.typesafe" % "config" % typesafeConfigVersion,
2024-02-19 19:39:05 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test
2020-10-22 17:12:28 +03:00
)
2020-10-02 19:17:21 +03:00
)
2023-09-04 12:40:16 +03:00
.dependsOn(`logging-utils`)
.dependsOn(`logging-config`)
lazy val `logging-config` = project
.in(file("lib/scala/logging-config"))
.configs(Test)
2020-10-02 19:17:21 +03:00
.settings(
2023-09-04 12:40:16 +03:00
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"com.typesafe" % "config" % typesafeConfigVersion,
"org.slf4j" % "slf4j-api" % slf4jVersion
)
)
lazy val `logging-service-logback` = project
.in(file("lib/scala/logging-service-logback"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"io.sentry" % "sentry-logback" % "6.28.0",
"io.sentry" % "sentry" % "6.28.0",
Suppress logs for test cases unless a failure is reported (#8694)
The change adds a convenient trait `ReportLogsOnFailure` that, when merged with the test class, will keep logs in memory and only delegate to the underlying appender on failure. For now we only support forwarding to the console which is sufficient.
A corresponding entry in `application-test.conf` has to point to the new `memory` appender. The additional complexity in the implementation ensures that if someone forgets to mixin `ReportLogsOnFailure` logs appear as before i.e. they respect the log level.
As a bonus fixed arguments passed to ScalaTest in build.sbt so that we are now, again, showing timings of individual tests.
Closes #8603.
# Important Notes
Before:
```
[info] VcsManagerTest:
[info] Initializing project
[ERROR] [2024-01-04 17:27:03,366] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must create a repository (3 seconds, 538 milliseconds)
[info] - must fail to create a repository for an already existing project (141 milliseconds)
[info] Save project
[ERROR] [2024-01-04 17:27:08,346] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must create a commit with a timestamp (198 milliseconds)
[ERROR] [2024-01-04 17:27:08,570] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must create a commit with a name (148 milliseconds)
[ERROR] [2024-01-04 17:27:08,741] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must force all pending saves (149 milliseconds)
[info] Status project
[ERROR] [2024-01-04 17:27:08,910] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must report changed files since last commit (148 milliseconds)
[info] Restore project
[ERROR] [2024-01-04 17:27:09,076] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must reset to the last state with committed changes (236 milliseconds)
[ERROR] [2024-01-04 17:27:09,328] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must reset to a named save (pending)
[ERROR] [2024-01-04 17:27:09,520] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] - must reset to a named save and notify about removed files *** FAILED *** (185 milliseconds)
[info] Right({
[info] "jsonrpc" : "2.0",
[info] "method" : "file/event",
[info] "params" : {
[info] "path" : {
[info] "rootId" : "cd84a4a3-fa50-4ead-8d80-04f6d0d124a3",
[info] "segments" : [
[info] "src",
[info] "Bar.enso"
[info] ]
[info] },
[info] "kind" : "Removed"
[info] }
[info] }) did not equal Right({
[info] "jsonrpc" : "1.0",
[info] "method" : "file/event",
[info] "params" : {
[info] "path" : {
[info] "rootId" : "cd84a4a3-fa50-4ead-8d80-04f6d0d124a3",
[info] "segments" : [
[info] "src",
[info] "Bar.enso"
[info] ]
[info] },
[info] "kind" : "Removed"
[info] }
[info] }) (VcsManagerTest.scala:1343)
[info] Analysis:
[info] Right(value: Json$JObject(value: object[jsonrpc -> "2.0",method -> "file/event",params -> {
[info] "path" : {
[info] "rootId" : "cd84a4a3-fa50-4ead-8d80-04f6d0d124a3",
[info] "segments" : [
[info] "src",
[info] "Bar.enso"
[info] ]
[info] },
[info] "kind" : "Removed"
[info] }] -> object[jsonrpc -> "1.0",method -> "file/event",params -> {
[info] "path" : {
[info] "rootId" : "cd84a4a3-fa50-4ead-8d80-04f6d0d124a3",
[info] "segments" : [
[info] "src",
[info] "Bar.enso"
[info] ]
[info] },
[info] "kind" : "Removed"
[info] }]))
[ERROR] [2024-01-04 17:27:09,734] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/3607843843826594318].
[info] List project saves
[info] - must return all explicit commits (146 milliseconds)
[info] Run completed in 9 seconds, 270 milliseconds.
[info] Total number of tests run: 9
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 8, failed 1, canceled 0, ignored 0, pending 1
[info] *** 1 TEST FAILED ***
```
After:
```
[info] VcsManagerTest:
[info] Initializing project
[info] - must create a repository (3 seconds, 554 milliseconds)
[info] - must fail to create a repository for an already existing project (164 milliseconds)
[info] Save project
[info] - must create a commit with a timestamp (212 milliseconds)
[info] - must create a commit with a name (142 milliseconds)
[info] - must force all pending saves (185 milliseconds)
[info] Status project
[info] - must report changed files since last commit (142 milliseconds)
[info] Restore project
[info] - must reset to the last state with committed changes (202 milliseconds)
[info] - must reset to a named save (pending)
[ERROR] [2024-01-04 17:24:55,738] [org.enso.languageserver.search.SuggestionsHandler] Cannot read the package definition from [/tmp/8456553964637757156].
[info] - must reset to a named save and notify about removed files *** FAILED *** (186 milliseconds)
[info] Right({
[info] "jsonrpc" : "2.0",
[info] "method" : "file/event",
[info] "params" : {
[info] "path" : {
[info] "rootId" : "965ed5c8-1760-4284-91f2-1376406fde0d",
[info] "segments" : [
[info] "src",
[info] "Bar.enso"
[info] ]
[info] },
[info] "kind" : "Removed"
[info] }
[info] }) did not equal Right({
[info] "jsonrpc" : "1.0",
[info] "method" : "file/event",
[info] "params" : {
[info] "path" : {
[info] "rootId" : "965ed5c8-1760-4284-91f2-1376406fde0d",
[info] "segments" : [
[info] "src",
[info] "Bar.enso"
[info] ]
[info] },
[info] "kind" : "Removed"
[info] }
[info] }) (VcsManagerTest.scala:1343)
[info] Analysis:
[info] Right(value: Json$JObject(value: object[jsonrpc -> "2.0",method -> "file/event",params -> {
[info] "path" : {
[info] "rootId" : "965ed5c8-1760-4284-91f2-1376406fde0d",
[info] "segments" : [
[info] "src",
[info] "Bar.enso"
[info] ]
[info] },
[info] "kind" : "Removed"
[info] }] -> object[jsonrpc -> "1.0",method -> "file/event",params -> {
[info] "path" : {
[info] "rootId" : "965ed5c8-1760-4284-91f2-1376406fde0d",
[info] "segments" : [
[info] "src",
[info] "Bar.enso"
[info] ]
[info] },
[info] "kind" : "Removed"
[info] }]))
[info] List project saves
[info] - must return all explicit commits (131 milliseconds)
[info] Run completed in 9 seconds, 400 milliseconds.
[info] Total number of tests run: 9
[info] Suites: completed 1, aborted 0
[info] Tests: succeeded 8, failed 1, canceled 0, ignored 0, pending 1
[info] *** 1 TEST FAILED ***
```
2024-01-09 12:59:10 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
2023-09-04 12:40:16 +03:00
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
) ++ logbackPkg
)
.dependsOn(`logging-config`)
.dependsOn(`logging-service`)
lazy val `logging-utils-akka` = project
.in(file("lib/scala/logging-utils-akka"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"com.typesafe.akka" %% "akka-actor" % akkaVersion
)
2020-10-02 19:17:21 +03:00
)
2023-07-19 22:22:08 +03:00
lazy val filewatcher = project
.in(file("lib/scala/filewatcher"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= Seq(
"io.methvin" % "directory-watcher" % directoryWatcherVersion,
"commons-io" % "commons-io" % commonsIoVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
2023-10-16 11:57:44 +03:00
),
Test / fork := true,
Test / javaOptions ++= testLogProviderOptions
2023-07-19 22:22:08 +03:00
)
.dependsOn(testkit % Test)
2023-10-16 11:57:44 +03:00
.dependsOn(`logging-service-logback` % "test->test")
2023-07-19 22:22:08 +03:00
2021-07-06 01:27:14 +03:00
lazy val `logging-truffle-connector` = project
.in(file("lib/scala/logging-truffle-connector"))
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2021-07-06 01:27:14 +03:00
version := "0.1",
libraryDependencies ++= Seq(
2023-10-16 11:57:44 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
2021-07-06 01:27:14 +03:00
)
)
.dependsOn(`logging-utils`)
.dependsOn(`polyglot-api`)
2020-07-22 20:28:03 +03:00
lazy val cli = project
.in(file("lib/scala/cli"))
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2020-07-22 20:28:03 +03:00
version := "0.1",
2021-07-22 09:24:06 +03:00
libraryDependencies ++= circe ++ Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
2024-07-05 10:32:45 +03:00
"org.yaml" % "snakeyaml" % snakeyamlVersion % "provided",
2024-06-12 21:15:36 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test
2020-10-22 17:12:28 +03:00
),
2021-05-14 15:08:39 +03:00
Test / parallelExecution := false
2020-07-22 20:28:03 +03:00
)
2024-07-05 10:32:45 +03:00
.dependsOn(`scala-yaml`)
2020-07-22 20:28:03 +03:00
2021-07-17 17:49:51 +03:00
lazy val `task-progress-notifications` = project
.in(file("lib/scala/task-progress-notifications"))
.configs(Test)
.settings(
version := "0.1",
libraryDependencies ++= Seq(
2024-06-12 21:15:36 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test
2021-07-17 17:49:51 +03:00
),
Test / parallelExecution := false
)
.dependsOn(cli)
.dependsOn(`json-rpc-server`)
2020-07-10 13:57:42 +03:00
lazy val `version-output` = (project in file("lib/scala/version-output"))
.settings(
version := "0.1"
)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2020-07-10 13:57:42 +03:00
Compile / sourceGenerators += Def.task {
2020-10-22 17:12:28 +03:00
val file = (Compile / sourceManaged).value / "buildinfo" / "Info.scala"
BuildInfo
.writeBuildInfoFile(
2022-02-15 18:34:33 +03:00
file = file,
log = state.value.log,
defaultDevEnsoVersion = defaultDevEnsoVersion,
ensoVersion = ensoVersion,
scalacVersion = scalacVersion,
graalVersion = graalVersion,
currentEdition = currentEdition
2020-10-22 17:12:28 +03:00
)
}.taskValue
2020-07-10 13:57:42 +03:00
)
2019-06-14 18:26:49 +03:00
2023-08-11 00:16:33 +03:00
lazy val `refactoring-utils` = project
.in(file("lib/scala/refactoring-utils"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
commands += WithDebugCommand.withDebug,
version := "0.1",
libraryDependencies ++= Seq(
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test
)
)
.dependsOn(`runtime-parser`)
.dependsOn(`text-buffer`)
.dependsOn(testkit % Test)
2020-07-03 16:42:45 +03:00
lazy val `project-manager` = (project in file("lib/scala/project-manager"))
2023-12-18 20:22:16 +03:00
.enablePlugins(JPMSPlugin)
2019-11-18 14:18:16 +03:00
.settings(
2020-03-31 16:51:05 +03:00
(Compile / mainClass) := Some("org.enso.projectmanager.boot.ProjectManager")
2019-11-18 14:18:16 +03:00
)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2020-03-31 16:51:05 +03:00
(Compile / run / fork) := true,
(Test / fork) := true,
(Compile / run / connectInput) := true,
2023-06-29 08:55:14 +03:00
commands += WithDebugCommand.withDebug,
2020-12-02 18:56:47 +03:00
libraryDependencies ++= akka ++ Seq(akkaTestkit % Test),
2024-05-28 16:51:42 +03:00
libraryDependencies ++= circe ++ helidon,
2020-03-18 13:41:55 +03:00
libraryDependencies ++= Seq(
2024-06-07 13:56:42 +03:00
"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.miguno.akka" %% "akka-mock-scheduler" % akkaMockSchedulerVersion % Test,
"org.mockito" %% "mockito-scala" % mockitoScalaVersion % Test,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test,
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion % Test
2020-10-22 17:12:28 +03:00
),
2020-03-24 15:03:43 +03:00
addCompilerPlugin(
2020-04-30 22:30:55 +03:00
"org.typelevel" %% "kind-projector" % kindProjectorVersion cross CrossVersion.full
2020-03-18 13:41:55 +03:00
)
2019-11-18 14:18:16 +03:00
)
2023-12-18 20:22:16 +03:00
/** Fat jar assembly settings
*/
2020-05-15 14:05:44 +03:00
.settings(
2021-05-14 15:08:39 +03:00
assembly / assemblyJarName := "project-manager.jar",
assembly / test := {},
assembly / assemblyOutputPath := file("project-manager.jar"),
2023-11-17 21:02:36 +03:00
// Exclude all the Truffle/Graal related artifacts from the fat jar
assembly / assemblyExcludedJars := {
val pkgsToExclude = GraalVM.modules
val ourFullCp = (Runtime / fullClasspath).value
JPMSUtils.filterModulesFromClasspath(
ourFullCp,
pkgsToExclude,
streams.value.log
)
},
2021-05-14 15:08:39 +03:00
assembly / assemblyMergeStrategy := {
2020-05-15 14:05:44 +03:00
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
2023-11-17 21:02:36 +03:00
// This fat Jar must not be an explicit module, so discard all the module-info classes
case PathList(xs @ _*) if xs.last.contains("module-info") =>
MergeStrategy.discard
2020-05-15 14:05:44 +03:00
case "application.conf" => MergeStrategy.concat
case "reference.conf" => MergeStrategy.concat
case _ => MergeStrategy.first
2023-12-18 20:22:16 +03:00
}
)
/** JPMS related settings for tests
*/
.settings(
Test / fork := true,
// These dependencies are here so that we can use them in `--module-path` later on.
libraryDependencies ++= {
val necessaryModules =
GraalVM.modules.map(_.withConfigurations(Some(Test.name))) ++
GraalVM.langsPkgs.map(_.withConfigurations(Some(Test.name)))
necessaryModules
2020-05-15 14:05:44 +03:00
},
2023-12-18 20:22:16 +03:00
Test / addModules := Seq(
2024-06-07 13:56:42 +03:00
(`runtime-fat-jar` / javaModuleName).value,
(`syntax-rust-definition` / javaModuleName).value,
(`profiling-utils` / javaModuleName).value,
(`ydoc-server` / javaModuleName).value
2023-12-18 20:22:16 +03:00
),
Test / modulePath := {
val updateReport = (Test / update).value
val requiredModIds =
2024-05-28 16:51:42 +03:00
GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq(
2024-06-07 13:56:42 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion
2023-12-18 20:22:16 +03:00
)
val requiredMods = JPMSUtils.filterModulesFromUpdate(
updateReport,
requiredModIds,
streams.value.log,
shouldContainAll = true
)
val runtimeMod =
(`runtime-fat-jar` / Compile / productDirectories).value.head
2024-06-07 13:56:42 +03:00
val ydocMod =
(`ydoc-server` / Compile / exportedProducts).value.head.data
val syntaxMod =
(`syntax-rust-definition` / Compile / exportedProducts).value.head.data
val profilingMod =
(`profiling-utils` / Compile / exportedProducts).value.head.data
requiredMods ++ Seq(
runtimeMod,
ydocMod,
syntaxMod,
profilingMod
)
2023-12-18 20:22:16 +03:00
},
Test / javaOptions ++= testLogProviderOptions
)
.settings(
2024-05-17 15:42:35 +03:00
NativeImage.smallJdk := None,
NativeImage.additionalCp := Seq.empty,
2020-12-09 16:58:11 +03:00
rebuildNativeImage := NativeImage
.buildNativeImage(
"project-manager",
2023-03-28 10:58:59 +03:00
staticOnLinux = true,
initializeAtRuntime = Seq(
"scala.util.Random",
"zio.internal.ZScheduler$$anon$4",
"zio.Runtime$",
"zio.FiberRef$"
)
2020-12-09 16:58:11 +03:00
)
2021-01-14 13:46:01 +03:00
.dependsOn(VerifyReflectionSetup.run)
2020-12-09 16:58:11 +03:00
.dependsOn(assembly)
.value,
buildNativeImage := NativeImage
.incrementalNativeImageBuild(
rebuildNativeImage,
"project-manager"
)
.value
2020-05-15 14:05:44 +03:00
)
2020-12-09 16:58:11 +03:00
.dependsOn(`akka-native`)
2024-06-22 15:40:51 +03:00
.dependsOn(`desktop-environment`)
2020-07-10 13:57:42 +03:00
.dependsOn(`version-output`)
2021-06-18 17:39:45 +03:00
.dependsOn(editions)
2021-08-12 17:55:23 +03:00
.dependsOn(`edition-updater`)
2021-06-18 17:39:45 +03:00
.dependsOn(cli)
2021-07-17 17:49:51 +03:00
.dependsOn(`task-progress-notifications`)
2020-12-02 18:56:47 +03:00
.dependsOn(`polyglot-api`)
2020-11-16 20:49:59 +03:00
.dependsOn(`runtime-version-manager`)
2021-06-18 17:39:45 +03:00
.dependsOn(`library-manager`)
2023-09-04 12:40:16 +03:00
.dependsOn(`logging-utils-akka`)
.dependsOn(`logging-service`)
2021-06-18 17:39:45 +03:00
.dependsOn(pkg)
2020-03-18 13:41:55 +03:00
.dependsOn(`json-rpc-server`)
2023-09-04 12:40:16 +03:00
.dependsOn(`logging-service-logback` % Runtime)
2020-03-18 13:41:55 +03:00
.dependsOn(`json-rpc-server-test` % Test)
2020-07-14 14:44:40 +03:00
.dependsOn(testkit % Test)
2020-11-16 20:49:59 +03:00
.dependsOn(`runtime-version-manager-test` % Test)
2023-12-21 16:45:33 +03:00
.dependsOn(`logging-service-logback` % "test->test")
2019-11-18 14:18:16 +03:00
2020-06-16 12:00:47 +03:00
/* 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`.
*/
2020-04-14 19:00:51 +03:00
lazy val `json-rpc-server` = project
2020-07-03 16:42:45 +03:00
.in(file("lib/scala/json-rpc-server"))
2020-04-14 19:00:51 +03:00
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2023-09-04 12:40:16 +03:00
libraryDependencies ++= akka ++ logbackTest,
2020-04-14 19:00:51 +03:00
libraryDependencies ++= circe,
libraryDependencies ++= Seq(
2023-10-12 01:03:34 +03:00
"io.circe" %% "circe-literal" % circeVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
2022-05-24 16:01:26 +03:00
akkaTestkit % Test,
2023-10-12 01:03:34 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.apache.httpcomponents" % "httpclient" % httpComponentsVersion % Test,
"org.apache.httpcomponents" % "httpcore" % httpComponentsVersion % Test,
"commons-io" % "commons-io" % commonsIoVersion % Test
2020-10-22 17:12:28 +03:00
)
2020-04-14 19:00:51 +03:00
)
2019-11-05 17:12:33 +03:00
2020-04-14 19:00:51 +03:00
lazy val `json-rpc-server-test` = project
2020-07-03 16:42:45 +03:00
.in(file("lib/scala/json-rpc-server-test"))
2020-04-14 19:00:51 +03:00
.settings(
2023-11-20 11:43:32 +03:00
frgaalJavaCompilerSetting,
2020-04-14 19:00:51 +03:00
libraryDependencies ++= akka,
libraryDependencies ++= circe,
libraryDependencies ++= Seq(
2020-10-22 17:12:28 +03:00
"io.circe" %% "circe-literal" % circeVersion,
akkaTestkit,
2022-11-14 20:32:39 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion,
"org.gnieh" %% "diffson-circe" % diffsonVersion
2020-10-22 17:12:28 +03:00
)
2020-04-14 19:00:51 +03:00
)
.dependsOn(`json-rpc-server`)
2019-08-08 14:50:29 +03:00
2020-07-14 14:44:40 +03:00
lazy val testkit = project
.in(file("lib/scala/testkit"))
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2020-07-14 14:44:40 +03:00
libraryDependencies ++= Seq(
2024-03-12 12:53:55 +03:00
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
"commons-io" % "commons-io" % commonsIoVersion,
"org.scalatest" %% "scalatest" % scalatestVersion,
"junit" % "junit" % junitVersion,
"com.github.sbt" % "junit-interface" % junitIfVersion
2020-10-22 17:12:28 +03:00
)
2020-07-14 14:44:40 +03:00
)
2020-06-23 11:26:05 +03:00
lazy val searcher = project
2020-07-03 16:42:45 +03:00
.in(file("lib/scala/searcher"))
2020-06-23 11:26:05 +03:00
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2024-05-30 19:24:04 +03:00
annotationProcSetting,
2020-07-06 16:55:21 +03:00
libraryDependencies ++= jmh ++ Seq(
2024-04-22 14:02:17 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test
2023-09-04 12:40:16 +03:00
) ++ logbackTest
2020-06-23 11:26:05 +03:00
)
2020-07-06 16:55:21 +03:00
.configs(Benchmark)
.settings(
inConfig(Benchmark)(Defaults.testSettings),
2021-05-14 15:08:39 +03:00
Benchmark / fork := true
2020-07-06 16:55:21 +03:00
)
2020-07-14 14:44:40 +03:00
.dependsOn(testkit % Test)
2020-07-20 11:00:49 +03:00
.dependsOn(`polyglot-api`)
2020-06-23 11:26:05 +03:00
2024-05-02 09:28:57 +03:00
lazy val `ydoc-server` = project
.in(file("lib/java/ydoc-server"))
.enablePlugins(JPMSPlugin)
.configs(Test)
.settings(
2024-05-07 11:12:43 +03:00
frgaalJavaCompilerSetting,
2024-05-28 16:51:42 +03:00
javaModuleName := "org.enso.ydoc",
2024-06-07 13:56:42 +03:00
Compile / exportJars := true,
2024-05-02 09:28:57 +03:00
crossPaths := false,
autoScalaLibrary := false,
Test / fork := true,
commands += WithDebugCommand.withDebug,
2024-05-28 16:51:42 +03:00
// GraalVM and helidon modules (3rd party modules)
2024-05-02 09:28:57 +03:00
modulePath := {
JPMSUtils.filterModulesFromUpdate(
update.value,
2024-05-28 16:51:42 +03:00
GraalVM.modules ++ GraalVM.jsPkgs ++ GraalVM.chromeInspectorPkgs ++ helidon ++ Seq(
"org.slf4j" % "slf4j-api" % slf4jVersion,
"ch.qos.logback" % "logback-classic" % logbackClassicVersion,
"ch.qos.logback" % "logback-core" % logbackClassicVersion
2024-05-02 09:28:57 +03:00
),
streams.value.log,
shouldContainAll = true
)
},
2024-05-28 16:51:42 +03:00
// Internal project modules
2024-05-02 09:28:57 +03:00
modulePath ++= Seq(
(`syntax-rust-definition` / Compile / productDirectories).value.head,
(`profiling-utils` / Compile / productDirectories).value.head
),
libraryDependencies ++= Seq(
2024-06-04 20:45:26 +03:00
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.polyglot" % "inspect" % graalMavenPackagesVersion % "runtime",
"org.graalvm.polyglot" % "js" % graalMavenPackagesVersion % "runtime",
"org.slf4j" % "slf4j-api" % slf4jVersion,
"io.helidon.webclient" % "helidon-webclient-websocket" % helidonVersion,
"io.helidon.webserver" % "helidon-webserver-websocket" % helidonVersion,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion % Test
2024-05-02 09:28:57 +03:00
)
)
2024-05-28 16:51:42 +03:00
// `Compile/run` settings are necessary for the `run` task to work.
// We add it here for convenience so that one can start ydoc-server directly
// with `ydoc-server/run` task.
.settings(
Compile / run / fork := true,
Compile / run / connectInput := true,
Compile / run / javaOptions := Seq(
"-ea"
),
// We need to assembly the cmd line options here manually, because we need
// to add path to this module, and adding that directly to the `modulePath` setting
// would result in an sbt caught in an infinite recursion.
//
Compile / run / javaOptions ++= {
val mp = modulePath.value ++ (`profiling-utils` / modulePath).value
val jar = (Compile / exportedProductJars).value.head
val modName = javaModuleName.value
val allMp = mp ++ Seq(jar.data.absolutePath)
val mainKlazz = (Compile / mainClass).value.get
val args = Seq(
"--module-path",
allMp.mkString(File.pathSeparator),
"--module",
modName + "/" + mainKlazz
)
args
},
Compile / resourceGenerators +=
Def
.task(
Ydoc.generateJsBundle(
(ThisBuild / baseDirectory).value,
baseDirectory.value,
(Compile / resourceManaged).value,
streams.value
)
)
.taskValue
)
2024-05-02 09:28:57 +03:00
.dependsOn(`syntax-rust-definition`)
.dependsOn(`logging-service-logback`)
.dependsOn(`profiling-utils`)
2023-11-19 18:38:31 +03:00
lazy val `persistance` = (project in file("lib/java/persistance"))
.settings(
2024-06-14 17:01:37 +03:00
version := mavenUploadVersion,
2024-05-18 20:33:04 +03:00
Test / fork := true,
commands += WithDebugCommand.withDebug,
2023-11-19 18:38:31 +03:00
frgaalJavaCompilerSetting,
2024-05-30 19:24:04 +03:00
annotationProcSetting,
2024-06-10 15:00:51 +03:00
javadocSettings,
publish / skip := false,
autoScalaLibrary := false,
crossPaths := false,
2023-11-19 18:38:31 +03:00
Compile / javacOptions := ((Compile / javacOptions).value),
2024-06-10 14:49:12 +03:00
inConfig(Compile)(truffleRunOptionsSettings),
2023-11-19 18:38:31 +03:00
libraryDependencies ++= Seq(
2024-01-29 13:26:58 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
2023-11-19 18:38:31 +03:00
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test
)
)
.dependsOn(`persistance-dsl` % Test)
lazy val `persistance-dsl` = (project in file("lib/java/persistance-dsl"))
.settings(
2024-06-14 17:01:37 +03:00
version := mavenUploadVersion,
2023-11-19 18:38:31 +03:00
frgaalJavaCompilerSetting,
2024-06-10 15:00:51 +03:00
publish / skip := false,
autoScalaLibrary := false,
crossPaths := false,
javadocSettings,
Compile / compile / javacOptions := ((Compile / compile / javacOptions).value ++
2023-11-19 18:38:31 +03:00
// Only run ServiceProvider processor and ignore those defined in META-INF, thus
// fixing incremental compilation setup
Seq(
"-processor",
"org.netbeans.modules.openide.util.ServiceProviderProcessor"
)),
libraryDependencies ++= Seq(
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
)
)
2020-07-03 16:42:45 +03:00
lazy val `interpreter-dsl` = (project in file("lib/scala/interpreter-dsl"))
.settings(
version := "0.1",
2022-05-12 11:42:00 +03:00
frgaalJavaCompilerSetting,
2022-05-30 22:30:37 +03:00
Compile / javacOptions := ((Compile / javacOptions).value ++
2022-07-01 04:58:14 +03:00
// Only run ServiceProvider processor and ignore those defined in META-INF, thus
// fixing incremental compilation setup
Seq(
"-processor",
"org.netbeans.modules.openide.util.ServiceProviderProcessor"
)),
Move Builtin Types and Methods to stdlib (#3363)
This PR replaces hard-coded `@Builtin_Method` and `@Builtin_Type` nodes in Builtins with an automated solution
that a) collects metadata from such annotations b) generates `BuiltinTypes` c) registers builtin methods with corresponding
constructors.
The main differences are:
1) The owner of the builtin method does not necessarily have to be a builtin type
2) You can now mix regular methods and builtin ones in stdlib
3) No need to keep track of builtin methods and types in various places and register them by hand (a source of many typos or omissions as it found during the process of this PR)
Related to #181497846
Benchmarks also execute within the margin of error.
### Important Notes
The PR got a bit large over time as I was moving various builtin types and finding various corner cases.
Most of the changes however are rather simple c&p from Builtins.enso to the corresponding stdlib module.
Here is the list of the most crucial updates:
- `engine/runtime/src/main/java/org/enso/interpreter/runtime/builtin/Builtins.java` - the core of the changes. We no longer register individual builtin constructors and their methods by hand. Instead, the information about those is read from 2 metadata files generated by annotation processors. When the builtin method is encountered in stdlib, we do not ignore the method. Instead we lookup it up in the list of registered functions (see `getBuiltinFunction` and `IrToTruffle`)
- `engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/AtomConstructor.java` has now information whether it corresponds to the builtin type or not.
- `engine/runtime/src/main/scala/org/enso/compiler/codegen/RuntimeStubsGenerator.scala` - when runtime stubs generator encounters a builtin type, based on the @Builtin_Type annotation, it looks up an existing constructor for it and registers it in the provided scope, rather than creating a new one. The scope of the constructor is also changed to the one coming from stdlib, while ensuring that synthetic methods (for fields) also get assigned correctly
- `engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala` - when a builtin method is encountered in stdlib we don't generate a new function node for it, instead we look it up in the list of registered builtin methods. Note that Integer and Number present a bit of a challenge because they list a whole bunch of methods that don't have a corresponding method (instead delegating to small/big integer implementations).
During the translation new atom constructors get initialized but we don't want to do it for builtins which have gone through the process earlier, hence the exception
- `lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java` - @Builtin_Method processor not only generates the actual code fpr nodes but also collects and writes the info about them (name, class, params) to a metadata file that is read during builtins initialization
- `lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java` - @Builtin_Method processor no longer generates only (root) nodes but also collects and writes the info about them (name, class, params) to a metadata file that is read during builtins initialization
- `lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/TypeProcessor.java` - Similar to MethodProcessor but handles @Builtin_Type annotations. It doesn't, **yet**, generate any builtin objects. It also collects the names, as present in stdlib, if any, so that we can generate the names automatically (see generated `types/ConstantsGen.java`)
- `engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin` - various classes annotated with @BuiltinType to ensure that the atom constructor is always properly registered for the builitn. Note that in order to support types fields in those, annotation takes optional `params` parameter (comma separated).
- `engine/runtime/src/bench/scala/org/enso/interpreter/bench/fixtures/semantic/AtomFixtures.scala` - drop manual creation of test list which seemed to be a relict of the old design
2022-05-05 21:18:06 +03:00
libraryDependencies ++= Seq(
2022-05-13 18:38:52 +03:00
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
2023-11-19 18:38:31 +03:00
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
2022-07-01 04:58:14 +03:00
"com.google.guava" % "guava" % guavaVersion exclude ("com.google.code.findbugs", "jsr305")
Move Builtin Types and Methods to stdlib (#3363)
This PR replaces hard-coded `@Builtin_Method` and `@Builtin_Type` nodes in Builtins with an automated solution
that a) collects metadata from such annotations b) generates `BuiltinTypes` c) registers builtin methods with corresponding
constructors.
The main differences are:
1) The owner of the builtin method does not necessarily have to be a builtin type
2) You can now mix regular methods and builtin ones in stdlib
3) No need to keep track of builtin methods and types in various places and register them by hand (a source of many typos or omissions as it found during the process of this PR)
Related to #181497846
Benchmarks also execute within the margin of error.
### Important Notes
The PR got a bit large over time as I was moving various builtin types and finding various corner cases.
Most of the changes however are rather simple c&p from Builtins.enso to the corresponding stdlib module.
Here is the list of the most crucial updates:
- `engine/runtime/src/main/java/org/enso/interpreter/runtime/builtin/Builtins.java` - the core of the changes. We no longer register individual builtin constructors and their methods by hand. Instead, the information about those is read from 2 metadata files generated by annotation processors. When the builtin method is encountered in stdlib, we do not ignore the method. Instead we lookup it up in the list of registered functions (see `getBuiltinFunction` and `IrToTruffle`)
- `engine/runtime/src/main/java/org/enso/interpreter/runtime/callable/atom/AtomConstructor.java` has now information whether it corresponds to the builtin type or not.
- `engine/runtime/src/main/scala/org/enso/compiler/codegen/RuntimeStubsGenerator.scala` - when runtime stubs generator encounters a builtin type, based on the @Builtin_Type annotation, it looks up an existing constructor for it and registers it in the provided scope, rather than creating a new one. The scope of the constructor is also changed to the one coming from stdlib, while ensuring that synthetic methods (for fields) also get assigned correctly
- `engine/runtime/src/main/scala/org/enso/compiler/codegen/IrToTruffle.scala` - when a builtin method is encountered in stdlib we don't generate a new function node for it, instead we look it up in the list of registered builtin methods. Note that Integer and Number present a bit of a challenge because they list a whole bunch of methods that don't have a corresponding method (instead delegating to small/big integer implementations).
During the translation new atom constructors get initialized but we don't want to do it for builtins which have gone through the process earlier, hence the exception
- `lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java` - @Builtin_Method processor not only generates the actual code fpr nodes but also collects and writes the info about them (name, class, params) to a metadata file that is read during builtins initialization
- `lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/MethodProcessor.java` - @Builtin_Method processor no longer generates only (root) nodes but also collects and writes the info about them (name, class, params) to a metadata file that is read during builtins initialization
- `lib/scala/interpreter-dsl/src/main/java/org/enso/interpreter/dsl/TypeProcessor.java` - Similar to MethodProcessor but handles @Builtin_Type annotations. It doesn't, **yet**, generate any builtin objects. It also collects the names, as present in stdlib, if any, so that we can generate the names automatically (see generated `types/ConstantsGen.java`)
- `engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin` - various classes annotated with @BuiltinType to ensure that the atom constructor is always properly registered for the builitn. Note that in order to support types fields in those, annotation takes optional `params` parameter (comma separated).
- `engine/runtime/src/bench/scala/org/enso/interpreter/bench/fixtures/semantic/AtomFixtures.scala` - drop manual creation of test list which seemed to be a relict of the old design
2022-05-05 21:18:06 +03:00
)
2020-07-03 16:42:45 +03:00
)
2023-04-18 07:58:06 +03:00
lazy val `interpreter-dsl-test` =
(project in file("engine/interpreter-dsl-test"))
.configs(Test)
.settings(
version := "0.1",
frgaalJavaCompilerSetting,
2024-05-30 19:24:04 +03:00
annotationProcSetting,
2024-06-07 13:56:42 +03:00
inConfig(Test)(truffleRunOptionsSettings),
2023-04-18 07:58:06 +03:00
Test / fork := true,
Test / javaOptions ++= Seq(
2023-11-17 21:02:36 +03:00
"-Dpolyglotimpl.DisableClassPathIsolation=true"
2023-04-18 07:58:06 +03:00
),
commands += WithDebugCommand.withDebug,
libraryDependencies ++= Seq(
2023-07-20 18:11:30 +03:00
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided",
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test
2023-04-18 07:58:06 +03:00
)
)
.dependsOn(`interpreter-dsl`)
.dependsOn(`runtime`)
2020-04-30 22:30:55 +03:00
// ============================================================================
// === Sub-Projects ===========================================================
// ============================================================================
2020-04-14 19:00:51 +03:00
2023-11-17 21:02:36 +03:00
val benchOnlyOptions = if (java.lang.Boolean.getBoolean("bench.compileOnly")) {
Seq(
"-Dbench.compileOnly=true"
)
} else {
Seq(
"-Dbench.compileOnly=false"
)
}
/** Truffle-related settings for test running.
*/
val truffleRunOpts = Seq(
"-Dpolyglot.compiler.IterativePartialEscape=true",
"-Dpolyglot.compiler.BackgroundCompilation=false"
)
2023-01-27 00:41:35 +03:00
2020-04-14 19:00:51 +03:00
val truffleRunOptionsSettings = Seq(
fork := true,
2023-11-17 21:02:36 +03:00
javaOptions ++= "-ea" +: benchOnlyOptions
2020-04-14 19:00:51 +03:00
)
2023-12-21 16:45:33 +03:00
/** Explicitly provide `application-test.conf` as the resource that should be used for
* parsing the logging configuration. Explicitly setting `config.resource` prevents
* the potential conflicts with other *.conf files.
*/
2023-10-16 11:57:44 +03:00
val testLogProviderOptions = Seq(
2023-12-21 16:45:33 +03:00
"-Dslf4j.provider=org.enso.logger.TestLogProvider",
"-Dconfig.resource=application-test.conf"
2023-10-16 11:57:44 +03:00
)
2024-07-29 10:49:14 +03:00
/** engine/common project contains classes that are necessary to configure
* GraalVM's polyglot context. Most specifically it contains `ContextFactory`.
* As such it needs to depend on `org.graalvm.polyglot` package. Otherwise
* its dependencies shall be limited - no JSON & co. please. For purposes
* of consistently setting up loaders, the module depends on `logging-utils`.
*/
2024-04-25 11:03:42 +03:00
lazy val `engine-common` = project
.in(file("engine/common"))
.settings(
frgaalJavaCompilerSetting,
Test / fork := true,
commands += WithDebugCommand.withDebug,
Test / envVars ++= distributionEnvironmentOverrides,
libraryDependencies ++= Seq(
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided"
)
)
2024-07-29 10:49:14 +03:00
.dependsOn(`logging-config`)
.dependsOn(`logging-utils`)
2024-04-25 11:03:42 +03:00
.dependsOn(testkit % Test)
2020-04-14 19:00:51 +03:00
lazy val `polyglot-api` = project
2020-02-13 17:33:39 +03:00
.in(file("engine/polyglot-api"))
.settings(
2023-01-27 00:41:35 +03:00
frgaalJavaCompilerSetting,
2020-02-13 17:33:39 +03:00
Test / fork := true,
2021-09-18 15:48:13 +03:00
commands += WithDebugCommand.withDebug,
2021-07-08 16:38:20 +03:00
Test / envVars ++= distributionEnvironmentOverrides,
2023-11-17 21:02:36 +03:00
Test / javaOptions ++= Seq(
"-Dpolyglot.engine.WarnInterpreterOnly=false",
"-Dpolyglotimpl.DisableClassPathIsolation=true"
),
// Append enso language on the class-path
Test / unmanagedClasspath :=
(LocalProject(
2023-12-18 20:22:16 +03:00
"runtime-fat-jar"
2023-11-17 21:02:36 +03:00
) / Compile / fullClasspath).value,
2020-02-13 17:33:39 +03:00
libraryDependencies ++= Seq(
2024-07-05 10:32:45 +03:00
"io.circe" %% "circe-core" % circeVersion % "provided",
2024-06-11 18:03:12 +03:00
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion,
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion,
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test
2020-10-22 17:12:28 +03:00
),
2020-06-05 11:48:16 +03:00
GenerateFlatbuffers.flatcVersion := flatbuffersVersion,
2021-05-14 15:08:39 +03:00
Compile / sourceGenerators += GenerateFlatbuffers.task
2020-01-31 19:58:35 +03:00
)
2024-04-25 11:03:42 +03:00
.dependsOn(`engine-common`)
2020-02-13 17:33:39 +03:00
.dependsOn(pkg)
2020-04-20 15:33:51 +03:00
.dependsOn(`text-buffer`)
2021-05-18 11:23:13 +03:00
.dependsOn(`logging-utils`)
2021-06-18 17:39:45 +03:00
.dependsOn(testkit % Test)
2024-06-11 18:03:12 +03:00
.dependsOn(`polyglot-api-macros`)
lazy val `polyglot-api-macros` = project
.in(file("engine/polyglot-api-macros"))
.settings(
frgaalJavaCompilerSetting,
libraryDependencies ++= Seq(
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion % "provided",
"com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion % "provided"
)
)
2020-02-13 17:33:39 +03:00
2020-04-14 19:00:51 +03:00
lazy val `language-server` = (project in file("engine/language-server"))
2023-12-18 20:22:16 +03:00
.enablePlugins(JPMSPlugin)
2020-02-13 17:33:39 +03:00
.settings(
2023-05-02 19:40:58 +03:00
commands += WithDebugCommand.withDebug,
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2020-12-02 18:56:47 +03:00
libraryDependencies ++= akka ++ circe ++ Seq(
2024-07-12 18:17:07 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"io.circe" %% "circe-generic-extras" % circeGenericExtrasVersion,
"io.circe" %% "circe-literal" % circeVersion,
"dev.zio" %% "zio" % zioVersion,
"com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion,
"commons-io" % "commons-io" % commonsIoVersion,
"com.github.pureconfig" %% "pureconfig" % pureconfigVersion,
2020-10-22 17:12:28 +03:00
akkaTestkit % Test,
2024-07-12 18:17:07 +03:00
"com.typesafe.akka" %% "akka-http-testkit" % akkaHTTPVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided",
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion,
"org.bouncycastle" % "bcutil-jdk18on" % "1.76" % Test,
"org.bouncycastle" % "bcpkix-jdk18on" % "1.76" % Test,
"org.bouncycastle" % "bcprov-jdk18on" % "1.76" % Test,
"org.apache.tika" % "tika-core" % tikaVersion % Test
2020-10-22 17:12:28 +03:00
),
2021-05-14 15:08:39 +03:00
Test / testOptions += Tests
2020-10-22 17:12:28 +03:00
.Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"),
2021-07-17 17:49:51 +03:00
Test / envVars ++= distributionEnvironmentOverrides,
2020-06-05 11:48:16 +03:00
GenerateFlatbuffers.flatcVersion := flatbuffersVersion,
2021-05-14 15:08:39 +03:00
Compile / sourceGenerators += GenerateFlatbuffers.task
2020-02-28 16:17:48 +03:00
)
.configs(Benchmark)
.settings(
2023-01-27 00:41:35 +03:00
inConfig(Compile)(truffleRunOptionsSettings),
2020-02-28 16:17:48 +03:00
inConfig(Benchmark)(Defaults.testSettings),
2021-05-14 15:08:39 +03:00
bench := (Benchmark / test).value,
2020-04-30 22:30:55 +03:00
libraryDependencies += "com.storm-enroute" %% "scalameter" % scalameterVersion % "bench",
2020-02-28 16:17:48 +03:00
testFrameworks ++= List(
2020-10-22 17:12:28 +03:00
new TestFramework("org.scalameter.ScalaMeterFramework")
)
2020-02-13 17:33:39 +03:00
)
2021-11-23 11:51:17 +03:00
.settings(
Test / fork := true,
2023-12-18 20:22:16 +03:00
// These dependencies are here so that we can use them in `--module-path` later on.
libraryDependencies ++= {
val necessaryModules =
GraalVM.modules.map(_.withConfigurations(Some(Test.name))) ++
GraalVM.langsPkgs.map(_.withConfigurations(Some(Test.name)))
necessaryModules
},
Test / addModules := Seq(
2024-06-07 13:56:42 +03:00
(`runtime-fat-jar` / javaModuleName).value,
(`syntax-rust-definition` / javaModuleName).value,
(`profiling-utils` / javaModuleName).value,
(`ydoc-server` / javaModuleName).value
2023-11-17 21:02:36 +03:00
),
2023-12-18 20:22:16 +03:00
Test / modulePath := {
val updateReport = (Test / update).value
val requiredModIds =
2024-05-28 16:51:42 +03:00
GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq(
2024-06-07 13:56:42 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion
2023-12-18 20:22:16 +03:00
)
val requiredMods = JPMSUtils.filterModulesFromUpdate(
updateReport,
requiredModIds,
streams.value.log,
shouldContainAll = true
)
val runtimeMod =
(`runtime-fat-jar` / Compile / productDirectories).value.head
2024-06-07 13:56:42 +03:00
val syntaxMod =
(`syntax-rust-definition` / Compile / productDirectories).value.head
val ydocMod =
(`ydoc-server` / Compile / productDirectories).value.head
val profilingMod =
(`profiling-utils` / Compile / productDirectories).value.head
requiredMods ++ Seq(
runtimeMod,
syntaxMod,
ydocMod,
profilingMod
)
2023-12-18 20:22:16 +03:00
},
Test / javaOptions ++= testLogProviderOptions,
Test / patchModules := {
/** All these modules will be in --patch-module cmdline option to java, which means that
* for the JVM, it will appear that all the classes contained in these sbt projects are contained
* in the `org.enso.runtime` module. In this way, we do not have to assembly the `runtime.jar`
* fat jar.
*/
val modulesToPatchIntoRuntime: Seq[File] =
(LocalProject(
"runtime-instrument-common"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-instrument-id-execution"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-instrument-repl-debugger"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-instrument-runtime-server"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-language-epb"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-compiler"
) / Compile / productDirectories).value ++
(LocalProject("runtime-parser") / Compile / productDirectories).value ++
2024-06-10 14:49:12 +03:00
(LocalProject("persistance") / Compile / productDirectories).value ++
2023-12-18 20:22:16 +03:00
(LocalProject(
"interpreter-dsl"
) / Compile / productDirectories).value ++
// We have to patch the `runtime` project as well, as it contains BuiltinTypes.metadata in
// runtime/target/classes/META-INF directory
2024-06-07 13:56:42 +03:00
(LocalProject("runtime") / Compile / productDirectories).value
2023-12-18 20:22:16 +03:00
val extraModsToPatch = JPMSUtils.filterModulesFromUpdate(
(Test / update).value,
Seq(
"org.apache.tika" % "tika-core" % tikaVersion
),
streams.value.log,
shouldContainAll = true
)
Map(
(`runtime-fat-jar` / javaModuleName).value -> (modulesToPatchIntoRuntime ++ extraModsToPatch)
)
},
Test / addReads := {
Map(
(`runtime-fat-jar` / javaModuleName).value -> Seq("ALL-UNNAMED")
)
2024-06-07 13:56:42 +03:00
},
Test / addExports := {
val profModName = (`profiling-utils` / javaModuleName).value
Map(
profModName + "/org.enso.profiling.snapshot" -> Seq("ALL-UNNAMED")
)
2023-12-18 20:22:16 +03:00
}
)
.settings(
2021-11-23 11:51:17 +03:00
Test / compile := (Test / compile)
2024-01-05 21:00:02 +03:00
.dependsOn(`runtime-fat-jar` / Compile / compileModuleInfo)
2021-11-23 11:51:17 +03:00
.value,
Test / envVars ++= Map(
"ENSO_EDITION_PATH" -> file("distribution/editions").getCanonicalPath
)
)
2020-03-18 13:41:55 +03:00
.dependsOn(`json-rpc-server-test` % Test)
2021-05-27 18:13:52 +03:00
.dependsOn(`json-rpc-server`)
2021-07-17 17:49:51 +03:00
.dependsOn(`task-progress-notifications`)
.dependsOn(`library-manager`)
2024-02-19 19:39:05 +03:00
.dependsOn(`connected-lock-manager-server`)
2021-08-12 17:55:23 +03:00
.dependsOn(`edition-updater`)
2024-07-12 18:17:07 +03:00
.dependsOn(`engine-runner-common`)
2023-09-04 12:40:16 +03:00
.dependsOn(`logging-utils-akka`)
2021-05-27 18:13:52 +03:00
.dependsOn(`logging-service`)
.dependsOn(`polyglot-api`)
2020-06-26 19:52:42 +03:00
.dependsOn(`searcher`)
2021-05-27 18:13:52 +03:00
.dependsOn(`text-buffer`)
.dependsOn(`version-output`)
.dependsOn(pkg)
2022-05-10 15:44:05 +03:00
.dependsOn(`profiling-utils`)
2023-07-19 22:22:08 +03:00
.dependsOn(filewatcher)
2020-07-14 14:44:40 +03:00
.dependsOn(testkit % Test)
2023-10-16 11:57:44 +03:00
.dependsOn(`logging-service-logback` % "test->test")
2021-08-09 17:00:04 +03:00
.dependsOn(`library-manager-test` % Test)
2021-07-17 17:49:51 +03:00
.dependsOn(`runtime-version-manager-test` % Test)
2024-05-28 16:51:42 +03:00
.dependsOn(`ydoc-server`)
2020-01-31 19:58:35 +03:00
2021-02-22 16:32:55 +03:00
lazy val cleanInstruments = taskKey[Unit](
"Cleans fragile class files to force a full recompilation and preserve" +
"consistency of instrumentation configuration."
)
2021-07-08 16:38:20 +03:00
/** Overrides for the environment variables related to the distribution, so that
* a local installation does not interfere with runtime tests.
*/
val distributionEnvironmentOverrides = {
val fakeDir = file("target/fake_dir").getAbsolutePath
Map(
"ENSO_DATA_DIRECTORY" -> fakeDir,
"ENSO_CONFIG_DIRECTORY" -> fakeDir,
"ENSO_RUNTIME_DIRECTORY" -> file("target/run").getAbsolutePath,
"ENSO_LOG_DIRECTORY" -> file("target/logs").getAbsolutePath,
"ENSO_HOME" -> fakeDir,
"ENSO_EDITION_PATH" -> "",
"ENSO_LIBRARY_PATH" -> "",
"ENSO_AUXILIARY_LIBRARY_CACHES" -> ""
)
}
2023-03-31 19:16:18 +03:00
val frgaalSourceLevel = FrgaalJavaCompiler.sourceLevel
2022-05-13 18:38:52 +03:00
2023-07-20 18:11:30 +03:00
lazy val truffleDslSuppressWarnsSetting = Seq(
Compile / javacOptions ++= Seq(
"-Atruffle.dsl.SuppressWarnings=truffle-inlining"
)
)
2024-05-30 19:24:04 +03:00
/** Common settings for projects whose sources are processed by some annotation
* processors. These settings ensure that the generated sources are placed under
* `(Compile/sourceManaged)` directory, usually pointing to `target/classes/src_managed`.
*/
lazy val annotationProcSetting = Seq(
2024-06-10 15:00:51 +03:00
Compile / compile / javacOptions ++= Seq(
2024-05-30 19:24:04 +03:00
"-s",
2024-06-10 15:00:51 +03:00
(Compile / compile / sourceManaged).value.getAbsolutePath,
2024-05-30 19:24:04 +03:00
"-Xlint:unchecked"
),
Compile / compile := (Compile / compile)
.dependsOn(Def.task { (Compile / sourceManaged).value.mkdirs })
.value,
// zinc cannot see who is generating the java files so it adds some
// spurious warning messages. The following setting filters out such
// spurious warnings.
// See https://stackoverflow.com/questions/55558849/how-do-i-build-a-mixed-java-scala-project-which-uses-java-annotation-code-genera
Compile / logManager :=
sbt.internal.util.CustomLogManager.excludeMsg(
"Could not determine source for class ",
Level.Warn
)
)
2024-06-10 15:00:51 +03:00
lazy val javadocSettings = Seq(
Compile / doc / javacOptions --= Seq(
"-deprecation",
"-g",
"-Xlint:unchecked",
"-proc:full"
),
Compile / doc / javacOptions ++= Seq(
"--snippet-path",
(Test / javaSource).value.getAbsolutePath
)
)
2022-05-11 14:21:01 +03:00
/** A setting to replace javac with Frgaal compiler, allowing to use latest Java features in the code
2023-12-15 03:02:15 +03:00
* and still compile down to JDK 17
2022-05-11 14:21:01 +03:00
*/
2023-12-15 03:02:15 +03:00
lazy val frgaalJavaCompilerSetting =
customFrgaalJavaCompilerSettings(targetJavaVersion)
def customFrgaalJavaCompilerSettings(targetJdk: String) = Seq(
2022-05-13 18:38:52 +03:00
Compile / compile / compilers := FrgaalJavaCompiler.compilers(
(Compile / dependencyClasspath).value,
compilers.value,
2023-12-15 03:02:15 +03:00
targetJdk
2022-05-13 18:38:52 +03:00
),
2022-05-11 14:21:01 +03:00
// This dependency is needed only so that developers don't download Frgaal manually.
// Sadly it cannot be placed under plugins either because meta dependencies are not easily
// accessible from the non-meta build definition.
2022-05-13 18:38:52 +03:00
libraryDependencies += FrgaalJavaCompiler.frgaal,
// Ensure that our tooling uses the right Java version for checking the code.
2022-07-01 04:58:14 +03:00
Compile / javacOptions ++= Seq(
"-source",
frgaalSourceLevel,
"--enable-preview"
)
2022-05-11 14:21:01 +03:00
)
2024-05-30 19:24:04 +03:00
lazy val instrumentationSettings =
frgaalJavaCompilerSetting ++ annotationProcSetting ++ Seq(
version := ensoVersion,
commands += WithDebugCommand.withDebug,
Compile / javacOptions --= Seq(
"-source",
frgaalSourceLevel,
"--enable-preview"
),
libraryDependencies ++= Seq(
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided"
)
2022-07-01 04:58:14 +03:00
)
2022-06-13 17:09:08 +03:00
2022-07-01 04:58:14 +03:00
lazy val `runtime-language-epb` =
(project in file("engine/runtime-language-epb"))
.settings(
2023-12-15 15:31:32 +03:00
frgaalJavaCompilerSetting,
2022-07-01 04:58:14 +03:00
inConfig(Compile)(truffleRunOptionsSettings),
2023-07-20 18:11:30 +03:00
truffleDslSuppressWarnsSetting,
2023-12-15 15:31:32 +03:00
commands += WithDebugCommand.withDebug,
fork := true,
Test / javaOptions ++= Seq(),
instrumentationSettings,
libraryDependencies ++= Seq(
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided"
)
2022-07-01 04:58:14 +03:00
)
2022-06-13 17:09:08 +03:00
2024-01-12 21:19:36 +03:00
lazy val `runtime-language-arrow` =
(project in file("engine/runtime-language-arrow"))
.enablePlugins(JPMSPlugin)
.settings(
crossPaths := false,
autoScalaLibrary := false,
inConfig(Compile)(truffleRunOptionsSettings),
instrumentationSettings,
libraryDependencies ++= GraalVM.modules ++ Seq(
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.slf4j" % "slf4j-nop" % slf4jVersion % Test,
"org.slf4j" % "slf4j-api" % slf4jVersion % Test,
"org.apache.arrow" % "arrow-vector" % apacheArrowVersion % Test,
"org.apache.arrow" % "arrow-memory-netty" % apacheArrowVersion % Test
),
javaModuleName := "org.enso.interpreter.arrow",
modulePath := {
val updateReport = (Test / update).value
JPMSUtils.filterModulesFromUpdate(
updateReport,
GraalVM.modules,
streams.value.log,
shouldContainAll = true
) ++ Seq(
(LocalProject(
"runtime-language-arrow"
) / Compile / productDirectories).value.head
)
},
Test / patchModules := {
val testClassesDir = (Test / productDirectories).value.head
Map(javaModuleName.value -> Seq(testClassesDir))
},
Test / addModules := Seq(javaModuleName.value),
Test / javaOptions ++= Seq(
s"--add-opens=java.base/java.nio=${javaModuleName.value}", // DirectByteBuffer in MemoryUtil init is in-accessible
"--add-opens=java.base/java.nio=ALL-UNNAMED" // Tests use Apache Arrow
),
Test / addReads := {
Map(javaModuleName.value -> Seq("ALL-UNNAMED"))
}
)
2023-12-18 20:22:16 +03:00
/** `runtime-test-instruments` project contains Truffle instruments that are used solely for testing.
* It is compiled into an explicit Java module. Note that this project cannot have compile-time dependency on `runtime`
* project, so if you need access to classes from `runtime`, you need to use reflection.
*/
lazy val `runtime-test-instruments` =
(project in file("engine/runtime-test-instruments"))
.enablePlugins(JPMSPlugin)
.settings(
inConfig(Compile)(truffleRunOptionsSettings),
truffleDslSuppressWarnsSetting,
instrumentationSettings,
javaModuleName := "org.enso.runtime.test",
modulePath := {
JPMSUtils.filterModulesFromUpdate(
update.value,
GraalVM.modules ++ Seq(
2024-01-12 09:21:16 +03:00
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion,
"org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion,
"org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion,
"org.graalvm.truffle" % "truffle-tck-tests" % graalMavenPackagesVersion,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion
2023-12-18 20:22:16 +03:00
),
streams.value.log,
shouldContainAll = true
)
},
libraryDependencies ++= GraalVM.modules,
libraryDependencies ++= Seq(
Add Truffle TCK libraryDependencies to runtime-test-instruments. (#8766)
Since #8685, there is the following error (warning) message from JPMS plugin when building `runtime-test-instruments`:
```
[error] Returned (10): Vector(/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/sdk/nativeimage/23.1.0/nativeimage-23.1.0.jar, /home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/sdk/word/23.1.0/word-23.1.0.jar, /home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/sdk/jniutils/23.1.0/jniutils-23.1.0.jar, /home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/sdk/collections/23.1.0/collections-23.1.0.jar, /home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/polyglot/polyglot/23.1.0/polyglot-23.1.0.jar, /home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/truffle/truffle-api/23.1.0/truffle-api-23.1.0.jar, /home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/truffle/truffle-runtime/23.1.0/truffle-runtime-23.1.0.jar, /home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/truffle/truffle-compiler/23.1.0/truffle-compiler-23.1.0.jar, /home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/sdk/polyglot-tck/23.1.0/polyglot-tck-23.1.0.jar, /home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/netbeans/api/org-openide-util-lookup/RELEASE180/org-openide-util-lookup-RELEASE180.jar)
[error] Expected: (13): List(org.graalvm.sdk:nativeimage:23.1.0, org.graalvm.sdk:word:23.1.0, org.graalvm.sdk:jniutils:23.1.0, org.graalvm.sdk:collections:23.1.0, org.graalvm.polyglot:polyglot:23.1.0, org.graalvm.truffle:truffle-api:23.1.0, org.graalvm.truffle:truffle-runtime:23.1.0, org.graalvm.truffle:truffle-compiler:23.1.0, org.graalvm.sdk:polyglot-tck:23.1.0, org.graalvm.truffle:truffle-tck:23.1.0, org.graalvm.truffle:truffle-tck-common:23.1.0, org.graalvm.truffle:truffle-tck-tests:23.1.0, org.netbeans.api:org-openide-util-lookup:RELEASE180)
```
This PR removes this error message by providing appropriate `libraryDependencies` to `runtime-test-instruments`.
2024-01-16 13:44:50 +03:00
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion,
"org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion,
"org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion,
"org.graalvm.truffle" % "truffle-tck-tests" % graalMavenPackagesVersion,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
2023-12-18 20:22:16 +03:00
)
)
2019-11-08 20:32:48 +03:00
lazy val runtime = (project in file("engine/runtime"))
2023-12-18 20:22:16 +03:00
.enablePlugins(JPMSPlugin)
2019-06-14 18:26:49 +03:00
.settings(
2022-05-11 14:21:01 +03:00
frgaalJavaCompilerSetting,
2024-05-30 19:24:04 +03:00
annotationProcSetting,
2023-07-20 18:11:30 +03:00
truffleDslSuppressWarnsSetting,
2020-05-15 11:07:58 +03:00
version := ensoVersion,
2019-09-12 17:47:25 +03:00
commands += WithDebugCommand.withDebug,
2019-11-05 17:12:33 +03:00
inConfig(Compile)(truffleRunOptionsSettings),
2024-02-13 12:05:31 +03:00
libraryDependencies ++= GraalVM.langsPkgs ++ Seq(
2023-11-19 18:38:31 +03:00
"org.apache.commons" % "commons-lang3" % commonsLangVersion,
"org.apache.tika" % "tika-core" % tikaVersion,
2024-02-02 14:45:19 +03:00
"com.lihaoyi" %% "fansi" % fansiVersion,
2023-11-19 18:38:31 +03:00
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided",
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided",
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.scalactic" %% "scalactic" % scalacticVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test,
2023-12-18 20:22:16 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion % Test
2020-10-22 17:12:28 +03:00
),
2023-11-17 21:02:36 +03:00
// Add all GraalVM packages with Runtime scope - we don't need them for compilation,
// just provide them at runtime (in module-path).
libraryDependencies ++= {
val necessaryModules =
GraalVM.modules.map(_.withConfigurations(Some(Runtime.name)))
val langs =
GraalVM.langsPkgs.map(_.withConfigurations(Some(Runtime.name)))
2023-11-22 20:18:41 +03:00
val tools =
GraalVM.toolsPkgs.map(_.withConfigurations(Some(Runtime.name)))
necessaryModules ++ langs ++ tools
2023-12-18 20:22:16 +03:00
}
)
2020-09-30 14:33:57 +03:00
.settings(
2020-10-19 11:50:12 +03:00
(Runtime / compile) := (Runtime / compile)
2021-06-24 13:42:24 +03:00
.dependsOn(`std-base` / Compile / packageBin)
2023-02-17 16:38:26 +03:00
.dependsOn(`enso-test-java-helpers` / Compile / packageBin)
2023-10-18 20:21:59 +03:00
.dependsOn(`benchmark-java-helpers` / Compile / packageBin)
2023-07-21 20:25:02 +03:00
.dependsOn(`exploratory-benchmark-java-helpers` / Compile / packageBin)
2021-06-24 13:42:24 +03:00
.dependsOn(`std-image` / Compile / packageBin)
.dependsOn(`std-database` / Compile / packageBin)
2021-09-03 22:41:12 +03:00
.dependsOn(`std-google-api` / Compile / packageBin)
2021-06-24 13:42:24 +03:00
.dependsOn(`std-table` / Compile / packageBin)
2023-05-04 20:36:51 +03:00
.dependsOn(`std-aws` / Compile / packageBin)
2024-03-20 13:06:12 +03:00
.dependsOn(`std-snowflake` / Compile / packageBin)
2024-07-30 13:13:08 +03:00
.dependsOn(`std-microsoft` / Compile / packageBin)
2020-10-22 17:12:28 +03:00
.value
2020-09-30 14:33:57 +03:00
)
2023-03-11 12:27:26 +03:00
.dependsOn(`common-polyglot-core-utils`)
2021-08-26 13:52:35 +03:00
.dependsOn(`edition-updater`)
2024-05-07 15:13:21 +03:00
.dependsOn(`interpreter-dsl` % "provided")
2023-11-19 18:38:31 +03:00
.dependsOn(`persistance-dsl` % "provided")
2021-08-26 13:52:35 +03:00
.dependsOn(`library-manager`)
.dependsOn(`logging-truffle-connector`)
2020-04-14 19:00:51 +03:00
.dependsOn(`polyglot-api`)
2020-04-20 15:33:51 +03:00
.dependsOn(`text-buffer`)
2023-11-01 14:42:34 +03:00
.dependsOn(`runtime-compiler`)
2024-04-26 16:14:22 +03:00
.dependsOn(`runtime-suggestions`)
2021-08-27 15:01:13 +03:00
.dependsOn(`connected-lock-manager`)
2020-10-19 11:50:12 +03:00
.dependsOn(testkit % Test)
2024-02-13 12:05:31 +03:00
/** A project holding all the runtime integration tests. These tests require, among other things,
* the `org.enso.runtime` JPMS module, so it is easier to keep them in a separate project.
* For standard unit tests, use `runtime/Test`.
*/
lazy val `runtime-integration-tests` =
(project in file("engine/runtime-integration-tests"))
.enablePlugins(JPMSPlugin)
.settings(
frgaalJavaCompilerSetting,
2024-05-30 19:24:04 +03:00
annotationProcSetting,
2024-02-13 12:05:31 +03:00
commands += WithDebugCommand.withDebug,
2024-05-28 16:51:42 +03:00
libraryDependencies ++= GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq(
2024-02-13 12:05:31 +03:00
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided",
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion % Test,
"org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion % Test,
"org.graalvm.truffle" % "truffle-tck-tests" % graalMavenPackagesVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.scalactic" %% "scalactic" % scalacticVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test,
"org.slf4j" % "slf4j-api" % slf4jVersion % Test
),
Test / compile := (Test / compile)
.dependsOn(`runtime-fat-jar` / Compile / compileModuleInfo)
.value,
Test / fork := true,
Test / parallelExecution := false,
Test / logBuffered := false,
Test / envVars ++= distributionEnvironmentOverrides ++ Map(
"ENSO_TEST_DISABLE_IR_CACHE" -> "false",
"ENSO_EDITION_PATH" -> file("distribution/editions").getCanonicalPath
),
inConfig(Test)(truffleRunOptionsSettings),
Test / javaOptions ++= Seq(
"-Dtck.values=java-host,enso",
"-Dtck.language=enso",
"-Dtck.inlineVerifierInstrument=false",
"-Dpolyglot.engine.AllowExperimentalOptions=true"
),
Test / javaOptions ++= testLogProviderOptions,
Test / addModules := Seq(
(`runtime-test-instruments` / javaModuleName).value,
2024-06-07 13:56:42 +03:00
(`runtime-fat-jar` / javaModuleName).value,
(`syntax-rust-definition` / javaModuleName).value,
(`profiling-utils` / javaModuleName).value,
(`ydoc-server` / javaModuleName).value
2024-02-13 12:05:31 +03:00
),
Test / modulePath := {
val updateReport = (Test / update).value
val requiredModIds =
2024-05-28 16:51:42 +03:00
GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq(
2024-06-07 13:56:42 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion,
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion,
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion,
"org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion,
"org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion,
"org.graalvm.truffle" % "truffle-tck-tests" % graalMavenPackagesVersion
2024-02-13 12:05:31 +03:00
)
val requiredMods = JPMSUtils.filterModulesFromUpdate(
updateReport,
requiredModIds,
streams.value.log,
shouldContainAll = true
)
val runtimeTestInstrumentsMod =
(`runtime-test-instruments` / Compile / exportedProducts).value.head.data
val runtimeMod =
(`runtime-fat-jar` / Compile / exportedProducts).value.head.data
2024-06-07 13:56:42 +03:00
val ydocMod =
(`ydoc-server` / Compile / exportedProducts).value.head.data
val syntaxMod =
(`syntax-rust-definition` / Compile / exportedProducts).value.head.data
val profilingMod =
(`profiling-utils` / Compile / exportedProducts).value.head.data
requiredMods ++ Seq(
runtimeTestInstrumentsMod,
runtimeMod,
ydocMod,
syntaxMod,
profilingMod
)
2024-02-13 12:05:31 +03:00
},
Test / patchModules := {
/** All these modules will be in --patch-module cmdline option to java, which means that
* for the JVM, it will appear that all the classes contained in these sbt projects are contained
* in the `org.enso.runtime` module. In this way, we do not have to assembly the `runtime.jar`
* fat jar.
*/
val modulesToPatchIntoRuntime: Seq[File] =
(LocalProject(
"runtime-instrument-common"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-instrument-id-execution"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-instrument-repl-debugger"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-instrument-runtime-server"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-language-epb"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-compiler"
) / Compile / productDirectories).value ++
(LocalProject(
"refactoring-utils"
) / Compile / productDirectories).value ++
(LocalProject(
"runtime-instrument-common"
) / Test / productDirectories).value
// Patch test-classes into the runtime module. This is standard way to deal with the
// split package problem in unit tests. For example, Maven's surefire plugin does this.
val testClassesDir = (Test / productDirectories).value.head
Map(
(`runtime-fat-jar` / javaModuleName).value -> (modulesToPatchIntoRuntime ++ Seq(
testClassesDir
))
)
},
Test / addReads := {
val runtimeModName = (`runtime-fat-jar` / javaModuleName).value
val testInstrumentsModName =
(`runtime-test-instruments` / javaModuleName).value
Map(
// We patched the test-classes into the runtime module. These classes access some stuff from
// unnamed module. Thus, let's add ALL-UNNAMED.
runtimeModName -> Seq(
"ALL-UNNAMED",
testInstrumentsModName,
"truffle.tck.tests",
"org.openide.util.lookup.RELEASE180"
),
testInstrumentsModName -> Seq(runtimeModName)
)
}
)
.dependsOn(`runtime-fat-jar`)
.dependsOn(`runtime-test-instruments`)
.dependsOn(`logging-service-logback` % "test->test")
.dependsOn(testkit % Test)
2024-02-19 19:39:05 +03:00
.dependsOn(`connected-lock-manager-server`)
2024-05-29 14:50:03 +03:00
.dependsOn(`test-utils`)
2024-02-13 12:05:31 +03:00
/** A project that holds only benchmarks for `runtime`. Unlike `runtime-integration-tests`, its execution requires
* the whole `runtime-fat-jar` assembly, as we want to be as close to the enso distribution as possible.
*/
lazy val `runtime-benchmarks` =
(project in file("engine/runtime-benchmarks"))
.enablePlugins(JPMSPlugin)
.settings(
frgaalJavaCompilerSetting,
2024-05-30 19:24:04 +03:00
annotationProcSetting,
2024-02-13 12:05:31 +03:00
// Note that withDebug command only makes sense if you use `@Fork(0)` in your benchmarks.
commands += WithDebugCommand.withDebug,
2024-05-28 16:51:42 +03:00
libraryDependencies ++= GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.toolsPkgs ++ helidon ++ Seq(
2024-02-13 12:05:31 +03:00
"org.openjdk.jmh" % "jmh-core" % jmhVersion,
"org.openjdk.jmh" % "jmh-generator-annprocess" % jmhVersion,
"jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion,
"com.sun.xml.bind" % "jaxb-impl" % jaxbVersion,
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion,
2024-03-01 16:37:18 +03:00
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided",
2024-02-13 12:05:31 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.slf4j" % "slf4j-nop" % slf4jVersion
),
mainClass :=
Some("org.enso.interpreter.bench.benchmarks.RuntimeBenchmarksRunner"),
javacOptions --= Seq(
"-source",
frgaalSourceLevel,
"--enable-preview"
),
2024-03-01 16:37:18 +03:00
Compile / compile := (Compile / compile)
dry-run benchmarks exits when some benchmark fails (#9397)
If some benchmark fails in dry-run (compileOnly) mode, the whole process exits with non-zero return code. Also fixes failing engine compiler benchmarks.
# Important Notes
Manually added failure:
```diff
diff --git a/engine/runtime-benchmarks/src/main/java/org/enso/interpreter/bench/benchmarks/semantic/ArrayProxyBenchmarks.java b/engine/runtime-benchmarks/src/main/java/org/enso/interpreter/bench/benchmarks/semantic/ArrayProxyBenchmarks.java
index c8d86cecc..f9f4d7cbc 100644
--- a/engine/runtime-benchmarks/src/main/java/org/enso/interpreter/bench/benchmarks/semantic/ArrayProxyBenchmarks.java
+++ b/engine/runtime-benchmarks/src/main/java/org/enso/interpreter/bench/benchmarks/semantic/ArrayProxyBenchmarks.java
@@ -95,7 +95,8 @@ public class ArrayProxyBenchmarks {
@Benchmark
public void sumOverComputingProxy(Blackhole matter) {
- performBenchmark(matter);
+ //performBenchmark(matter);
+ throw new AssertionError("My error");
}
@Benchmark
```
Run with `sbt "-Dbench.compileOnly=true runtime-benchmarks/benchOnly org.enso.interpreter.bench.benchmarks.semantic.ArrayProxyBenchmarks.sumOverComputingProxy"` fails with:
```
[info] Running benchmarks [org.enso.interpreter.bench.benchmarks.semantic.ArrayProxyBenchmarks.sumOverComputingProxy] in compileOnly mode
[info] # JMH version: 1.36
[info] # VM version: JDK 21.0.2, Java HotSpot(TM) 64-Bit Server VM, 21.0.2+13-LTS-jvmci-23.1-b30
[info] # VM invoker: /home/pavel/.sdkman/candidates/java/21.0.2-graal/bin/java
[info] # VM options: -XX:ThreadPriorityPolicy=1 -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCIProduct -XX:-UnlockExperimentalVMOptions -Dslf4j.provider=org.slf4j.nop.NOPServiceProvider -Dbench.compileOnly=true --module-path=/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/sdk/nativeimage/23.1.2/nativeimage-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/sdk/word/23.1.2/word-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/sdk/jniutils/23.1.2/jniutils-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/sdk/collections/23.1.2/collections-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/polyglot/polyglot/23.1.2/polyglot-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/truffle/truffle-api/23.1.2/truffle-api-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/truffle/truffle-runtime/23.1.2/truffle-runtime-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/truffle/truffle-compiler/23.1.2/truffle-compiler-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/js/js-language/23.1.2/js-language-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/regex/regex/23.1.2/regex-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/shadowed/icu4j/23.1.2/icu4j-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/python/python-language/23.1.2/python-language-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/python/python-resources/23.1.2/python-resources-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/bouncycastle/bcutil-jdk18on/1.76/bcutil-jdk18on-1.76.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/bouncycastle/bcpkix-jdk18on/1.76/bcpkix-jdk18on-1.76.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk18on/1.76/bcprov-jdk18on-1.76.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/llvm/llvm-api/23.1.2/llvm-api-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/truffle/truffle-nfi/23.1.2/truffle-nfi-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/truffle/truffle-nfi-libffi/23.1.2/truffle-nfi-libffi-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/tools/profiler-tool/23.1.2/profiler-tool-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/graalvm/shadowed/json/23.1.2/json-23.1.2.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/tukaani/xz/1.9/xz-1.9.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar:/home/pavel/.cache/coursier/v1/https/repo1.maven.org/maven2/org/slf4j/slf4j-nop/2.0.9/slf4j-nop-2.0.9.jar:/home/pavel/dev/enso/runtime.jar --add-modules=org.enso.runtime --add-exports=org.slf4j.nop/org.slf4j.nop=org.slf4j
[info] # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable)
[info] # Warmup: <none>
[info] # Measurement: 1 iterations, 1 s each
[info] # Timeout: 10 min per iteration
[info] # Threads: 1 thread, will synchronize iterations
[info] # Benchmark mode: Average time, time/op
[info] # Benchmark: org.enso.interpreter.bench.benchmarks.semantic.ArrayProxyBenchmarks.sumOverComputingProxy
[info] # Run progress: 0.00% complete, ETA 00:00:01
[info] # Fork: N/A, test runs in the host VM
[info] # *** WARNING: Non-forked runs may silently omit JVM options, mess up profilers, disable compiler hints, etc. ***
[info] # *** WARNING: Use non-forked runs only for debugging purposes, not for actual performance runs. ***
[error] SLF4J: Attempting to load provider "org.slf4j.nop.NOPServiceProvider" specified via "slf4j.provider" system property
[info] Iteration 1: <failure>
[info] java.lang.AssertionError: My error
[info] at org.enso.interpreter.bench.benchmarks.semantic.ArrayProxyBenchmarks.sumOverComputingProxy(ArrayProxyBenchmarks.java:99)
[info] at org.enso.interpreter.bench.benchmarks.semantic.jmh_generated.ArrayProxyBenchmarks_sumOverComputingProxy_jmhTest.sumOverComputingProxy_avgt_jmhStub(ArrayProxyBenchmarks_sumOverComputingProxy_jmhTest.java:232)
[info] at org.enso.interpreter.bench.benchmarks.semantic.jmh_generated.ArrayProxyBenchmarks_sumOverComputingProxy_jmhTest.sumOverComputingProxy_AverageTime(ArrayProxyBenchmarks_sumOverComputingProxy_jmhTest.java:173)
[info] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
[info] at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[info] at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:475)
[info] at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:458)
[info] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[info] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[info] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[info] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[info] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error] Benchmark run failed: Benchmark caught the exception
[info] at java.base/java.lang.Thread.run(Thread.java:1583)
[error] org.openjdk.jmh.runner.RunnerException: Benchmark caught the exception
[error] at org.openjdk.jmh.runner.Runner.runBenchmarks(Runner.java:575)
[error] at org.openjdk.jmh.runner.Runner.internalRun(Runner.java:310)
[error] at org.openjdk.jmh.runner.Runner.run(Runner.java:209)
[error] at org.enso.interpreter.bench.BenchmarksRunner.runCompileOnly(BenchmarksRunner.java:93)
[error] at org.enso.interpreter.bench.BenchmarksRunner.run(BenchmarksRunner.java:36)
[error] at org.enso.interpreter.bench.benchmarks.RuntimeBenchmarksRunner.main(RuntimeBenchmarksRunner.java:8)
[error] Caused by: org.openjdk.jmh.runner.BenchmarkException: Benchmark error during the run
[error] at org.openjdk.jmh.runner.BenchmarkHandler.runIteration(BenchmarkHandler.java:424)
[error] at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:281)
[error] at org.openjdk.jmh.runner.BaseRunner.runBenchmark(BaseRunner.java:233)
[error] at org.openjdk.jmh.runner.BaseRunner.doSingle(BaseRunner.java:138)
[error] at org.openjdk.jmh.runner.BaseRunner.runBenchmarksEmbedded(BaseRunner.java:110)
[error] at org.openjdk.jmh.runner.Runner.runBenchmarks(Runner.java:555)
[error] ... 5 more
[error] Suppressed: java.lang.AssertionError: My error
[error] at org.enso.interpreter.bench.benchmarks.semantic.ArrayProxyBenchmarks.sumOverComputingProxy(ArrayProxyBenchmarks.java:99)
[error] at org.enso.interpreter.bench.benchmarks.semantic.jmh_generated.ArrayProxyBenchmarks_sumOverComputingProxy_jmhTest.sumOverComputingProxy_avgt_jmhStub(ArrayProxyBenchmarks_sumOverComputingProxy_jmhTest.java:232)
[error] at org.enso.interpreter.bench.benchmarks.semantic.jmh_generated.ArrayProxyBenchmarks_sumOverComputingProxy_jmhTest.sumOverComputingProxy_AverageTime(ArrayProxyBenchmarks_sumOverComputingProxy_jmhTest.java:173)
[error] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
[error] at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[error] at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:475)
[error] at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:458)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
[error] at java.base/java.lang.Thread.run(Thread.java:1583)
[error] Nonzero exit code returned from runner: 1
[error] (Compile / run) Nonzero exit code returned from runner: 1
[error] Total time: 5 s, completed Mar 13, 2024, 12:49:59 PM
```
2024-03-14 18:21:38 +03:00
.dependsOn(`runtime-fat-jar` / assembly)
2024-03-01 16:37:18 +03:00
.value,
2024-02-13 12:05:31 +03:00
parallelExecution := false,
modulePath := {
2024-05-28 16:51:42 +03:00
val requiredModIds =
GraalVM.modules ++ GraalVM.langsPkgs ++ helidon ++ Seq(
2024-06-07 13:56:42 +03:00
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.slf4j" % "slf4j-nop" % slf4jVersion,
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion
2024-05-28 16:51:42 +03:00
)
2024-02-13 12:05:31 +03:00
val requiredMods = JPMSUtils.filterModulesFromUpdate(
(Compile / update).value,
requiredModIds,
streams.value.log,
shouldContainAll = true
)
val runtimeMod =
(`runtime-fat-jar` / assembly / assemblyOutputPath).value
2024-06-07 13:56:42 +03:00
val ydocMod =
(`ydoc-server` / Compile / exportedProducts).value.head.data
val syntaxMod =
(`syntax-rust-definition` / Compile / exportedProducts).value.head.data
val profilingMod =
(`profiling-utils` / Compile / exportedProducts).value.head.data
requiredMods ++ Seq(
runtimeMod,
ydocMod,
syntaxMod,
profilingMod
)
2024-02-13 12:05:31 +03:00
},
addModules := {
val runtimeModuleName = (`runtime-fat-jar` / javaModuleName).value
Seq(runtimeModuleName)
},
addExports := {
Map("org.slf4j.nop/org.slf4j.nop" -> Seq("org.slf4j"))
},
javaOptions ++= {
Seq(
// To enable logging in benchmarks, add ch.qos.logback module on the modulePath
"-Dslf4j.provider=org.slf4j.nop.NOPServiceProvider"
)
},
javaOptions ++= benchOnlyOptions,
2024-05-02 17:18:41 +03:00
javaOptions += "-Xss16M",
2024-02-13 12:05:31 +03:00
run / fork := true,
run / connectInput := true,
bench := Def
.task {
(Compile / run).toTask("").tag(Exclusive).value
}
.dependsOn(
buildEngineDistribution
)
.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 {
(Compile / run).toTask(" " + name).value
}
}.evaluated
)
.dependsOn(`runtime-fat-jar`)
.dependsOn(`benchmarks-common`)
2024-07-15 13:38:05 +03:00
.dependsOn(`test-utils`)
2019-11-18 16:36:03 +03:00
2023-06-24 07:34:21 +03:00
lazy val `runtime-parser` =
(project in file("engine/runtime-parser"))
.settings(
2024-06-14 17:01:37 +03:00
version := mavenUploadVersion,
javadocSettings,
publish / skip := false,
crossPaths := false,
2023-06-24 07:34:21 +03:00
frgaalJavaCompilerSetting,
2024-05-30 19:24:04 +03:00
annotationProcSetting,
2023-11-19 18:38:31 +03:00
commands += WithDebugCommand.withDebug,
fork := true,
2023-06-24 07:34:21 +03:00
libraryDependencies ++= Seq(
2023-11-19 18:38:31 +03:00
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
2024-05-30 19:24:04 +03:00
)
2023-06-24 07:34:21 +03:00
)
.dependsOn(`syntax-rust-definition`)
2023-11-19 18:38:31 +03:00
.dependsOn(`persistance`)
.dependsOn(`persistance-dsl` % "provided")
2023-06-24 07:34:21 +03:00
2023-11-01 14:42:34 +03:00
lazy val `runtime-compiler` =
(project in file("engine/runtime-compiler"))
.settings(
frgaalJavaCompilerSetting,
2024-05-30 19:24:04 +03:00
annotationProcSetting,
2024-04-26 16:14:22 +03:00
(Test / fork) := true,
2023-11-01 14:42:34 +03:00
libraryDependencies ++= Seq(
2023-11-19 18:38:31 +03:00
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
2024-02-02 14:45:19 +03:00
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
2023-11-01 14:42:34 +03:00
)
)
.dependsOn(`runtime-parser`)
.dependsOn(pkg)
2024-04-26 16:14:22 +03:00
.dependsOn(`engine-common`)
2023-11-01 14:42:34 +03:00
.dependsOn(editions)
2023-11-19 18:38:31 +03:00
.dependsOn(`persistance-dsl` % "provided")
2023-11-01 14:42:34 +03:00
2024-04-26 16:14:22 +03:00
lazy val `runtime-suggestions` =
(project in file("engine/runtime-suggestions"))
.settings(
frgaalJavaCompilerSetting,
(Test / fork) := true,
libraryDependencies ++= Seq(
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
)
)
.dependsOn(`runtime-compiler`)
.dependsOn(`polyglot-api`)
2023-06-08 17:51:50 +03:00
lazy val `runtime-instrument-common` =
(project in file("engine/runtime-instrument-common"))
.configs(Benchmark)
.settings(
frgaalJavaCompilerSetting,
inConfig(Compile)(truffleRunOptionsSettings),
inConfig(Benchmark)(Defaults.testSettings),
instrumentationSettings,
Test / javaOptions ++= Seq(
2023-11-17 21:02:36 +03:00
"-Dpolyglotimpl.DisableClassPathIsolation=true"
2023-06-08 17:51:50 +03:00
),
bench := (Benchmark / test).tag(Exclusive).value,
Benchmark / parallelExecution := false,
2023-11-17 21:02:36 +03:00
(Benchmark / javaOptions) :=
2024-02-13 12:05:31 +03:00
(LocalProject("std-benchmarks") / Compile / javaOptions).value,
2023-06-08 17:51:50 +03:00
Test / fork := true,
Test / envVars ++= distributionEnvironmentOverrides ++ Map(
"ENSO_TEST_DISABLE_IR_CACHE" -> "false"
2024-01-30 03:13:43 +03:00
),
libraryDependencies ++= Seq(
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
2023-06-08 17:51:50 +03:00
)
)
2023-08-11 00:16:33 +03:00
.dependsOn(`refactoring-utils`)
2023-06-08 17:51:50 +03:00
.dependsOn(
2023-12-18 20:22:16 +03:00
LocalProject(
"runtime"
2024-01-30 03:13:43 +03:00
) % "compile->compile;runtime->runtime;bench->bench"
2023-06-08 17:51:50 +03:00
)
2022-07-01 04:58:14 +03:00
lazy val `runtime-instrument-id-execution` =
(project in file("engine/runtime-instrument-id-execution"))
.settings(
2023-09-15 13:09:42 +03:00
frgaalJavaCompilerSetting,
2022-07-01 04:58:14 +03:00
inConfig(Compile)(truffleRunOptionsSettings),
instrumentationSettings
)
2023-12-18 20:22:16 +03:00
.dependsOn(LocalProject("runtime"))
2023-06-08 17:51:50 +03:00
.dependsOn(`runtime-instrument-common`)
2022-06-13 17:09:08 +03:00
2022-07-01 04:58:14 +03:00
lazy val `runtime-instrument-repl-debugger` =
(project in file("engine/runtime-instrument-repl-debugger"))
.settings(
inConfig(Compile)(truffleRunOptionsSettings),
instrumentationSettings
)
2023-12-18 20:22:16 +03:00
.dependsOn(LocalProject("runtime"))
2023-06-08 17:51:50 +03:00
.dependsOn(`runtime-instrument-common`)
2022-06-13 17:09:08 +03:00
2022-07-01 04:58:14 +03:00
lazy val `runtime-instrument-runtime-server` =
(project in file("engine/runtime-instrument-runtime-server"))
.settings(
inConfig(Compile)(truffleRunOptionsSettings),
instrumentationSettings
)
2023-12-18 20:22:16 +03:00
.dependsOn(LocalProject("runtime"))
2024-01-23 02:05:41 +03:00
.dependsOn(`runtime-instrument-common` % "test->test;compile->compile")
2022-06-13 17:09:08 +03:00
2023-12-18 20:22:16 +03:00
/** A "meta" project that exists solely to provide logic for assembling the `runtime.jar` fat Jar.
* We do not want to put this task into any other existing project, as it internally copies some
* classes from other projects into the `classes` directory, therefore, pollutes the build.
* There is only one Java source in this project - `module-info.java`. During the assembling of the
* fat jar, all the classes from the dependent projects are copied into the `classes` directory of
* this project and then, a custom task is invoked to compile the `module-info.java`.
*/
lazy val `runtime-fat-jar` =
(project in file("engine/runtime-fat-jar"))
.enablePlugins(JPMSPlugin)
.settings(
2024-06-07 13:56:42 +03:00
// extra module path for compileModuleInfo task
Compile / JPMSUtils.extraMp := {
val ydocMod =
(`ydoc-server` / Compile / exportedProductJars).value
val syntaxMod =
(`syntax-rust-definition` / Compile / exportedProductJars).value
val profilingMod =
(`profiling-utils` / Compile / exportedProductJars).value
ydocMod ++ syntaxMod ++ profilingMod
},
2023-12-18 20:22:16 +03:00
Compile / compileModuleInfo := {
JPMSUtils.compileModuleInfo(
copyDepsFilter = ScopeFilter(
inProjects(
LocalProject("runtime"),
LocalProject("runtime-language-epb"),
LocalProject("runtime-instrument-common"),
LocalProject("runtime-instrument-id-execution"),
LocalProject("runtime-instrument-repl-debugger"),
2024-06-07 13:56:42 +03:00
LocalProject("runtime-instrument-runtime-server")
2023-12-18 20:22:16 +03:00
),
inConfigurations(Compile)
),
2024-05-28 16:51:42 +03:00
modulePath = JPMSUtils.componentModules ++ helidon
2023-12-18 20:22:16 +03:00
)
}
.dependsOn(Compile / compile)
.value,
// Filter module-info.java from the compilation
excludeFilter := excludeFilter.value || "module-info.java",
javaModuleName := "org.enso.runtime",
compileOrder := CompileOrder.JavaThenScala
)
/** The following libraryDependencies are provided in Runtime scope.
* Later, we will collect them into --module-path option.
* We don't collect them in Compile scope as it does not even make sense
* to run `compile` task in this project.
*/
2022-07-01 04:58:14 +03:00
.settings(
2023-12-04 14:50:59 +03:00
libraryDependencies ++= {
2023-12-18 20:22:16 +03:00
val graalMods =
2023-12-04 14:50:59 +03:00
GraalVM.modules.map(_.withConfigurations(Some(Runtime.name)))
2023-12-18 20:22:16 +03:00
val langMods =
2023-12-04 14:50:59 +03:00
GraalVM.langsPkgs.map(_.withConfigurations(Some(Runtime.name)))
2023-12-18 20:22:16 +03:00
val logbackMods =
logbackPkg.map(_.withConfigurations(Some(Runtime.name)))
2024-05-28 16:51:42 +03:00
val helidonMods = helidon.map(_.withConfigurations(Some(Runtime.name)))
graalMods ++ langMods ++ logbackMods ++ helidonMods
2023-12-18 20:22:16 +03:00
}
2023-11-17 21:02:36 +03:00
)
/** Assembling Uber Jar */
.settings(
assembly := assembly
2023-12-18 20:22:16 +03:00
.dependsOn(Compile / compile)
.dependsOn(Compile / compileModuleInfo)
2024-06-07 13:56:42 +03:00
//`pakcageBin`dependencies are needed because
// assemblyExcludedJars can only exclude JAR archives, not exploded
// directories with classes.
.dependsOn(`syntax-rust-definition` / Compile / packageBin)
.dependsOn(`ydoc-server` / Compile / packageBin)
.dependsOn(`profiling-utils` / Compile / packageBin)
2023-11-17 21:02:36 +03:00
.value,
2022-07-01 04:58:14 +03:00
assembly / assemblyJarName := "runtime.jar",
assembly / test := {},
assembly / assemblyOutputPath := file("runtime.jar"),
2023-11-17 21:02:36 +03:00
assembly / assemblyExcludedJars := {
2024-06-07 13:56:42 +03:00
val pkgsToExclude = JPMSUtils.componentModules ++ helidon ++ Seq(
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion
)
val ourFullCp = (Runtime / fullClasspath).value
val excludedExternalPkgs = JPMSUtils.filterModulesFromClasspath(
2023-11-17 21:02:36 +03:00
ourFullCp,
pkgsToExclude,
streams.value.log
)
2024-06-07 13:56:42 +03:00
val syntaxJar =
(`syntax-rust-definition` / Compile / exportedProducts).value
val ydocJar = (`ydoc-server` / Compile / exportedProducts).value
val profilingJar =
(`profiling-utils` / Compile / exportedProducts).value
val excludedInternalPkgs = syntaxJar ++ ydocJar ++ profilingJar
val log = streams.value.log
excludedInternalPkgs.foreach { internalPkg =>
val isJar =
internalPkg.data.exists() && internalPkg.data.name.endsWith(".jar")
if (!isJar) {
log.error(
internalPkg.data.absolutePath + " is not a JAR archive." +
" It might not be excluded from runtime.jar fat jar."
)
}
}
excludedExternalPkgs ++ excludedInternalPkgs
2023-11-17 21:02:36 +03:00
},
2022-07-01 04:58:14 +03:00
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 PathList("META-INF", "services", xs @ _*) =>
MergeStrategy.concat
2024-02-06 08:23:55 +03:00
case PathList("module-info.class") =>
2024-02-04 13:39:36 +03:00
MergeStrategy.preferProject
2024-05-17 15:42:35 +03:00
// remove once https://github.com/snakeyaml/snakeyaml/pull/12 gets integrated
case PathList("org", "yaml", "snakeyaml", "introspector", xs @ _*) =>
MergeStrategy.preferProject
2024-02-06 08:23:55 +03:00
case PathList(xs @ _*) if xs.last.contains("module-info.class") =>
MergeStrategy.discard
2022-07-01 04:58:14 +03:00
case _ => MergeStrategy.first
}
)
2023-06-08 17:51:50 +03:00
.dependsOn(`runtime-instrument-common`)
2022-07-01 04:58:14 +03:00
.dependsOn(`runtime-instrument-id-execution`)
.dependsOn(`runtime-instrument-repl-debugger`)
.dependsOn(`runtime-instrument-runtime-server`)
2023-08-21 06:31:39 +03:00
.dependsOn(`runtime-language-epb`)
2024-05-28 16:51:42 +03:00
.dependsOn(`ydoc-server`)
2024-05-17 15:42:35 +03:00
.dependsOn(yaml)
2023-12-18 20:22:16 +03:00
.dependsOn(LocalProject("runtime"))
2023-01-03 17:36:26 +03:00
2020-01-31 19:58:35 +03:00
/* Note [Unmanaged Classpath]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~
* As the definition of the core primitives in `core_definition` is achieved
* entirely using the graph macros, this means that the IDE experience for those
* using these primitives is very poor.
*
* To get around this, we want to treat the core definition as a .jar dependency
* to force the IDE to depend on bytecode for its diagnostics, rather than the
* source code (as this means it sees the macros expanded). A standard workflow
* with local publishing would not recompile the definition automatically on
* changes, so the `unmanagedClasspath` route allows us to get automatic
* recompilation but still convince the IDE that it is a .jar dependency.
*/
2024-07-12 18:17:07 +03:00
/* The purpose of the `engine-runner-common` project is to contain everything
* that's needed for the `engine-runner` project to invoke `language-server` when
* `--server` option is used.
*
* As such this project contains (primarily) the `LanguageServerApi`
* API & SPI class. `engine-runner` project call the `LanguageServerApi` class static method
* and that method then delegates to an implementation which is supposed to be provided
* by the `language-server` project.
*
* `engine-runner` and `language-server` projects shall be "loosely coupled" - they shouldn't
* have compile time dependency between each other. All that's needed for them to
* communicate belongs into `engine-runner-common` project.
*/
lazy val `engine-runner-common` = project
.in(file("engine/runner-common"))
.settings(
frgaalJavaCompilerSetting,
Test / fork := true,
commands += WithDebugCommand.withDebug,
Test / envVars ++= distributionEnvironmentOverrides,
libraryDependencies ++= Seq(
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided",
"commons-io" % "commons-io" % commonsIoVersion,
"commons-cli" % "commons-cli" % commonsCliVersion
)
)
.dependsOn(`polyglot-api`)
.dependsOn(`library-manager`)
.dependsOn(`edition-updater`)
.dependsOn(testkit % Test)
2020-10-09 17:19:58 +03:00
lazy val `engine-runner` = project
2020-01-17 18:35:44 +03:00
.in(file("engine/runner"))
2019-11-18 16:36:03 +03:00
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2023-11-17 21:02:36 +03:00
truffleDslSuppressWarnsSetting,
2020-06-16 12:00:47 +03:00
javaOptions ++= {
// Note [Classpath Separation]
val runtimeClasspath =
(runtime / Compile / fullClasspath).value
.map(_.data)
.mkString(File.pathSeparator)
Seq(s"-Dtruffle.class.path.append=$runtimeClasspath")
},
2023-06-15 14:00:18 +03:00
packageOptions := Seq(
// The `Multi-Release: true` comes from the `org.xerial/sqlite-jdbc` dependency.
// But the current version of sbt-assembly does not allow to merge MANIFEST.MF
// files this way.
Package.ManifestAttributes(("Multi-Release", "true"))
),
2021-05-14 15:08:39 +03:00
Compile / run / mainClass := Some("org.enso.runner.Main"),
assembly / mainClass := (Compile / run / mainClass).value,
assembly / assemblyJarName := "runner.jar",
assembly / test := {},
assembly / assemblyOutputPath := file("runner.jar"),
2024-06-07 13:56:42 +03:00
assembly / assemblyExcludedJars := {
val excludedExternalPkgs = JPMSUtils.filterArtifacts(
2024-05-28 16:51:42 +03:00
(Compile / fullClasspath).value,
"graalvm",
"truffle",
"helidon"
2024-06-07 13:56:42 +03:00
)
val syntaxJar =
(`syntax-rust-definition` / Compile / exportedProducts).value
val ydocJar = (`ydoc-server` / Compile / exportedProducts).value
val profilingJar = (`profiling-utils` / Compile / exportedProducts).value
val excludedInternalPkgs = syntaxJar ++ ydocJar ++ profilingJar
val log = streams.value.log
excludedInternalPkgs.foreach { internalPkg =>
val isJar =
internalPkg.data.exists() && internalPkg.data.name.endsWith(".jar")
if (!isJar) {
log.error(
internalPkg.data.absolutePath + " is not a JAR archive." +
" It might not be excluded from runtime.jar fat jar."
)
}
}
excludedInternalPkgs ++ excludedExternalPkgs
},
2021-05-14 15:08:39 +03:00
assembly / assemblyMergeStrategy := {
2020-03-06 17:17:46 +03:00
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
2024-05-17 15:42:35 +03:00
// remove once https://github.com/snakeyaml/snakeyaml/pull/12 gets integrated
case PathList("org", "yaml", "snakeyaml", "introspector", xs @ _*) =>
MergeStrategy.preferProject
2023-11-17 21:02:36 +03:00
case PathList(xs @ _*) if xs.last.contains("module-info") =>
// runner.jar must not be a JPMS module
MergeStrategy.discard
2020-03-06 17:17:46 +03:00
case x =>
MergeStrategy.first
},
2020-03-06 16:40:29 +03:00
commands += WithDebugCommand.withDebug,
2019-11-18 16:36:03 +03:00
inConfig(Compile)(truffleRunOptionsSettings),
libraryDependencies ++= Seq(
2024-04-26 16:14:22 +03:00
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion,
2024-04-22 14:02:17 +03:00
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % Provided,
"commons-cli" % "commons-cli" % commonsCliVersion,
"com.monovore" %% "decline" % declineVersion,
"org.jline" % "jline" % jlineVersion,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion
2020-10-22 17:12:28 +03:00
),
2021-05-14 15:08:39 +03:00
run / connectInput := true
2019-11-18 16:36:03 +03:00
)
2020-03-09 16:44:40 +03:00
.settings(
2024-05-17 15:42:35 +03:00
NativeImage.smallJdk := Some(buildSmallJdk.value),
NativeImage.additionalCp := {
val core = Seq(
"runtime.jar",
"runner.jar"
)
2024-06-07 13:56:42 +03:00
val stdLibsJars =
`base-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath())
val profJar = (`profiling-utils` / Compile / exportedProductJars).value
.map(_.data.getAbsolutePath)
val syntaxJar =
(`syntax-rust-definition` / Compile / exportedProductJars).value
.map(_.data.getAbsolutePath)
core ++ stdLibsJars ++ profJar ++ syntaxJar
2024-05-17 15:42:35 +03:00
},
buildSmallJdk := {
val smallJdkDirectory = (target.value / "jdk").getAbsoluteFile()
if (smallJdkDirectory.exists()) {
IO.delete(smallJdkDirectory)
}
2024-06-21 07:03:53 +03:00
val NI_MODULES =
"org.graalvm.nativeimage,org.graalvm.nativeimage.builder,org.graalvm.nativeimage.base,org.graalvm.nativeimage.driver,org.graalvm.nativeimage.librarysupport,org.graalvm.nativeimage.objectfile,org.graalvm.nativeimage.pointsto,com.oracle.graal.graal_enterprise,com.oracle.svm.svm_enterprise"
val JDK_MODULES =
"jdk.localedata,jdk.compiler.graal,jdk.httpserver,java.naming,java.net.http"
2024-05-17 15:42:35 +03:00
val DEBUG_MODULES = "jdk.jdwp.agent"
val PYTHON_MODULES = "jdk.security.auth,java.naming"
val javaHome = Option(System.getProperty("java.home")).map(Paths.get(_))
val (jlink, modules, libDirs) = javaHome match {
case None =>
throw new RuntimeException("Missing java.home variable")
case Some(jh) =>
val exec = jh.resolve("bin").resolve("jlink")
val moduleJars = List(
"lib/svm/bin/../../graalvm/svm-driver.jar",
"lib/svm/bin/../builder/native-image-base.jar",
"lib/svm/bin/../builder/objectfile.jar",
"lib/svm/bin/../builder/pointsto.jar",
"lib/svm/bin/../builder/svm-enterprise.jar",
"lib/svm/bin/../builder/svm.jar",
"lib/svm/bin/../library-support.jar"
)
val targetLibDirs = List("graalvm", "svm", "static", "truffle")
(
exec,
moduleJars.map(jar => jh.resolve(jar).toString),
targetLibDirs.map(d => jh.resolve("lib").resolve(d))
)
}
2024-06-25 12:38:18 +03:00
var jlinkArgs = Seq(
"--module-path",
modules.mkString(File.pathSeparator),
"--output",
smallJdkDirectory.toString(),
"--add-modules",
s"$NI_MODULES,$JDK_MODULES,$DEBUG_MODULES,$PYTHON_MODULES"
)
val exitCode = scala.sys.process.Process(jlink.toString(), jlinkArgs).!
2024-05-17 15:42:35 +03:00
if (exitCode != 0) {
2024-06-25 12:38:18 +03:00
throw new RuntimeException(
s"Failed to execute $jlink ${jlinkArgs.mkString(" ")} - exit code: $exitCode"
)
2024-05-17 15:42:35 +03:00
}
libDirs.foreach(libDir =>
IO.copyDirectory(
libDir.toFile,
smallJdkDirectory.toPath
.resolve("lib")
.resolve(libDir.toFile.getName)
.toFile
)
)
assert(
smallJdkDirectory.exists(),
"Directory of small JDK " + smallJdkDirectory + " is not present"
)
smallJdkDirectory
},
2020-06-16 12:00:47 +03:00
assembly := assembly
2023-12-18 20:22:16 +03:00
.dependsOn(`runtime-fat-jar` / assembly)
2022-10-24 12:55:18 +03:00
.value,
2024-07-06 10:02:20 +03:00
rebuildNativeImage := Def
.taskDyn {
NativeImage
.buildNativeImage(
"enso",
targetDir = engineDistributionRoot.value / "bin",
staticOnLinux = false,
additionalOptions = Seq(
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
"-H:IncludeResources=.*Main.enso$",
"-H:+AddAllCharsets",
"-H:+IncludeAllLocales",
"-ea",
// useful perf & debug switches:
// "-g",
// "-H:+SourceLevelDebug",
// "-H:-DeleteLocalSymbols",
// you may need to set smallJdk := None to use following flags:
// "--trace-class-initialization=org.enso.syntax2.Parser",
"-Dnic=nic"
),
mainClass = Some("org.enso.runner.Main"),
initializeAtRuntime = Seq(
"org.jline.nativ.JLineLibrary",
"org.jline.terminal.impl.jna",
"io.methvin.watchservice.jna.CarbonAPI",
"zio.internal.ZScheduler$$anon$4",
"org.enso.runner.Main$",
"sun.awt",
"sun.java2d",
"sun.font",
"java.awt",
"com.sun.imageio",
"com.sun.jna.internal.Cleaner",
"com.sun.jna.Structure$FFIType",
"akka.http"
)
2023-11-17 21:02:36 +03:00
)
2024-07-06 10:02:20 +03:00
}
.dependsOn(NativeImage.additionalCp)
.dependsOn(NativeImage.smallJdk)
.dependsOn(assembly)
.dependsOn(
buildEngineDistribution
2022-09-22 17:45:10 +03:00
)
2024-07-06 10:02:20 +03:00
.value,
buildNativeImage := Def.taskDyn {
NativeImage
.incrementalNativeImageBuild(
rebuildNativeImage,
"enso",
targetDir = engineDistributionRoot.value / "bin"
)
}.value
2022-09-22 17:45:10 +03:00
)
2022-11-23 17:30:48 +03:00
.dependsOn(`version-output`)
2024-05-17 15:42:35 +03:00
.dependsOn(yaml)
2022-11-23 17:30:48 +03:00
.dependsOn(pkg)
.dependsOn(cli)
2024-07-12 18:17:07 +03:00
.dependsOn(`profiling-utils`)
2022-11-23 17:30:48 +03:00
.dependsOn(`library-manager`)
2023-09-04 12:40:16 +03:00
.dependsOn(`edition-updater`)
2024-05-23 09:20:19 +03:00
.dependsOn(`runtime-parser`)
2022-11-23 17:30:48 +03:00
.dependsOn(`logging-service`)
2023-09-04 12:40:16 +03:00
.dependsOn(`logging-service-logback` % Runtime)
2024-07-12 18:17:07 +03:00
.dependsOn(`engine-runner-common`)
2023-09-04 12:40:16 +03:00
.dependsOn(`polyglot-api`)
2024-06-21 07:03:53 +03:00
.dependsOn(`enso-test-java-helpers`)
2024-07-12 18:17:07 +03:00
.dependsOn(`language-server` % Runtime)
2022-09-22 17:45:10 +03:00
2024-05-17 15:42:35 +03:00
lazy val buildSmallJdk =
taskKey[File]("Build a minimal JDK used for native image generation")
2020-07-10 13:57:42 +03:00
lazy val launcher = project
.in(file("engine/launcher"))
.configs(Test)
.settings(
2024-07-16 17:30:23 +03:00
frgaalJavaCompilerSetting,
2020-08-10 13:14:39 +03:00
resolvers += Resolver.bintrayRepo("gn0s1s", "releases"),
2024-07-16 17:30:23 +03:00
commands += WithDebugCommand.withDebug,
2020-07-10 13:57:42 +03:00
libraryDependencies ++= Seq(
2020-10-22 17:12:28 +03:00
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.apache.commons" % "commons-compress" % commonsCompressVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
akkaSLF4J
)
2020-07-10 13:57:42 +03:00
)
.settings(
2024-05-17 15:42:35 +03:00
NativeImage.smallJdk := None,
NativeImage.additionalCp := Seq.empty,
2020-12-09 16:58:11 +03:00
rebuildNativeImage := NativeImage
2020-10-22 17:12:28 +03:00
.buildNativeImage(
2024-07-16 17:30:23 +03:00
"ensoup",
2020-10-22 17:12:28 +03:00
staticOnLinux = true,
2020-12-09 16:58:11 +03:00
additionalOptions = Seq(
2020-10-22 17:12:28 +03:00
"-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog",
2020-12-09 16:58:11 +03:00
"-H:IncludeResources=.*Main.enso$"
2023-11-17 21:02:36 +03:00
),
includeRuntime = false,
mainClass = Some("org.enso.launcher.cli.Main")
2020-10-22 17:12:28 +03:00
)
2020-12-09 16:58:11 +03:00
.dependsOn(assembly)
2021-01-14 13:46:01 +03:00
.dependsOn(VerifyReflectionSetup.run)
2020-12-09 16:58:11 +03:00
.value,
buildNativeImage := NativeImage
.incrementalNativeImageBuild(
rebuildNativeImage,
2024-07-16 17:30:23 +03:00
"ensoup"
2020-12-09 16:58:11 +03:00
)
2020-10-22 17:12:28 +03:00
.value,
2021-05-14 15:08:39 +03:00
assembly / test := {},
2022-05-10 15:44:05 +03:00
assembly / assemblyOutputPath := file("launcher.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
2023-11-17 21:02:36 +03:00
// launcher.jar must not be an explicit Jar module
case PathList(xs @ _*) if xs.last.contains("module-info") =>
MergeStrategy.discard
2022-05-10 15:44:05 +03:00
case x =>
MergeStrategy.first
}
2020-07-10 13:57:42 +03:00
)
2020-07-22 20:28:03 +03:00
.settings(
2023-10-16 11:57:44 +03:00
Test / fork := true,
Test / javaOptions ++= testLogProviderOptions,
2020-07-22 20:28:03 +03:00
(Test / test) := (Test / test)
2020-12-09 16:58:11 +03:00
.dependsOn(buildNativeImage)
2021-12-27 19:56:35 +03:00
.dependsOn(LauncherShimsForTest.prepare())
2020-10-22 17:12:28 +03:00
.value,
2023-09-04 12:40:16 +03:00
(Test / testOnly) := (Test / testOnly)
.dependsOn(buildNativeImage)
.dependsOn(LauncherShimsForTest.prepare())
2023-09-26 12:32:04 +03:00
.evaluated,
2023-12-21 16:45:33 +03:00
Test / fork := true
2020-07-22 20:28:03 +03:00
)
.dependsOn(cli)
2020-10-30 14:31:31 +03:00
.dependsOn(`runtime-version-manager`)
2020-07-10 13:57:42 +03:00
.dependsOn(`version-output`)
.dependsOn(pkg)
2023-09-04 12:40:16 +03:00
.dependsOn(`logging-utils` % "test->test")
2020-10-02 19:17:21 +03:00
.dependsOn(`logging-service`)
2023-10-16 11:57:44 +03:00
.dependsOn(`logging-service-logback` % "test->test;runtime->runtime")
2021-06-18 17:39:45 +03:00
.dependsOn(`distribution-manager` % Test)
2020-10-30 14:31:31 +03:00
.dependsOn(`runtime-version-manager-test` % Test)
2021-06-18 17:39:45 +03:00
lazy val `distribution-manager` = project
.in(file("lib/scala/distribution-manager"))
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2021-06-18 17:39:45 +03:00
resolvers += Resolver.bintrayRepo("gn0s1s", "releases"),
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
2024-07-05 10:32:45 +03:00
"org.yaml" % "snakeyaml" % snakeyamlVersion,
2021-06-18 17:39:45 +03:00
"commons-io" % "commons-io" % commonsIoVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
.dependsOn(editions)
2021-07-22 09:24:06 +03:00
.dependsOn(cli)
2021-06-18 17:39:45 +03:00
.dependsOn(pkg)
.dependsOn(`logging-utils`)
2024-05-29 14:50:03 +03:00
lazy val `test-utils` =
(project in file("lib/java/test-utils"))
.settings(
frgaalJavaCompilerSetting,
2024-05-30 19:24:04 +03:00
annotationProcSetting,
2024-05-29 14:50:03 +03:00
libraryDependencies ++= GraalVM.modules,
libraryDependencies ++= Seq(
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided"
),
Compile / javacOptions ++= Seq(
"-s",
(Compile / sourceManaged).value.getAbsolutePath
),
Compile / compile := (Compile / compile)
.dependsOn(Def.task { (Compile / sourceManaged).value.mkdirs })
.value
)
.dependsOn(runtime)
2024-02-13 12:05:31 +03:00
lazy val `benchmarks-common` =
(project in file("lib/java/benchmarks-common"))
.settings(
frgaalJavaCompilerSetting,
libraryDependencies ++= GraalVM.modules ++ Seq(
"org.openjdk.jmh" % "jmh-core" % jmhVersion,
"org.openjdk.jmh" % "jmh-generator-annprocess" % jmhVersion,
"jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion,
"com.sun.xml.bind" % "jaxb-impl" % jaxbVersion
)
)
.dependsOn(`polyglot-api`)
2024-06-22 15:40:51 +03:00
lazy val `desktop-environment` =
project
.in(file("lib/java/desktop-environment"))
.settings(
frgaalJavaCompilerSetting,
libraryDependencies ++= Seq(
2024-07-27 16:37:43 +03:00
"org.graalvm.sdk" % "graal-sdk" % graalMavenPackagesVersion % "provided",
"commons-io" % "commons-io" % commonsIoVersion,
"org.slf4j" % "slf4j-api" % slf4jVersion,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test
2024-06-22 15:40:51 +03:00
)
)
2023-08-07 15:39:01 +03:00
lazy val `bench-processor` = (project in file("lib/scala/bench-processor"))
.settings(
frgaalJavaCompilerSetting,
libraryDependencies ++= Seq(
2023-11-17 21:02:36 +03:00
"jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion,
"com.sun.xml.bind" % "jaxb-impl" % jaxbVersion,
"org.openjdk.jmh" % "jmh-core" % jmhVersion % "provided",
"org.openjdk.jmh" % "jmh-generator-annprocess" % jmhVersion % "provided",
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided",
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % Test
2023-08-07 15:39:01 +03:00
),
Compile / javacOptions := ((Compile / javacOptions).value ++
// Only run ServiceProvider processor and ignore those defined in META-INF, thus
// fixing incremental compilation setup
Seq(
"-processor",
"org.netbeans.modules.openide.util.ServiceProviderProcessor"
)),
2023-11-17 21:02:36 +03:00
mainClass := Some("org.enso.benchmarks.libs.LibBenchRunner"),
2023-08-07 15:39:01 +03:00
commands += WithDebugCommand.withDebug,
(Test / fork) := true,
(Test / parallelExecution) := false,
2023-11-17 21:02:36 +03:00
(Test / javaOptions) ++=
2023-08-07 15:39:01 +03:00
Seq(
2023-11-17 21:02:36 +03:00
"-Dpolyglot.engine.WarnInterpreterOnly=false",
"-Dpolyglotimpl.DisableClassPathIsolation=true"
),
// Append enso language on the class-path
(Test / unmanagedClasspath) :=
2023-12-18 20:22:16 +03:00
(LocalProject("runtime-fat-jar") / Compile / fullClasspath).value
2023-08-07 15:39:01 +03:00
)
2024-02-13 12:05:31 +03:00
.dependsOn(`benchmarks-common`)
2023-08-07 15:39:01 +03:00
.dependsOn(`polyglot-api`)
.dependsOn(runtime)
lazy val `std-benchmarks` = (project in file("std-bits/benchmarks"))
2024-02-13 12:05:31 +03:00
.enablePlugins(JPMSPlugin)
2023-08-07 15:39:01 +03:00
.settings(
frgaalJavaCompilerSetting,
2024-05-30 19:24:04 +03:00
annotationProcSetting,
2024-02-13 12:05:31 +03:00
libraryDependencies ++= GraalVM.modules ++ GraalVM.langsPkgs ++ Seq(
"org.openjdk.jmh" % "jmh-core" % jmhVersion,
"org.openjdk.jmh" % "jmh-generator-annprocess" % jmhVersion,
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion,
"org.slf4j" % "slf4j-api" % slf4jVersion,
"org.slf4j" % "slf4j-nop" % slf4jVersion
2023-08-07 15:39:01 +03:00
),
2024-05-30 19:24:04 +03:00
commands += WithDebugCommand.withDebug
2023-08-07 15:39:01 +03:00
)
.settings(
2024-02-13 12:05:31 +03:00
parallelExecution := false,
run / fork := true,
run / connectInput := true,
mainClass :=
(LocalProject("bench-processor") / mainClass).value,
Compile / compile := (Compile / compile)
.dependsOn(`runtime-fat-jar` / assembly)
.value,
Compile / javacOptions ++= Seq(
2023-11-17 21:02:36 +03:00
"-Xlint:unchecked",
"-J-Dpolyglotimpl.DisableClassPathIsolation=true",
"-J-Dpolyglot.engine.WarnInterpreterOnly=false"
2023-08-07 15:39:01 +03:00
),
2024-02-13 12:05:31 +03:00
modulePath := {
2024-05-30 19:33:48 +03:00
val allRuntimeMods = componentModulesPaths.value
val otherModIds = Seq(
2023-11-17 21:02:36 +03:00
"org.slf4j" % "slf4j-nop" % slf4jVersion
)
2024-02-13 12:05:31 +03:00
val requiredMods = JPMSUtils.filterModulesFromUpdate(
(Compile / update).value,
2024-05-30 19:33:48 +03:00
otherModIds,
2023-11-17 21:02:36 +03:00
streams.value.log,
shouldContainAll = true
)
2024-05-30 19:33:48 +03:00
allRuntimeMods ++ requiredMods
2024-02-13 12:05:31 +03:00
},
addModules := {
val runtimeModuleName = (`runtime-fat-jar` / javaModuleName).value
Seq(runtimeModuleName)
},
addExports := {
Map("org.slf4j.nop/org.slf4j.nop" -> Seq("org.slf4j"))
},
javaOptions ++= {
2023-08-07 15:39:01 +03:00
Seq(
2023-11-17 21:02:36 +03:00
// To enable logging in benchmarks, add ch.qos.logback module on the modulePath
2024-02-13 12:05:31 +03:00
"-Dslf4j.provider=org.slf4j.nop.NOPServiceProvider"
2023-08-07 15:39:01 +03:00
)
2023-11-17 21:02:36 +03:00
},
2024-02-13 12:05:31 +03:00
javaOptions ++= benchOnlyOptions
2023-08-07 15:39:01 +03:00
)
.settings(
2023-08-23 13:18:36 +03:00
bench := Def
.task {
2024-02-13 12:05:31 +03:00
(Compile / run).toTask("").tag(Exclusive).value
2023-08-23 13:18:36 +03:00
}
.dependsOn(
buildEngineDistribution
)
.value,
2023-08-07 15:39:01 +03:00
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 {
2024-02-13 12:05:31 +03:00
(Compile / run).toTask(" " + name).value
2023-08-07 15:39:01 +03:00
}
}.evaluated
)
2024-02-13 12:05:31 +03:00
.dependsOn(`bench-processor`)
.dependsOn(`runtime-fat-jar`)
2024-03-21 13:57:40 +03:00
.dependsOn(`std-table` % "provided")
.dependsOn(`std-base` % "provided")
2024-03-27 12:31:15 +03:00
.dependsOn(`benchmark-java-helpers` % "provided")
2023-08-07 15:39:01 +03:00
2021-06-18 17:39:45 +03:00
lazy val editions = project
.in(file("lib/scala/editions"))
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2021-06-18 17:39:45 +03:00
libraryDependencies ++= Seq(
2024-07-05 10:32:45 +03:00
"io.circe" %% "circe-core" % circeVersion % "provided",
"org.yaml" % "snakeyaml" % snakeyamlVersion % "provided",
2024-04-26 16:14:22 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test
2021-06-18 17:39:45 +03:00
)
)
2021-08-09 17:00:04 +03:00
.settings(
(Compile / compile) := (Compile / compile)
.dependsOn(
Def.task {
Editions.writeEditionConfig(
2022-02-07 17:14:32 +03:00
editionsRoot = file("distribution") / "editions",
2021-08-13 19:14:20 +03:00
ensoVersion = ensoVersion,
editionName = currentEdition,
libraryVersion = stdLibVersion,
log = streams.value.log
2021-08-09 17:00:04 +03:00
)
}
)
.value,
cleanFiles += baseDirectory.value / ".." / ".." / "distribution" / "editions"
)
2024-02-22 12:59:09 +03:00
.dependsOn(semver)
.dependsOn(testkit % Test)
lazy val semver = project
.in(file("lib/scala/semver"))
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
libraryDependencies ++= Seq(
2024-07-05 10:32:45 +03:00
"io.circe" %% "circe-core" % circeVersion % "provided",
"org.yaml" % "snakeyaml" % snakeyamlVersion % "provided",
2024-04-26 16:14:22 +03:00
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test
2024-02-22 12:59:09 +03:00
)
)
.settings(
(Compile / compile) := (Compile / compile)
.dependsOn(
Def.task {
Editions.writeEditionConfig(
editionsRoot = file("distribution") / "editions",
ensoVersion = ensoVersion,
editionName = currentEdition,
libraryVersion = stdLibVersion,
log = streams.value.log
)
}
)
.value,
cleanFiles += baseDirectory.value / ".." / ".." / "distribution" / "editions"
)
2021-06-22 14:35:15 +03:00
.dependsOn(testkit % Test)
2024-07-05 10:32:45 +03:00
.dependsOn(`scala-yaml`)
2021-06-18 17:39:45 +03:00
2021-07-22 09:24:06 +03:00
lazy val downloader = (project in file("lib/scala/downloader"))
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2024-02-19 19:39:05 +03:00
// Fork the tests to make sure that the withDebug command works (we can
// attach debugger to the subprocess)
(Test / fork) := true,
commands += WithDebugCommand.withDebug,
2021-07-22 09:24:06 +03:00
version := "0.1",
libraryDependencies ++= circe ++ Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"commons-io" % "commons-io" % commonsIoVersion,
"org.apache.commons" % "commons-compress" % commonsCompressVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
2024-02-19 19:39:05 +03:00
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test
2021-07-22 09:24:06 +03:00
)
)
.dependsOn(cli)
2024-06-12 21:15:36 +03:00
.dependsOn(`http-test-helper` % "test->test")
2024-03-12 12:53:55 +03:00
.dependsOn(testkit % Test)
2021-07-22 09:24:06 +03:00
lazy val `edition-updater` = project
.in(file("lib/scala/edition-updater"))
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2022-07-01 04:58:14 +03:00
Test / test := (Test / test).tag(simpleLibraryServerTag).value,
2021-07-22 09:24:06 +03:00
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
.dependsOn(editions)
.dependsOn(downloader)
2021-08-12 17:55:23 +03:00
.dependsOn(`distribution-manager`)
.dependsOn(`library-manager-test` % Test)
lazy val `edition-uploader` = project
.in(file("lib/scala/edition-uploader"))
2023-01-31 11:40:04 +03:00
.settings(
2024-04-26 16:14:22 +03:00
frgaalJavaCompilerSetting,
libraryDependencies ++= Seq(
2024-07-05 10:32:45 +03:00
"io.circe" %% "circe-core" % circeVersion % "provided"
2024-04-26 16:14:22 +03:00
)
2023-01-31 11:40:04 +03:00
)
2021-08-12 17:55:23 +03:00
.dependsOn(editions)
.dependsOn(`version-output`)
2021-07-22 09:24:06 +03:00
2021-06-18 17:39:45 +03:00
lazy val `library-manager` = project
.in(file("lib/scala/library-manager"))
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2021-06-18 17:39:45 +03:00
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
2021-07-08 16:38:20 +03:00
.dependsOn(`version-output`) // Note [Default Editions]
2021-06-18 17:39:45 +03:00
.dependsOn(editions)
.dependsOn(cli)
.dependsOn(`distribution-manager`)
2021-07-22 09:24:06 +03:00
.dependsOn(downloader)
2021-06-18 17:39:45 +03:00
.dependsOn(testkit % Test)
2021-08-09 17:00:04 +03:00
lazy val `library-manager-test` = project
.in(file("lib/scala/library-manager-test"))
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2023-10-16 11:57:44 +03:00
Test / fork := true,
2024-02-19 19:39:05 +03:00
commands += WithDebugCommand.withDebug,
2023-10-16 11:57:44 +03:00
Test / javaOptions ++= testLogProviderOptions,
2022-07-01 04:58:14 +03:00
Test / test := (Test / test).tag(simpleLibraryServerTag).value,
2021-08-09 17:00:04 +03:00
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
.dependsOn(`library-manager`)
2024-07-26 19:01:44 +03:00
.dependsOn(`process-utils`)
2023-09-04 12:40:16 +03:00
.dependsOn(`logging-utils` % "test->test")
2021-08-09 17:00:04 +03:00
.dependsOn(testkit)
2023-10-16 11:57:44 +03:00
.dependsOn(`logging-service-logback` % "test->test")
2021-08-09 17:00:04 +03:00
2021-08-27 15:01:13 +03:00
lazy val `connected-lock-manager` = project
.in(file("lib/scala/connected-lock-manager"))
2024-02-19 19:39:05 +03:00
.configs(Test)
.settings(
frgaalJavaCompilerSetting,
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
.dependsOn(`distribution-manager`)
.dependsOn(`connected-lock-manager-server` % "test->test")
.dependsOn(`polyglot-api`)
/** Unlike `connected-lock-manager` project, has a dependency on akka.
*/
lazy val `connected-lock-manager-server` = project
.in(file("lib/scala/connected-lock-manager-server"))
2021-08-27 15:01:13 +03:00
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2021-08-27 15:01:13 +03:00
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
akkaActor,
akkaTestkit % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
.dependsOn(`distribution-manager`)
.dependsOn(`polyglot-api`)
.dependsOn(testkit % Test)
2020-10-30 14:31:31 +03:00
lazy val `runtime-version-manager` = project
.in(file("lib/scala/runtime-version-manager"))
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2020-10-30 14:31:31 +03:00
resolvers += Resolver.bintrayRepo("gn0s1s", "releases"),
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.apache.commons" % "commons-compress" % commonsCompressVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
2020-12-15 11:49:58 +03:00
akkaHttp
2020-10-30 14:31:31 +03:00
)
)
.dependsOn(pkg)
2021-07-22 09:24:06 +03:00
.dependsOn(downloader)
2020-10-30 14:31:31 +03:00
.dependsOn(cli)
2024-07-26 19:01:44 +03:00
.dependsOn(`process-utils`)
2020-10-30 14:31:31 +03:00
.dependsOn(`version-output`)
2021-08-12 17:55:23 +03:00
.dependsOn(`edition-updater`)
2021-06-18 17:39:45 +03:00
.dependsOn(`distribution-manager`)
2020-10-30 14:31:31 +03:00
2024-07-26 19:01:44 +03:00
/** `process-utils` provides utilities for correctly managing process execution such as providing
* handlers for its stdout/stderr.
*/
lazy val `process-utils` = project
.in(file("lib/scala/process-utils"))
.settings(
frgaalJavaCompilerSetting
)
2020-10-30 14:31:31 +03:00
lazy val `runtime-version-manager-test` = project
.in(file("lib/scala/runtime-version-manager-test"))
.configs(Test)
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2020-10-30 14:31:31 +03:00
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.scalatest" %% "scalatest" % scalatestVersion,
"commons-io" % "commons-io" % commonsIoVersion
)
)
2021-05-14 15:08:39 +03:00
.settings(Test / parallelExecution := false)
2020-11-06 15:53:45 +03:00
.settings(
(Test / test) := (Test / test)
.dependsOn(`locking-test-helper` / assembly)
.value
)
2020-10-30 14:31:31 +03:00
.dependsOn(`runtime-version-manager`)
2020-11-06 15:53:45 +03:00
.dependsOn(testkit)
2021-06-18 17:39:45 +03:00
.dependsOn(cli)
.dependsOn(`distribution-manager`)
2020-11-06 15:53:45 +03:00
lazy val `locking-test-helper` = project
.in(file("lib/scala/locking-test-helper"))
.settings(
2023-01-31 11:40:04 +03:00
frgaalJavaCompilerSetting,
2021-05-14 15:08:39 +03:00
assembly / test := {},
assembly / assemblyOutputPath := file("locking-test-helper.jar")
2020-11-06 15:53:45 +03:00
)
2020-08-10 13:14:39 +03:00
2021-07-08 16:38:20 +03:00
val `std-lib-root` = file("distribution/lib/Standard/")
def stdLibComponentRoot(name: String): File =
`std-lib-root` / name / stdLibVersion
val `base-polyglot-root` = stdLibComponentRoot("Base") / "polyglot" / "java"
val `table-polyglot-root` = stdLibComponentRoot("Table") / "polyglot" / "java"
val `image-polyglot-root` = stdLibComponentRoot("Image") / "polyglot" / "java"
2021-09-03 22:41:12 +03:00
val `google-api-polyglot-root` =
stdLibComponentRoot("Google_Api") / "polyglot" / "java"
2021-07-08 16:38:20 +03:00
val `database-polyglot-root` =
stdLibComponentRoot("Database") / "polyglot" / "java"
2023-05-04 20:36:51 +03:00
val `std-aws-polyglot-root` =
stdLibComponentRoot("AWS") / "polyglot" / "java"
2024-03-20 13:06:12 +03:00
val `std-snowflake-polyglot-root` =
stdLibComponentRoot("Snowflake") / "polyglot" / "java"
2024-07-30 13:13:08 +03:00
val `std-microsoft-polyglot-root` =
stdLibComponentRoot("Microsoft") / "polyglot" / "java"
2021-06-24 13:42:24 +03:00
lazy val `std-base` = project
.in(file("std-bits") / "base")
.settings(
2022-05-11 14:21:01 +03:00
frgaalJavaCompilerSetting,
2021-06-24 13:42:24 +03:00
autoScalaLibrary := false,
2023-10-23 12:14:35 +03:00
Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(SPIHelpers.ensureSPIConsistency)
.value,
2021-06-24 13:42:24 +03:00
Compile / packageBin / artifactPath :=
`base-polyglot-root` / "std-base.jar",
libraryDependencies ++= Seq(
2024-02-01 10:29:50 +03:00
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion
2021-06-24 13:42:24 +03:00
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
2023-03-11 12:27:26 +03:00
val _ensureCoreIsCompiled =
(`common-polyglot-core-utils` / Compile / packageBin).value
2021-06-24 13:42:24 +03:00
val _ = StdBits
.copyDependencies(
`base-polyglot-root`,
2023-03-11 12:27:26 +03:00
Seq("std-base.jar", "common-polyglot-core-utils.jar"),
2021-06-24 13:42:24 +03:00
ignoreScalaLibrary = true
)
.value
result
}.value
)
2023-03-11 12:27:26 +03:00
.dependsOn(`common-polyglot-core-utils`)
lazy val `common-polyglot-core-utils` = project
.in(file("lib/scala/common-polyglot-core-utils"))
.settings(
frgaalJavaCompilerSetting,
autoScalaLibrary := false,
Compile / packageBin / artifactPath :=
`base-polyglot-root` / "common-polyglot-core-utils.jar",
libraryDependencies ++= Seq(
2023-11-17 21:02:36 +03:00
"com.ibm.icu" % "icu4j" % icuVersion,
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided"
2023-03-11 12:27:26 +03:00
)
)
2021-06-24 13:42:24 +03:00
2023-02-17 16:38:26 +03:00
lazy val `enso-test-java-helpers` = project
2024-01-17 18:19:19 +03:00
.in(file("test/Base_Tests/polyglot-sources/enso-test-java-helpers"))
2023-02-17 16:38:26 +03:00
.settings(
frgaalJavaCompilerSetting,
autoScalaLibrary := false,
Compile / packageBin / artifactPath :=
2024-01-17 18:19:19 +03:00
file("test/Base_Tests/polyglot/java/helpers.jar"),
2023-02-17 16:38:26 +03:00
libraryDependencies ++= Seq(
2023-11-17 21:02:36 +03:00
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided"
2023-03-07 05:25:13 +03:00
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
val primaryLocation = (Compile / packageBin / artifactPath).value
val secondaryLocations = Seq(
file("test/Table_Tests/polyglot/java/helpers.jar")
)
secondaryLocations.foreach { target =>
IO.copyFile(primaryLocation, target)
}
result
}.value
2023-02-17 16:38:26 +03:00
)
2023-04-27 23:06:17 +03:00
.dependsOn(`std-base` % "provided")
.dependsOn(`std-table` % "provided")
2023-02-17 16:38:26 +03:00
2023-07-21 20:25:02 +03:00
lazy val `exploratory-benchmark-java-helpers` = project
.in(
file(
"test/Exploratory_Benchmarks/polyglot-sources/exploratory-benchmark-java-helpers"
)
)
.settings(
frgaalJavaCompilerSetting,
autoScalaLibrary := false,
Compile / packageBin / artifactPath :=
file(
"test/Exploratory_Benchmarks/polyglot/java/exploratory-benchmark-java-helpers.jar"
),
libraryDependencies ++= Seq(
2023-11-17 21:02:36 +03:00
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided"
2023-07-21 20:25:02 +03:00
)
)
.dependsOn(`std-base` % "provided")
.dependsOn(`std-table` % "provided")
2023-10-18 20:21:59 +03:00
lazy val `benchmark-java-helpers` = project
.in(
file(
"test/Benchmarks/polyglot-sources/benchmark-java-helpers"
)
)
.settings(
frgaalJavaCompilerSetting,
autoScalaLibrary := false,
Compile / packageBin / artifactPath :=
file(
"test/Benchmarks/polyglot/java/benchmark-java-helpers.jar"
),
libraryDependencies ++= Seq(
"org.graalvm.sdk" % "graal-sdk" % graalMavenPackagesVersion % "provided"
)
)
.dependsOn(`std-base` % "provided")
.dependsOn(`std-table` % "provided")
2021-06-24 13:42:24 +03:00
lazy val `std-table` = project
.in(file("std-bits") / "table")
2022-11-08 18:57:59 +03:00
.enablePlugins(Antlr4Plugin)
2021-06-24 13:42:24 +03:00
.settings(
2022-05-11 14:21:01 +03:00
frgaalJavaCompilerSetting,
2021-06-24 13:42:24 +03:00
autoScalaLibrary := false,
2023-10-23 12:14:35 +03:00
Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(SPIHelpers.ensureSPIConsistency)
.value,
2021-06-24 13:42:24 +03:00
Compile / packageBin / artifactPath :=
`table-polyglot-root` / "std-table.jar",
2022-11-08 18:57:59 +03:00
Antlr4 / antlr4PackageName := Some("org.enso.table.expressions"),
2023-06-14 16:15:57 +03:00
Antlr4 / antlr4Version := antlrVersion,
2022-11-08 18:57:59 +03:00
Antlr4 / antlr4GenVisitor := true,
Antlr4 / antlr4TreatWarningsAsErrors := true,
Compile / managedSourceDirectories += {
(Antlr4 / sourceManaged).value / "main" / "antlr4"
},
2021-06-24 13:42:24 +03:00
libraryDependencies ++= Seq(
2023-11-17 21:02:36 +03:00
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided",
2023-09-26 12:32:04 +03:00
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"com.univocity" % "univocity-parsers" % univocityParsersVersion,
"org.apache.poi" % "poi-ooxml" % poiOoxmlVersion,
"org.apache.xmlbeans" % "xmlbeans" % xmlbeansVersion,
"org.antlr" % "antlr4-runtime" % antlrVersion,
"org.apache.logging.log4j" % "log4j-to-slf4j" % "2.18.0" // org.apache.poi uses log4j
2021-06-24 13:42:24 +03:00
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
val _ = StdBits
.copyDependencies(
`table-polyglot-root`,
2023-03-11 12:27:26 +03:00
Seq("std-table.jar"),
2022-10-14 21:08:08 +03:00
ignoreScalaLibrary = true
2021-06-24 13:42:24 +03:00
)
.value
result
}.value
)
2022-09-07 15:28:41 +03:00
.dependsOn(`std-base` % "provided")
2021-06-24 13:42:24 +03:00
lazy val `std-image` = project
.in(file("std-bits") / "image")
.settings(
2022-05-11 14:21:01 +03:00
frgaalJavaCompilerSetting,
2021-06-24 13:42:24 +03:00
autoScalaLibrary := false,
2023-10-23 12:14:35 +03:00
Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(SPIHelpers.ensureSPIConsistency)
.value,
2021-06-24 13:42:24 +03:00
Compile / packageBin / artifactPath :=
`image-polyglot-root` / "std-image.jar",
libraryDependencies ++= Seq(
2023-11-17 21:02:36 +03:00
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided",
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"org.openpnp" % "opencv" % "4.7.0-0"
2021-06-24 13:42:24 +03:00
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
val _ = StdBits
.copyDependencies(
`image-polyglot-root`,
2023-03-11 12:27:26 +03:00
Seq("std-image.jar"),
2021-06-24 13:42:24 +03:00
ignoreScalaLibrary = true
)
.value
result
}.value
)
2023-02-16 18:15:49 +03:00
.dependsOn(`std-base` % "provided")
2020-10-09 17:19:58 +03:00
2021-09-03 22:41:12 +03:00
lazy val `std-google-api` = project
.in(file("std-bits") / "google-api")
.settings(
2022-05-11 14:21:01 +03:00
frgaalJavaCompilerSetting,
2021-09-03 22:41:12 +03:00
autoScalaLibrary := false,
2023-10-23 12:14:35 +03:00
Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(SPIHelpers.ensureSPIConsistency)
.value,
2021-09-03 22:41:12 +03:00
Compile / packageBin / artifactPath :=
2022-01-13 18:17:19 +03:00
`google-api-polyglot-root` / "std-google-api.jar",
2021-09-03 22:41:12 +03:00
libraryDependencies ++= Seq(
2024-02-13 19:23:48 +03:00
"com.google.api-client" % "google-api-client" % "2.2.0" exclude ("com.google.code.findbugs", "jsr305"),
"com.google.apis" % "google-api-services-sheets" % "v4-rev612-1.25.0" exclude ("com.google.code.findbugs", "jsr305"),
"com.google.analytics" % "google-analytics-data" % "0.44.0" exclude ("com.google.code.findbugs", "jsr305")
2021-09-03 22:41:12 +03:00
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
val _ = StdBits
.copyDependencies(
`google-api-polyglot-root`,
2023-03-11 12:27:26 +03:00
Seq("std-google-api.jar"),
2021-09-03 22:41:12 +03:00
ignoreScalaLibrary = true
)
.value
result
}.value
)
2021-06-24 13:42:24 +03:00
lazy val `std-database` = project
.in(file("std-bits") / "database")
2020-10-09 17:19:58 +03:00
.settings(
2022-05-11 14:21:01 +03:00
frgaalJavaCompilerSetting,
2020-10-09 17:19:58 +03:00
autoScalaLibrary := false,
2023-10-23 12:14:35 +03:00
Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(SPIHelpers.ensureSPIConsistency)
.value,
2020-10-09 17:19:58 +03:00
Compile / packageBin / artifactPath :=
2021-06-24 13:42:24 +03:00
`database-polyglot-root` / "std-database.jar",
2023-05-04 20:36:51 +03:00
libraryDependencies ++= Seq(
2023-11-17 21:02:36 +03:00
"org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided",
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"org.xerial" % "sqlite-jdbc" % sqliteVersion,
"org.postgresql" % "postgresql" % "42.4.0"
2023-05-04 20:36:51 +03:00
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
val _ = StdBits
.copyDependencies(
`database-polyglot-root`,
Seq("std-database.jar"),
ignoreScalaLibrary = true
)
.value
result
}.value
)
.dependsOn(`std-base` % "provided")
.dependsOn(`std-table` % "provided")
lazy val `std-aws` = project
.in(file("std-bits") / "aws")
.settings(
frgaalJavaCompilerSetting,
autoScalaLibrary := false,
2023-10-23 12:14:35 +03:00
Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(SPIHelpers.ensureSPIConsistency)
.value,
2023-05-04 20:36:51 +03:00
Compile / packageBin / artifactPath :=
`std-aws-polyglot-root` / "std-aws.jar",
2020-10-09 17:19:58 +03:00
libraryDependencies ++= Seq(
2023-06-15 19:20:13 +03:00
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"com.amazon.redshift" % "redshift-jdbc42" % redshiftVersion,
"com.amazonaws" % "aws-java-sdk-core" % awsJavaSdkV1Version,
"com.amazonaws" % "aws-java-sdk-redshift" % awsJavaSdkV1Version,
"com.amazonaws" % "aws-java-sdk-sts" % awsJavaSdkV1Version,
"software.amazon.awssdk" % "auth" % awsJavaSdkV2Version,
Add AWS SSO JARs to the `Standard.AWS` library (#9782)
As reported by our users, when using the AWS SSO, our code was failing with:
```
Execution finished with an error: To use Sso related properties in the 'xyz' profile, the 'sso' service module must be on the class path.
```
This PR adds the missing JARs to fix that.
Additionally it improves the license review tool UX a bit (parts of #9122):
- sorting the report by amount of problems, so that dependencies with unresolved problems appear at the top,
- semi-automatic helper button to rename package configurations after a version bump,
- button to remove stale entries from config (files or copyrights that disappeared after update),
- button to add custom copyright notice text straight from the report UI,
- button to set a file as the license for the project (creating the `custom-license` file automatically)
- ability to filter processed projects - e.g. `openLegalReviewReport AWS` will only run on the AWS subproject - saving time processing unchanged dependencies,
- updated the license search heuristic, fixing a problem with duplicates:
- if we had dependencies `netty-http` and `netty-http2`, because of a prefix-check logic, the notices for `netty-http` would also appear again for `netty-http2`, which is not valid. I have improved the heuristic to avoid these false positives and removed them from the current report.
- WIP: button to mark a license type as reviewed (not finished in this PR).
2024-04-25 21:44:51 +03:00
"software.amazon.awssdk" % "bom" % awsJavaSdkV2Version,
"software.amazon.awssdk" % "s3" % awsJavaSdkV2Version,
"software.amazon.awssdk" % "sso" % awsJavaSdkV2Version,
"software.amazon.awssdk" % "ssooidc" % awsJavaSdkV2Version
2020-10-22 17:12:28 +03:00
),
2020-10-09 17:19:58 +03:00
Compile / packageBin := Def.task {
2020-10-22 17:12:28 +03:00
val result = (Compile / packageBin).value
2021-02-22 16:32:55 +03:00
val _ = StdBits
2020-10-22 17:12:28 +03:00
.copyDependencies(
2023-05-04 20:36:51 +03:00
`std-aws-polyglot-root`,
Seq("std-aws.jar"),
2022-07-11 21:39:16 +03:00
ignoreScalaLibrary = true
2020-10-22 17:12:28 +03:00
)
.value
result
}.value
2020-10-09 17:19:58 +03:00
)
2023-02-16 18:15:49 +03:00
.dependsOn(`std-base` % "provided")
2023-05-04 20:36:51 +03:00
.dependsOn(`std-table` % "provided")
.dependsOn(`std-database` % "provided")
2020-10-09 17:19:58 +03:00
2024-03-20 13:06:12 +03:00
lazy val `std-snowflake` = project
.in(file("std-bits") / "snowflake")
.settings(
frgaalJavaCompilerSetting,
autoScalaLibrary := false,
Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(SPIHelpers.ensureSPIConsistency)
.value,
Compile / packageBin / artifactPath :=
`std-snowflake-polyglot-root` / "std-snowflake.jar",
libraryDependencies ++= Seq(
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"net.snowflake" % "snowflake-jdbc" % snowflakeJDBCVersion
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
val _ = StdBits
.copyDependencies(
`std-snowflake-polyglot-root`,
Seq("std-snowflake.jar"),
ignoreScalaLibrary = true
)
.value
result
}.value
)
.dependsOn(`std-base` % "provided")
.dependsOn(`std-table` % "provided")
.dependsOn(`std-database` % "provided")
2024-07-30 13:13:08 +03:00
lazy val `std-microsoft` = project
.in(file("std-bits") / "microsoft")
.settings(
frgaalJavaCompilerSetting,
autoScalaLibrary := false,
Compile / compile / compileInputs := (Compile / compile / compileInputs)
.dependsOn(SPIHelpers.ensureSPIConsistency)
.value,
Compile / packageBin / artifactPath :=
`std-microsoft-polyglot-root` / "std-microsoft.jar",
libraryDependencies ++= Seq(
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided",
"com.microsoft.sqlserver" % "mssql-jdbc" % mssqlserverJDBCVersion
),
Compile / packageBin := Def.task {
val result = (Compile / packageBin).value
val _ = StdBits
.copyDependencies(
`std-microsoft-polyglot-root`,
Seq("std-microsoft.jar"),
ignoreScalaLibrary = true
)
.value
result
}.value
)
.dependsOn(`std-base` % "provided")
.dependsOn(`std-table` % "provided")
.dependsOn(`std-database` % "provided")
2020-08-28 14:03:09 +03:00
/* Note [Native Image Workaround for GraalVM 20.2]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* In GraalVM 20.2 the Native Image build of even simple Scala programs has
* started to fail on a call to `Statics.releaseFence`. It has been reported as
* a bug in the GraalVM repository: https://github.com/oracle/graal/issues/2770
*
* A proposed workaround for this bug is to substitute the original function
* with a different implementation that does not use the problematic
* MethodHandle. This is implemented in class
* `org.enso.launcher.workarounds.ReplacementStatics` using
* `org.enso.launcher.workarounds.Unsafe` which gives access to
* `sun.misc.Unsafe` which contains a low-level function corresponding to the
* required "release fence".
*
* To allow for that substitution, the launcher code requires annotations from
* the `svm` module and that is why this additional dependency is needed as long
* as that workaround is in-place. The dependency is marked as "provided"
* because it is included within the native-image build.
*/
2020-10-02 19:17:21 +03:00
/* Note [WSLoggerManager Shutdown Hook]
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* As the WSLoggerManager registers a shutdown hook when its initialized to
* ensure that logs are not lost in case of logging service initialization
* failure, it has to be initialized at runtime, as otherwise if the
* initialization was done at build time, the shutdown hook would actually also
* run at build time and have no effect at runtime.
*/
2020-12-09 16:58:11 +03:00
lazy val engineDistributionRoot =
settingKey[File]("Root of built engine distribution")
lazy val launcherDistributionRoot =
settingKey[File]("Root of built launcher distribution")
lazy val projectManagerDistributionRoot =
settingKey[File]("Root of built project manager distribution")
2021-01-15 18:26:51 +03:00
engineDistributionRoot :=
packageBuilder.localArtifact("engine") / s"enso-$ensoVersion"
launcherDistributionRoot := packageBuilder.localArtifact("launcher") / "enso"
projectManagerDistributionRoot :=
packageBuilder.localArtifact("project-manager") / "enso"
2020-12-09 16:58:11 +03:00
lazy val buildEngineDistribution =
taskKey[Unit]("Builds the engine distribution")
buildEngineDistribution := {
2021-11-23 11:51:17 +03:00
val _ = (`engine-runner` / assembly).value
updateLibraryManifests.value
2024-05-28 16:51:42 +03:00
val modulesToCopy = componentModulesPaths.value
2023-11-17 21:02:36 +03:00
val root = engineDistributionRoot.value
val log = streams.value.log
val cacheFactory = streams.value.cacheStoreFactory
2020-12-09 16:58:11 +03:00
DistributionPackage.createEnginePackage(
2022-02-07 17:14:32 +03:00
distributionRoot = root,
cacheFactory = cacheFactory,
log = log,
2024-05-28 16:51:42 +03:00
jarModulesToCopy = modulesToCopy,
2023-07-20 18:11:30 +03:00
graalVersion = graalMavenPackagesVersion,
2023-11-29 22:36:21 +03:00
javaVersion = graalVersion,
2022-02-07 17:14:32 +03:00
ensoVersion = ensoVersion,
editionName = currentEdition,
sourceStdlibVersion = stdLibVersion,
2022-11-09 18:26:25 +03:00
targetStdlibVersion = targetStdlibVersion,
2023-03-30 12:59:49 +03:00
targetDir = (`syntax-rust-definition` / rustParserTargetDirectory).value,
generateIndex = true
)
log.info(s"Engine package created at $root")
}
2023-08-23 13:18:36 +03:00
// This makes the buildEngineDistribution task usable as a dependency
// of other tasks.
ThisBuild / buildEngineDistribution := {
buildEngineDistribution.result.value
}
2024-07-06 10:02:20 +03:00
ThisBuild / engineDistributionRoot := {
engineDistributionRoot.value
}
2023-03-30 12:59:49 +03:00
lazy val buildEngineDistributionNoIndex =
taskKey[Unit]("Builds the engine distribution without generating indexes")
buildEngineDistributionNoIndex := {
val _ = (`engine-runner` / assembly).value
updateLibraryManifests.value
2024-05-28 16:51:42 +03:00
val modulesToCopy = componentModulesPaths.value
2023-11-17 21:02:36 +03:00
val root = engineDistributionRoot.value
val log = streams.value.log
val cacheFactory = streams.value.cacheStoreFactory
2023-03-30 12:59:49 +03:00
DistributionPackage.createEnginePackage(
distributionRoot = root,
cacheFactory = cacheFactory,
log = log,
2024-05-28 16:51:42 +03:00
jarModulesToCopy = modulesToCopy,
2023-07-20 18:11:30 +03:00
graalVersion = graalMavenPackagesVersion,
2023-11-29 22:36:21 +03:00
javaVersion = graalVersion,
2023-03-30 12:59:49 +03:00
ensoVersion = ensoVersion,
editionName = currentEdition,
sourceStdlibVersion = stdLibVersion,
targetStdlibVersion = targetStdlibVersion,
targetDir = (`syntax-rust-definition` / rustParserTargetDirectory).value,
generateIndex = false
2020-12-09 16:58:11 +03:00
)
log.info(s"Engine package created at $root")
}
2023-11-17 21:02:36 +03:00
// This makes the buildEngineDistributionNoIndex task usable as a dependency
// of other tasks.
ThisBuild / buildEngineDistributionNoIndex := {
buildEngineDistributionNoIndex.result.value
}
2023-03-07 05:25:13 +03:00
lazy val runEngineDistribution =
2023-07-17 20:38:54 +03:00
inputKey[Unit]("Run or --debug the engine distribution with arguments")
2023-02-17 00:37:12 +03:00
runEngineDistribution := {
2024-06-21 07:03:53 +03:00
buildEngineDistributionNoIndex.value
2023-02-17 00:37:12 +03:00
val args: Seq[String] = spaceDelimited("<arg>").parsed
2023-03-07 05:25:13 +03:00
DistributionPackage.runEnginePackage(
engineDistributionRoot.value,
args,
streams.value.log
)
2023-02-17 00:37:12 +03:00
}
2023-07-17 20:38:54 +03:00
lazy val runProjectManagerDistribution =
inputKey[Unit](
"Run or --debug the project manager distribution with arguments"
)
runProjectManagerDistribution := {
buildEngineDistribution.value
buildProjectManagerDistribution.value
val args: Seq[String] = spaceDelimited("<arg>").parsed
DistributionPackage.runProjectManagerPackage(
engineDistributionRoot.value,
projectManagerDistributionRoot.value,
args,
streams.value.log
)
}
2023-03-29 01:28:38 +03:00
val allStdBitsSuffix = List("All", "AllWithIndex")
2022-10-24 12:55:18 +03:00
val stdBitsProjects =
2023-05-04 20:36:51 +03:00
List(
"AWS",
"Base",
"Database",
"Google_Api",
"Image",
2024-07-30 13:13:08 +03:00
"Microsoft",
2024-03-20 13:06:12 +03:00
"Snowflake",
2023-05-04 20:36:51 +03:00
"Table"
) ++ allStdBitsSuffix
2022-05-13 18:38:52 +03:00
val allStdBits: Parser[String] =
stdBitsProjects.map(v => v: Parser[String]).reduce(_ | _)
2022-05-11 13:12:18 +03:00
2023-12-19 20:41:09 +03:00
lazy val `http-test-helper` = project
.in(file("tools") / "http-test-helper")
2022-11-18 14:27:27 +03:00
.settings(
2023-12-15 03:02:15 +03:00
customFrgaalJavaCompilerSettings(targetJdk = "21"),
autoScalaLibrary := false,
2023-11-17 21:02:36 +03:00
Compile / javacOptions ++= Seq("-Xlint:all"),
2023-12-19 20:41:09 +03:00
Compile / run / mainClass := Some("org.enso.shttp.HTTPTestHelperServer"),
2022-11-18 14:27:27 +03:00
libraryDependencies ++= Seq(
2024-01-15 19:12:08 +03:00
"org.apache.commons" % "commons-text" % commonsTextVersion,
"org.apache.httpcomponents" % "httpclient" % httpComponentsVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion
2023-12-15 03:02:15 +03:00
),
2024-01-15 19:12:08 +03:00
assembly / assemblyMergeStrategy := {
case PathList("META-INF", "MANIFEST.MF", xs @ _*) =>
MergeStrategy.discard
case PathList(xs @ _*) if xs.last.contains("module-info") =>
MergeStrategy.discard
case _ => MergeStrategy.first
},
assembly / mainClass := (Compile / run / mainClass).value,
2023-12-15 03:02:15 +03:00
(Compile / run / fork) := true,
(Compile / run / connectInput) := true
2022-11-18 14:27:27 +03:00
)
.configs(Test)
2022-05-13 18:38:52 +03:00
lazy val buildStdLib =
inputKey[Unit]("Build an individual standard library package")
2022-05-11 13:12:18 +03:00
buildStdLib := Def.inputTaskDyn {
val cmd: String = allStdBits.parsed
2022-05-13 18:38:52 +03:00
val root: File = engineDistributionRoot.value
2022-05-11 13:12:18 +03:00
// Ensure that a complete distribution was built at least once.
2022-11-23 14:40:59 +03:00
// Because of `if` in the sbt task definition and usage of `streams.value` one has to
// delegate to another task definition (sbt restriction).
2022-05-11 13:12:18 +03:00
if ((root / "manifest.yaml").exists) {
pkgStdLibInternal.toTask(cmd)
} else buildEngineDistribution
}.evaluated
lazy val pkgStdLibInternal = inputKey[Unit]("Use `buildStdLib`")
2022-10-11 02:11:04 +03:00
pkgStdLibInternal := Def.inputTask {
2023-03-29 01:28:38 +03:00
val cmd = allStdBits.parsed
val root = engineDistributionRoot.value
val log: sbt.Logger = streams.value.log
val cacheFactory = streams.value.cacheStoreFactory
val standardNamespace = "Standard"
val buildAllCmd = allStdBitsSuffix.contains(cmd)
2022-05-11 13:12:18 +03:00
cmd match {
2022-05-13 18:38:52 +03:00
case "Base" =>
2022-05-11 13:12:18 +03:00
(`std-base` / Compile / packageBin).value
2022-05-13 18:38:52 +03:00
case "Database" =>
2022-05-11 13:12:18 +03:00
(`std-database` / Compile / packageBin).value
case "Google_Api" =>
(`std-google-api` / Compile / packageBin).value
2022-05-13 18:38:52 +03:00
case "Image" =>
2022-05-11 13:12:18 +03:00
(`std-image` / Compile / packageBin).value
2022-05-13 18:38:52 +03:00
case "Table" =>
2022-05-11 13:12:18 +03:00
(`std-table` / Compile / packageBin).value
2023-02-17 16:38:26 +03:00
case "TestHelpers" =>
(`enso-test-java-helpers` / Compile / packageBin).value
2023-07-21 20:25:02 +03:00
(`exploratory-benchmark-java-helpers` / Compile / packageBin).value
2023-10-18 20:21:59 +03:00
(`benchmark-java-helpers` / Compile / packageBin).value
2023-05-04 20:36:51 +03:00
case "AWS" =>
(`std-aws` / Compile / packageBin).value
2024-03-20 13:06:12 +03:00
case "Snowflake" =>
(`std-snowflake` / Compile / packageBin).value
2024-07-30 13:13:08 +03:00
case "Microsoft" =>
(`std-microsoft` / Compile / packageBin).value
2023-03-29 01:28:38 +03:00
case _ if buildAllCmd =>
2022-10-11 02:11:04 +03:00
(`std-base` / Compile / packageBin).value
2023-02-17 16:38:26 +03:00
(`enso-test-java-helpers` / Compile / packageBin).value
2023-07-21 20:25:02 +03:00
(`exploratory-benchmark-java-helpers` / Compile / packageBin).value
2023-10-18 20:21:59 +03:00
(`benchmark-java-helpers` / Compile / packageBin).value
2022-10-11 02:11:04 +03:00
(`std-table` / Compile / packageBin).value
(`std-database` / Compile / packageBin).value
(`std-image` / Compile / packageBin).value
(`std-google-api` / Compile / packageBin).value
2023-05-04 20:36:51 +03:00
(`std-aws` / Compile / packageBin).value
2024-03-20 13:06:12 +03:00
(`std-snowflake` / Compile / packageBin).value
2024-07-30 13:13:08 +03:00
(`std-microsoft` / Compile / packageBin).value
2022-05-13 18:38:52 +03:00
case _ =>
2022-05-11 13:12:18 +03:00
}
2022-10-24 12:55:18 +03:00
val libs =
2023-03-29 01:28:38 +03:00
if (!buildAllCmd) Seq(cmd)
2022-10-24 12:55:18 +03:00
else {
2023-03-29 01:28:38 +03:00
val prefix = s"$standardNamespace."
2022-10-24 12:55:18 +03:00
Editions.standardLibraries
.filter(_.startsWith(prefix))
.map(_.stripPrefix(prefix))
}
2023-03-29 01:28:38 +03:00
val generateIndex = cmd.endsWith("WithIndex")
2022-10-11 02:11:04 +03:00
libs.foreach { lib =>
StdBits.buildStdLibPackage(
lib,
root,
cacheFactory,
log,
defaultDevEnsoVersion
)
2023-03-29 01:28:38 +03:00
if (generateIndex) {
val stdlibStandardRoot = root / "lib" / standardNamespace
DistributionPackage.indexStdLib(
libName = stdlibStandardRoot / lib,
stdLibVersion = defaultDevEnsoVersion,
ensoVersion = defaultDevEnsoVersion,
ensoExecutable = root / "bin" / "enso",
cacheFactory = cacheFactory.sub("stdlib"),
log = log
)
}
2022-10-11 02:11:04 +03:00
}
2022-05-11 13:12:18 +03:00
}.evaluated
2020-12-09 16:58:11 +03:00
lazy val buildLauncherDistribution =
taskKey[Unit]("Builds the launcher distribution")
buildLauncherDistribution := {
val _ = (launcher / buildNativeImage).value
val root = launcherDistributionRoot.value
val log = streams.value.log
val cacheFactory = streams.value.cacheStoreFactory
DistributionPackage.createLauncherPackage(root, cacheFactory)
log.info(s"Launcher package created at $root")
}
lazy val buildProjectManagerDistribution =
taskKey[Unit]("Builds the project manager distribution")
buildProjectManagerDistribution := {
val _ = (`project-manager` / buildNativeImage).value
val root = projectManagerDistributionRoot.value
val log = streams.value.log
val cacheFactory = streams.value.cacheStoreFactory
DistributionPackage.createProjectManagerPackage(root, cacheFactory)
log.info(s"Project Manager package created at $root")
}
2021-04-07 17:19:23 +03:00
lazy val buildGraalDistribution =
taskKey[Unit]("Builds the GraalVM distribution")
buildGraalDistribution := {
2023-12-05 13:24:02 +03:00
val log = streams.value.log
val distOs = "DIST_OS"
val distArch = "DIST_ARCH"
val osName = "os.name"
val archName = "os.arch"
2021-04-07 17:19:23 +03:00
val distName = sys.env.get(distOs).getOrElse {
val name = sys.props(osName).takeWhile(!_.isWhitespace)
if (sys.env.contains("CI")) {
log.warn(
s"$distOs env var is empty. Fallback to system property $osName=$name."
)
}
name
}
2023-12-05 13:24:02 +03:00
val arch = sys.env.get(distArch).orElse(sys.env.get(archName))
val os = DistributionPackage.OS(distName, arch).getOrElse {
2021-04-07 17:19:23 +03:00
throw new RuntimeException(s"Failed to determine OS: $distName.")
}
packageBuilder.createGraalPackage(
log,
os,
2023-12-05 13:24:02 +03:00
os.archs.head
2021-04-07 17:19:23 +03:00
)
}
2021-11-23 11:51:17 +03:00
lazy val updateLibraryManifests =
taskKey[Unit](
"Recomputes dependencies to update manifests bundled with libraries."
)
updateLibraryManifests := {
val _ = (`engine-runner` / assembly).value
val log = streams.value.log
val cacheFactory = streams.value.cacheStoreFactory
val libraries = Editions.standardLibraries.map(libName =>
BundledLibrary(libName, stdLibVersion)
)
2024-06-07 13:56:42 +03:00
val runnerCp = (LocalProject("engine-runner") / Runtime / fullClasspath).value
val runtimeCp = (LocalProject("runtime") / Runtime / fullClasspath).value
val fullCp = (runnerCp ++ runtimeCp).distinct
val modulePath = componentModulesPaths.value
2023-11-17 21:02:36 +03:00
val runnerJar = (LocalProject("engine-runner") / assembly).value
val javaOpts = Seq(
"-Denso.runner=" + runnerJar.getAbsolutePath,
"--module-path",
modulePath.map(_.getAbsolutePath).mkString(File.pathSeparator),
"-m",
"org.enso.runtime/org.enso.EngineRunnerBootLoader"
)
2021-11-23 11:51:17 +03:00
LibraryManifestGenerator.generateManifests(
libraries,
file("distribution"),
log,
2023-11-17 21:02:36 +03:00
javaOpts,
2021-11-23 11:51:17 +03:00
cacheFactory
)
}