-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify declaration of module path in sbt build #10836
Changes from 6 commits
543b3c2
298557b
367ff21
196162e
906442f
bcc6cce
e2a1229
fcb6c11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -583,6 +583,25 @@ val jnaVersion = "5.14.0" | |
// === Utility methods ===================================================== | ||
// ============================================================================ | ||
|
||
lazy val componentModulesIds = | ||
taskKey[Seq[ModuleID]]( | ||
"Gather all sbt module IDs that will be put on the module-path for the engine runner" | ||
) | ||
(ThisBuild / componentModulesIds) := { | ||
GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.toolsPkgs ++ helidon ++ Seq( | ||
"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, | ||
(`runtime-language-arrow` / projectID).value, | ||
(`syntax-rust-definition` / projectID).value, | ||
(`ydoc-server` / projectID).value, | ||
(`profiling-utils` / projectID).value, | ||
(`runtime-fat-jar` / projectID).value | ||
) | ||
} | ||
|
||
// TODO[pm]: this is now deprecated and should be removed | ||
lazy val componentModulesPaths = | ||
taskKey[Seq[File]]( | ||
"Gathers all component modules (Jar archives that should be put on module-path" + | ||
|
@@ -836,15 +855,10 @@ lazy val `profiling-utils` = project | |
"junit" % "junit" % junitVersion % Test, | ||
"com.github.sbt" % "junit-interface" % junitIfVersion % Test | ||
), | ||
modulePath := { | ||
JPMSUtils.filterModulesFromUpdate( | ||
update.value, | ||
Seq( | ||
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, | ||
"org.slf4j" % "slf4j-api" % slf4jVersion | ||
), | ||
streams.value.log, | ||
shouldContainAll = true | ||
moduleDependencies := { | ||
Seq( | ||
"org.slf4j" % "slf4j-api" % slf4jVersion, | ||
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion | ||
) | ||
} | ||
) | ||
|
@@ -1094,33 +1108,14 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) | |
(`profiling-utils` / javaModuleName).value, | ||
(`ydoc-server` / javaModuleName).value | ||
), | ||
Test / modulePath := { | ||
val updateReport = (Test / update).value | ||
val requiredModIds = | ||
GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq( | ||
"org.slf4j" % "slf4j-api" % slf4jVersion, | ||
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion | ||
) | ||
val requiredMods = JPMSUtils.filterModulesFromUpdate( | ||
updateReport, | ||
requiredModIds, | ||
streams.value.log, | ||
shouldContainAll = true | ||
) | ||
val runtimeMod = | ||
(`runtime-fat-jar` / Compile / productDirectories).value.head | ||
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 | ||
Test / moduleDependencies := { | ||
GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq( | ||
"org.slf4j" % "slf4j-api" % slf4jVersion, | ||
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, | ||
(`runtime-fat-jar` / projectID).value, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is how you specify that you want to put |
||
(`ydoc-server` / projectID).value, | ||
(`syntax-rust-definition` / projectID).value, | ||
(`profiling-utils` / projectID).value | ||
) | ||
}, | ||
Test / javaOptions ++= testLogProviderOptions | ||
|
@@ -1168,6 +1163,9 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) | |
.dependsOn(testkit % Test) | ||
.dependsOn(`runtime-version-manager-test` % Test) | ||
.dependsOn(`logging-service-logback` % "test->test") | ||
.dependsOn(`runtime-fat-jar` % Test) | ||
.dependsOn(`ydoc-server` % Test) | ||
.dependsOn(`profiling-utils` % Test) | ||
|
||
/* Note [Classpath Separation] | ||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
@@ -1268,24 +1266,15 @@ lazy val `ydoc-server` = project | |
autoScalaLibrary := false, | ||
Test / fork := true, | ||
commands += WithDebugCommand.withDebug, | ||
// GraalVM and helidon modules (3rd party modules) | ||
modulePath := { | ||
JPMSUtils.filterModulesFromUpdate( | ||
update.value, | ||
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 | ||
), | ||
streams.value.log, | ||
shouldContainAll = true | ||
) | ||
moduleDependencies := { | ||
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, | ||
(`syntax-rust-definition` / projectID).value, | ||
(`profiling-utils` / projectID).value | ||
), | ||
}, | ||
// Internal project modules | ||
modulePath ++= Seq( | ||
(`syntax-rust-definition` / Compile / productDirectories).value.head, | ||
(`profiling-utils` / Compile / productDirectories).value.head | ||
), | ||
libraryDependencies ++= Seq( | ||
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", | ||
"org.graalvm.polyglot" % "inspect" % graalMavenPackagesVersion % "runtime", | ||
|
@@ -1296,7 +1285,10 @@ lazy val `ydoc-server` = project | |
"junit" % "junit" % junitVersion % Test, | ||
"com.github.sbt" % "junit-interface" % junitIfVersion % Test, | ||
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion % Test | ||
) | ||
), | ||
libraryDependencies ++= { | ||
GraalVM.modules ++ GraalVM.jsPkgs ++ GraalVM.chromeInspectorPkgs ++ helidon | ||
} | ||
) | ||
// `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 | ||
|
@@ -1585,32 +1577,14 @@ lazy val `language-server` = (project in file("engine/language-server")) | |
(`profiling-utils` / javaModuleName).value, | ||
(`ydoc-server` / javaModuleName).value | ||
), | ||
Test / modulePath := { | ||
val updateReport = (Test / update).value | ||
val requiredModIds = | ||
GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq( | ||
"org.slf4j" % "slf4j-api" % slf4jVersion, | ||
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion | ||
) | ||
val requiredMods = JPMSUtils.filterModulesFromUpdate( | ||
updateReport, | ||
requiredModIds, | ||
streams.value.log, | ||
shouldContainAll = true | ||
) | ||
val runtimeMod = | ||
(`runtime-fat-jar` / Compile / productDirectories).value.head | ||
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 | ||
Test / moduleDependencies := { | ||
GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq( | ||
"org.slf4j" % "slf4j-api" % slf4jVersion, | ||
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, | ||
(`runtime-fat-jar` / projectID).value, | ||
(`syntax-rust-definition` / projectID).value, | ||
(`ydoc-server` / projectID).value, | ||
(`profiling-utils` / projectID).value | ||
) | ||
}, | ||
Test / javaOptions ++= testLogProviderOptions, | ||
|
@@ -1698,6 +1672,7 @@ lazy val `language-server` = (project in file("engine/language-server")) | |
.dependsOn(filewatcher) | ||
.dependsOn(testkit % Test) | ||
.dependsOn(`logging-service-logback` % "test->test") | ||
.dependsOn(`runtime-fat-jar` % Test) | ||
.dependsOn(`library-manager-test` % Test) | ||
.dependsOn(`runtime-version-manager-test` % Test) | ||
.dependsOn(`ydoc-server`) | ||
|
@@ -1843,19 +1818,9 @@ lazy val `runtime-language-arrow` = | |
"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 | ||
) | ||
}, | ||
moduleDependencies := GraalVM.modules, | ||
Test / moduleDependencies += | ||
(LocalProject("runtime-language-arrow") / projectID).value, | ||
Test / patchModules := { | ||
val testClassesDir = (Test / productDirectories).value.head | ||
Map(javaModuleName.value -> Seq(testClassesDir)) | ||
|
@@ -1881,29 +1846,24 @@ lazy val `runtime-test-instruments` = | |
inConfig(Compile)(truffleRunOptionsSettings), | ||
truffleDslSuppressWarnsSetting, | ||
instrumentationSettings, | ||
javaModuleName := "org.enso.runtime.test", | ||
modulePath := { | ||
JPMSUtils.filterModulesFromUpdate( | ||
update.value, | ||
GraalVM.modules ++ Seq( | ||
"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 | ||
), | ||
streams.value.log, | ||
shouldContainAll = true | ||
) | ||
}, | ||
libraryDependencies ++= GraalVM.modules, | ||
libraryDependencies ++= Seq( | ||
"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" | ||
) | ||
), | ||
javaModuleName := "org.enso.runtime.test", | ||
moduleDependencies := { | ||
GraalVM.modules ++ Seq( | ||
"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" | ||
) | ||
} | ||
) | ||
|
||
lazy val runtime = (project in file("engine/runtime")) | ||
|
@@ -2025,40 +1985,20 @@ lazy val `runtime-integration-tests` = | |
(`profiling-utils` / javaModuleName).value, | ||
(`ydoc-server` / javaModuleName).value | ||
), | ||
Test / modulePath := { | ||
val updateReport = (Test / update).value | ||
val requiredModIds = | ||
GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq( | ||
"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 | ||
) | ||
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 | ||
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 | ||
Test / moduleDependencies := { | ||
GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks pretty understandable! It is a format I hope to be able to work with. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am glad. More info in the scaladocs of JPMSPlugin |
||
"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, | ||
(`runtime-test-instruments` / projectID).value, | ||
(`runtime-fat-jar` / projectID).value, | ||
(`ydoc-server` / projectID).value, | ||
(`syntax-rust-definition` / projectID).value, | ||
(`profiling-utils` / projectID).value | ||
) | ||
}, | ||
Test / patchModules := { | ||
|
@@ -2158,32 +2098,15 @@ lazy val `runtime-benchmarks` = | |
.dependsOn(`runtime-fat-jar` / assembly) | ||
.value, | ||
parallelExecution := false, | ||
modulePath := { | ||
val requiredModIds = | ||
GraalVM.modules ++ GraalVM.langsPkgs ++ helidon ++ Seq( | ||
"org.slf4j" % "slf4j-api" % slf4jVersion, | ||
"org.slf4j" % "slf4j-nop" % slf4jVersion, | ||
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion | ||
) | ||
val requiredMods = JPMSUtils.filterModulesFromUpdate( | ||
(Compile / update).value, | ||
requiredModIds, | ||
streams.value.log, | ||
shouldContainAll = true | ||
) | ||
val runtimeMod = | ||
(`runtime-fat-jar` / assembly / assemblyOutputPath).value | ||
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 | ||
moduleDependencies := { | ||
GraalVM.modules ++ GraalVM.langsPkgs ++ helidon ++ Seq( | ||
"org.slf4j" % "slf4j-api" % slf4jVersion, | ||
"org.slf4j" % "slf4j-nop" % slf4jVersion, | ||
"org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, | ||
(`runtime-fat-jar` / projectID).value, | ||
(`ydoc-server` / projectID).value, | ||
(`syntax-rust-definition` / projectID).value, | ||
(`profiling-utils` / projectID).value | ||
) | ||
}, | ||
addModules := { | ||
|
@@ -2969,18 +2892,10 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) | |
"-J-Dpolyglotimpl.DisableClassPathIsolation=true", | ||
"-J-Dpolyglot.engine.WarnInterpreterOnly=false" | ||
), | ||
modulePath := { | ||
val allRuntimeMods = componentModulesPaths.value | ||
val otherModIds = Seq( | ||
moduleDependencies := { | ||
componentModulesIds.value ++ Seq( | ||
"org.slf4j" % "slf4j-nop" % slf4jVersion | ||
) | ||
val requiredMods = JPMSUtils.filterModulesFromUpdate( | ||
(Compile / update).value, | ||
otherModIds, | ||
streams.value.log, | ||
shouldContainAll = true | ||
) | ||
allRuntimeMods ++ requiredMods | ||
}, | ||
addModules := { | ||
val runtimeModuleName = (`runtime-fat-jar` / javaModuleName).value | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same format as
libraryDependencies
. No longer need to call this crypticfilterModulesFromUpdate
methods ...