From b06f2ece74d60fb6555b811e2af44c9d1f2dee5e Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 14 Aug 2024 19:29:15 +0200 Subject: [PATCH 001/268] Remove unused -Dtruffle.class.path.append from javaOptions --- build.sbt | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/build.sbt b/build.sbt index 6d9a64f99181..3df59cf1d2df 100644 --- a/build.sbt +++ b/build.sbt @@ -1169,28 +1169,6 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) .dependsOn(`runtime-version-manager-test` % Test) .dependsOn(`logging-service-logback` % "test->test") -/* Note [Classpath Separation] - * ~~~~~~~~~~~~~~~~~~~~~~~~~~ - * Projects using the language runtime do not depend on it directly, but instead - * the language runtime is put on the Truffle classpath, rather than the - * standard classpath. This is the recommended way of handling this and we - * strive to use such structure everywhere. - * See - * https://www.graalvm.org/docs/graalvm-as-a-platform/implement-language#graalvm - * - * Currently the only exception to this are the tests of the runtime project - * which have classpath separation disabled, because they need direct access to - * the runtime's instruments. - * - * To ensure correct handling of dependencies by sbt, the classpath appended to - * Java options, should be based on `(runtime / Compile / fullClasspath).value` - * wherever possible. Using a key from the runtime project enables sbt to see - * the dependency. - * - * Assembly tasks that build JAR files which need `runtime.jar` to run should - * also add a dependency on `runtime / assembly`. - */ - lazy val `json-rpc-server` = project .in(file("lib/scala/json-rpc-server")) .settings( @@ -2525,14 +2503,6 @@ lazy val `engine-runner` = project .settings( frgaalJavaCompilerSetting, truffleDslSuppressWarnsSetting, - javaOptions ++= { - // Note [Classpath Separation] - val runtimeClasspath = - (runtime / Compile / fullClasspath).value - .map(_.data) - .mkString(File.pathSeparator) - Seq(s"-Dtruffle.class.path.append=$runtimeClasspath") - }, 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 From a3efe01a62503f570ce77ef2b72826cf66e0a9e3 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 14 Aug 2024 19:29:25 +0200 Subject: [PATCH 002/268] fix typo in docs --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 3df59cf1d2df..c8faac96a5f3 100644 --- a/build.sbt +++ b/build.sbt @@ -2533,7 +2533,7 @@ lazy val `engine-runner` = project if (!isJar) { log.error( internalPkg.data.absolutePath + " is not a JAR archive." + - " It might not be excluded from runtime.jar fat jar." + " It might not be excluded from runner.jar fat jar." ) } } From 6fb9c26fb70382baf3e1dbcf7fb6bd936d795192 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 12:05:34 +0200 Subject: [PATCH 003/268] Rewrite scala in engine-runner to Java. This will make migration to JPMS easier. --- build.sbt | 1 + .../java/org/enso/runner/CurrentVersion.java | 46 +++++ .../enso/runner/DependencyPreinstaller.java | 138 +++++++++++++ .../src/main/java/org/enso/runner/Main.java | 12 +- .../java/org/enso/runner/ProjectUploader.java | 73 +++++++ .../src/main/java/org/enso/runner/Repl.java | 57 +++++ .../src/main/java/org/enso/runner/ReplIO.java | 48 +++++ .../java/org/enso/runner/RunnerLogging.java | 80 +++++++ .../main/java/org/enso/runner/TerminalIO.java | 66 ++++++ .../main/java/org/enso/runner/UserInput.java | 17 ++ .../org/enso/runner/CurrentVersion.scala | 32 --- .../enso/runner/DependencyPreinstaller.scala | 132 ------------ .../org/enso/runner/ProjectUploader.scala | 77 ------- .../src/main/scala/org/enso/runner/Repl.scala | 195 ------------------ .../scala/org/enso/runner/RunnerLogging.scala | 78 ------- 15 files changed, 535 insertions(+), 517 deletions(-) create mode 100644 engine/runner/src/main/java/org/enso/runner/CurrentVersion.java create mode 100644 engine/runner/src/main/java/org/enso/runner/DependencyPreinstaller.java create mode 100644 engine/runner/src/main/java/org/enso/runner/ProjectUploader.java create mode 100644 engine/runner/src/main/java/org/enso/runner/Repl.java create mode 100644 engine/runner/src/main/java/org/enso/runner/ReplIO.java create mode 100644 engine/runner/src/main/java/org/enso/runner/RunnerLogging.java create mode 100644 engine/runner/src/main/java/org/enso/runner/TerminalIO.java create mode 100644 engine/runner/src/main/java/org/enso/runner/UserInput.java delete mode 100644 engine/runner/src/main/scala/org/enso/runner/CurrentVersion.scala delete mode 100644 engine/runner/src/main/scala/org/enso/runner/DependencyPreinstaller.scala delete mode 100644 engine/runner/src/main/scala/org/enso/runner/ProjectUploader.scala delete mode 100644 engine/runner/src/main/scala/org/enso/runner/Repl.scala delete mode 100644 engine/runner/src/main/scala/org/enso/runner/RunnerLogging.scala diff --git a/build.sbt b/build.sbt index c8faac96a5f3..de320b5ea1ca 100644 --- a/build.sbt +++ b/build.sbt @@ -2510,6 +2510,7 @@ lazy val `engine-runner` = project Package.ManifestAttributes(("Multi-Release", "true")) ), Compile / run / mainClass := Some("org.enso.runner.Main"), + compileOrder := CompileOrder.JavaThenScala, assembly / mainClass := (Compile / run / mainClass).value, assembly / assemblyJarName := "runner.jar", assembly / test := {}, diff --git a/engine/runner/src/main/java/org/enso/runner/CurrentVersion.java b/engine/runner/src/main/java/org/enso/runner/CurrentVersion.java new file mode 100644 index 000000000000..11e902f9f5fb --- /dev/null +++ b/engine/runner/src/main/java/org/enso/runner/CurrentVersion.java @@ -0,0 +1,46 @@ +package org.enso.runner; + +import org.enso.semver.SemVer; + +/** + * A helper class that allows to access current version of the runner. + * + *

The current version is parsed from {@link buildinfo}, but in development mode it can be + * overridden by setting `enso.version.override` property. This is used in project-manager tests to + * override the version of projects created using the runner. + */ +final class CurrentVersion { + private CurrentVersion() {} + + private static SemVer version = null; + + public static SemVer getVersion() { + if (version == null) { + version = computeVersion(); + } + return version; + } + + private static SemVer computeVersion() { + var buildVersion = + (SemVer) + SemVer.parse(buildinfo.Info.ensoVersion()) + .getOrElse( + () -> { + throw new IllegalStateException( + "Fatal error: Enso version included in buildinfo is not a valid " + + "semver string, this should never happen."); + }); + if (!buildinfo.Info.isRelease()) { + var overrideVersionProp = System.getProperty("enso.version.override"); + if (overrideVersionProp == null) { + return buildVersion; + } + var parseRes = SemVer.parse(overrideVersionProp); + if (parseRes.isSuccess()) { + return parseRes.get(); + } + } + return buildVersion; + } +} diff --git a/engine/runner/src/main/java/org/enso/runner/DependencyPreinstaller.java b/engine/runner/src/main/java/org/enso/runner/DependencyPreinstaller.java new file mode 100644 index 000000000000..ee77908dbfd7 --- /dev/null +++ b/engine/runner/src/main/java/org/enso/runner/DependencyPreinstaller.java @@ -0,0 +1,138 @@ +package org.enso.runner; + +import java.io.File; +import java.util.HashSet; +import java.util.Set; +import java.util.stream.Collectors; +import org.enso.cli.ProgressBar; +import org.enso.cli.task.ProgressReporter; +import org.enso.cli.task.TaskProgress; +import org.enso.distribution.DistributionManager; +import org.enso.distribution.Environment; +import org.enso.distribution.LanguageHome; +import org.enso.distribution.locking.LockUserInterface; +import org.enso.distribution.locking.Resource; +import org.enso.distribution.locking.ResourceManager; +import org.enso.distribution.locking.ThreadSafeFileLockManager; +import org.enso.editions.DefaultEdition; +import org.enso.editions.EditionResolver; +import org.enso.editions.updater.EditionManager; +import org.enso.librarymanager.DefaultLibraryProvider; +import org.enso.librarymanager.LibraryResolver; +import org.enso.librarymanager.dependencies.Dependency; +import org.enso.librarymanager.dependencies.DependencyResolver; +import org.enso.librarymanager.published.PublishedLibraryCache; +import org.enso.pkg.PackageManager; +import org.enso.runner.common.CompilerBasedDependencyExtractor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.event.Level; +import scala.Some; + +/** A helper to preinstall all dependencies of a project. */ +class DependencyPreinstaller { + private DependencyPreinstaller() {} + + private static final Logger logger = LoggerFactory.getLogger(DependencyPreinstaller.class); + + static void preinstallDependencies(File projectRoot, Level logLevel) { + var pkg = PackageManager.Default().loadPackage(projectRoot).get(); + var dependencyExtractor = new CompilerBasedDependencyExtractor(logLevel); + var environment = new Environment() {}; + var languageHome = LanguageHome.detectFromExecutableLocation(environment); + + var distributionManager = new DistributionManager(environment); + var lockManager = new ThreadSafeFileLockManager(distributionManager.paths().locks()); + var resourceManager = new ResourceManager(lockManager); + var editionProvider = + EditionManager.makeEditionProvider(distributionManager, Some.apply(languageHome), true); + var editionResolver = new EditionResolver(editionProvider); + var editionOpt = + editionResolver.resolve( + pkg.getConfig().edition().getOrElse(DefaultEdition::getDefaultEdition)); + if (editionOpt.isLeft()) { + @SuppressWarnings("deprecation") + var ex = editionOpt.left().get(); + throw new RuntimeException("Cannot resolve current project's editionOpt: " + ex.getMessage()); + } + @SuppressWarnings("deprecation") + var edition = editionOpt.right().get(); + + var preferLocalLibraries = pkg.getConfig().preferLocalLibraries(); + var progressReporter = + new ProgressReporter() { + @Override + public void trackProgress(String message, TaskProgress task) { + logger.info(message); + ProgressBar.waitWithProgress(task); + } + }; + var lockUserInterface = + new LockUserInterface() { + @Override + public void startWaitingForResource(Resource resource) { + logger.warn(resource.waitMessage()); + } + + @Override + public void finishWaitingForResource(Resource resource) {} + }; + var providers = + DefaultLibraryProvider.makeProviders( + distributionManager, + resourceManager, + lockUserInterface, + progressReporter, + Some.apply(languageHome), + Some.apply(projectRoot.toPath())); + var localLibraryProvider = providers._1; + var publishedLibraryProvider = providers._2; + + var dependencyResolver = + new DependencyResolver( + localLibraryProvider, + (PublishedLibraryCache) publishedLibraryProvider, + edition, + preferLocalLibraries, + new LibraryResolver(localLibraryProvider), + dependencyExtractor); + var installer = + new DefaultLibraryProvider( + localLibraryProvider, publishedLibraryProvider, edition, preferLocalLibraries); + + var immediateDependencies = dependencyExtractor.findDependencies(pkg); + logger.trace("The project imports the following libraries: {}", immediateDependencies); + Set allDependencies = new HashSet<>(); + immediateDependencies.foreach( + name -> { + var transitiveDeps = dependencyResolver.findDependencies(name).get(); + transitiveDeps.foreach( + transitiveDep -> { + allDependencies.add(transitiveDep); + return null; + }); + return null; + }); + logger.trace("The project depends on: {}", allDependencies); + + var dependenciesToInstall = + allDependencies.stream() + .filter(dep -> !dep.isCached()) + .collect(Collectors.toUnmodifiableSet()); + if (dependenciesToInstall.isEmpty()) { + logger.info("All {} dependencies are installed", allDependencies.size()); + } else { + logger.info("Will install {} dependencies", dependenciesToInstall.size()); + for (var depToInstall : dependenciesToInstall) { + var foundOpt = + installer.findSpecificLibraryVersion( + depToInstall.libraryName(), depToInstall.version()); + if (foundOpt.isLeft()) { + @SuppressWarnings("deprecation") + var err = foundOpt.left().get(); + throw new RuntimeException("Some dependencies could not be installed: [" + err + "]."); + } + } + } + } +} diff --git a/engine/runner/src/main/java/org/enso/runner/Main.java b/engine/runner/src/main/java/org/enso/runner/Main.java index 106b28358642..af4e521cd732 100644 --- a/engine/runner/src/main/java/org/enso/runner/Main.java +++ b/engine/runner/src/main/java/org/enso/runner/Main.java @@ -952,13 +952,14 @@ private static MessageTransport replTransport() { * @param useJson whether the output should be JSON or human-readable. */ private void displayVersion(boolean useJson) { + var customVersion = CurrentVersion.getVersion().toString(); var versionDescription = VersionDescription.make( "Enso Compiler and Runtime", true, VersionDescription.make$default$3(), VersionDescription.make$default$4(), - scala.Option.apply(CurrentVersion.version().toString())); + scala.Option.apply(customVersion)); println(versionDescription.asString(useJson)); } @@ -1046,7 +1047,7 @@ final void mainEntry(CommandLine line, Level logLevel, boolean logMasking) throw ProjectUploader.uploadProject( projectRoot.get(), line.getOptionValue(UPLOAD_OPTION), - scala.Option.apply(line.getOptionValue(AUTH_TOKEN)), + line.getOptionValue(AUTH_TOKEN), !line.hasOption(HIDE_PROGRESS), logLevel); throw exitSuccess(); @@ -1399,7 +1400,12 @@ private Level setupLogging(CommandLine line, boolean[] logMasking) { scala.Option.apply(line.getOptionValue(LOG_LEVEL)) .map(this::parseLogLevel) .getOrElse(() -> defaultLogLevel); - var connectionUri = scala.Option.apply(line.getOptionValue(LOGGER_CONNECT)).map(this::parseUri); + URI connectionUri; + if (line.getOptionValue(LOGGER_CONNECT) != null) { + connectionUri = parseUri(line.getOptionValue(LOGGER_CONNECT)); + } else { + connectionUri = null; + } logMasking[0] = !line.hasOption(NO_LOG_MASKING); RunnerLogging.setup(connectionUri, logLevel, logMasking[0]); return logLevel; diff --git a/engine/runner/src/main/java/org/enso/runner/ProjectUploader.java b/engine/runner/src/main/java/org/enso/runner/ProjectUploader.java new file mode 100644 index 000000000000..42faf583f1b3 --- /dev/null +++ b/engine/runner/src/main/java/org/enso/runner/ProjectUploader.java @@ -0,0 +1,73 @@ +package org.enso.runner; + +import java.nio.file.Path; +import org.enso.cli.ProgressBar; +import org.enso.cli.task.ProgressReporter; +import org.enso.cli.task.TaskProgress; +import org.enso.libraryupload.LibraryUploader; +import org.enso.libraryupload.auth.NoAuthorization$; +import org.enso.libraryupload.auth.SimpleHeaderToken; +import org.enso.libraryupload.auth.Token; +import org.enso.pkg.PackageManager; +import org.enso.runner.common.CompilerBasedDependencyExtractor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.event.Level; + +final class ProjectUploader { + private ProjectUploader() {} + + private static final Logger logger = LoggerFactory.getLogger(ProjectUploader.class); + + /** + * Uploads a project to a library repository + * + * @param projectRoot path to the root of the project + * @param uploadUrl URL of upload endpoint of the repository to upload to + * @param authToken an optional token used for authentication in the repository + * @param showProgress specifies if CLI progress bars should be displayed showing progress of + * compression and upload + * @param logLevel the log level to use for the context gathering dependencies + */ + static void uploadProject( + Path projectRoot, String uploadUrl, String authToken, boolean showProgress, Level logLevel) { + var progressReporter = + new ProgressReporter() { + @Override + public void trackProgress(String message, TaskProgress task) { + logger.info(message); + if (showProgress) { + ProgressBar.waitWithProgress(task); + } + } + }; + + Token token; + if (authToken != null) { + token = new SimpleHeaderToken(authToken); + } else { + token = NoAuthorization$.MODULE$; + } + + var dependencyExtractor = new CompilerBasedDependencyExtractor(logLevel); + var libraryUploader = new LibraryUploader(dependencyExtractor); + var uploadedRes = + libraryUploader.uploadLibrary(projectRoot, uploadUrl, token, progressReporter); + uploadedRes.get(); + } + + /** + * Updates manifest of the project. + * + * @param projectRoot path to the root of the project + * @param logLevel the log level to use for the context gathering dependencies + */ + static void updateManifest(Path projectRoot, Level logLevel) { + var pkg = PackageManager.Default().loadPackage(projectRoot.toFile()).get(); + + var dependencyExtractor = new CompilerBasedDependencyExtractor(logLevel); + var libraryUploader = new LibraryUploader(dependencyExtractor); + var uploadedRes = libraryUploader.updateManifest(pkg); + uploadedRes.get(); + } +} diff --git a/engine/runner/src/main/java/org/enso/runner/Repl.java b/engine/runner/src/main/java/org/enso/runner/Repl.java new file mode 100644 index 000000000000..840ee9e73ccd --- /dev/null +++ b/engine/runner/src/main/java/org/enso/runner/Repl.java @@ -0,0 +1,57 @@ +package org.enso.runner; + +import org.enso.polyglot.debugger.ReplExecutor; +import org.enso.polyglot.debugger.SessionManager; +import scala.runtime.Nothing$; + +final class Repl implements SessionManager { + private final ReplIO replIO; + + Repl(ReplIO replIO) { + this.replIO = replIO; + } + + @Override + public Nothing$ startSession(ReplExecutor executor) { + var continueRunning = true; + while (continueRunning) { + var input = replIO.readLine("> "); + switch (input) { + case EndOfInput eoi -> continueRunning = false; + case Line line when !line.getLine().isEmpty() -> { + var content = line.getLine(); + switch (content) { + case ":list", ":l" -> { + var bindings = executor.listBindings(); + bindings.foreachEntry((name, value) -> { + replIO.println(name + " = " + value); + return null; + }); + } + case ":quit", "q" -> { + continueRunning = false; + } + default -> { + var result = executor.evaluate(content); + if (result.isLeft()) { + @SuppressWarnings("deprecation") + var ex = result.left().get(); + replIO.println("Evaluation failed with: " + ex.getMessage()); + replIO.printStackTrace(ex); + } else { + @SuppressWarnings("deprecation") + var objectRepr = result.right().get(); + replIO.println(">>> " + objectRepr); + } + } + } + } + default -> { + // nop + } + } + } + + return (Nothing$) executor.exit(); + } +} diff --git a/engine/runner/src/main/java/org/enso/runner/ReplIO.java b/engine/runner/src/main/java/org/enso/runner/ReplIO.java new file mode 100644 index 000000000000..4e9460fb0e71 --- /dev/null +++ b/engine/runner/src/main/java/org/enso/runner/ReplIO.java @@ -0,0 +1,48 @@ +package org.enso.runner; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.Writer; + +interface ReplIO { + /** + * Ask user for a line of input, using given prompt + * + * @param prompt the prompt to display to the user + * @return the user-provided input + */ + UserInput readLine(String prompt); + + /** + * Print a line to the REPL. + * + * @param contents contents of the line to print + */ + void println(String contents); + + /** + * Print a stack trace to the REPL. + * + * @param exception which stack trace is to be printed + */ + default void printStackTrace(Exception exception) { + var traceBuilder = new StringBuilder(); + var traceWriter = + new Writer() { + @Override + public void write(char[] cbuf, int off, int len) { + for (char c : cbuf) { + traceBuilder.append(c); + } + } + + @Override + public void flush() throws IOException {} + + @Override + public void close() throws IOException {} + }; + exception.printStackTrace(new PrintWriter(traceWriter)); + System.out.println(traceBuilder); + } +} diff --git a/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java b/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java new file mode 100644 index 000000000000..6c879cec9800 --- /dev/null +++ b/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java @@ -0,0 +1,80 @@ +package org.enso.runner; + +import java.net.URI; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import org.enso.logger.LoggerSetup; +import org.enso.logger.masking.Masking; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.event.Level; + +final class RunnerLogging { + private RunnerLogging() {} + + private static final Logger logger = LoggerFactory.getLogger(RunnerLogging.class); + + /** + * Sets up the runner's logging service. + * + *

If `connectionUri` is provided it tries to connect to a logging service server and pass logs + * to it. If it is not provided, or the connection could not be established, falls back to logging + * to standard error output. + * + * @param connectionUri optional uri of logging service server to connect to + * @param logLevel log level to use for the runner and runtime + * @param logMasking switches log masking on and off + */ + static void setup(URI connectionUri, Level logLevel, boolean logMasking) { + Masking.setup(logMasking); + var loggerSetup = LoggerSetup.get(); + var executorService = Executors.newSingleThreadExecutor(); + try { + setupImpl(connectionUri, logLevel, executorService, loggerSetup); + } finally { + executorService.shutdown(); + } + } + + private static void setupImpl( + URI connectionUri, Level logLevel, ExecutorService executorService, LoggerSetup loggerSetup) { + if (connectionUri != null) { + var future = + executorService.submit( + () -> + loggerSetup.setupSocketAppender( + logLevel, connectionUri.getHost(), connectionUri.getPort())); + try { + var success = future.get(); + if (success) { + logger.trace("Connected to logging service at [{}]", connectionUri); + return; + } else { + throw new RuntimeException("Failed to connect to logging service"); + } + } catch (InterruptedException | ExecutionException e) { + System.err.println( + "Failed to connect to the logging service server, " + "falling back to local logging."); + } + } + if (!setupConsoleAppender(logLevel, executorService, loggerSetup)) { + System.err.println("Failed to initialize logging infrastructure"); + } + } + + static void tearDown() { + LoggerSetup.get().teardown(); + } + + private static boolean setupConsoleAppender( + Level logLevel, ExecutorService executorService, LoggerSetup loggerSetup) { + var future = executorService.submit(() -> loggerSetup.setupConsoleAppender(logLevel)); + try { + return future.get(); + } catch (ExecutionException | InterruptedException e) { + System.err.println("Failed to initialize console appender: " + e.getMessage()); + return false; + } + } +} diff --git a/engine/runner/src/main/java/org/enso/runner/TerminalIO.java b/engine/runner/src/main/java/org/enso/runner/TerminalIO.java new file mode 100644 index 000000000000..3a1c2525be79 --- /dev/null +++ b/engine/runner/src/main/java/org/enso/runner/TerminalIO.java @@ -0,0 +1,66 @@ +package org.enso.runner; + +import java.io.IOException; +import java.nio.file.Path; +import org.jline.reader.EndOfFileException; +import org.jline.reader.LineReader; +import org.jline.reader.LineReaderBuilder; +import org.jline.reader.UserInterruptException; +import org.jline.reader.impl.DefaultParser; +import org.jline.reader.impl.history.DefaultHistory; +import org.jline.terminal.Terminal; +import org.jline.terminal.TerminalBuilder; + +final class TerminalIO implements ReplIO { + private final Terminal terminal; + private final LineReader lineReader; + + TerminalIO(Path historyFilePath) { + // jline uses the class loader from `Thread.currentThread().getContextClassLoader()` to + // load services. We need to override the context class loader to be `IsolatedClassLoader` + // from the runner.jar class loader. + var prevClassLoader = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); + try { + terminal = TerminalBuilder.builder().system(true).build(); + } catch (IOException e) { + throw new IllegalStateException(e); + } + var parser = new DefaultParser(); + parser.setEscapeChars(null); + var history = new DefaultHistory(); + lineReader = + LineReaderBuilder.builder() + .parser(parser) + .variable(LineReader.HISTORY_FILE, historyFilePath) + .history(history) + .terminal(terminal) + .build(); + Thread.currentThread().setContextClassLoader(prevClassLoader); + + Runtime.getRuntime() + .addShutdownHook( + new Thread( + () -> { + try { + history.save(); + } catch (IOException e) { + System.err.println("Failed to save REPL history: " + e); + } + })); + } + + @Override + public UserInput readLine(String prompt) { + try { + return new Line(lineReader.readLine(prompt)); + } catch (UserInterruptException | EndOfFileException e) { + return new EndOfInput(); + } + } + + @Override + public void println(String contents) { + terminal.writer().println(contents); + } +} diff --git a/engine/runner/src/main/java/org/enso/runner/UserInput.java b/engine/runner/src/main/java/org/enso/runner/UserInput.java new file mode 100644 index 000000000000..638422e58398 --- /dev/null +++ b/engine/runner/src/main/java/org/enso/runner/UserInput.java @@ -0,0 +1,17 @@ +package org.enso.runner; + +sealed class UserInput permits EndOfInput, Line {} + +final class EndOfInput extends UserInput {} + +final class Line extends UserInput { + private final String line; + + Line(String line) { + this.line = line; + } + + public String getLine() { + return line; + } +} diff --git a/engine/runner/src/main/scala/org/enso/runner/CurrentVersion.scala b/engine/runner/src/main/scala/org/enso/runner/CurrentVersion.scala deleted file mode 100644 index c7adb0d92c42..000000000000 --- a/engine/runner/src/main/scala/org/enso/runner/CurrentVersion.scala +++ /dev/null @@ -1,32 +0,0 @@ -package org.enso.runner - -import org.enso.semver.SemVer - -/** A helper object that allows to access current version of the runner. - * - * The current version is parsed from [[buildinfo]], but in development mode it - * can be overridden by setting `enso.version.override` property. This is used - * in project-manager tests to override the version of projects created using - * the runner. - */ -object CurrentVersion { - - /** The version that the application should report. */ - lazy val version: SemVer = computeVersion() - - private def computeVersion(): SemVer = { - val buildVersion = - SemVer.parse(buildinfo.Info.ensoVersion).getOrElse { - throw new IllegalStateException( - "Fatal error: Enso version included in buildinfo is not a valid " + - "semver string, this should never happen." - ) - } - if (buildinfo.Info.isRelease) buildVersion - else - sys.props - .get("enso.version.override") - .flatMap(v => SemVer.parse(v).toOption) - .getOrElse(buildVersion) - } -} diff --git a/engine/runner/src/main/scala/org/enso/runner/DependencyPreinstaller.scala b/engine/runner/src/main/scala/org/enso/runner/DependencyPreinstaller.scala deleted file mode 100644 index a26ebc232322..000000000000 --- a/engine/runner/src/main/scala/org/enso/runner/DependencyPreinstaller.scala +++ /dev/null @@ -1,132 +0,0 @@ -package org.enso.runner - -import org.slf4j.event.Level -import com.typesafe.scalalogging.Logger -import org.enso.cli.ProgressBar -import org.enso.cli.task.{ProgressReporter, TaskProgress} -import org.enso.distribution.locking.{ - LockUserInterface, - Resource, - ResourceManager, - ThreadSafeFileLockManager -} -import org.enso.distribution.{DistributionManager, Environment, LanguageHome} -import org.enso.editions.updater.EditionManager -import org.enso.editions.{DefaultEdition, EditionResolver} -import org.enso.runner.common.CompilerBasedDependencyExtractor -import org.enso.librarymanager.dependencies.DependencyResolver -import org.enso.librarymanager.{DefaultLibraryProvider, LibraryResolver} -import org.enso.pkg.PackageManager - -import java.io.File - -/** A helper to preinstall all dependencies of a project. */ -object DependencyPreinstaller { - - /** Parses the project to find out its direct dependencies, uses the resolver - * to find all transitive dependencies and ensures that all of them are - * installed. - */ - def preinstallDependencies(projectRoot: File, logLevel: Level): Unit = { - val logger = Logger[DependencyPreinstaller.type] - val pkg = PackageManager.Default.loadPackage(projectRoot).get - - val dependencyExtractor = new CompilerBasedDependencyExtractor(logLevel) - val environment = new Environment {} - val languageHome = LanguageHome.detectFromExecutableLocation(environment) - - val distributionManager = new DistributionManager(environment) - val lockManager = new ThreadSafeFileLockManager( - distributionManager.paths.locks - ) - val resourceManager = new ResourceManager(lockManager) - - val editionProvider = EditionManager.makeEditionProvider( - distributionManager, - Some(languageHome), - true - ) - val editionResolver = EditionResolver(editionProvider) - val edition = editionResolver - .resolve( - pkg.getConfig().edition.getOrElse(DefaultEdition.getDefaultEdition) - ) match { - case Left(error) => - throw new RuntimeException( - s"Cannot resolve current project's edition: ${error.getMessage}" - ) - case Right(value) => value - } - - val preferLocalLibraries = pkg.getConfig().preferLocalLibraries - - val (localLibraryProvider, publishedLibraryProvider) = - DefaultLibraryProvider.makeProviders( - distributionManager, - resourceManager, - new LockUserInterface { - override def startWaitingForResource(resource: Resource): Unit = - logger.warn(resource.waitMessage) - - override def finishWaitingForResource(resource: Resource): Unit = () - }, - new ProgressReporter { - override def trackProgress( - message: String, - task: TaskProgress[_] - ): Unit = { - logger.info(message) - ProgressBar.waitWithProgress(task) - } - }, - languageHome = Some(languageHome), - projectRoot = Some(projectRoot.toPath) - ) - - val dependencyResolver = new DependencyResolver( - localLibraryProvider, - publishedLibraryProvider, - edition, - preferLocalLibraries, - LibraryResolver(localLibraryProvider), - dependencyExtractor - ) - val installer = new DefaultLibraryProvider( - localLibraryProvider, - publishedLibraryProvider, - edition, - preferLocalLibraries - ) - val immediateDependencies = dependencyExtractor.findDependencies(pkg) - logger.trace( - s"The project imports the following libraries: $immediateDependencies." - ) - val allDependencies = immediateDependencies.flatMap { name => - dependencyResolver.findDependencies(name).get - } - logger.trace(s"The project depends on: $allDependencies.") - - val dependenciesToInstall = allDependencies.filter(!_.isCached) - - if (dependenciesToInstall.isEmpty) { - logger.info(s"All ${allDependencies.size} dependencies are installed.") - } else { - logger.info(s"Will install ${dependenciesToInstall.size} dependencies.") - dependenciesToInstall.toList - .map { dependency => - installer.findSpecificLibraryVersion( - dependency.libraryName, - dependency.version - ) - } - .find(_.isLeft) - .toLeft(()) match { - case Left(error) => - throw new RuntimeException( - s"Some dependencies could not be installed: [$error]." - ) - case Right(_) => - } - } - } -} diff --git a/engine/runner/src/main/scala/org/enso/runner/ProjectUploader.scala b/engine/runner/src/main/scala/org/enso/runner/ProjectUploader.scala deleted file mode 100644 index 7d165c9e66db..000000000000 --- a/engine/runner/src/main/scala/org/enso/runner/ProjectUploader.scala +++ /dev/null @@ -1,77 +0,0 @@ -package org.enso.runner - -import com.typesafe.scalalogging.Logger -import org.enso.cli.ProgressBar -import org.enso.cli.task.{ProgressReporter, TaskProgress} -import org.enso.runner.common.CompilerBasedDependencyExtractor -import org.enso.libraryupload.{auth, LibraryUploader} -import org.enso.pkg.PackageManager -import org.slf4j.event.Level - -import java.nio.file.Path - -/** Gathers helper functions for uploading a library project. */ -object ProjectUploader { - - private lazy val logger = Logger[ProjectUploader.type] - - /** Uploads a project to a library repository. - * - * @param projectRoot path to the root of the project - * @param uploadUrl URL of upload endpoint of the repository to upload to - * @param authToken an optional token used for authentication in the - * repository - * @param showProgress specifies if CLI progress bars should be displayed - * showing progress of compression and upload - * @param logLevel the log level to use for the context gathering - * dependencies - */ - def uploadProject( - projectRoot: Path, - uploadUrl: String, - authToken: Option[String], - showProgress: Boolean, - logLevel: Level - ): Unit = { - val progressReporter = new ProgressReporter { - override def trackProgress( - message: String, - task: TaskProgress[_] - ): Unit = { - logger.info(message) - if (showProgress) { - ProgressBar.waitWithProgress(task) - } - } - } - - val token = authToken match { - case Some(value) => auth.SimpleHeaderToken(value) - case None => auth.NoAuthorization - } - - val dependencyExtractor = new CompilerBasedDependencyExtractor(logLevel) - - LibraryUploader(dependencyExtractor) - .uploadLibrary( - projectRoot, - uploadUrl, - token, - progressReporter - ) - .get - } - - /** Updates manifest of the project. - * - * @param projectRoot path to the root of the project - * @param logLevel the log level to use for the context gathering - * dependencies - */ - def updateManifest(projectRoot: Path, logLevel: Level): Unit = { - val pkg = PackageManager.Default.loadPackage(projectRoot.toFile).get - - val dependencyExtractor = new CompilerBasedDependencyExtractor(logLevel) - LibraryUploader(dependencyExtractor).updateManifest(pkg).get - } -} diff --git a/engine/runner/src/main/scala/org/enso/runner/Repl.scala b/engine/runner/src/main/scala/org/enso/runner/Repl.scala deleted file mode 100644 index bf299c454942..000000000000 --- a/engine/runner/src/main/scala/org/enso/runner/Repl.scala +++ /dev/null @@ -1,195 +0,0 @@ -package org.enso.runner - -import com.typesafe.scalalogging.Logger - -import java.io.{ - IOException, - InputStream, - OutputStream, - PrintStream, - PrintWriter, - Writer -} -import java.util.Scanner -import org.enso.polyglot.debugger.{ReplExecutor, SessionManager} -import org.jline.reader.impl.DefaultParser -import org.jline.reader.impl.history.DefaultHistory -import org.jline.reader.{LineReader, LineReaderBuilder} -import org.jline.terminal.{Terminal, TerminalBuilder} - -import java.nio.file.Path -import scala.util.Try - -/** Represents user console input. - */ -sealed trait UserInput - -/** End of user input. - */ -case object EndOfInput extends UserInput - -/** A normal line of user input. - * @param line the contents of the input line - */ -case class Line(line: String) extends UserInput - -/** Abstract representation of Repl IO operations - */ -trait ReplIO { - - /** Ask user for a line of input, using given prompt - * @param prompt the prompt to display to the user - * @return the user-provided input - */ - def readLine(prompt: String): UserInput - - /** Print a line to the REPL. - * @param contents contents of the line to print - */ - def println(contents: String): Unit - - /** Print a stack trace to the REPL. - * @param exception which stack trace is to be printed - */ - def printStackTrace(exception: Exception): Unit = { - val traceBuilder = new StringBuilder - val traceWriter = new Writer() { - override def write( - cbuf: Array[Char], - off: Int, - len: Int - ): Unit = - traceBuilder.append(cbuf.slice(off, off + len).mkString) - - override def flush(): Unit = {} - - override def close(): Unit = {} - } - exception.printStackTrace(new PrintWriter(traceWriter)) - println(traceBuilder.toString()) - } -} - -/** A barebones implementation of [[ReplIO]] based on standard input / output operations. - * @param in input stream to use - * @param out output stream to use - */ -case class SimpleReplIO(in: InputStream, out: OutputStream) extends ReplIO { - private val scanner: Scanner = new Scanner(in) - private val printer: PrintStream = new PrintStream(out) - - /** Ask user for a line of input, using given prompt - * @param prompt the prompt to display to the user - * @return the user-provided input - */ - override def readLine(prompt: String): UserInput = { - printer.print(prompt) - Try(scanner.nextLine()).map(Line).getOrElse(EndOfInput) - } - - /** Print a line to the REPL. - * @param contents contents of the line to print - */ - override def println(contents: String): Unit = printer.println(contents) -} - -/** An implementation of [[ReplIO]] using system terminal capabilities. - */ -case class TerminalIO(historyFilePath: Path) extends ReplIO { - // jline uses the class loader from `Thread.currentThread().getContextClassLoader()` to - // load services. We need to override the context class loader to be `IsolatedClassLoader` - // from the runner.jar class loader. - private val prevClassLoader = Thread.currentThread().getContextClassLoader - Thread - .currentThread() - .setContextClassLoader(classOf[TerminalIO].getClassLoader) - private val terminal: Terminal = - TerminalBuilder.builder().system(true).build() - private val parser: DefaultParser = new DefaultParser() - parser.setEscapeChars(null) - private val history = new DefaultHistory() - private val lineReader: LineReader = - LineReaderBuilder - .builder() - .parser(parser) - .variable(LineReader.HISTORY_FILE, historyFilePath) - .history(history) - .terminal(terminal) - .build() - Thread.currentThread().setContextClassLoader(prevClassLoader) - - Runtime.getRuntime.addShutdownHook(new Thread() { - override def run(): Unit = { - try { - history.save() - } catch { - case e: IOException => - Logger[TerminalIO].warn("Failed to save REPL history.", e) - } - } - }) - - /** Ask user for a line of input, using given prompt - * @param prompt the prompt to display to the user - * @return the user-provided input - */ - override def readLine(prompt: String): UserInput = - Try(lineReader.readLine(prompt)).map(Line).getOrElse(EndOfInput) - - /** Print a line to the REPL. - * @param contents contents of the line to print - */ - override def println(contents: String): Unit = - terminal.writer().println(contents) -} - -/** The Repl logic to inject into runtime instrumentation framework. - * - * @param replIO the IO implementation to use with this Repl - */ -case class Repl(replIO: ReplIO) extends SessionManager { - - /** Runs the Repl session by asking for user input and performing - * the requested action with the execution node. - * - * End of input causes exit from the Repl. - * - * @param executor the interface for executing commands inside the session - */ - override def startSession( - executor: ReplExecutor - ): Nothing = { - var continueRunning = true - while (continueRunning) { - val input = replIO.readLine("> ") - input match { - case EndOfInput => - continueRunning = false - case Line(line) => - if (line.isEmpty) { - // nop - } else if (line == ":list" || line == ":l") { - val bindings = executor.listBindings() - bindings.foreach { case (varName, value) => - replIO.println(s"$varName = $value") - } - } else if (line == ":quit" || line == ":q") { - continueRunning = false - } else { - val result = executor.evaluate(line) - result match { - case Left(exception) => - replIO.println( - s"Evaluation failed with: ${exception.getMessage}" - ) - replIO.printStackTrace(exception) - case Right(objectRepresentation) => - replIO.println(s">>> $objectRepresentation") - } - } - } - } - - executor.exit() - } -} diff --git a/engine/runner/src/main/scala/org/enso/runner/RunnerLogging.scala b/engine/runner/src/main/scala/org/enso/runner/RunnerLogging.scala deleted file mode 100644 index ccaee4120a60..000000000000 --- a/engine/runner/src/main/scala/org/enso/runner/RunnerLogging.scala +++ /dev/null @@ -1,78 +0,0 @@ -package org.enso.runner - -import java.net.URI -import com.typesafe.scalalogging.Logger -import org.enso.logger.LoggerSetup -import org.enso.logger.masking.Masking -import org.slf4j.event.Level - -import scala.util.{Failure, Success} -import scala.concurrent.Future - -/** Manages setting up the logging service within the runner. - */ -object RunnerLogging { - - private val logger = Logger[RunnerLogging.type] - - /** Sets up the runner's logging service. - * - * If `connectionUri` is provided it tries to connect to a logging service - * server and pass logs to it. If it is not provided, or the connection could - * not be established, falls back to logging to standard error output. - * - * @param connectionUri optional uri of logging service server to connect to - * @param logLevel log level to use for the runner and runtime - * @param logMasking switches log masking on and off - */ - def setup( - connectionUri: Option[URI], - logLevel: Level, - logMasking: Boolean - ): Unit = { - import scala.concurrent.ExecutionContext.Implicits.global - Masking.setup(logMasking) - val loggerSetup = LoggerSetup.get() - val initializedLogger = connectionUri match { - case Some(uri) => - Future { - loggerSetup.setupSocketAppender( - logLevel, - uri.getHost(), - uri.getPort() - ) - } - .map(success => - if (success) { - logger.trace("Connected to logging service at [{}].", uri) - true - } else - throw new RuntimeException("Failed to connect to logging service") - ) - .recoverWith[Boolean] { _ => - System.err.println( - "Failed to connect to the logging service server, " + - "falling back to local logging." - ) - Future.successful(loggerSetup.setupConsoleAppender(logLevel)) - } - case None => - Future.successful(loggerSetup.setupConsoleAppender(logLevel)) - } - initializedLogger.onComplete { - case Failure(exception) => - exception.printStackTrace() - System.err.println("Logger setup: " + exception.getMessage) - case Success(success) => - if (!success) { - System.err.println("Failed to initialize logging infrastructure") - } - } - } - - /** Shuts down the logging service gracefully. - */ - def tearDown(): Unit = { - LoggerSetup.get().teardown() - } -} From c61036aaa167d0d134af0c9958ac6c78b4597433 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 13:43:58 +0200 Subject: [PATCH 004/268] Add module-info to engine-runner --- build.sbt | 24 +++++++++++++++++++ engine/runner/src/main/java/module-info.java | 9 +++++++ .../java/org/enso/runner/package-info.java | 1 - 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 engine/runner/src/main/java/module-info.java delete mode 100644 engine/runner/src/main/java/org/enso/runner/package-info.java diff --git a/build.sbt b/build.sbt index de320b5ea1ca..d676e98e792a 100644 --- a/build.sbt +++ b/build.sbt @@ -2500,6 +2500,7 @@ lazy val `engine-runner-common` = project lazy val `engine-runner` = project .in(file("engine/runner")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, truffleDslSuppressWarnsSetting, @@ -2573,6 +2574,29 @@ lazy val `engine-runner` = project "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test, "org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion ), + modulePath := { + val requiredModIds = Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "org.jline" % "jline" % jlineVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion + ) + val requiredExternalMods = JPMSUtils.filterModulesFromUpdate( + (Compile / update).value, + requiredModIds, + streams.value.log, + shouldContainAll = true + ) + val profilingMod = + (`profiling-utils` / Compile / exportedProducts).value.head.data + + requiredExternalMods ++ Seq( + profilingMod + ) + }, run / connectInput := true ) .settings( diff --git a/engine/runner/src/main/java/module-info.java b/engine/runner/src/main/java/module-info.java new file mode 100644 index 000000000000..509033e03040 --- /dev/null +++ b/engine/runner/src/main/java/module-info.java @@ -0,0 +1,9 @@ +module org.enso.runner { + requires commons.cli; + requires org.enso.profiling; + requires org.graalvm.nativeimage; + requires org.graalvm.polyglot; + requires org.jline; + requires org.slf4j; + requires scala.library; +} diff --git a/engine/runner/src/main/java/org/enso/runner/package-info.java b/engine/runner/src/main/java/org/enso/runner/package-info.java deleted file mode 100644 index 6f18e5c56e40..000000000000 --- a/engine/runner/src/main/java/org/enso/runner/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.runner; From 170d1489d8c7dd175db78719ed62517f85a44f4b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 13:49:41 +0200 Subject: [PATCH 005/268] Add module-info to semver --- build.sbt | 16 +++++++++++++++- lib/scala/semver/src/main/java/module-info.java | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 lib/scala/semver/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index d676e98e792a..74e308eb2acb 100644 --- a/build.sbt +++ b/build.sbt @@ -3050,16 +3050,30 @@ lazy val editions = project lazy val semver = project .in(file("lib/scala/semver")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, + // Compile order needed for JPMSPlugin to work correctly. More specifically, + // to force compilation of `module-info.java` + compileOrder := CompileOrder.JavaThenScala, libraryDependencies ++= Seq( "io.circe" %% "circe-core" % circeVersion % "provided", "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test, "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test - ) + ), + modulePath := { + JPMSUtils.filterModulesFromUpdate( + (Compile / update).value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + streams.value.log, + shouldContainAll = true + ) + } ) .settings( (Compile / compile) := (Compile / compile) diff --git a/lib/scala/semver/src/main/java/module-info.java b/lib/scala/semver/src/main/java/module-info.java new file mode 100644 index 000000000000..25fa693e43f6 --- /dev/null +++ b/lib/scala/semver/src/main/java/module-info.java @@ -0,0 +1,3 @@ +module org.enso.semver { + requires scala.library; +} From bd5e6d9ad24c9ded87f70f7637ef10fb753d4e0a Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 18:14:30 +0200 Subject: [PATCH 006/268] runtime-parser is JPMS module --- build.sbt | 73 ++++++++++++++++++- .../src/main/java/module-info.java | 15 ++++ project/JPMSUtils.scala | 45 +++++++++++- 3 files changed, 128 insertions(+), 5 deletions(-) create mode 100644 engine/runtime-parser/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 74e308eb2acb..8cc4a0b4d5f5 100644 --- a/build.sbt +++ b/build.sbt @@ -791,7 +791,17 @@ lazy val pkg = (project in file("lib/scala/pkg")) "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.apache.commons" % "commons-compress" % commonsCompressVersion - ) + ), + modulePath := { + JPMSUtils.filterModulesFromUpdate( + (Compile / update).value, + Seq( + "org.apache.commons" % "commons-compress" % commonsCompressVersion + ), + streams.value.log, + shouldContainAll = true + ) + } ) .dependsOn(editions) @@ -953,6 +963,7 @@ lazy val cli = project .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, version := "0.1", libraryDependencies ++= circe ++ Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, @@ -2206,6 +2217,7 @@ lazy val `runtime-benchmarks` = lazy val `runtime-parser` = (project in file("engine/runtime-parser")) + .enablePlugins(JPMSPlugin) .settings( version := mavenUploadVersion, javadocSettings, @@ -2220,7 +2232,31 @@ lazy val `runtime-parser` = "com.github.sbt" % "junit-interface" % junitIfVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" - ) + ), + javaModuleName := "org.enso.runtime.parser", + modulePath := { + val requiredExternalMods = JPMSUtils.filterModulesFromUpdate( + (Compile / update).value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion + ), + streams.value.log, + shouldContainAll = true + ) + val syntaxMod = + (`syntax-rust-definition` / Compile / exportedProducts).value.head.data + + requiredExternalMods ++ Seq( + syntaxMod + ) + }, + // Note [Compile module-info] + excludeFilter := excludeFilter.value || "module-info.java", + Compile / compileModuleInfo := JPMSUtils + .compileModuleInfo() + .dependsOn(Compile / compile) + .value ) .dependsOn(`syntax-rust-definition`) .dependsOn(`persistance`) @@ -2359,7 +2395,7 @@ lazy val `runtime-fat-jar` = } .dependsOn(Compile / compile) .value, - // Filter module-info.java from the compilation + // Note [Compile module-info] excludeFilter := excludeFilter.value || "module-info.java", javaModuleName := "org.enso.runtime", compileOrder := CompileOrder.JavaThenScala @@ -2574,6 +2610,9 @@ lazy val `engine-runner` = project "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test, "org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion ), + Compile / compile := (Compile / compile) + .dependsOn(`runtime-parser` / Compile / compileModuleInfo) + .value, modulePath := { val requiredModIds = Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -2584,14 +2623,40 @@ lazy val `engine-runner` = project "org.jline" % "jline" % jlineVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ) + val logger = streams.value.log val requiredExternalMods = JPMSUtils.filterModulesFromUpdate( (Compile / update).value, requiredModIds, - streams.value.log, + logger, shouldContainAll = true ) val profilingMod = (`profiling-utils` / Compile / exportedProducts).value.head.data + val semverMod = + (`semver` / Compile / exportedProducts).value.head.data + val cliMod = + (`cli` / Compile / exportedProducts).value.head.data + val distributionMod = + (`distribution-manager` / Compile / exportedProducts).value.head.data + val editionsMod = + (`editions` / Compile / exportedProducts).value.head.data + val editionsUpdaterMod = + (`edition-updater` / Compile / exportedProducts).value.head.data + val libraryManagerMod = + (`library-manager` / Compile / exportedProducts).value.head.data + val pkgMod = + (`pkg` / Compile / exportedProducts).value.head.data + val runnerCommonMod = + (`engine-runner-common` / Compile / exportedProducts).value.head.data + val parserMod = + (`runtime-parser` / Compile / classDirectory).value + if (!parserMod.toPath.resolve("module-info.class").toFile.exists()) { + logger.error( + "module-info.class not in runtime-parser/target" + + "Dependencies are probably not set correctly. Make sure that the current " + + "task depends on runtime-parser/Compile/compileModuleInfo" + ) + } requiredExternalMods ++ Seq( profilingMod diff --git a/engine/runtime-parser/src/main/java/module-info.java b/engine/runtime-parser/src/main/java/module-info.java new file mode 100644 index 000000000000..16450e611001 --- /dev/null +++ b/engine/runtime-parser/src/main/java/module-info.java @@ -0,0 +1,15 @@ +module org.enso.runtime.parser { + requires org.enso.syntax; + requires org.openide.util.lookup.RELEASE180; + requires scala.library; + + exports org.enso.compiler.core; + exports org.enso.compiler.core.ir; + exports org.enso.compiler.core.ir.expression; + exports org.enso.compiler.core.ir.expression.errors; + exports org.enso.compiler.core.ir.expression.warnings; + exports org.enso.compiler.core.ir.module; + exports org.enso.compiler.core.ir.module.scope; + exports org.enso.compiler.core.ir.module.scope.definition; + exports org.enso.compiler.core.ir.module.scope.imports; +} diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index fc790c03b077..09df886d5e26 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -1,4 +1,4 @@ -import JPMSPlugin.autoImport.javaModuleName +import JPMSPlugin.autoImport.{javaModuleName, modulePath} import sbt._ import sbt.Keys._ import sbt.internal.inc.{CompileOutput, PlainVirtualFile} @@ -253,6 +253,49 @@ object JPMSUtils { } } + /** Compiles `module-info.java` in the current project. The module path is + * gathered from [[JPMSPlugin.autoImport.modulePath]] settings. + * @see [[compileModuleInfo]]. + */ + def compileModuleInfo(): Def.Initialize[Task[Unit]] = Def.task { + val moduleInfo = (Compile / javaSource).value / "module-info.java" + val log = streams.value.log + val incToolOpts = IncToolOptionsUtil.defaultIncToolOptions() + val reporter = (Compile / compile / bspReporter).value + val output = CompileOutput((Compile / classDirectory).value.toPath) + val outputPath: Path = output.getSingleOutputAsPath.get() + val moduleName = javaModuleName.value + val mp = (Compile / modulePath).value + val baseJavacOpts = (Compile / javacOptions).value + val cp = (Compile / fullClasspath).value + val javaCompiler = + (Compile / compile / compilers).value.javaTools.javac() + log.info(s"Compiling $moduleInfo with javac") + val allOpts = baseJavacOpts ++ Seq( + "--class-path", + cp.map(_.data.getAbsolutePath).mkString(File.pathSeparator), + "--module-path", + mp.map(_.getAbsolutePath).mkString(File.pathSeparator), + "-d", + outputPath.toAbsolutePath.toString + ) + log.debug(s"javac options: $allOpts") + val succ = javaCompiler.run( + Array(PlainVirtualFile(moduleInfo.toPath)), + allOpts.toArray, + output, + incToolOpts, + reporter, + log + ) + if (!succ) { + val msg = s"Compilation of ${moduleInfo} failed" + log.error(s"javac options: $allOpts") + log.error(msg) + throw new IllegalStateException(msg) + } + } + /** Copies all classes from all the dependencies `classes` directories into the target directory. * @param sourceClassesDir Directory from where the classes will be copied. * @param output Target directory where all the classes from all the dependencies From a3b7b5f10751201439c340bfa1aeada150bf308b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 18:15:32 +0200 Subject: [PATCH 007/268] Migrate more projects to JPMS --- build.sbt | 13 ++++++++++++- engine/runner-common/src/main/java/module-info.java | 3 +++ engine/runner/src/main/java/module-info.java | 9 +++++++++ lib/scala/cli/src/main/java/module-info.java | 4 ++++ .../src/main/java/module-info.java | 5 +++++ .../java/org/enso/distribution/package-info.java | 1 - .../edition-updater/src/main/java/module-info.java | 3 +++ .../org/enso/editions/updater/package-info.java | 1 - lib/scala/editions/src/main/java/module-info.java | 3 +++ .../main/java/org/enso/editions/package-info.java | 1 - .../library-manager/src/main/java/module-info.java | 6 ++++++ .../main/java/org/enso/editions/package-info.java | 1 - lib/scala/pkg/src/main/java/module-info.java | 4 ++++ lib/scala/semver/src/main/java/module-info.java | 2 ++ 14 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 engine/runner-common/src/main/java/module-info.java create mode 100644 lib/scala/cli/src/main/java/module-info.java create mode 100644 lib/scala/distribution-manager/src/main/java/module-info.java delete mode 100644 lib/scala/distribution-manager/src/main/java/org/enso/distribution/package-info.java create mode 100644 lib/scala/edition-updater/src/main/java/module-info.java delete mode 100644 lib/scala/edition-updater/src/main/java/org/enso/editions/updater/package-info.java create mode 100644 lib/scala/editions/src/main/java/module-info.java delete mode 100644 lib/scala/editions/src/main/java/org/enso/editions/package-info.java create mode 100644 lib/scala/library-manager/src/main/java/module-info.java delete mode 100644 lib/scala/library-manager/src/main/java/org/enso/editions/package-info.java create mode 100644 lib/scala/pkg/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 8cc4a0b4d5f5..7584d19acb35 100644 --- a/build.sbt +++ b/build.sbt @@ -781,9 +781,11 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) ) lazy val pkg = (project in file("lib/scala/pkg")) + .enablePlugins(JPMSPlugin) .settings( Compile / run / mainClass := Some("org.enso.pkg.Main"), frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, version := "0.1", libraryDependencies ++= Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", @@ -2659,7 +2661,16 @@ lazy val `engine-runner` = project } requiredExternalMods ++ Seq( - profilingMod + profilingMod, + semverMod, + cliMod, + distributionMod, + editionsMod, + editionsUpdaterMod, + libraryManagerMod, + pkgMod, + runnerCommonMod, + parserMod ) }, run / connectInput := true diff --git a/engine/runner-common/src/main/java/module-info.java b/engine/runner-common/src/main/java/module-info.java new file mode 100644 index 000000000000..672da44abc8f --- /dev/null +++ b/engine/runner-common/src/main/java/module-info.java @@ -0,0 +1,3 @@ +module org.enso.runner.common { + exports org.enso.runner.common; +} diff --git a/engine/runner/src/main/java/module-info.java b/engine/runner/src/main/java/module-info.java index 509033e03040..8725f572746b 100644 --- a/engine/runner/src/main/java/module-info.java +++ b/engine/runner/src/main/java/module-info.java @@ -1,9 +1,18 @@ module org.enso.runner { requires commons.cli; + requires org.enso.cli; + requires org.enso.distribution; + requires org.enso.editions; + requires org.enso.editions.updater; + requires org.enso.librarymanager; + requires org.enso.runtime.parser; requires org.enso.profiling; + requires org.enso.semver; requires org.graalvm.nativeimage; requires org.graalvm.polyglot; requires org.jline; requires org.slf4j; requires scala.library; + requires org.enso.pkg; + requires org.enso.runner.common; } diff --git a/lib/scala/cli/src/main/java/module-info.java b/lib/scala/cli/src/main/java/module-info.java new file mode 100644 index 000000000000..6acfb249c6ef --- /dev/null +++ b/lib/scala/cli/src/main/java/module-info.java @@ -0,0 +1,4 @@ +module org.enso.cli { + exports org.enso.cli; + exports org.enso.cli.task; +} diff --git a/lib/scala/distribution-manager/src/main/java/module-info.java b/lib/scala/distribution-manager/src/main/java/module-info.java new file mode 100644 index 000000000000..cfc50be4f67b --- /dev/null +++ b/lib/scala/distribution-manager/src/main/java/module-info.java @@ -0,0 +1,5 @@ +module org.enso.distribution { + exports org.enso.distribution; + exports org.enso.distribution.config; + exports org.enso.distribution.locking; +} diff --git a/lib/scala/distribution-manager/src/main/java/org/enso/distribution/package-info.java b/lib/scala/distribution-manager/src/main/java/org/enso/distribution/package-info.java deleted file mode 100644 index afb9069e7533..000000000000 --- a/lib/scala/distribution-manager/src/main/java/org/enso/distribution/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.distribution; diff --git a/lib/scala/edition-updater/src/main/java/module-info.java b/lib/scala/edition-updater/src/main/java/module-info.java new file mode 100644 index 000000000000..ef93fa590c24 --- /dev/null +++ b/lib/scala/edition-updater/src/main/java/module-info.java @@ -0,0 +1,3 @@ +module org.enso.editions.updater { + exports org.enso.editions.updater; +} diff --git a/lib/scala/edition-updater/src/main/java/org/enso/editions/updater/package-info.java b/lib/scala/edition-updater/src/main/java/org/enso/editions/updater/package-info.java deleted file mode 100644 index db865cb8e61d..000000000000 --- a/lib/scala/edition-updater/src/main/java/org/enso/editions/updater/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.editions.updater; diff --git a/lib/scala/editions/src/main/java/module-info.java b/lib/scala/editions/src/main/java/module-info.java new file mode 100644 index 000000000000..9c1688f8eb07 --- /dev/null +++ b/lib/scala/editions/src/main/java/module-info.java @@ -0,0 +1,3 @@ +module org.enso.editions { + exports org.enso.editions; +} diff --git a/lib/scala/editions/src/main/java/org/enso/editions/package-info.java b/lib/scala/editions/src/main/java/org/enso/editions/package-info.java deleted file mode 100644 index 5487ffa35b5e..000000000000 --- a/lib/scala/editions/src/main/java/org/enso/editions/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.editions; diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java new file mode 100644 index 000000000000..e7b4112602ef --- /dev/null +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module org.enso.librarymanager { + exports org.enso.librarymanager; + exports org.enso.librarymanager.dependencies; + exports org.enso.librarymanager.published; + exports org.enso.libraryupload; +} diff --git a/lib/scala/library-manager/src/main/java/org/enso/editions/package-info.java b/lib/scala/library-manager/src/main/java/org/enso/editions/package-info.java deleted file mode 100644 index 5487ffa35b5e..000000000000 --- a/lib/scala/library-manager/src/main/java/org/enso/editions/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.editions; diff --git a/lib/scala/pkg/src/main/java/module-info.java b/lib/scala/pkg/src/main/java/module-info.java new file mode 100644 index 000000000000..5b850cf0d067 --- /dev/null +++ b/lib/scala/pkg/src/main/java/module-info.java @@ -0,0 +1,4 @@ +module org.enso.pkg { + requires org.apache.commons.compress; + exports org.enso.pkg; +} diff --git a/lib/scala/semver/src/main/java/module-info.java b/lib/scala/semver/src/main/java/module-info.java index 25fa693e43f6..95927c10ebd1 100644 --- a/lib/scala/semver/src/main/java/module-info.java +++ b/lib/scala/semver/src/main/java/module-info.java @@ -1,3 +1,5 @@ module org.enso.semver { requires scala.library; + + exports org.enso.semver; } From 878acf2518902635f81c5e89efce68a164986a4b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 18:15:47 +0200 Subject: [PATCH 008/268] Fix package name conflict in library-manager --- build.sbt | 1 + .../src/main/scala/org/enso/editions/DefaultEdition.scala | 0 2 files changed, 1 insertion(+) rename lib/scala/{library-manager => editions}/src/main/scala/org/enso/editions/DefaultEdition.scala (100%) diff --git a/build.sbt b/build.sbt index 7584d19acb35..15b8abf9b476 100644 --- a/build.sbt +++ b/build.sbt @@ -3122,6 +3122,7 @@ lazy val editions = project cleanFiles += baseDirectory.value / ".." / ".." / "distribution" / "editions" ) .dependsOn(semver) + .dependsOn(`version-output`) // Note [Default Editions] .dependsOn(testkit % Test) lazy val semver = project diff --git a/lib/scala/library-manager/src/main/scala/org/enso/editions/DefaultEdition.scala b/lib/scala/editions/src/main/scala/org/enso/editions/DefaultEdition.scala similarity index 100% rename from lib/scala/library-manager/src/main/scala/org/enso/editions/DefaultEdition.scala rename to lib/scala/editions/src/main/scala/org/enso/editions/DefaultEdition.scala From 0ed9622b972044d44c65c239cea950cead2987f8 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 18:16:07 +0200 Subject: [PATCH 009/268] fmt --- engine/runner/src/main/java/module-info.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/runner/src/main/java/module-info.java b/engine/runner/src/main/java/module-info.java index 8725f572746b..62aefb601fba 100644 --- a/engine/runner/src/main/java/module-info.java +++ b/engine/runner/src/main/java/module-info.java @@ -6,6 +6,8 @@ requires org.enso.editions.updater; requires org.enso.librarymanager; requires org.enso.runtime.parser; + requires org.enso.runner.common; + requires org.enso.pkg; requires org.enso.profiling; requires org.enso.semver; requires org.graalvm.nativeimage; @@ -13,6 +15,4 @@ requires org.jline; requires org.slf4j; requires scala.library; - requires org.enso.pkg; - requires org.enso.runner.common; } From 3e4889cc922b0b9980e41d6a5f17ea9ed87f9723 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 19:38:00 +0200 Subject: [PATCH 010/268] version-output is JPMSModule. Also, refactor it to Java. --- build.sbt | 2 +- .../src/main/java/org/enso/runner/Main.java | 10 +- .../org/enso/editions/DefaultEdition.scala | 4 +- .../projectmanager/boot/ProjectManager.scala | 4 +- .../src/main/java/module-info.java | 3 + .../java/org/enso/version/BuildVersion.java | 59 ++++++ .../org/enso/version/VersionDescription.java | 184 ++++++++++++++++++ .../version/VersionDescriptionParameter.java | 17 ++ .../java/org/enso/version/package-info.java | 1 - .../org/enso/version/VersionDescription.scala | 132 ------------- project/BuildInfo.scala | 59 ++++-- 11 files changed, 315 insertions(+), 160 deletions(-) create mode 100644 lib/scala/version-output/src/main/java/module-info.java create mode 100644 lib/scala/version-output/src/main/java/org/enso/version/BuildVersion.java create mode 100644 lib/scala/version-output/src/main/java/org/enso/version/VersionDescription.java create mode 100644 lib/scala/version-output/src/main/java/org/enso/version/VersionDescriptionParameter.java delete mode 100644 lib/scala/version-output/src/main/java/org/enso/version/package-info.java delete mode 100644 lib/scala/version-output/src/main/scala/org/enso/version/VersionDescription.scala diff --git a/build.sbt b/build.sbt index 15b8abf9b476..64746cce296d 100644 --- a/build.sbt +++ b/build.sbt @@ -996,7 +996,7 @@ lazy val `version-output` = (project in file("lib/scala/version-output")) .settings( frgaalJavaCompilerSetting, Compile / sourceGenerators += Def.task { - val file = (Compile / sourceManaged).value / "buildinfo" / "Info.scala" + val file = (Compile / sourceManaged).value / "org" / "enso" / "version" / "GeneratedVersion.java" BuildInfo .writeBuildInfoFile( file = file, diff --git a/engine/runner/src/main/java/org/enso/runner/Main.java b/engine/runner/src/main/java/org/enso/runner/Main.java index af4e521cd732..cd9f662e3d40 100644 --- a/engine/runner/src/main/java/org/enso/runner/Main.java +++ b/engine/runner/src/main/java/org/enso/runner/Main.java @@ -1,6 +1,5 @@ package org.enso.runner; -import buildinfo.Info; import java.io.File; import java.io.IOException; import java.net.URI; @@ -44,6 +43,7 @@ import org.enso.runner.common.LanguageServerApi; import org.enso.runner.common.ProfilingConfig; import org.enso.runner.common.WrongOption; +import org.enso.version.BuildVersion; import org.enso.version.VersionDescription; import org.graalvm.polyglot.PolyglotException; import org.graalvm.polyglot.PolyglotException.StackFrame; @@ -103,7 +103,7 @@ public class Main { Main() {} private static boolean isDevBuild() { - return Info.ensoVersion().matches(".+-SNAPSHOT$"); + return BuildVersion.ensoVersion().matches(".+-SNAPSHOT$"); } private static Option.Builder cliOptionBuilder() { @@ -957,9 +957,9 @@ private void displayVersion(boolean useJson) { VersionDescription.make( "Enso Compiler and Runtime", true, - VersionDescription.make$default$3(), - VersionDescription.make$default$4(), - scala.Option.apply(customVersion)); + false, + List.of(), + customVersion); println(versionDescription.asString(useJson)); } diff --git a/lib/scala/editions/src/main/scala/org/enso/editions/DefaultEdition.scala b/lib/scala/editions/src/main/scala/org/enso/editions/DefaultEdition.scala index 99561fc6cafa..dff972b8890b 100644 --- a/lib/scala/editions/src/main/scala/org/enso/editions/DefaultEdition.scala +++ b/lib/scala/editions/src/main/scala/org/enso/editions/DefaultEdition.scala @@ -1,6 +1,6 @@ package org.enso.editions -import buildinfo.Info +import org.enso.version.BuildVersion /** Allows to get the default edition associated with the current Enso version. * @@ -13,5 +13,5 @@ object DefaultEdition { /** Returns the default edition associated with the current Enso version. */ def getDefaultEdition: Editions.RawEdition = - Editions.Raw.Edition(parent = Some(Info.currentEdition)) + Editions.Raw.Edition(parent = Some(BuildVersion.currentEdition)) } diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/ProjectManager.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/ProjectManager.scala index 9019d576bec7..73c2dc5513ef 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/ProjectManager.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/ProjectManager.scala @@ -329,8 +329,8 @@ object ProjectManager extends ZIOAppDefault with LazyLogging { private def makeVersionDescription: VersionDescription = VersionDescription.make( "Enso Project Manager", - includeRuntimeJVMInfo = false, - enableNativeImageOSWorkaround = true + false, + true ) private def logServerStartup(): UIO[Unit] = diff --git a/lib/scala/version-output/src/main/java/module-info.java b/lib/scala/version-output/src/main/java/module-info.java new file mode 100644 index 000000000000..49b8b6b2f104 --- /dev/null +++ b/lib/scala/version-output/src/main/java/module-info.java @@ -0,0 +1,3 @@ +module org.enso.version.output { + exports org.enso.version; +} diff --git a/lib/scala/version-output/src/main/java/org/enso/version/BuildVersion.java b/lib/scala/version-output/src/main/java/org/enso/version/BuildVersion.java new file mode 100644 index 000000000000..025a3a90a558 --- /dev/null +++ b/lib/scala/version-output/src/main/java/org/enso/version/BuildVersion.java @@ -0,0 +1,59 @@ +package org.enso.version; + +/** + * Class containing only static methods for getting various version information + * gathered at build time. + */ +public class BuildVersion { + private BuildVersion() {} + + public static String defaultDevEnsoVersion() { + return GeneratedVersion.defaultDevEnsoVersion(); + } + + public static String ensoVersion() { + return GeneratedVersion.ensoVersion(); + } + + public static String scalacVersion() { + return GeneratedVersion.scalacVersion(); + } + + public static String graalVersion() { + return GeneratedVersion.graalVersion(); + } + + public static String currentEdition() { + return GeneratedVersion.currentEdition(); + } + + /** + * Current commit ID. + */ + public static String commit() { + return GeneratedVersion.commit(); + } + + /** + * Current git ref + */ + public static String ref() { + return GeneratedVersion.ref(); + } + + public static boolean isDirty() { + return GeneratedVersion.isDirty(); + } + + public static String latestCommitDate() { + return GeneratedVersion.latestCommitDate(); + } + + /** + * Release mode, set to true if the environment variable + * {@code ENSO_RELEASE_MODE} is set to {@code true} at build time. + */ + public static boolean isRelease() { + return GeneratedVersion.isRelease(); + } +} diff --git a/lib/scala/version-output/src/main/java/org/enso/version/VersionDescription.java b/lib/scala/version-output/src/main/java/org/enso/version/VersionDescription.java new file mode 100644 index 000000000000..554e61331a55 --- /dev/null +++ b/lib/scala/version-output/src/main/java/org/enso/version/VersionDescription.java @@ -0,0 +1,184 @@ +package org.enso.version; + +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** Represents a description of a version string that can be rendered as a + * human-readable string or in JSON format. + */ +public class VersionDescription { + private final boolean includeRuntimeJVMInfo; + private final boolean enableNativeImageOSWorkaround; + private final String header; + private final String version; + private final String osArch; + private final String osName; + private final String osVersion; + private final String vmName; + private final String vmVendor; + private final String jreVersion; + private final List additionalParameters; + + private VersionDescription(boolean includeRuntimeJVMInfo, boolean enableNativeImageOSWorkaround, String header, String version, + List additionalParameters) { + this.includeRuntimeJVMInfo = includeRuntimeJVMInfo; + this.enableNativeImageOSWorkaround = enableNativeImageOSWorkaround; + this.header = header; + this.version = version; + this.additionalParameters = additionalParameters; + + this.osArch = System.getProperty("os.arch"); + this.osName = System.getProperty("os.name"); + this.osVersion = System.getProperty("os.version"); + + this.vmName = System.getProperty("java.vm.name"); + this.vmVendor = System.getProperty("java.vm.vendor"); + this.jreVersion = System.getProperty("java.runtime.version"); + } + + public static VersionDescription make( + String header, + boolean includeRuntimeJVMInfo, + boolean enableNativeImageOSWorkaround + ) { + return make(header, includeRuntimeJVMInfo, enableNativeImageOSWorkaround, List.of(), null); + } + + /** Creates a {@link VersionDescription} instance. + * + * @param header header displayed as the first line of the human-readable + * representation + * @param includeRuntimeJVMInfo if set to true, includes information about + * the JVM that is running the program + * @param enableNativeImageOSWorkaround if set to true, changes how the OS + * information is displayed; this is a + * temporary workaround caused by the + * Native Image OS returning the value + * known at build-time and not at + * runtime + * @param additionalParameters a sequence of additional + * {@link VersionDescriptionParameter} to include in + * the version string + * @param customVersion if provided, overrides the version string from + * {@code GeneratedVersion}; used for testing purposes + * @return + */ + public static VersionDescription make( + String header, + boolean includeRuntimeJVMInfo, + boolean enableNativeImageOSWorkaround, + List additionalParameters, + String customVersion + ) { + Objects.requireNonNull(header); + Objects.requireNonNull(additionalParameters); + String version; + if (customVersion != null) { + version = customVersion; + } else { + version = BuildVersion.ensoVersion(); + } + return new VersionDescription( + includeRuntimeJVMInfo, + enableNativeImageOSWorkaround, + header, + version, + additionalParameters + ); + } + + public String asHumanReadableString() { + String runtimeDescription; + if (includeRuntimeJVMInfo) { + runtimeDescription = String.format(""" + Running on: %s, %s, JDK %s + %s, %s (%s) + """, vmName, vmVendor, jreVersion, osName, osVersion, osArch); + } else if (enableNativeImageOSWorkaround) { + // TODO [RW] Currently the `os.name` property seems to be set to the + // OS the program has been built on, instead of the OS that is + // currently running. A workaround should be implemented in #1100 + // that will use other means to query the OS name and version. + runtimeDescription = String.format( + "Built on: %s (%s)", osName, osArch + ); + } else { + runtimeDescription = String.format( + "Running on: %s %s (%s)", osName, osVersion, osArch + ); + } + String dirtyStr = ""; + if (BuildVersion.isDirty()) { + dirtyStr = "*"; + } + var parameters = formatParameters(VersionDescription::formatParameterAsHumanReadableString, "\n"); + return String.format(""" + %s + Version: %s + Built with: scala-%s for GraalVM %s + Built from: %s%s @ %s + %s%s + """, header, version, BuildVersion.scalacVersion(), BuildVersion.graalVersion(), BuildVersion.ref(), dirtyStr, BuildVersion.commit(), runtimeDescription, parameters); + } + + public String asJSONString() { + String runtimeDescription; + if (includeRuntimeJVMInfo) { + runtimeDescription = String.format(""" + "osName": "%s", + "osVersion": "%s", + "osArch": "%s", + """, osName, osVersion, osArch); + } else { + runtimeDescription = String.format(""" + "vmName": "%s", + "vmVendor": "%s", + "jreVersion": "%s", + "osName": "%s", + "osVersion": "%s", + "osArch": "%s", + """, vmName, vmVendor, jreVersion, osName, osVersion, osArch); + } + var parameters = formatParameters(VersionDescription::formatParameterAsJSONString, ",\n"); + return String.format(""" + { + "version": "%s", + "ref": "%s", + "dirty": "%s", + "commit": "%s", + %s%s + } + """, + version, BuildVersion.ref(), BuildVersion.isDirty(), BuildVersion.commit(), runtimeDescription, parameters); + } + + public String asString(boolean useJson) { + if (useJson) { + return asJSONString(); + } else { + return asHumanReadableString(); + } + } + + private static String formatParameterAsJSONString(VersionDescriptionParameter parameter) { + return "\"" + parameter.jsonName() + "\": " + parameter.value() + "\""; + } + + private static String formatParameterAsHumanReadableString(VersionDescriptionParameter parameter) { + return parameter.humanReadableName() + ": " + parameter.value(); + } + + private String formatParameters(Function formatter, String separator) { + if (additionalParameters.isEmpty()) { + return ""; + } else { + return additionalParameters + .stream() + .map(formatter) + .collect(Collectors.joining(separator)); + } + } +} + diff --git a/lib/scala/version-output/src/main/java/org/enso/version/VersionDescriptionParameter.java b/lib/scala/version-output/src/main/java/org/enso/version/VersionDescriptionParameter.java new file mode 100644 index 000000000000..5b8b64a0e160 --- /dev/null +++ b/lib/scala/version-output/src/main/java/org/enso/version/VersionDescriptionParameter.java @@ -0,0 +1,17 @@ +package org.enso.version; + +/** Defines an additional parameter for the version description. + * + * @param humanReadableName the human readable prefix added when printing this + * parameter in human-readable format + * @param jsonName the key when outputting the parameter in JSON format + * @param value the value to use for the parameter; depending on if the whole + * version description will be queried as a human-readable version + * or in JSON, this value should be in the right format + */ + +public record VersionDescriptionParameter( + String humanReadableName, + String jsonName, + String value +) { } diff --git a/lib/scala/version-output/src/main/java/org/enso/version/package-info.java b/lib/scala/version-output/src/main/java/org/enso/version/package-info.java deleted file mode 100644 index e127b0943c00..000000000000 --- a/lib/scala/version-output/src/main/java/org/enso/version/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.version; diff --git a/lib/scala/version-output/src/main/scala/org/enso/version/VersionDescription.scala b/lib/scala/version-output/src/main/scala/org/enso/version/VersionDescription.scala deleted file mode 100644 index aa78030b5cae..000000000000 --- a/lib/scala/version-output/src/main/scala/org/enso/version/VersionDescription.scala +++ /dev/null @@ -1,132 +0,0 @@ -package org.enso.version - -import buildinfo.Info - -/** Represents a description of a version string that can be rendered as a - * human-readable string or in JSON format. - */ -trait VersionDescription { - def asHumanReadableString: String - def asJSONString: String - - def asString(useJson: Boolean): String = - if (useJson) asJSONString else asHumanReadableString -} - -/** Defines an additional parameter for the version description. - * - * @param humanReadableName the human readable prefix added when printing this - * parameter in human-readable format - * @param jsonName the key when outputting the parameter in JSON format - * @param value the value to use for the parameter; depending on if the whole - * version description will be queried as a human-readable version - * or in JSON, this value should be in the right format - */ -case class VersionDescriptionParameter( - humanReadableName: String, - jsonName: String, - value: String -) - -object VersionDescription { - - /** Creates a [[VersionDescription]] instance. - * - * @param header header displayed as the first line of the human-readable - * representation - * @param includeRuntimeJVMInfo if set to true, includes information about - * the JVM that is running the program - * @param enableNativeImageOSWorkaround if set to true, changes how the OS - * information is displayed; this is a - * temporary workaround caused by the - * Native Image OS returning the value - * known at build-time and not at - * runtime - * @param additionalParameters a sequence of additional - * [[VersionDescriptionParameter]] to include in - * the version string - * @param customVersion if provided, overrides the version string from - * [[buildinfo]]; used for testing purposes - * @return - */ - def make( - header: String, - includeRuntimeJVMInfo: Boolean, - enableNativeImageOSWorkaround: Boolean = false, - additionalParameters: Seq[VersionDescriptionParameter] = Seq.empty, - customVersion: Option[String] = None - ): VersionDescription = { - val version = customVersion.getOrElse(Info.ensoVersion) - val osArch = System.getProperty("os.arch") - val osName = System.getProperty("os.name") - val osVersion = System.getProperty("os.version") - - val vmName = System.getProperty("java.vm.name") - val vmVendor = System.getProperty("java.vm.vendor") - val jreVersion = System.getProperty("java.runtime.version") - - def formatParameters( - formatter: VersionDescriptionParameter => String, - separator: String - ): String = - if (additionalParameters.isEmpty) "" - else separator + additionalParameters.map(formatter).mkString(separator) - - new VersionDescription { - override def asHumanReadableString: String = { - val runtimeDescription = - if (includeRuntimeJVMInfo) - s"""Running on: $vmName, $vmVendor, JDK $jreVersion - | $osName $osVersion ($osArch)""".stripMargin - else if (enableNativeImageOSWorkaround) { - // TODO [RW] Currently the `os.name` property seems to be set to the - // OS the program has been built on, instead of the OS that is - // currently running. A workaround should be implemented in #1100 - // that will use other means to query the OS name and version. - s"Built on: $osName ($osArch)" - } else s"Running on: $osName $osVersion ($osArch)" - - val dirtyStr = if (Info.isDirty) "*" else "" - val parameters = - formatParameters(formatParameterAsHumanReadableString, "\n") - s"""$header - |Version: $version - |Built with: scala-${Info.scalacVersion} for GraalVM ${Info.graalVersion} - |Built from: ${Info.ref}$dirtyStr @ ${Info.commit} - |$runtimeDescription$parameters - |""".stripMargin - } - - override def asJSONString: String = { - val runtimeDescription = - if (includeRuntimeJVMInfo) - s""" "osName": "$osName", - | "osVersion": "$osVersion", - | "osArch": "$osArch"""".stripMargin - else - s""" "vmName": "$vmName", - | "vmVendor": "$vmVendor", - | "jreVersion": "$jreVersion", - | "osName": "$osName", - | "osVersion": "$osVersion", - | "osArch": "$osArch"""".stripMargin - val parameters = formatParameters(formatParameterAsJSONString, ",\n") - s"""{ "version": "$version", - | "ref": "${Info.ref}", - | "dirty": ${Info.isDirty}, - | "commit": "${Info.commit}", - |$runtimeDescription$parameters - |}""".stripMargin - } - } - } - - private def formatParameterAsJSONString( - parameter: VersionDescriptionParameter - ): String = - s""""${parameter.jsonName}": ${parameter.value}""" - private def formatParameterAsHumanReadableString( - parameter: VersionDescriptionParameter - ): String = - s"${parameter.humanReadableName}: ${parameter.value}" -} diff --git a/project/BuildInfo.scala b/project/BuildInfo.scala index 1d44b4b9bf53..44c7fad93f1d 100644 --- a/project/BuildInfo.scala +++ b/project/BuildInfo.scala @@ -5,7 +5,7 @@ import scala.sys.process._ object BuildInfo { - /** Writes build-time information to a Scala object that can be used by the + /** Writes build-time information to a Java class that can be used by the * components. * * If the `ENSO_RELEASE_MODE` environment variable is set to `true`, will set @@ -34,28 +34,53 @@ object BuildInfo { ): Seq[File] = { val gitInfo = getGitInformation(log).getOrElse(fallbackGitInformation) val isRelease = isReleaseMode + val className = file.getName.stripSuffix(".java") val fileContents = s""" - |package buildinfo + |package org.enso.version; | - |object Info { + |final class ${className} { + | private GeneratedVersion() {} | - | // Versions - | val defaultDevEnsoVersion = "$defaultDevEnsoVersion" - | val ensoVersion = "$ensoVersion" - | val scalacVersion = "$scalacVersion" - | val graalVersion = "$graalVersion" - | val currentEdition = "$currentEdition" + | static String defaultDevEnsoVersion() { + | return "${defaultDevEnsoVersion}"; + | } | - | // Git Info - | val commit = "${gitInfo.commitHash}" - | val ref = "${gitInfo.ref}" - | val isDirty = ${gitInfo.isDirty} - | val latestCommitDate = "${gitInfo.latestCommitDate}" + | static String ensoVersion() { + | return "${ensoVersion}"; + | } | - | // Release mode, set to true if the environment variable - | // `ENSO_RELEASE_MODE` is set to `true` at build time. - | val isRelease = $isRelease + | static String scalacVersion() { + | return "${scalacVersion}"; + | } + | + | static String graalVersion() { + | return "${graalVersion}"; + | } + | + | static String currentEdition() { + | return "${currentEdition}"; + | } + | + | static String commit() { + | return "${gitInfo.commitHash}"; + | } + | + | static String ref() { + | return "${gitInfo.ref}"; + | } + | + | static boolean isDirty() { + | return ${gitInfo.isDirty}; + | } + | + | static String latestCommitDate() { + | return "${gitInfo.latestCommitDate}"; + | } + | + | static boolean isRelease() { + | return ${isRelease}; + | } |} |""".stripMargin IO.write(file, fileContents) From 84b30dfa241002fcaf1709567699e690d87b7ed7 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 19:39:14 +0200 Subject: [PATCH 011/268] version-output is JPMSModule. Also, refactor it to Java. --- build.sbt | 3 +- .../src/main/java/org/enso/runner/Main.java | 7 +- .../java/org/enso/version/BuildVersion.java | 16 +-- .../org/enso/version/VersionDescription.java | 126 ++++++++++-------- .../version/VersionDescriptionParameter.java | 19 ++- 5 files changed, 88 insertions(+), 83 deletions(-) diff --git a/build.sbt b/build.sbt index 64746cce296d..89c34ac90900 100644 --- a/build.sbt +++ b/build.sbt @@ -996,7 +996,8 @@ lazy val `version-output` = (project in file("lib/scala/version-output")) .settings( frgaalJavaCompilerSetting, Compile / sourceGenerators += Def.task { - val file = (Compile / sourceManaged).value / "org" / "enso" / "version" / "GeneratedVersion.java" + val file = + (Compile / sourceManaged).value / "org" / "enso" / "version" / "GeneratedVersion.java" BuildInfo .writeBuildInfoFile( file = file, diff --git a/engine/runner/src/main/java/org/enso/runner/Main.java b/engine/runner/src/main/java/org/enso/runner/Main.java index cd9f662e3d40..51b3fb555e4a 100644 --- a/engine/runner/src/main/java/org/enso/runner/Main.java +++ b/engine/runner/src/main/java/org/enso/runner/Main.java @@ -954,12 +954,7 @@ private static MessageTransport replTransport() { private void displayVersion(boolean useJson) { var customVersion = CurrentVersion.getVersion().toString(); var versionDescription = - VersionDescription.make( - "Enso Compiler and Runtime", - true, - false, - List.of(), - customVersion); + VersionDescription.make("Enso Compiler and Runtime", true, false, List.of(), customVersion); println(versionDescription.asString(useJson)); } diff --git a/lib/scala/version-output/src/main/java/org/enso/version/BuildVersion.java b/lib/scala/version-output/src/main/java/org/enso/version/BuildVersion.java index 025a3a90a558..a5d3b54f3ac8 100644 --- a/lib/scala/version-output/src/main/java/org/enso/version/BuildVersion.java +++ b/lib/scala/version-output/src/main/java/org/enso/version/BuildVersion.java @@ -1,8 +1,8 @@ package org.enso.version; /** - * Class containing only static methods for getting various version information - * gathered at build time. + * Class containing only static methods for getting various version information gathered at build + * time. */ public class BuildVersion { private BuildVersion() {} @@ -27,16 +27,12 @@ public static String currentEdition() { return GeneratedVersion.currentEdition(); } - /** - * Current commit ID. - */ + /** Current commit ID. */ public static String commit() { return GeneratedVersion.commit(); } - /** - * Current git ref - */ + /** Current git ref */ public static String ref() { return GeneratedVersion.ref(); } @@ -50,8 +46,8 @@ public static String latestCommitDate() { } /** - * Release mode, set to true if the environment variable - * {@code ENSO_RELEASE_MODE} is set to {@code true} at build time. + * Release mode, set to true if the environment variable {@code ENSO_RELEASE_MODE} is set to + * {@code true} at build time. */ public static boolean isRelease() { return GeneratedVersion.isRelease(); diff --git a/lib/scala/version-output/src/main/java/org/enso/version/VersionDescription.java b/lib/scala/version-output/src/main/java/org/enso/version/VersionDescription.java index 554e61331a55..988cdbeff86c 100644 --- a/lib/scala/version-output/src/main/java/org/enso/version/VersionDescription.java +++ b/lib/scala/version-output/src/main/java/org/enso/version/VersionDescription.java @@ -5,8 +5,9 @@ import java.util.function.Function; import java.util.stream.Collectors; -/** Represents a description of a version string that can be rendered as a - * human-readable string or in JSON format. +/** + * Represents a description of a version string that can be rendered as a human-readable string or + * in JSON format. */ public class VersionDescription { private final boolean includeRuntimeJVMInfo; @@ -21,7 +22,11 @@ public class VersionDescription { private final String jreVersion; private final List additionalParameters; - private VersionDescription(boolean includeRuntimeJVMInfo, boolean enableNativeImageOSWorkaround, String header, String version, + private VersionDescription( + boolean includeRuntimeJVMInfo, + boolean enableNativeImageOSWorkaround, + String header, + String version, List additionalParameters) { this.includeRuntimeJVMInfo = includeRuntimeJVMInfo; this.enableNativeImageOSWorkaround = enableNativeImageOSWorkaround; @@ -29,40 +34,33 @@ private VersionDescription(boolean includeRuntimeJVMInfo, boolean enableNativeIm this.version = version; this.additionalParameters = additionalParameters; - this.osArch = System.getProperty("os.arch"); - this.osName = System.getProperty("os.name"); + this.osArch = System.getProperty("os.arch"); + this.osName = System.getProperty("os.name"); this.osVersion = System.getProperty("os.version"); - this.vmName = System.getProperty("java.vm.name"); - this.vmVendor = System.getProperty("java.vm.vendor"); + this.vmName = System.getProperty("java.vm.name"); + this.vmVendor = System.getProperty("java.vm.vendor"); this.jreVersion = System.getProperty("java.runtime.version"); } public static VersionDescription make( - String header, - boolean includeRuntimeJVMInfo, - boolean enableNativeImageOSWorkaround - ) { + String header, boolean includeRuntimeJVMInfo, boolean enableNativeImageOSWorkaround) { return make(header, includeRuntimeJVMInfo, enableNativeImageOSWorkaround, List.of(), null); } - /** Creates a {@link VersionDescription} instance. + /** + * Creates a {@link VersionDescription} instance. * - * @param header header displayed as the first line of the human-readable - * representation - * @param includeRuntimeJVMInfo if set to true, includes information about - * the JVM that is running the program - * @param enableNativeImageOSWorkaround if set to true, changes how the OS - * information is displayed; this is a - * temporary workaround caused by the - * Native Image OS returning the value - * known at build-time and not at - * runtime - * @param additionalParameters a sequence of additional - * {@link VersionDescriptionParameter} to include in - * the version string - * @param customVersion if provided, overrides the version string from - * {@code GeneratedVersion}; used for testing purposes + * @param header header displayed as the first line of the human-readable representation + * @param includeRuntimeJVMInfo if set to true, includes information about the JVM that is running + * the program + * @param enableNativeImageOSWorkaround if set to true, changes how the OS information is + * displayed; this is a temporary workaround caused by the Native Image OS returning the value + * known at build-time and not at runtime + * @param additionalParameters a sequence of additional {@link VersionDescriptionParameter} to + * include in the version string + * @param customVersion if provided, overrides the version string from {@code GeneratedVersion}; + * used for testing purposes * @return */ public static VersionDescription make( @@ -70,8 +68,7 @@ public static VersionDescription make( boolean includeRuntimeJVMInfo, boolean enableNativeImageOSWorkaround, List additionalParameters, - String customVersion - ) { + String customVersion) { Objects.requireNonNull(header); Objects.requireNonNull(additionalParameters); String version; @@ -85,64 +82,80 @@ public static VersionDescription make( enableNativeImageOSWorkaround, header, version, - additionalParameters - ); + additionalParameters); } public String asHumanReadableString() { String runtimeDescription; if (includeRuntimeJVMInfo) { - runtimeDescription = String.format(""" + runtimeDescription = + String.format( + """ Running on: %s, %s, JDK %s %s, %s (%s) - """, vmName, vmVendor, jreVersion, osName, osVersion, osArch); + """, + vmName, vmVendor, jreVersion, osName, osVersion, osArch); } else if (enableNativeImageOSWorkaround) { // TODO [RW] Currently the `os.name` property seems to be set to the // OS the program has been built on, instead of the OS that is // currently running. A workaround should be implemented in #1100 // that will use other means to query the OS name and version. - runtimeDescription = String.format( - "Built on: %s (%s)", osName, osArch - ); + runtimeDescription = String.format("Built on: %s (%s)", osName, osArch); } else { - runtimeDescription = String.format( - "Running on: %s %s (%s)", osName, osVersion, osArch - ); + runtimeDescription = String.format("Running on: %s %s (%s)", osName, osVersion, osArch); } String dirtyStr = ""; if (BuildVersion.isDirty()) { dirtyStr = "*"; } - var parameters = formatParameters(VersionDescription::formatParameterAsHumanReadableString, "\n"); - return String.format(""" + var parameters = + formatParameters(VersionDescription::formatParameterAsHumanReadableString, "\n"); + return String.format( + """ %s Version: %s Built with: scala-%s for GraalVM %s Built from: %s%s @ %s %s%s - """, header, version, BuildVersion.scalacVersion(), BuildVersion.graalVersion(), BuildVersion.ref(), dirtyStr, BuildVersion.commit(), runtimeDescription, parameters); + """, + header, + version, + BuildVersion.scalacVersion(), + BuildVersion.graalVersion(), + BuildVersion.ref(), + dirtyStr, + BuildVersion.commit(), + runtimeDescription, + parameters); } public String asJSONString() { String runtimeDescription; if (includeRuntimeJVMInfo) { - runtimeDescription = String.format(""" + runtimeDescription = + String.format( + """ "osName": "%s", "osVersion": "%s", "osArch": "%s", - """, osName, osVersion, osArch); + """, + osName, osVersion, osArch); } else { - runtimeDescription = String.format(""" + runtimeDescription = + String.format( + """ "vmName": "%s", "vmVendor": "%s", "jreVersion": "%s", "osName": "%s", "osVersion": "%s", "osArch": "%s", - """, vmName, vmVendor, jreVersion, osName, osVersion, osArch); + """, + vmName, vmVendor, jreVersion, osName, osVersion, osArch); } var parameters = formatParameters(VersionDescription::formatParameterAsJSONString, ",\n"); - return String.format(""" + return String.format( + """ { "version": "%s", "ref": "%s", @@ -151,7 +164,12 @@ public String asJSONString() { %s%s } """, - version, BuildVersion.ref(), BuildVersion.isDirty(), BuildVersion.commit(), runtimeDescription, parameters); + version, + BuildVersion.ref(), + BuildVersion.isDirty(), + BuildVersion.commit(), + runtimeDescription, + parameters); } public String asString(boolean useJson) { @@ -166,19 +184,17 @@ private static String formatParameterAsJSONString(VersionDescriptionParameter pa return "\"" + parameter.jsonName() + "\": " + parameter.value() + "\""; } - private static String formatParameterAsHumanReadableString(VersionDescriptionParameter parameter) { + private static String formatParameterAsHumanReadableString( + VersionDescriptionParameter parameter) { return parameter.humanReadableName() + ": " + parameter.value(); } - private String formatParameters(Function formatter, String separator) { + private String formatParameters( + Function formatter, String separator) { if (additionalParameters.isEmpty()) { return ""; } else { - return additionalParameters - .stream() - .map(formatter) - .collect(Collectors.joining(separator)); + return additionalParameters.stream().map(formatter).collect(Collectors.joining(separator)); } } } - diff --git a/lib/scala/version-output/src/main/java/org/enso/version/VersionDescriptionParameter.java b/lib/scala/version-output/src/main/java/org/enso/version/VersionDescriptionParameter.java index 5b8b64a0e160..420538580c65 100644 --- a/lib/scala/version-output/src/main/java/org/enso/version/VersionDescriptionParameter.java +++ b/lib/scala/version-output/src/main/java/org/enso/version/VersionDescriptionParameter.java @@ -1,17 +1,14 @@ package org.enso.version; -/** Defines an additional parameter for the version description. +/** + * Defines an additional parameter for the version description. * - * @param humanReadableName the human readable prefix added when printing this - * parameter in human-readable format + * @param humanReadableName the human readable prefix added when printing this parameter in + * human-readable format * @param jsonName the key when outputting the parameter in JSON format - * @param value the value to use for the parameter; depending on if the whole - * version description will be queried as a human-readable version - * or in JSON, this value should be in the right format + * @param value the value to use for the parameter; depending on if the whole version description + * will be queried as a human-readable version or in JSON, this value should be in the right + * format */ - public record VersionDescriptionParameter( - String humanReadableName, - String jsonName, - String value -) { } + String humanReadableName, String jsonName, String value) {} From 45582e7093ed19bde477db9be42ffb5eb50fa78a Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 19:39:30 +0200 Subject: [PATCH 012/268] engine-runner module depends on version-output --- build.sbt | 5 ++++- engine/runner/src/main/java/module-info.java | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 89c34ac90900..4a8a251e88ea 100644 --- a/build.sbt +++ b/build.sbt @@ -2660,6 +2660,8 @@ lazy val `engine-runner` = project "task depends on runtime-parser/Compile/compileModuleInfo" ) } + val versionMod = + (`version-output` / Compile / classDirectory).value requiredExternalMods ++ Seq( profilingMod, @@ -2671,7 +2673,8 @@ lazy val `engine-runner` = project libraryManagerMod, pkgMod, runnerCommonMod, - parserMod + parserMod, + versionMod ) }, run / connectInput := true diff --git a/engine/runner/src/main/java/module-info.java b/engine/runner/src/main/java/module-info.java index 62aefb601fba..8c143264fb07 100644 --- a/engine/runner/src/main/java/module-info.java +++ b/engine/runner/src/main/java/module-info.java @@ -10,6 +10,7 @@ requires org.enso.pkg; requires org.enso.profiling; requires org.enso.semver; + requires org.enso.version.output; requires org.graalvm.nativeimage; requires org.graalvm.polyglot; requires org.jline; From a4cbfaee444e8bf19ed25b1514cda50120698e9c Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 19:39:38 +0200 Subject: [PATCH 013/268] fmt --- lib/scala/pkg/src/main/java/module-info.java | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/scala/pkg/src/main/java/module-info.java b/lib/scala/pkg/src/main/java/module-info.java index 5b850cf0d067..5ba02b334735 100644 --- a/lib/scala/pkg/src/main/java/module-info.java +++ b/lib/scala/pkg/src/main/java/module-info.java @@ -1,4 +1,5 @@ module org.enso.pkg { requires org.apache.commons.compress; + exports org.enso.pkg; } From e6ea7f243a139d54130ec5868ea43d469e4a0ddf Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 19:45:40 +0200 Subject: [PATCH 014/268] engine-common is module --- build.sbt | 19 +++++++++++++++++-- engine/common/src/main/java/module-info.java | 6 ++++++ engine/runner/src/main/java/module-info.java | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 engine/common/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 4a8a251e88ea..d4bc753f5da0 100644 --- a/build.sbt +++ b/build.sbt @@ -1460,6 +1460,7 @@ val testLogProviderOptions = Seq( */ lazy val `engine-common` = project .in(file("engine/common")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, Test / fork := true, @@ -1467,7 +1468,18 @@ lazy val `engine-common` = project Test / envVars ++= distributionEnvironmentOverrides, libraryDependencies ++= Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided" - ) + ), + modulePath := { + JPMSUtils.filterModulesFromUpdate( + (Compile / update).value, + Seq( + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion + ), + streams.value.log, + shouldContainAll = true + ) + } ) .dependsOn(`logging-config`) .dependsOn(`logging-utils`) @@ -2662,6 +2674,8 @@ lazy val `engine-runner` = project } val versionMod = (`version-output` / Compile / classDirectory).value + val engineCommonMod = + (`engine-common` / Compile / classDirectory).value requiredExternalMods ++ Seq( profilingMod, @@ -2674,7 +2688,8 @@ lazy val `engine-runner` = project pkgMod, runnerCommonMod, parserMod, - versionMod + versionMod, + engineCommonMod ) }, run / connectInput := true diff --git a/engine/common/src/main/java/module-info.java b/engine/common/src/main/java/module-info.java new file mode 100644 index 000000000000..385803a1e0a3 --- /dev/null +++ b/engine/common/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module org.enso.engine.common { + requires org.graalvm.polyglot; + requires org.slf4j; + + exports org.enso.common; +} diff --git a/engine/runner/src/main/java/module-info.java b/engine/runner/src/main/java/module-info.java index 8c143264fb07..d2f2d20ac342 100644 --- a/engine/runner/src/main/java/module-info.java +++ b/engine/runner/src/main/java/module-info.java @@ -4,6 +4,7 @@ requires org.enso.distribution; requires org.enso.editions; requires org.enso.editions.updater; + requires org.enso.engine.common; requires org.enso.librarymanager; requires org.enso.runtime.parser; requires org.enso.runner.common; From 978a551aaf5b39dfe48bc35b20d236e3a532d408 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 19:54:04 +0200 Subject: [PATCH 015/268] Move LoggerSetup from org.enso.logger package to org.enso.logger.config --- docs/infrastructure/logging.md | 8 ++++---- .../src/main/java/org/enso/common/ContextFactory.java | 2 +- .../scala/org/enso/launcher/cli/LauncherLogging.scala | 2 +- .../src/main/java/org/enso/runner/RunnerLogging.java | 2 +- .../src/main/java/org/enso/logger/config/Appender.java | 1 - .../main/java/org/enso/logger/config/ConsoleAppender.java | 1 - .../main/java/org/enso/logger/config/FileAppender.java | 1 - .../java/org/enso/logger/{ => config}/LoggerSetup.java | 4 +--- .../main/java/org/enso/logger/config/MemoryAppender.java | 1 - .../main/java/org/enso/logger/config/SentryAppender.java | 1 - .../main/java/org/enso/logger/config/SocketAppender.java | 1 - .../main/java/org/enso/logging/LoggingSetupHelper.java | 2 +- .../enso/projectmanager/boot/command/CommandHandler.scala | 2 +- .../scala/org/enso/projectmanager/BaseServerSpec.scala | 2 +- 14 files changed, 11 insertions(+), 19 deletions(-) rename lib/scala/logging-config/src/main/java/org/enso/logger/{ => config}/LoggerSetup.java (97%) diff --git a/docs/infrastructure/logging.md b/docs/infrastructure/logging.md index c771eb08f46f..21bebc68ad53 100644 --- a/docs/infrastructure/logging.md +++ b/docs/infrastructure/logging.md @@ -281,9 +281,9 @@ The `org.slf4j.Logger` instances have to know where to send log events. This setting is typically performed once, when the service starts, and applies globally during its execution. Currently, it is not possible to dynamically change where log events are being stored. The main (abstract) class used for -setting up logging is `org.enso.logger.LoggerSetup`. An instance of that class -can be retrieved with the thread-safe `org.enso.logger.LoggerSetup.get` factory -method. `org.enso.logger.LoggerSetup` provides a number of `setupXYZAppender` +setting up logging is `org.enso.logger.config.LoggerSetup`. An instance of that class +can be retrieved with the thread-safe `org.enso.logger.config.LoggerSetup.get` factory +method. `org.enso.logger.config.LoggerSetup` provides a number of `setupXYZAppender` methods that will direct loggers to send log events to an `XYZ` appender. Setting a specific hard-coded appender programmatically should however be avoided by the users. Instead, one should invoke one of the overloaded `setup` @@ -292,7 +292,7 @@ configuration. ```java package foo; -import org.enso.logger.LoggerSetup; +import org.enso.logger.config.LoggerSetup; import org.slf4j.event.Level; public class MyService { diff --git a/engine/common/src/main/java/org/enso/common/ContextFactory.java b/engine/common/src/main/java/org/enso/common/ContextFactory.java index 796ab95c3ba3..45eb59d7d4ab 100644 --- a/engine/common/src/main/java/org/enso/common/ContextFactory.java +++ b/engine/common/src/main/java/org/enso/common/ContextFactory.java @@ -7,7 +7,7 @@ import org.enso.logger.Converter; import org.enso.logger.JulHandler; -import org.enso.logger.LoggerSetup; +import org.enso.logger.config.LoggerSetup; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.HostAccess; import org.graalvm.polyglot.io.MessageTransport; diff --git a/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala b/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala index a49ebdc435f5..610394a650f1 100644 --- a/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala +++ b/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala @@ -2,7 +2,7 @@ package org.enso.launcher.cli import java.nio.file.Path import org.enso.launcher.distribution.DefaultManagers -import org.enso.logger.LoggerSetup +import org.enso.logger.config.LoggerSetup import org.slf4j.event.Level import org.enso.logging.LoggingSetupHelper import scala.concurrent.ExecutionContext.Implicits.global diff --git a/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java b/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java index 6c879cec9800..4141e3adc544 100644 --- a/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java +++ b/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java @@ -4,7 +4,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import org.enso.logger.LoggerSetup; +import org.enso.logger.config.LoggerSetup; import org.enso.logger.masking.Masking; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/Appender.java b/lib/scala/logging-config/src/main/java/org/enso/logger/config/Appender.java index 58524572c671..3986a9d98275 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/Appender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logger/config/Appender.java @@ -2,7 +2,6 @@ import com.typesafe.config.Config; import java.nio.file.Path; -import org.enso.logger.LoggerSetup; import org.slf4j.event.Level; /** diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/ConsoleAppender.java b/lib/scala/logging-config/src/main/java/org/enso/logger/config/ConsoleAppender.java index 7d96ad42834d..1a4253080a10 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/ConsoleAppender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logger/config/ConsoleAppender.java @@ -2,7 +2,6 @@ import com.typesafe.config.Config; import java.nio.file.Path; -import org.enso.logger.LoggerSetup; import org.slf4j.event.Level; /** Config for log configuration that appends to the console */ diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/FileAppender.java b/lib/scala/logging-config/src/main/java/org/enso/logger/config/FileAppender.java index c1fe2a70098c..36a3e862ff99 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/FileAppender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logger/config/FileAppender.java @@ -3,7 +3,6 @@ import com.typesafe.config.Config; import java.nio.file.Path; import java.nio.file.Paths; -import org.enso.logger.LoggerSetup; import org.slf4j.event.Level; /** Config for log configuration that appends to the file. */ diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/LoggerSetup.java b/lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggerSetup.java similarity index 97% rename from lib/scala/logging-config/src/main/java/org/enso/logger/LoggerSetup.java rename to lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggerSetup.java index a07a23211c73..d23c4593cc3a 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/LoggerSetup.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggerSetup.java @@ -1,9 +1,7 @@ -package org.enso.logger; +package org.enso.logger.config; import java.nio.file.Path; import java.util.ServiceLoader; -import org.enso.logger.config.LoggingServiceConfig; -import org.enso.logger.config.MissingConfigurationField; import org.slf4j.event.Level; /** Base class to be implemented by the underlying logging implementation. */ diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/MemoryAppender.java b/lib/scala/logging-config/src/main/java/org/enso/logger/config/MemoryAppender.java index ef77217f51d8..f60b1d2881fc 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/MemoryAppender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logger/config/MemoryAppender.java @@ -2,7 +2,6 @@ import com.typesafe.config.Config; import java.nio.file.Path; -import org.enso.logger.LoggerSetup; import org.slf4j.event.Level; /** diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/SentryAppender.java b/lib/scala/logging-config/src/main/java/org/enso/logger/config/SentryAppender.java index 1c4fa75daf34..8a19768f1233 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/SentryAppender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logger/config/SentryAppender.java @@ -2,7 +2,6 @@ import com.typesafe.config.Config; import java.nio.file.Path; -import org.enso.logger.LoggerSetup; import org.slf4j.event.Level; /** Config for log configuration that sends logs to sentry.io service. */ diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/SocketAppender.java b/lib/scala/logging-config/src/main/java/org/enso/logger/config/SocketAppender.java index c309e2ebb80f..9ee8dc47844a 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/SocketAppender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logger/config/SocketAppender.java @@ -1,7 +1,6 @@ package org.enso.logger.config; import com.typesafe.config.Config; -import org.enso.logger.LoggerSetup; import org.slf4j.event.Level; /** Config for log configuration that forwards logs to the network socket as-is. */ diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java b/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java index cf75c0e0ea19..24ce945db4cc 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java @@ -4,7 +4,7 @@ import java.nio.file.Path; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.enso.logger.LoggerSetup; +import org.enso.logger.config.LoggerSetup; import org.enso.logger.config.MissingConfigurationField; import org.enso.logger.masking.Masking; import org.slf4j.event.Level; diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/command/CommandHandler.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/command/CommandHandler.scala index bbd9f755910d..4798b4f9a575 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/command/CommandHandler.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/command/CommandHandler.scala @@ -1,7 +1,7 @@ package org.enso.projectmanager.boot.command import org.enso.jsonrpc.{Id, JsonProtocol, Protocol} -import org.enso.logger.LoggerSetup +import org.enso.logger.config.LoggerSetup import org.enso.projectmanager.boot.Globals.SuccessExitCode import org.enso.projectmanager.requesthandler.FailureMapper import zio.{Console, ExitCode, ZAny, ZIO} diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/BaseServerSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/BaseServerSpec.scala index ece2d108cd9c..2cb4ca47e99f 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/BaseServerSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/BaseServerSpec.scala @@ -16,7 +16,7 @@ import org.enso.editions.Editions import org.enso.cli.OS import org.enso.jsonrpc.test.JsonRpcServerTestKit import org.enso.jsonrpc.{ClientControllerFactory, ProtocolFactory} -import org.enso.logger.LoggerSetup +import org.enso.logger.config.LoggerSetup import org.enso.pkg.{Config, PackageManager} import org.enso.projectmanager.boot.Globals.{ConfigFilename, ConfigNamespace} import org.enso.projectmanager.boot.configuration._ From 9a231714c6bb8a84e4ffe8c0ae5f98ac4a5b9375 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 20:05:16 +0200 Subject: [PATCH 016/268] logging-utils is JPMS module --- build.sbt | 20 +++++++++++++++++-- engine/common/src/main/java/module-info.java | 2 +- .../src/main/java/module-info.java | 7 +++++++ .../org/enso/logger/masking/package-info.java | 1 - 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 lib/scala/logging-utils/src/main/java/module-info.java delete mode 100644 lib/scala/logging-utils/src/main/java/org/enso/logger/masking/package-info.java diff --git a/build.sbt b/build.sbt index d4bc753f5da0..95b6f748cf7c 100644 --- a/build.sbt +++ b/build.sbt @@ -863,6 +863,7 @@ lazy val `profiling-utils` = project lazy val `logging-utils` = project .in(file("lib/scala/logging-utils")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, @@ -870,7 +871,18 @@ lazy val `logging-utils` = project libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.slf4j" % "slf4j-api" % slf4jVersion - ) ++ logbackTest + ) ++ logbackTest, + compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] + modulePath := { + JPMSUtils.filterModulesFromUpdate( + (Compile / update).value, + Seq( + "org.slf4j" % "slf4j-api" % slf4jVersion + ), + streams.value.log, + shouldContainAll = true + ) + } ) lazy val `logging-service` = project @@ -1470,7 +1482,7 @@ lazy val `engine-common` = project "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided" ), modulePath := { - JPMSUtils.filterModulesFromUpdate( + val externalMods = JPMSUtils.filterModulesFromUpdate( (Compile / update).value, Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, @@ -1479,6 +1491,10 @@ lazy val `engine-common` = project streams.value.log, shouldContainAll = true ) + val ourMods = Seq( + (`logging-utils` / Compile / classDirectory).value + ) + externalMods ++ ourMods } ) .dependsOn(`logging-config`) diff --git a/engine/common/src/main/java/module-info.java b/engine/common/src/main/java/module-info.java index 385803a1e0a3..c9d030272fb8 100644 --- a/engine/common/src/main/java/module-info.java +++ b/engine/common/src/main/java/module-info.java @@ -1,6 +1,6 @@ module org.enso.engine.common { requires org.graalvm.polyglot; - requires org.slf4j; + requires org.enso.logging.utils; exports org.enso.common; } diff --git a/lib/scala/logging-utils/src/main/java/module-info.java b/lib/scala/logging-utils/src/main/java/module-info.java new file mode 100644 index 000000000000..0fc4ebcf5f63 --- /dev/null +++ b/lib/scala/logging-utils/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module org.enso.logging.utils { + requires java.logging; + requires org.slf4j; + + exports org.enso.logger; + exports org.enso.logger.masking; +} diff --git a/lib/scala/logging-utils/src/main/java/org/enso/logger/masking/package-info.java b/lib/scala/logging-utils/src/main/java/org/enso/logger/masking/package-info.java deleted file mode 100644 index 37cd33e94f49..000000000000 --- a/lib/scala/logging-utils/src/main/java/org/enso/logger/masking/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.logger.masking; From 96ade16301420e66a8b1bbf2209ca497ea5de37f Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 20:13:41 +0200 Subject: [PATCH 017/268] logging-config is JPMS module --- build.sbt | 17 +++++++++++++++-- engine/common/src/main/java/module-info.java | 2 ++ .../src/main/java/module-info.java | 6 ++++++ 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 lib/scala/logging-config/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 95b6f748cf7c..41263e8d3045 100644 --- a/build.sbt +++ b/build.sbt @@ -902,6 +902,7 @@ lazy val `logging-service` = project lazy val `logging-config` = project .in(file("lib/scala/logging-config")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, @@ -909,7 +910,18 @@ lazy val `logging-config` = project libraryDependencies ++= Seq( "com.typesafe" % "config" % typesafeConfigVersion, "org.slf4j" % "slf4j-api" % slf4jVersion - ) + ), + modulePath := { + JPMSUtils.filterModulesFromUpdate( + update.value, + Seq( + "com.typesafe" % "config" % typesafeConfigVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion + ), + streams.value.log, + shouldContainAll = true + ) + } ) lazy val `logging-service-logback` = project @@ -1492,7 +1504,8 @@ lazy val `engine-common` = project shouldContainAll = true ) val ourMods = Seq( - (`logging-utils` / Compile / classDirectory).value + (`logging-utils` / Compile / classDirectory).value, + (`logging-config` / Compile / classDirectory).value, ) externalMods ++ ourMods } diff --git a/engine/common/src/main/java/module-info.java b/engine/common/src/main/java/module-info.java index c9d030272fb8..ab242d316c5e 100644 --- a/engine/common/src/main/java/module-info.java +++ b/engine/common/src/main/java/module-info.java @@ -1,6 +1,8 @@ module org.enso.engine.common { requires org.graalvm.polyglot; requires org.enso.logging.utils; + requires org.enso.logging.config; + requires org.slf4j; exports org.enso.common; } diff --git a/lib/scala/logging-config/src/main/java/module-info.java b/lib/scala/logging-config/src/main/java/module-info.java new file mode 100644 index 000000000000..a68492a69834 --- /dev/null +++ b/lib/scala/logging-config/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module org.enso.logging.config { + requires org.slf4j; + requires typesafe.config; + + exports org.enso.logger.config; +} From 5a57c0b0714b834d7fd4b8ffde1393f3cd251589 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 20:14:00 +0200 Subject: [PATCH 018/268] Use BuildVersion, not Info --- .../main/scala/org/enso/languageserver/boot/MainModule.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala b/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala index 8c86184f4533..f5d74c1cf576 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala @@ -54,6 +54,7 @@ import org.enso.polyglot.RuntimeServerInfo import org.enso.profiling.events.NoopEventsMonitor import org.enso.searcher.memory.InMemorySuggestionsRepo import org.enso.text.{ContentBasedVersioning, Sha3_224VersionCalculator} +import org.enso.version.BuildVersion import org.graalvm.polyglot.io.MessageEndpoint import org.slf4j.event.Level import org.slf4j.LoggerFactory @@ -75,7 +76,7 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) { private val log = LoggerFactory.getLogger(this.getClass) log.debug( "Initializing main module of the Language Server from [{}, {}, {}]", - Info.currentEdition, + BuildVersion.currentEdition, serverConfig, logLevel ) @@ -312,7 +313,7 @@ class MainModule(serverConfig: LanguageServerConfig, logLevel: Level) { RuntimeOptions.LOG_MASKING, Masking.isMaskingEnabled.toString ) - extraOptions.put(RuntimeOptions.EDITION_OVERRIDE, Info.currentEdition) + extraOptions.put(RuntimeOptions.EDITION_OVERRIDE, BuildVersion.currentEdition) extraOptions.put( RuntimeOptions.JOB_PARALLELISM, Runtime.getRuntime.availableProcessors().toString From c7c56386722df1f00dcbb4fef3979e71ca4537d3 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 15 Aug 2024 20:14:19 +0200 Subject: [PATCH 019/268] polyglot-api is JPMS module --- build.sbt | 6 ++++++ engine/polyglot-api/src/main/java/module-info.java | 7 +++++++ 2 files changed, 13 insertions(+) create mode 100644 engine/polyglot-api/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 41263e8d3045..e2a145f576fc 100644 --- a/build.sbt +++ b/build.sbt @@ -1516,6 +1516,7 @@ lazy val `engine-common` = project lazy val `polyglot-api` = project .in(file("engine/polyglot-api")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, Test / fork := true, @@ -1540,6 +1541,11 @@ lazy val `polyglot-api` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test ), + compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] + modulePath := { + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", + }, GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task ) diff --git a/engine/polyglot-api/src/main/java/module-info.java b/engine/polyglot-api/src/main/java/module-info.java new file mode 100644 index 000000000000..79c1be3bdfe1 --- /dev/null +++ b/engine/polyglot-api/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module org.enso.polyglot.api { + requires flatbuffers.java; + requires org.graalvm.truffle; + + exports org.enso.polyglot; + exports org.enso.polyglot.debugger; +} From 543b3c24806ece695715380520339531c25f09b1 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 16 Aug 2024 16:02:42 +0200 Subject: [PATCH 020/268] Introduce new setting key moduleDependencies. modulePath is based on that setting. --- build.sbt | 48 +++++++++++----------------------------- project/JPMSPlugin.scala | 29 +++++++++++++++++++++++- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/build.sbt b/build.sbt index 6d9a64f99181..6fd4dde1bf2f 100644 --- a/build.sbt +++ b/build.sbt @@ -836,15 +836,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, ) } ) @@ -1585,32 +1580,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 +1675,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`) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 2b3edf4164cb..9bde45fdb115 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -20,6 +20,11 @@ object JPMSPlugin extends AutoPlugin { val addModules = settingKey[Seq[String]]( "Module names that will be added to --add-modules option" ) + val moduleDependencies = taskKey[Seq[ModuleID]]( + "Modules dependencies that will be added to --module-path option. List all the sbt modules " + + "that should be added on module-path, including internal dependencies. To get ModuleID for a " + + "local dependency, use the `projectID` setting." + ) val modulePath = taskKey[Seq[File]]( "Directories (Jar archives or expanded Jar archives) that will be put into " + "--module-path option" @@ -49,9 +54,22 @@ object JPMSPlugin extends AutoPlugin { import autoImport._ + override lazy val projectSettings: Seq[Setting[_]] = Seq( addModules := Seq.empty, - modulePath := Seq.empty, + moduleDependencies := Seq.empty, + // modulePath is set based on moduleDependencies + modulePath := { + val cp = JPMSUtils.filterModulesFromClasspath( + // Do not use fullClasspath here - it will result in an infinite recursion + // and sbt will not be able to detect the cycle. + (Compile / dependencyClasspath).value, + (Compile / moduleDependencies).value, + streams.value.log, + shouldContainAll = true + ) + cp.map(_.data) + }, patchModules := Map.empty, addExports := Map.empty, addReads := Map.empty, @@ -75,6 +93,15 @@ object JPMSPlugin extends AutoPlugin { (Compile / addReads).value ) }, + Test / modulePath := { + val cp = JPMSUtils.filterModulesFromClasspath( + (Test / dependencyClasspath).value, + (Test / moduleDependencies).value, + streams.value.log, + shouldContainAll = true + ) + cp.map(_.data) + }, Test / javacOptions ++= { constructOptions( streams.value.log, From 298557bbfa39b2369a2b547f74f7d958d19d7ae6 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 16 Aug 2024 16:11:57 +0200 Subject: [PATCH 021/268] runtime-language-arrow uses moduleDependencies and not modulePath --- build.sbt | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/build.sbt b/build.sbt index 6fd4dde1bf2f..51390f5056fb 100644 --- a/build.sbt +++ b/build.sbt @@ -1821,19 +1821,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)) From 367ff2114504a6894efe14f8f141c35e5e18462b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 16 Aug 2024 16:31:24 +0200 Subject: [PATCH 022/268] Use moduleDependencies instead of modulePath --- build.sbt | 207 ++++++++++++++------------------------- project/JPMSPlugin.scala | 1 - 2 files changed, 74 insertions(+), 134 deletions(-) diff --git a/build.sbt b/build.sbt index 51390f5056fb..065974e16a84 100644 --- a/build.sbt +++ b/build.sbt @@ -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" + @@ -838,8 +857,8 @@ lazy val `profiling-utils` = project ), moduleDependencies := { Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion ) } ) @@ -1089,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, + (`ydoc-server` / projectID).value, + (`syntax-rust-definition` / projectID).value, + (`profiling-utils` / projectID).value ) }, Test / javaOptions ++= testLogProviderOptions @@ -1263,24 +1263,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", @@ -1587,7 +1578,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`runtime-fat-jar` / projectID).value, (`syntax-rust-definition` / projectID).value, (`ydoc-server` / projectID).value, - (`profiling-utils` / projectID).value, + (`profiling-utils` / projectID).value ) }, Test / javaOptions ++= testLogProviderOptions, @@ -1849,21 +1840,6 @@ 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, @@ -1871,7 +1847,17 @@ lazy val `runtime-test-instruments` = "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")) @@ -1993,40 +1979,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( + "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 := { @@ -2126,32 +2092,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 := { @@ -2937,18 +2886,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 diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 9bde45fdb115..04a14ad553c0 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -54,7 +54,6 @@ object JPMSPlugin extends AutoPlugin { import autoImport._ - override lazy val projectSettings: Seq[Setting[_]] = Seq( addModules := Seq.empty, moduleDependencies := Seq.empty, From 196162eaf9122125c1d8971f6259186a92f30997 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 16 Aug 2024 16:57:23 +0200 Subject: [PATCH 023/268] Fix moduleDependencies of ydoc-server --- build.sbt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 065974e16a84..884daf44025a 100644 --- a/build.sbt +++ b/build.sbt @@ -1282,7 +1282,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 From 906442fe62b42d32546ea4281a3a11870571a75c Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 16 Aug 2024 17:06:11 +0200 Subject: [PATCH 024/268] Fix project-manager/Test/compile --- build.sbt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sbt b/build.sbt index 884daf44025a..4bee6af06902 100644 --- a/build.sbt +++ b/build.sbt @@ -1163,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] * ~~~~~~~~~~~~~~~~~~~~~~~~~~ From bcc6ccec0f9045c1e9ef43a9a8240bf4df929687 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 16 Aug 2024 17:06:39 +0200 Subject: [PATCH 025/268] Make error messages in JPMSUtils more descriptive --- project/JPMSUtils.scala | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index fc790c03b077..87bc78b691d4 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -70,9 +70,14 @@ object JPMSUtils { }) if (shouldContainAll) { if (ret.size < distinctModules.size) { - log.error("Not all modules from classpath were found") - log.error(s"Returned (${ret.size}): $ret") - log.error(s"Expected: (${distinctModules.size}): $distinctModules") + log.error("[JPMSUtils] Not all modules from classpath were found") + log.error( + "[JPMSUtils] Ensure libraryDependencies and moduleDependencies are correct" + ) + log.error(s"[JPMSUtils] Returned (${ret.size}): $ret") + log.error( + s"[JPMSUtils] Expected: (${distinctModules.size}): $distinctModules" + ) } } ret @@ -107,9 +112,14 @@ object JPMSUtils { ) if (shouldContainAll) { if (foundFiles.size < distinctModules.size) { - log.error("Not all modules from update were found") - log.error(s"Returned (${foundFiles.size}): $foundFiles") - log.error(s"Expected: (${distinctModules.size}): $distinctModules") + log.error("[JPMSUtils] Not all modules from update were found") + log.error( + "[JPMSUtils] Ensure libraryDependencies and moduleDependencies are correct" + ) + log.error(s"[JPMSUtils] Returned (${foundFiles.size}): $foundFiles") + log.error( + s"[JPMSUtils] Expected: (${distinctModules.size}): $distinctModules" + ) } } foundFiles From ed5cfc56f3db7441bbc5f25132a1b131754c4fe7 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 16 Aug 2024 17:22:10 +0200 Subject: [PATCH 026/268] Use moduleDependencies instead of modulePath --- build.sbt | 165 ++++++++++++++---------------------------------------- 1 file changed, 42 insertions(+), 123 deletions(-) diff --git a/build.sbt b/build.sbt index 0a804fda70ca..7363d3495ecf 100644 --- a/build.sbt +++ b/build.sbt @@ -813,14 +813,9 @@ lazy val pkg = (project in file("lib/scala/pkg")) "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.apache.commons" % "commons-compress" % commonsCompressVersion ), - modulePath := { - JPMSUtils.filterModulesFromUpdate( - (Compile / update).value, - Seq( - "org.apache.commons" % "commons-compress" % commonsCompressVersion - ), - streams.value.log, - shouldContainAll = true + moduleDependencies := { + Seq( + "org.apache.commons" % "commons-compress" % commonsCompressVersion ) } ) @@ -887,14 +882,9 @@ lazy val `logging-utils` = project "org.slf4j" % "slf4j-api" % slf4jVersion ) ++ logbackTest, compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] - modulePath := { - JPMSUtils.filterModulesFromUpdate( - (Compile / update).value, - Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion - ), - streams.value.log, - shouldContainAll = true + moduleDependencies := { + Seq( + "org.slf4j" % "slf4j-api" % slf4jVersion ) } ) @@ -925,17 +915,10 @@ lazy val `logging-config` = project "com.typesafe" % "config" % typesafeConfigVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), - modulePath := { - JPMSUtils.filterModulesFromUpdate( - update.value, - Seq( - "com.typesafe" % "config" % typesafeConfigVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion - ), - streams.value.log, - shouldContainAll = true - ) - } + moduleDependencies := Seq( + "com.typesafe" % "config" % typesafeConfigVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion + ) ) lazy val `logging-service-logback` = project @@ -1485,21 +1468,13 @@ lazy val `engine-common` = project libraryDependencies ++= Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided" ), - modulePath := { - val externalMods = JPMSUtils.filterModulesFromUpdate( - (Compile / update).value, - Seq( - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion - ), - streams.value.log, - shouldContainAll = true - ) - val ourMods = Seq( - (`logging-utils` / Compile / classDirectory).value, - (`logging-config` / Compile / classDirectory).value, + moduleDependencies := { + Seq( + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + (`logging-utils` / projectID).value, + (`logging-config` / projectID).value ) - externalMods ++ ourMods } ) .dependsOn(`logging-config`) @@ -1534,10 +1509,10 @@ lazy val `polyglot-api` = project "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test ), compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] - modulePath := { + moduleDependencies := Seq( "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", - }, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion + ), GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task ) @@ -2207,21 +2182,11 @@ lazy val `runtime-parser` = "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), javaModuleName := "org.enso.runtime.parser", - modulePath := { - val requiredExternalMods = JPMSUtils.filterModulesFromUpdate( - (Compile / update).value, - Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion - ), - streams.value.log, - shouldContainAll = true - ) - val syntaxMod = - (`syntax-rust-definition` / Compile / exportedProducts).value.head.data - - requiredExternalMods ++ Seq( - syntaxMod + moduleDependencies := { + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + (`syntax-rust-definition` / projectID).value ) }, // Note [Compile module-info] @@ -2586,68 +2551,27 @@ lazy val `engine-runner` = project Compile / compile := (Compile / compile) .dependsOn(`runtime-parser` / Compile / compileModuleInfo) .value, - modulePath := { - val requiredModIds = Seq( + moduleDependencies := { + Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, "commons-cli" % "commons-cli" % commonsCliVersion, "org.jline" % "jline" % jlineVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion - ) - val logger = streams.value.log - val requiredExternalMods = JPMSUtils.filterModulesFromUpdate( - (Compile / update).value, - requiredModIds, - logger, - shouldContainAll = true - ) - val profilingMod = - (`profiling-utils` / Compile / exportedProducts).value.head.data - val semverMod = - (`semver` / Compile / exportedProducts).value.head.data - val cliMod = - (`cli` / Compile / exportedProducts).value.head.data - val distributionMod = - (`distribution-manager` / Compile / exportedProducts).value.head.data - val editionsMod = - (`editions` / Compile / exportedProducts).value.head.data - val editionsUpdaterMod = - (`edition-updater` / Compile / exportedProducts).value.head.data - val libraryManagerMod = - (`library-manager` / Compile / exportedProducts).value.head.data - val pkgMod = - (`pkg` / Compile / exportedProducts).value.head.data - val runnerCommonMod = - (`engine-runner-common` / Compile / exportedProducts).value.head.data - val parserMod = - (`runtime-parser` / Compile / classDirectory).value - if (!parserMod.toPath.resolve("module-info.class").toFile.exists()) { - logger.error( - "module-info.class not in runtime-parser/target" + - "Dependencies are probably not set correctly. Make sure that the current " + - "task depends on runtime-parser/Compile/compileModuleInfo" - ) - } - val versionMod = - (`version-output` / Compile / classDirectory).value - val engineCommonMod = - (`engine-common` / Compile / classDirectory).value - - requiredExternalMods ++ Seq( - profilingMod, - semverMod, - cliMod, - distributionMod, - editionsMod, - editionsUpdaterMod, - libraryManagerMod, - pkgMod, - runnerCommonMod, - parserMod, - versionMod, - engineCommonMod + "org.slf4j" % "slf4j-api" % slf4jVersion, + (`profiling-utils` / projectID).value, + (`semver` / projectID).value, + (`cli` / projectID).value, + (`distribution-manager` / projectID).value, + (`editions` / projectID).value, + (`edition-updater` / projectID).value, + (`library-manager` / projectID).value, + (`pkg` / projectID).value, + (`engine-runner-common` / projectID).value, + (`runtime-parser` / projectID).value, + (`version-output` / projectID).value, + (`engine-common` / projectID).value, ) }, run / connectInput := true @@ -3110,14 +3034,9 @@ lazy val semver = project "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), - modulePath := { - JPMSUtils.filterModulesFromUpdate( - (Compile / update).value, - Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), - streams.value.log, - shouldContainAll = true + moduleDependencies := { + Seq( + "org.scala-lang" % "scala-library" % scalacVersion ) } ) From c5a12964e2ce4f125506efd4f18906b4649f6fe5 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 16 Aug 2024 17:32:03 +0200 Subject: [PATCH 027/268] Fix compilation of editions --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 7363d3495ecf..6a86f004491a 100644 --- a/build.sbt +++ b/build.sbt @@ -2992,6 +2992,7 @@ lazy val editions = project .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] libraryDependencies ++= Seq( "io.circe" %% "circe-core" % circeVersion % "provided", "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", @@ -3024,8 +3025,7 @@ lazy val semver = project .configs(Test) .settings( frgaalJavaCompilerSetting, - // Compile order needed for JPMSPlugin to work correctly. More specifically, - // to force compilation of `module-info.java` + // Note [JPMS Compile order] compileOrder := CompileOrder.JavaThenScala, libraryDependencies ++= Seq( "io.circe" %% "circe-core" % circeVersion % "provided", From 98896dac9677f4cc9ca817498e93cb7dbb3ced6f Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 16 Aug 2024 17:32:17 +0200 Subject: [PATCH 028/268] Fix compilation of distribution-manager --- build.sbt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sbt b/build.sbt index 6a86f004491a..336584fe2646 100644 --- a/build.sbt +++ b/build.sbt @@ -2812,9 +2812,12 @@ lazy val launcher = project lazy val `distribution-manager` = project .in(file("lib/scala/distribution-manager")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, + // Note [JPMS Compile order] + compileOrder := CompileOrder.ScalaThenJava, resolvers += Resolver.bintrayRepo("gn0s1s", "releases"), libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, From 7cc3e694ede87528d9ed7dcf4c998629b120390c Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 16 Aug 2024 17:32:37 +0200 Subject: [PATCH 029/268] polyglot-api needs to explicitly compile module-info --- build.sbt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 336584fe2646..0c3e46792c57 100644 --- a/build.sbt +++ b/build.sbt @@ -1508,7 +1508,13 @@ lazy val `polyglot-api` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test ), - compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] + javaModuleName := "org.enso.polyglot.api", + // Note [Compile module-info] + excludeFilter := excludeFilter.value || "module-info.java", + Compile / compileModuleInfo := JPMSUtils + .compileModuleInfo() + .dependsOn(Compile / compile) + .value, moduleDependencies := Seq( "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion From ba5d2dacaa7326ee84e50b606b3a7abeadb41353 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 19 Aug 2024 12:46:23 +0200 Subject: [PATCH 030/268] Fix compilationOrder in library-manager and edition-updater --- build.sbt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.sbt b/build.sbt index 0c3e46792c57..4a4a5339c0f9 100644 --- a/build.sbt +++ b/build.sbt @@ -3092,9 +3092,11 @@ lazy val downloader = (project in file("lib/scala/downloader")) lazy val `edition-updater` = project .in(file("lib/scala/edition-updater")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] Test / test := (Test / test).tag(simpleLibraryServerTag).value, libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, @@ -3119,9 +3121,11 @@ lazy val `edition-uploader` = project lazy val `library-manager` = project .in(file("lib/scala/library-manager")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test From fb9f0093b88a08dba8984c0de879248e570a6fa6 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 19 Aug 2024 12:46:57 +0200 Subject: [PATCH 031/268] engine-runner-common is module --- build.sbt | 6 ++++++ engine/runner-common/src/main/java/module-info.java | 2 ++ 2 files changed, 8 insertions(+) diff --git a/build.sbt b/build.sbt index 4a4a5339c0f9..a581ff698742 100644 --- a/build.sbt +++ b/build.sbt @@ -2462,8 +2462,10 @@ lazy val `runtime-fat-jar` = */ lazy val `engine-runner-common` = project .in(file("engine/runner-common")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] Test / fork := true, commands += WithDebugCommand.withDebug, Test / envVars ++= distributionEnvironmentOverrides, @@ -2471,6 +2473,10 @@ lazy val `engine-runner-common` = project "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided", "commons-io" % "commons-io" % commonsIoVersion, "commons-cli" % "commons-cli" % commonsCliVersion + ), + moduleDependencies := Seq( + "commons-cli" % "commons-cli" % commonsCliVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, ) ) .dependsOn(`polyglot-api`) diff --git a/engine/runner-common/src/main/java/module-info.java b/engine/runner-common/src/main/java/module-info.java index 672da44abc8f..624ca4fbd45c 100644 --- a/engine/runner-common/src/main/java/module-info.java +++ b/engine/runner-common/src/main/java/module-info.java @@ -1,3 +1,5 @@ module org.enso.runner.common { + requires commons.cli; + requires org.slf4j; exports org.enso.runner.common; } From f7a53c1d77813f2c52038701b3dca8626de5c58e Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 19 Aug 2024 18:36:50 +0200 Subject: [PATCH 032/268] JPMSPlugin provides default implementation of compileModuleInfo --- project/JPMSPlugin.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 04a14ad553c0..e7cb87ffefcf 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -72,7 +72,12 @@ object JPMSPlugin extends AutoPlugin { patchModules := Map.empty, addExports := Map.empty, addReads := Map.empty, - compileModuleInfo := {}, + compileModuleInfo := { + JPMSUtils + .compileModuleInfo() + .dependsOn(Compile / compile) + .value + }, // javacOptions only inject --module-path and --add-modules, not the rest of the // options. Compile / javacOptions ++= { From 7c558873455edcda0ba25d49dbe27866f754cae8 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 19 Aug 2024 18:37:16 +0200 Subject: [PATCH 033/268] Remove unused setting key from JPMSUtils.compileModuleInfo --- project/JPMSUtils.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index 191cbdd44091..c344cc3990ab 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -274,7 +274,6 @@ object JPMSUtils { val reporter = (Compile / compile / bspReporter).value val output = CompileOutput((Compile / classDirectory).value.toPath) val outputPath: Path = output.getSingleOutputAsPath.get() - val moduleName = javaModuleName.value val mp = (Compile / modulePath).value val baseJavacOpts = (Compile / javacOptions).value val cp = (Compile / fullClasspath).value From 16bb900cb1f14e6bf4a24ef0ca3c3deea0067353 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 17:16:43 +0200 Subject: [PATCH 034/268] JPMSPlugin has internalModuleDependencies and exportedModule tasks. --- project/JPMSPlugin.scala | 208 +++++++++++++++++++++++++++++++++++---- 1 file changed, 188 insertions(+), 20 deletions(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index e7cb87ffefcf..718dcf81b9a1 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -1,7 +1,10 @@ -import sbt._ -import sbt.Keys._ +import sbt.* +import sbt.Keys.* +import sbt.internal.util.ManagedLogger import java.io.File +import java.net.{URI, URL} +import java.util.jar.JarFile /** An automatic plugin that handles everything related to JPMS modules. One needs to explicitly * enable this plugin in a project with `.enablePlugins(JPMSPlugin)`. The keys and tasks provided by this plugin @@ -22,9 +25,18 @@ object JPMSPlugin extends AutoPlugin { ) val moduleDependencies = taskKey[Seq[ModuleID]]( "Modules dependencies that will be added to --module-path option. List all the sbt modules " + - "that should be added on module-path, including internal dependencies. To get ModuleID for a " + - "local dependency, use the `projectID` setting." + "that should be added on module-path. Use it only for external dependencies." ) + + val internalModuleDependencies = taskKey[Seq[File]]( + """ + |Inter-project JPMS module dependencies. This task has a different return type than + |`moduleDependencies` task. It returns a sequence of files on purpose - that way, + |projects are able to override their `exportedModule` task to somehow prepare for + |modularization. + |""".stripMargin + ) + val modulePath = taskKey[Seq[File]]( "Directories (Jar archives or expanded Jar archives) that will be put into " + "--module-path option" @@ -49,35 +61,114 @@ object JPMSPlugin extends AutoPlugin { |effect as if module A would have `requires B` in its module-info.java file. |""".stripMargin ) + // TODO: Make this private val compileModuleInfo = taskKey[Unit]("Compile module-info.java") + + val exportedModule = taskKey[File]( + """ + |Similarly to `exportedProducts` task, this task returns a file that can be + |directly put on module-path. For majority of projects, this task will have + |the same result as `exportedProducts`. The purpose of this task is to be able + |for the projects to *prepare* for modularization. For example, mixed Scala/Java + |projects are known to be problematic for modularization, and one needs to manually + |compile `module-info.java` file. For this mixed project, this task can be declared + |to depend on `compileModuleInfo`. + |""".stripMargin + ) } import autoImport._ + /** Should module-info.java be compiled manually? True iff there is `module-info.java` + * in java sources and if the compile order is Mixed. In such case, sbt tries to first + * parse all the Java sources via its internal parser, and that fails for `modue-info`. + * In these cases, we need to exclude `module-info.java` from the sources and compile it + * manually. + */ + private lazy val shouldCompileModuleInfoManually = taskKey[Boolean]( + "Should module-info.java be compiled manually?" + ) + override lazy val projectSettings: Seq[Setting[_]] = Seq( addModules := Seq.empty, moduleDependencies := Seq.empty, + internalModuleDependencies := Seq.empty, + shouldCompileModuleInfoManually := { + val javaSrcDir = (Compile / javaSource).value + val hasModInfo = + javaSrcDir.toPath.resolve("module-info.java").toFile.exists() + val projName = moduleName.value + val logger = streams.value.log + val hasScalaSources = (Compile / scalaSource).value.exists() + val _compileOrder = (Compile / compileOrder).value + val res = + _compileOrder == CompileOrder.Mixed && + hasModInfo && + hasScalaSources + if (res) { + logger.info( + s"[JPMSPlugin] Project '$projName' will have `module-info.java` compiled " + + "manually. If this is not the intended behavior, consult the documentation " + + "of JPMSPlugin." + ) + } + res + }, // modulePath is set based on moduleDependencies modulePath := { - val cp = JPMSUtils.filterModulesFromClasspath( - // Do not use fullClasspath here - it will result in an infinite recursion - // and sbt will not be able to detect the cycle. - (Compile / dependencyClasspath).value, + // Do not use fullClasspath here - it will result in an infinite recursion + // and sbt will not be able to detect the cycle. + transformModuleDependenciesToModulePath( (Compile / moduleDependencies).value, + (Compile / internalModuleDependencies).value, + (Compile / dependencyClasspath).value, streams.value.log, - shouldContainAll = true + moduleName.value ) - cp.map(_.data) + }, + exportedModule := { + // Ensure module-info.java is compiled + compileModuleInfo.value + val logger = streams.value.log + val projName = moduleName.value + val targetClassDir = (Compile / exportedProducts).value + .map(_.data) + .head + if (!isModule(targetClassDir)) { + logger.error( + s"[JPMSPlugin/$projName] The target classes directory ${targetClassDir.getAbsolutePath} is not " + + "a module - it does not contain module-info.class. Make sure the `compileModuleInfo` task " + + "is set correctly." + ) + } + targetClassDir }, patchModules := Map.empty, addExports := Map.empty, addReads := Map.empty, - compileModuleInfo := { - JPMSUtils - .compileModuleInfo() - .dependsOn(Compile / compile) - .value - }, + compileModuleInfo := Def.taskIf { + if (shouldCompileModuleInfoManually.value) { + val projectName = moduleName.value + val logger = streams.value.log + val sources = (Compile / unmanagedSources).value + val moduleInfo = sources.find(_.name == "module-info.java") + if (moduleInfo.isDefined) { + logger.error( + s"[JPMSPlugin/$projectName] module-info.java is contained in `Compile / unmanagedSources`. " + + s"This means that it is not excluded from the default sbt compilation. " + + """Declare `excludedFilter := excludedFilter.value || \"module-info.java\"` in settings. """ + + s"Otherwise, JPMSPlugin cannot manually compile module-info.java. " + + s"(See the docs for `JPMSPlugin.shouldCompileModuleInfoManually`)" + ) + } + JPMSUtils + .compileModuleInfo() + .dependsOn(Compile / compile) + .value + } else { + (Compile / compile).value + } + }.value, // javacOptions only inject --module-path and --add-modules, not the rest of the // options. Compile / javacOptions ++= { @@ -98,13 +189,13 @@ object JPMSPlugin extends AutoPlugin { ) }, Test / modulePath := { - val cp = JPMSUtils.filterModulesFromClasspath( - (Test / dependencyClasspath).value, + transformModuleDependenciesToModulePath( (Test / moduleDependencies).value, + (Test / internalModuleDependencies).value, + (Test / dependencyClasspath).value, streams.value.log, - shouldContainAll = true + moduleName.value ) - cp.map(_.data) }, Test / javacOptions ++= { constructOptions( @@ -125,6 +216,83 @@ object JPMSPlugin extends AutoPlugin { } ) + /** @param moduleDeps External module dependencies, fetched from `moduleDependencies` task. + * @param classPath Dependency class path of the project. From this class path, external dependencies + * will be searched for. + * @param internalModuleDeps Internal module dependencies, fetched from `internalModuleDependencies` task. + * It is assumed that there is `module-info.class` in the root of the internal + * module dependency. + * @param logger + * @param currProjName Current name of the local project, for debugging purposes. + * @return + */ + private def transformModuleDependenciesToModulePath( + moduleDeps: Seq[ModuleID], + internalModuleDeps: Seq[File], + classPath: Def.Classpath, + logger: ManagedLogger, + currProjName: String + ): Seq[File] = { + moduleDeps.foreach { moduleDep => + if (moduleDep.organization == "org.enso") { + logger.warn( + s"[JPMSPlugin/$currProjName] ModuleID $moduleDep specified inside " + + "`moduleDependencies` task. This is and internal dependency " + + "and should be specified in `internalModuleDependencies`. " + ) + } + } + + internalModuleDeps.foreach { internalModuleDep => + if (internalModuleDep.isDirectory) { + val modInfo = + internalModuleDep.toPath.resolve("module-info.class").toFile + if (!modInfo.exists()) { + logger.error( + s"[JPMSPlugin/$currProjName] Internal module dependency $internalModuleDep does not contain " + + "module-info.class file. This is required for JPMS modules." + ) + } + } else if (internalModuleDep.getName.endsWith(".jar")) { + val jarFile = new JarFile(internalModuleDep) + val modInfoEntry = jarFile.getJarEntry("module-info.class") + if (modInfoEntry == null) { + logger.error( + s"[JPMSPlugin/$currProjName] Internal module dependency (JAR) $internalModuleDep does not contain " + + "module-info.class file. This is required for JPMS modules." + ) + } + } else { + logger.error( + s"[JPMSPlugin/$currProjName] Internal module dependency $internalModuleDep is not a directory " + + "nor a jar file. This is not supported. " + ) + } + } + + val cp = JPMSUtils.filterModulesFromClasspath( + classPath, + moduleDeps, + logger, + shouldContainAll = true + ) + val externalFiles = cp.map(_.data) + externalFiles ++ internalModuleDeps + } + + private def isModule(file: File): Boolean = { + if (file.isDirectory) { + val modInfo = file.toPath.resolve("module-info.class").toFile + modInfo.exists() + } else if (file.getName.endsWith(".jar")) { + val jarFile = new JarFile(file) + val modInfoEntry = jarFile.getJarEntry("module-info.class") + modInfoEntry == null + } else { + false + } + } + def constructOptions( log: Logger, modulePath: Seq[File], From b61a7b721257e7bc84c24646025f797f78029ee9 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 17:31:10 +0200 Subject: [PATCH 035/268] Use BuildVersion instead of buildInfo --- .../scala/org/enso/languageserver/boot/MainModule.scala | 1 - .../protocol/json/JsonConnectionController.scala | 9 +++++---- .../requesthandler/workspace/ProjectInfoHandler.scala | 6 +++--- .../src/main/java/org/enso/runner/CurrentVersion.java | 7 ++++--- .../org/enso/interpreter/caches/ImportExportCache.java | 6 +++--- .../java/org/enso/interpreter/caches/ModuleCache.java | 8 ++++---- .../org/enso/interpreter/caches/SuggestionsCache.java | 6 +++--- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala b/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala index f5d74c1cf576..c7759a5dd708 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala @@ -1,7 +1,6 @@ package org.enso.languageserver.boot import akka.actor.ActorSystem -import buildinfo.Info import com.typesafe.config.ConfigFactory import org.enso.distribution.locking.{ ResourceManager, diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala b/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala index 83ae82c4c3fe..106627a169b0 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala @@ -100,6 +100,7 @@ import org.enso.languageserver.workspace.WorkspaceApi.ProjectInfo import org.enso.logger.akka.ActorMessageLogging import org.enso.polyglot.runtime.Runtime.Api import org.enso.polyglot.runtime.Runtime.Api.ProgressNotification +import org.enso.version.BuildVersion import java.util.UUID @@ -289,8 +290,8 @@ class JsonConnectionController( InitProtocolConnection, request.id, InitProtocolConnection.Result( - buildinfo.Info.ensoVersion, - buildinfo.Info.currentEdition, + BuildVersion.ensoVersion, + BuildVersion.currentEdition, allContentRoots ) ) @@ -346,8 +347,8 @@ class JsonConnectionController( InitProtocolConnection, id, InitProtocolConnection.Result( - buildinfo.Info.ensoVersion, - buildinfo.Info.currentEdition, + BuildVersion.ensoVersion, + BuildVersion.currentEdition, roots ) ) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/workspace/ProjectInfoHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/workspace/ProjectInfoHandler.scala index ea9517e243d7..21163ced83f3 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/workspace/ProjectInfoHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/workspace/ProjectInfoHandler.scala @@ -1,7 +1,6 @@ package org.enso.languageserver.requesthandler.workspace import akka.actor.{Actor, Props} -import buildinfo.Info import com.typesafe.scalalogging.LazyLogging import org.enso.jsonrpc.{Request, ResponseError, ResponseResult} import org.enso.languageserver.data.Config @@ -10,6 +9,7 @@ import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.workspace.WorkspaceApi.ProjectInfo import org.enso.logger.masking.MaskedPath import org.enso.pkg.{Config => PkgConfig} +import org.enso.version.BuildVersion import java.io.{File, FileReader} @@ -31,8 +31,8 @@ class ProjectInfoHandler(languageServerConfig: Config) if (projectConfig.isSuccess) { val projectInfo = ProjectInfo.Result( projectName = projectConfig.get.moduleName, - engineVersion = Info.ensoVersion, - graalVersion = Info.graalVersion + engineVersion = BuildVersion.ensoVersion, + graalVersion = BuildVersion.graalVersion ) sender() ! ResponseResult( ProjectInfo, diff --git a/engine/runner/src/main/java/org/enso/runner/CurrentVersion.java b/engine/runner/src/main/java/org/enso/runner/CurrentVersion.java index 11e902f9f5fb..31dd8177f23b 100644 --- a/engine/runner/src/main/java/org/enso/runner/CurrentVersion.java +++ b/engine/runner/src/main/java/org/enso/runner/CurrentVersion.java @@ -1,11 +1,12 @@ package org.enso.runner; import org.enso.semver.SemVer; +import org.enso.version.BuildVersion; /** * A helper class that allows to access current version of the runner. * - *

The current version is parsed from {@link buildinfo}, but in development mode it can be + *

The current version is parsed from {@link BuildVersion}, but in development mode it can be * overridden by setting `enso.version.override` property. This is used in project-manager tests to * override the version of projects created using the runner. */ @@ -24,14 +25,14 @@ public static SemVer getVersion() { private static SemVer computeVersion() { var buildVersion = (SemVer) - SemVer.parse(buildinfo.Info.ensoVersion()) + SemVer.parse(BuildVersion.ensoVersion()) .getOrElse( () -> { throw new IllegalStateException( "Fatal error: Enso version included in buildinfo is not a valid " + "semver string, this should never happen."); }); - if (!buildinfo.Info.isRelease()) { + if (!BuildVersion.isRelease()) { var overrideVersionProp = System.getProperty("enso.version.override"); if (overrideVersionProp == null) { return buildVersion; diff --git a/engine/runtime/src/main/java/org/enso/interpreter/caches/ImportExportCache.java b/engine/runtime/src/main/java/org/enso/interpreter/caches/ImportExportCache.java index 3a243b7e591b..657d5e16c86a 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/caches/ImportExportCache.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/caches/ImportExportCache.java @@ -1,6 +1,5 @@ package org.enso.interpreter.caches; -import buildinfo.Info; import com.oracle.truffle.api.TruffleFile; import com.oracle.truffle.api.TruffleLogger; import java.io.ByteArrayInputStream; @@ -22,6 +21,7 @@ import org.enso.persist.Persistance; import org.enso.pkg.QualifiedName; import org.enso.pkg.SourceFile; +import org.enso.version.BuildVersion; import org.openide.util.lookup.ServiceProvider; public final class ImportExportCache @@ -106,7 +106,7 @@ public Optional getCacheRoots(EnsoContext context) { .map( pkg -> { TruffleFile bindingsCacheRoot = - pkg.getBindingsCacheRootForPackage(Info.ensoVersion()); + pkg.getBindingsCacheRootForPackage(BuildVersion.ensoVersion()); var localCacheRoot = bindingsCacheRoot.resolve(libraryName.namespace()); var distribution = context.getDistributionManager(); var pathSegments = @@ -114,7 +114,7 @@ public Optional getCacheRoots(EnsoContext context) { pkg.namespace(), pkg.normalizedName(), pkg.getConfig().version(), - Info.ensoVersion(), + BuildVersion.ensoVersion(), libraryName.namespace() }; var path = diff --git a/engine/runtime/src/main/java/org/enso/interpreter/caches/ModuleCache.java b/engine/runtime/src/main/java/org/enso/interpreter/caches/ModuleCache.java index 3702e7b4c7ec..1cd8e1a12c26 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/caches/ModuleCache.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/caches/ModuleCache.java @@ -1,6 +1,5 @@ package org.enso.interpreter.caches; -import buildinfo.Info; import com.oracle.truffle.api.TruffleLogger; import com.oracle.truffle.api.source.Source; import java.io.ByteArrayInputStream; @@ -20,6 +19,7 @@ import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.builtin.Builtins; import org.enso.persist.Persistance; +import org.enso.version.BuildVersion; public final class ModuleCache implements Cache.Spi { @@ -116,7 +116,7 @@ public Optional getCacheRoots(EnsoContext context) { .getPackageOf(module.getSourceFile()) .map( pkg -> { - var irCacheRoot = pkg.getIrCacheRootForPackage(Info.ensoVersion()); + var irCacheRoot = pkg.getIrCacheRootForPackage(BuildVersion.ensoVersion()); var qualName = module.getName(); var localCacheRoot = irCacheRoot.resolve(qualName.path().mkString("/")); @@ -127,7 +127,7 @@ public Optional getCacheRoots(EnsoContext context) { pkg.namespace(), pkg.normalizedName(), pkg.getConfig().version(), - Info.ensoVersion())); + BuildVersion.ensoVersion())); pathSegmentsJava.addAll(qualName.pathAsJava()); var path = distribution.LocallyInstalledDirectories() @@ -142,7 +142,7 @@ public Optional getCacheRoots(EnsoContext context) { var pathSegmentsJava = new ArrayList(); pathSegmentsJava.addAll( Arrays.asList( - Builtins.NAMESPACE, Builtins.PACKAGE_NAME, Info.ensoVersion(), Info.ensoVersion())); + Builtins.NAMESPACE, Builtins.PACKAGE_NAME, BuildVersion.ensoVersion(), BuildVersion.ensoVersion())); pathSegmentsJava.addAll(module.getName().pathAsJava()); var path = distribution.LocallyInstalledDirectories() diff --git a/engine/runtime/src/main/java/org/enso/interpreter/caches/SuggestionsCache.java b/engine/runtime/src/main/java/org/enso/interpreter/caches/SuggestionsCache.java index 5f3d948d4ce5..a99e6f45173f 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/caches/SuggestionsCache.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/caches/SuggestionsCache.java @@ -1,6 +1,5 @@ package org.enso.interpreter.caches; -import buildinfo.Info; import com.oracle.truffle.api.TruffleLogger; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -18,6 +17,7 @@ import org.enso.persist.Persistable; import org.enso.persist.Persistance; import org.enso.polyglot.Suggestion; +import org.enso.version.BuildVersion; @Persistable(clazz = CachedSuggestions.class, id = 30301) @Persistable(clazz = Suggestion.Constructor.class, id = 30303) @@ -106,7 +106,7 @@ public Optional getCacheRoots(EnsoContext context) { .getPackageForLibraryJava(libraryName) .map( pkg -> { - var bindingsCacheRoot = pkg.getSuggestionsCacheRootForPackage(Info.ensoVersion()); + var bindingsCacheRoot = pkg.getSuggestionsCacheRootForPackage(BuildVersion.ensoVersion()); var localCacheRoot = bindingsCacheRoot.resolve(libraryName.namespace()); var distribution = context.getDistributionManager(); var pathSegments = @@ -114,7 +114,7 @@ public Optional getCacheRoots(EnsoContext context) { pkg.namespace(), pkg.normalizedName(), pkg.getConfig().version(), - Info.ensoVersion(), + BuildVersion.ensoVersion(), libraryName.namespace() }; var path = From ac46ecd0ec45737576e99de8adcbdb65a001d9a9 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 17:37:05 +0200 Subject: [PATCH 036/268] Manual compilation of module-info.java is reported as warning --- project/JPMSPlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 718dcf81b9a1..a6c86e74f366 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -106,7 +106,7 @@ object JPMSPlugin extends AutoPlugin { hasModInfo && hasScalaSources if (res) { - logger.info( + logger.warn( s"[JPMSPlugin] Project '$projName' will have `module-info.java` compiled " + "manually. If this is not the intended behavior, consult the documentation " + "of JPMSPlugin." From 218ab0728a4562235abc6fd194e44cfd67d023e3 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:29:52 +0200 Subject: [PATCH 037/268] Define org.enso.scalalibs.wrapper meta project. --- build.sbt | 83 +++++++++++++++++++ .../src/main/java/module-info.java | 79 ++++++++++++++++++ project/JPMSPlugin.scala | 22 +++-- 3 files changed, 175 insertions(+), 9 deletions(-) create mode 100644 lib/java/scala-libs-wrapper/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index a581ff698742..bec43ed0dd98 100644 --- a/build.sbt +++ b/build.sbt @@ -981,6 +981,89 @@ lazy val `logging-truffle-connector` = project .dependsOn(`logging-utils`) .dependsOn(`polyglot-api`) +/** This is a simple wrapper for some Scala libraries that cannot be put directly + * on module-path. For example because it's automatic module name cannot be derived: + * {{{ + * $ jar --describe-module -f ./circe-core_2.13-0.14.7.jar + * Unable to derive module descriptor for: ./circe-core_2.13-0.14.7.jar + * circe.core.2.13: Invalid module name: '2' is not a Java identifier + * }}} + * This project contains only a single `module-info.java` that serves as the module + * descriptor for these problematic dependencies. + */ +lazy val `scala-libs-wrapper` = project + .in(file("lib/java/scala-libs-wrapper")) + .enablePlugins(JPMSPlugin) + .settings( + javaModuleName := "org.enso.scalalibs.wrapper", + libraryDependencies ++= circe ++ Seq( + "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.typelevel" %% "cats-core" % "2.10.0", + ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + ), + shouldCompileModuleInfoManually := true, + excludeFilter := excludeFilter.value || "module-info.java", + compileModuleInfo := { + JPMSUtils.compileModuleInfo() + .value + }, + javacOptions ++= { + JPMSPlugin.constructOptions( + streams.value.log, + modulePath = modulePath.value, + patchModules = patchModules.value + ) + }, + // Ensure that `module-info.class` is included in the assembled Jar + assembly := assembly + .dependsOn(compileModuleInfo) + .value, + assembly / assemblyExcludedJars := { + JPMSUtils.filterModulesFromClasspath( + (Compile / fullClasspath).value, + Seq( + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + ), + streams.value.log, + shouldContainAll = true + ) + }, + // Patch this JPMS module such that the JVM thinks that all the Scala stuff + // is part of this module + patchModules := { + val scalaVer = scalaBinaryVersion.value + val scalaLibs = JPMSUtils.filterModulesFromUpdate( + update.value, + Seq( + "com.typesafe.scala-logging" % ("scala-logging_" + scalaVer) % scalaLoggingVersion, + "io.circe" % ("circe-core_" + scalaVer) % circeVersion, + "io.circe" % ("circe-generic_" + scalaVer) % circeVersion, + "io.circe" % ("circe-parser_" + scalaVer) % circeVersion, + "io.circe" % ("circe-jawn_" + scalaVer) % circeVersion, + "io.circe" % ("circe-numbers_" + scalaVer) % circeVersion, + "org.typelevel" % ("cats-core_" + scalaVer) % "2.10.0", + "org.typelevel" % ("cats-kernel_" + scalaVer) % "2.10.0", + "org.typelevel" % ("jawn-parser_" + scalaVer) % "1.5.1", + "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", + ), + streams.value.log, + shouldContainAll = true + ) + Map( + javaModuleName.value -> scalaLibs + ) + }, + exportedModule := { + (assembly / assembly).value + } + ) + lazy val cli = project .in(file("lib/scala/cli")) .configs(Test) diff --git a/lib/java/scala-libs-wrapper/src/main/java/module-info.java b/lib/java/scala-libs-wrapper/src/main/java/module-info.java new file mode 100644 index 000000000000..ea5f61b052dc --- /dev/null +++ b/lib/java/scala-libs-wrapper/src/main/java/module-info.java @@ -0,0 +1,79 @@ +module org.enso.scalalibs.wrapper { + requires scala.library; + requires scala.reflect; + + // "org.typelevel" % ("cats-core_" + scalaVer) % "2.10.0", + exports cats; + exports cats.arrow; + exports cats.compat; + exports cats.conversions; + exports cats.data; + exports cats.evidence; + exports cats.instances; + exports cats.instances.symbol; + exports cats.syntax; + + // "org.typelevel" % ("cats-kernel_" + scalaVer) % "2.10.0", + exports cats.kernel; + exports cats.kernel.compat; + exports cats.kernel.instances; + exports cats.kernel.instances.all; + exports cats.kernel.instances.arraySeq; + exports cats.kernel.instances.bitSet; + exports cats.kernel.instances.map; + exports cats.kernel.instances.bigInt; + exports cats.kernel.instances.deadline; + exports cats.kernel.instances.bigDecimal; + exports cats.kernel.instances.set; + exports cats.kernel.instances.seq; + exports cats.kernel.instances.stream; + exports cats.kernel.instances.vector; + exports cats.kernel.instances.sortedMap; + exports cats.kernel.instances.either; + exports cats.kernel.instances.duration; + exports cats.kernel.instances.list; + exports cats.kernel.instances.unit; + exports cats.kernel.instances.finiteDuration; + exports cats.kernel.instances.queue; + exports cats.kernel.instances.tuple; + exports cats.kernel.instances.option; + exports cats.kernel.instances.uuid; + exports cats.kernel.instances.string; + exports cats.kernel.instances.sortedSet; + + // "com.typesafe.scala-logging" % ("scala-logging_" + scalaVer) % scalaLoggingVersion, + exports com.typesafe.scalalogging; + + // "io.circe" % ("circe-core_" + scalaVer) % circeVersion, + exports io.circe; + exports io.circe.cursor; + exports io.circe.export; + exports io.circe.numbers; + exports io.circe.syntax; + + // "io.circe" % ("circe-parser_" + scalaVer) % circeVersion, + exports io.circe.parser; + + + // "io.circe" % ("circe-generic_" + scalaVer) % circeVersion, + exports io.circe.generic.decoding; + exports io.circe.generic; + exports io.circe.generic.util; + exports io.circe.generic.util.macros; + exports io.circe.generic.codec; + exports io.circe.generic.auto; + exports io.circe.generic.encoding; + + // "io.circe" % ("circe-jawn_" + scalaVer) % circeVersion, + exports io.circe.jawn; + + // "org.typelevel" % ("jawn-parser_" + scalaVer) % "1.5.1", + exports org.typelevel.jawn; + + // "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", + exports shapeless.ops; + exports shapeless.ops.record; + exports shapeless.test; + exports shapeless.syntax; + exports shapeless.syntax.std; +} diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index a6c86e74f366..cf52aaf6a452 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -75,19 +75,23 @@ object JPMSPlugin extends AutoPlugin { |to depend on `compileModuleInfo`. |""".stripMargin ) + + /** + * Should module-info.java be compiled manually? True iff there is `module-info.java` + * in java sources and if the compile order is Mixed. In such case, sbt tries to first + * parse all the Java sources via its internal parser, and that fails for `modue-info`. + * In these cases, we need to exclude `module-info.java` from the sources and compile it + * manually. + * + * WARNING: Do not use override this task directly if you don't know exactly what you are doing. + */ + val shouldCompileModuleInfoManually = taskKey[Boolean]( + "Should module-info.java be compiled manually?" + ) } import autoImport._ - /** Should module-info.java be compiled manually? True iff there is `module-info.java` - * in java sources and if the compile order is Mixed. In such case, sbt tries to first - * parse all the Java sources via its internal parser, and that fails for `modue-info`. - * In these cases, we need to exclude `module-info.java` from the sources and compile it - * manually. - */ - private lazy val shouldCompileModuleInfoManually = taskKey[Boolean]( - "Should module-info.java be compiled manually?" - ) override lazy val projectSettings: Seq[Setting[_]] = Seq( addModules := Seq.empty, From 50585fc92e25bde376775844abb4b6f0c60b43f3 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:36:45 +0200 Subject: [PATCH 038/268] Fix module check in JPMSPlugin. This is a fix for projects that declare `Compile /exportJars := true` --- project/JPMSPlugin.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index cf52aaf6a452..0f172c3e19ac 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -61,6 +61,7 @@ object JPMSPlugin extends AutoPlugin { |effect as if module A would have `requires B` in its module-info.java file. |""".stripMargin ) + // TODO: Make this private val compileModuleInfo = taskKey[Unit]("Compile module-info.java") @@ -290,7 +291,7 @@ object JPMSPlugin extends AutoPlugin { modInfo.exists() } else if (file.getName.endsWith(".jar")) { val jarFile = new JarFile(file) - val modInfoEntry = jarFile.getJarEntry("module-info.class") + val modInfoEntry = jarFile.getJarEntry("module-info") modInfoEntry == null } else { false From de46229c2dcfffe9780edba6443a889d4de9b33a Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:37:12 +0200 Subject: [PATCH 039/268] version-output is a module --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index bec43ed0dd98..135a205f26a8 100644 --- a/build.sbt +++ b/build.sbt @@ -1094,6 +1094,7 @@ lazy val `task-progress-notifications` = project .dependsOn(`json-rpc-server`) lazy val `version-output` = (project in file("lib/scala/version-output")) + .enablePlugins(JPMSPlugin) .settings( version := "0.1" ) From 949fe5eac05acf7e51da08938cdbe10bb4e46c23 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:37:37 +0200 Subject: [PATCH 040/268] ydoc-server uses internalModuleDependencies --- build.sbt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 135a205f26a8..e1fcd63a2dac 100644 --- a/build.sbt +++ b/build.sbt @@ -1353,11 +1353,13 @@ lazy val `ydoc-server` = project 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 - ), + "ch.qos.logback" % "logback-core" % logbackClassicVersion + ) }, + internalModuleDependencies := Seq( + (`syntax-rust-definition` / exportedModule).value, + (`profiling-utils` / exportedModule).value, + ), libraryDependencies ++= Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", "org.graalvm.polyglot" % "inspect" % graalMavenPackagesVersion % "runtime", From 9b630640dec0b630f11d428c25020d3faf9adbfa Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:38:19 +0200 Subject: [PATCH 041/268] persistance is module --- build.sbt | 5 +++++ lib/java/persistance/src/main/java/module-info.java | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 lib/java/persistance/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index e1fcd63a2dac..0ba5985d5fb6 100644 --- a/build.sbt +++ b/build.sbt @@ -1419,6 +1419,7 @@ lazy val `ydoc-server` = project .dependsOn(`profiling-utils`) lazy val `persistance` = (project in file("lib/java/persistance")) + .enablePlugins(JPMSPlugin) .settings( version := mavenUploadVersion, Test / fork := true, @@ -1436,6 +1437,10 @@ lazy val `persistance` = (project in file("lib/java/persistance")) "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test + ), + moduleDependencies := Seq( + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, ) ) .dependsOn(`persistance-dsl` % Test) diff --git a/lib/java/persistance/src/main/java/module-info.java b/lib/java/persistance/src/main/java/module-info.java new file mode 100644 index 000000000000..cce95af6737b --- /dev/null +++ b/lib/java/persistance/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module org.enso.persistance { + requires org.openide.util.lookup.RELEASE180; + requires org.slf4j; + + exports org.enso.persist; +} From 0ea8b11b5923a3d9b0fc48a70f7c9edc19a0e29b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:38:47 +0200 Subject: [PATCH 042/268] engine-common uses internalModuleDependencies --- build.sbt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 0ba5985d5fb6..d391980c6239 100644 --- a/build.sbt +++ b/build.sbt @@ -1562,11 +1562,13 @@ lazy val `engine-common` = project moduleDependencies := { Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - (`logging-utils` / projectID).value, - (`logging-config` / projectID).value + "org.slf4j" % "slf4j-api" % slf4jVersion ) - } + }, + internalModuleDependencies := Seq( + (`logging-utils` / exportedModule).value, + (`logging-config` / exportedModule).value + ) ) .dependsOn(`logging-config`) .dependsOn(`logging-utils`) From 55ea57fa2000b4cd62d46b7e023b81128af368af Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:39:20 +0200 Subject: [PATCH 043/268] polyglot-api does not override compileModuleInfo task --- build.sbt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index d391980c6239..c47678f7bf9a 100644 --- a/build.sbt +++ b/build.sbt @@ -1604,13 +1604,13 @@ lazy val `polyglot-api` = project javaModuleName := "org.enso.polyglot.api", // Note [Compile module-info] excludeFilter := excludeFilter.value || "module-info.java", - Compile / compileModuleInfo := JPMSUtils - .compileModuleInfo() - .dependsOn(Compile / compile) - .value, moduleDependencies := Seq( - "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion ), GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task From 25f8ec354f70161c4b4a30576ea154417bff0b51 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:39:51 +0200 Subject: [PATCH 044/268] runtime-parser uses internalModuleDependencies --- build.sbt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index c47678f7bf9a..bb61d1053b6f 100644 --- a/build.sbt +++ b/build.sbt @@ -2284,16 +2284,15 @@ lazy val `runtime-parser` = moduleDependencies := { Seq( "org.scala-lang" % "scala-library" % scalacVersion, - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, - (`syntax-rust-definition` / projectID).value + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ) }, + internalModuleDependencies := Seq( + (`syntax-rust-definition` / exportedModule).value, + (`persistance` / exportedModule).value, + ), // Note [Compile module-info] - excludeFilter := excludeFilter.value || "module-info.java", - Compile / compileModuleInfo := JPMSUtils - .compileModuleInfo() - .dependsOn(Compile / compile) - .value + excludeFilter := excludeFilter.value || "module-info.java" ) .dependsOn(`syntax-rust-definition`) .dependsOn(`persistance`) From 9ce91f8ef27683723c6b52bcf6eaa18c0d4b83cf Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:40:19 +0200 Subject: [PATCH 045/268] edition-updater is module --- build.sbt | 7 +++++++ lib/scala/edition-updater/src/main/java/module-info.java | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/build.sbt b/build.sbt index bb61d1053b6f..717df4eb738c 100644 --- a/build.sbt +++ b/build.sbt @@ -3199,6 +3199,13 @@ lazy val `edition-updater` = project libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test + ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + internalModuleDependencies := Seq( + (`distribution-manager` / exportedModule).value, + (`editions` / exportedModule).value ) ) .dependsOn(editions) diff --git a/lib/scala/edition-updater/src/main/java/module-info.java b/lib/scala/edition-updater/src/main/java/module-info.java index ef93fa590c24..aa66566eb114 100644 --- a/lib/scala/edition-updater/src/main/java/module-info.java +++ b/lib/scala/edition-updater/src/main/java/module-info.java @@ -1,3 +1,7 @@ module org.enso.editions.updater { + requires scala.library; + requires org.enso.distribution; + requires org.enso.editions; + exports org.enso.editions.updater; } From 32b36c0ec89efe55287589c44223981e44572af7 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:40:54 +0200 Subject: [PATCH 046/268] Update moduleDependencies for distribution-manager --- build.sbt | 3 +++ .../distribution-manager/src/main/java/module-info.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/build.sbt b/build.sbt index 717df4eb738c..ba72bf8bd049 100644 --- a/build.sbt +++ b/build.sbt @@ -2928,6 +2928,9 @@ lazy val `distribution-manager` = project "org.yaml" % "snakeyaml" % snakeyamlVersion, "commons-io" % "commons-io" % commonsIoVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test + ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion ) ) .dependsOn(editions) diff --git a/lib/scala/distribution-manager/src/main/java/module-info.java b/lib/scala/distribution-manager/src/main/java/module-info.java index cfc50be4f67b..019a7f7067e9 100644 --- a/lib/scala/distribution-manager/src/main/java/module-info.java +++ b/lib/scala/distribution-manager/src/main/java/module-info.java @@ -1,4 +1,9 @@ module org.enso.distribution { + requires scala.library; + requires org.enso.cli; + requires org.enso.logging.utils; + requires org.enso.scalalibs.wrapper; + exports org.enso.distribution; exports org.enso.distribution.config; exports org.enso.distribution.locking; From 702a5ad41525ca3ec8455c1b085c5b076d7c6185 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:41:17 +0200 Subject: [PATCH 047/268] editions is module --- build.sbt | 4 ++++ lib/scala/editions/src/main/java/module-info.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/build.sbt b/build.sbt index ba72bf8bd049..4c16af1638d7 100644 --- a/build.sbt +++ b/build.sbt @@ -3099,6 +3099,7 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) lazy val editions = project .in(file("lib/scala/editions")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, @@ -3107,6 +3108,9 @@ lazy val editions = project "io.circe" %% "circe-core" % circeVersion % "provided", "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test + ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion ) ) .settings( diff --git a/lib/scala/editions/src/main/java/module-info.java b/lib/scala/editions/src/main/java/module-info.java index 9c1688f8eb07..a8ab16fe4c41 100644 --- a/lib/scala/editions/src/main/java/module-info.java +++ b/lib/scala/editions/src/main/java/module-info.java @@ -1,3 +1,7 @@ module org.enso.editions { + requires scala.library; + exports org.enso.editions; + exports org.enso.editions.provider; + exports org.enso.editions.repository; } From afe261b1c502b8ca1394458c8a4b332e96c0b1dc Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 20 Aug 2024 19:42:00 +0200 Subject: [PATCH 048/268] Fix some dependencies of modules --- engine/runner/src/main/java/module-info.java | 5 ++++- engine/runtime-parser/src/main/java/module-info.java | 2 +- lib/scala/cli/src/main/java/module-info.java | 2 ++ .../src/main/java/org/enso/cli/internal/package-info.java | 1 - lib/scala/library-manager/src/main/java/module-info.java | 1 + lib/scala/logging-utils/src/main/java/module-info.java | 1 + lib/scala/pkg/src/main/java/module-info.java | 1 + 7 files changed, 10 insertions(+), 3 deletions(-) delete mode 100644 lib/scala/cli/src/main/java/org/enso/cli/internal/package-info.java diff --git a/engine/runner/src/main/java/module-info.java b/engine/runner/src/main/java/module-info.java index d2f2d20ac342..dd625d9c59bd 100644 --- a/engine/runner/src/main/java/module-info.java +++ b/engine/runner/src/main/java/module-info.java @@ -6,15 +6,18 @@ requires org.enso.editions.updater; requires org.enso.engine.common; requires org.enso.librarymanager; + requires org.enso.logging.config; + requires org.enso.logging.utils; requires org.enso.runtime.parser; requires org.enso.runner.common; requires org.enso.pkg; + requires org.enso.polyglot.api; requires org.enso.profiling; requires org.enso.semver; requires org.enso.version.output; requires org.graalvm.nativeimage; requires org.graalvm.polyglot; requires org.jline; - requires org.slf4j; requires scala.library; + requires org.slf4j; } diff --git a/engine/runtime-parser/src/main/java/module-info.java b/engine/runtime-parser/src/main/java/module-info.java index 16450e611001..23710fed72ee 100644 --- a/engine/runtime-parser/src/main/java/module-info.java +++ b/engine/runtime-parser/src/main/java/module-info.java @@ -1,7 +1,7 @@ module org.enso.runtime.parser { requires org.enso.syntax; - requires org.openide.util.lookup.RELEASE180; requires scala.library; + requires org.enso.persistance; exports org.enso.compiler.core; exports org.enso.compiler.core.ir; diff --git a/lib/scala/cli/src/main/java/module-info.java b/lib/scala/cli/src/main/java/module-info.java index 6acfb249c6ef..161bb4b17535 100644 --- a/lib/scala/cli/src/main/java/module-info.java +++ b/lib/scala/cli/src/main/java/module-info.java @@ -1,4 +1,6 @@ module org.enso.cli { + requires scala.library; + exports org.enso.cli; exports org.enso.cli.task; } diff --git a/lib/scala/cli/src/main/java/org/enso/cli/internal/package-info.java b/lib/scala/cli/src/main/java/org/enso/cli/internal/package-info.java deleted file mode 100644 index c8392ab1c42a..000000000000 --- a/lib/scala/cli/src/main/java/org/enso/cli/internal/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.cli.internal; diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java index e7b4112602ef..12cc61a9eb5a 100644 --- a/lib/scala/library-manager/src/main/java/module-info.java +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -3,4 +3,5 @@ exports org.enso.librarymanager.dependencies; exports org.enso.librarymanager.published; exports org.enso.libraryupload; + exports org.enso.libraryupload.auth; } diff --git a/lib/scala/logging-utils/src/main/java/module-info.java b/lib/scala/logging-utils/src/main/java/module-info.java index 0fc4ebcf5f63..14f1fc2bbd2b 100644 --- a/lib/scala/logging-utils/src/main/java/module-info.java +++ b/lib/scala/logging-utils/src/main/java/module-info.java @@ -1,4 +1,5 @@ module org.enso.logging.utils { + requires scala.library; requires java.logging; requires org.slf4j; diff --git a/lib/scala/pkg/src/main/java/module-info.java b/lib/scala/pkg/src/main/java/module-info.java index 5ba02b334735..bf97e169828d 100644 --- a/lib/scala/pkg/src/main/java/module-info.java +++ b/lib/scala/pkg/src/main/java/module-info.java @@ -1,5 +1,6 @@ module org.enso.pkg { requires org.apache.commons.compress; + requires scala.library; exports org.enso.pkg; } From b00fcfa3e95399ebf0e5d1e8fcfb0e859ed8989a Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 13:07:11 +0200 Subject: [PATCH 049/268] scala-yaml is a module --- build.sbt | 13 ++++++++++++- .../fallback/staticwebsite/FallbackManifest.scala | 2 +- .../releases/launcher/LauncherManifest.scala | 3 ++- .../src/main/java/module-info.java | 3 +++ lib/scala/cli/src/main/scala/org/enso/cli/OS.scala | 2 +- .../enso/distribution/config/DefaultVersion.scala | 2 +- .../org/enso/distribution/config/GlobalConfig.scala | 2 +- .../config/GlobalConfigurationManager.scala | 2 +- .../main/scala/org/enso/editions/EditionName.scala | 2 +- .../src/main/scala/org/enso/editions/Editions.scala | 4 ++-- .../main/scala/org/enso/editions/LibraryName.scala | 2 +- .../org/enso/editions/repository/Manifest.scala | 2 +- .../src/main/scala/org/enso/yaml/YamlHelper.scala | 1 + .../published/repository/LibraryManifest.scala | 2 +- .../main/scala/org/enso/pkg/ComponentGroup.scala | 2 +- .../pkg/src/main/scala/org/enso/pkg/Config.scala | 2 +- .../runtimeversionmanager/components/Manifest.scala | 7 ++++--- .../src/main/scala/org/enso/semver/SemVerYaml.scala | 2 +- lib/scala/yaml/src/main/java/module-info.java | 5 +++++ .../org/enso/{ => scala}/yaml/YamlDecoder.scala | 10 +++------- .../org/enso/{ => scala}/yaml/YamlEncoder.scala | 2 +- 21 files changed, 45 insertions(+), 27 deletions(-) create mode 100644 lib/scala/yaml/src/main/java/module-info.java rename lib/scala/yaml/src/main/scala/org/enso/{ => scala}/yaml/YamlDecoder.scala (96%) rename lib/scala/yaml/src/main/scala/org/enso/{ => scala}/yaml/YamlEncoder.scala (98%) diff --git a/build.sbt b/build.sbt index 4c16af1638d7..9c3c1b39d7cb 100644 --- a/build.sbt +++ b/build.sbt @@ -791,13 +791,24 @@ lazy val yaml = (project in file("lib/java/yaml")) ) lazy val `scala-yaml` = (project in file("lib/scala/yaml")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, + excludeFilter := excludeFilter.value || "module-info.java", libraryDependencies ++= Seq( - "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided" + "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", + "com.chuusai" %% "shapeless" % "2.3.10", + ), + moduleDependencies ++= Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion + ), + internalModuleDependencies := Seq( + (`scala-libs-wrapper` / exportedModule).value ) ) + .dependsOn(`scala-libs-wrapper`) lazy val pkg = (project in file("lib/scala/pkg")) .enablePlugins(JPMSPlugin) diff --git a/engine/launcher/src/main/scala/org/enso/launcher/releases/fallback/staticwebsite/FallbackManifest.scala b/engine/launcher/src/main/scala/org/enso/launcher/releases/fallback/staticwebsite/FallbackManifest.scala index c9fadf82b9c3..4fc54e66ae79 100644 --- a/engine/launcher/src/main/scala/org/enso/launcher/releases/fallback/staticwebsite/FallbackManifest.scala +++ b/engine/launcher/src/main/scala/org/enso/launcher/releases/fallback/staticwebsite/FallbackManifest.scala @@ -1,6 +1,6 @@ package org.enso.launcher.releases.fallback.staticwebsite -import org.enso.yaml.YamlDecoder +import org.enso.scala.yaml.YamlDecoder import org.yaml.snakeyaml.nodes.{MappingNode, Node} import java.io.StringReader diff --git a/engine/launcher/src/main/scala/org/enso/launcher/releases/launcher/LauncherManifest.scala b/engine/launcher/src/main/scala/org/enso/launcher/releases/launcher/LauncherManifest.scala index 4654b57755f3..36bd08f5bce9 100644 --- a/engine/launcher/src/main/scala/org/enso/launcher/releases/launcher/LauncherManifest.scala +++ b/engine/launcher/src/main/scala/org/enso/launcher/releases/launcher/LauncherManifest.scala @@ -3,8 +3,9 @@ package org.enso.launcher.releases.launcher import org.enso.launcher.releases.launcher import org.enso.semver.SemVer import org.enso.runtimeversionmanager.releases.ReleaseProviderException +import org.enso.scala.yaml.YamlDecoder import org.enso.semver.SemVerYaml._ -import org.enso.yaml.{ParseError, YamlDecoder} +import org.enso.yaml.ParseError import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{MappingNode, Node} diff --git a/lib/java/scala-libs-wrapper/src/main/java/module-info.java b/lib/java/scala-libs-wrapper/src/main/java/module-info.java index ea5f61b052dc..f88772bb66bf 100644 --- a/lib/java/scala-libs-wrapper/src/main/java/module-info.java +++ b/lib/java/scala-libs-wrapper/src/main/java/module-info.java @@ -1,6 +1,9 @@ module org.enso.scalalibs.wrapper { requires scala.library; requires scala.reflect; + // scala-compiler.jar + requires scala.tools.nsc; + requires org.jline; // "org.typelevel" % ("cats-core_" + scalaVer) % "2.10.0", exports cats; diff --git a/lib/scala/cli/src/main/scala/org/enso/cli/OS.scala b/lib/scala/cli/src/main/scala/org/enso/cli/OS.scala index dc3aa15b9d46..1c1b0241fae5 100644 --- a/lib/scala/cli/src/main/scala/org/enso/cli/OS.scala +++ b/lib/scala/cli/src/main/scala/org/enso/cli/OS.scala @@ -2,7 +2,7 @@ package org.enso.cli import com.typesafe.scalalogging.Logger import io.circe.{Decoder, DecodingFailure} -import org.enso.yaml.YamlDecoder +import org.enso.scala.yaml.YamlDecoder import org.yaml.snakeyaml.nodes.{Node, ScalarNode} import org.yaml.snakeyaml.error.YAMLException diff --git a/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/DefaultVersion.scala b/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/DefaultVersion.scala index 4a2672a82738..360363ea1941 100644 --- a/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/DefaultVersion.scala +++ b/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/DefaultVersion.scala @@ -2,8 +2,8 @@ package org.enso.distribution.config import org.enso.semver.SemVer import org.enso.cli.arguments.{Argument, OptsParseError} +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.enso.semver.SemVerYaml._ -import org.enso.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.nodes.{Node, ScalarNode} /** Default version that is used when launching Enso outside of projects and diff --git a/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/GlobalConfig.scala b/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/GlobalConfig.scala index af0f04abfc53..b6db81754639 100644 --- a/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/GlobalConfig.scala +++ b/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/GlobalConfig.scala @@ -1,6 +1,6 @@ package org.enso.distribution.config -import org.enso.yaml.{YamlDecoder, YamlEncoder} +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{MappingNode, Node} diff --git a/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/GlobalConfigurationManager.scala b/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/GlobalConfigurationManager.scala index 6bb5dea91cfb..20e489e9f416 100644 --- a/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/GlobalConfigurationManager.scala +++ b/lib/scala/distribution-manager/src/main/scala/org/enso/distribution/config/GlobalConfigurationManager.scala @@ -3,7 +3,7 @@ package org.enso.distribution.config import com.typesafe.scalalogging.Logger import org.enso.distribution.DistributionManager import org.enso.distribution.FileSystem.PathSyntax -import org.enso.yaml.{YamlDecoder, YamlEncoder} +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.{DumperOptions, Yaml} import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{MappingNode, Node, NodeTuple, ScalarNode, Tag} diff --git a/lib/scala/editions/src/main/scala/org/enso/editions/EditionName.scala b/lib/scala/editions/src/main/scala/org/enso/editions/EditionName.scala index fe6cc85c9e9b..f33c9d97d6ca 100644 --- a/lib/scala/editions/src/main/scala/org/enso/editions/EditionName.scala +++ b/lib/scala/editions/src/main/scala/org/enso/editions/EditionName.scala @@ -1,8 +1,8 @@ package org.enso.editions +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{Node, ScalarNode, Tag} -import org.enso.yaml.{YamlDecoder, YamlEncoder} /** A helper type to handle special parsing logic of edition names. * diff --git a/lib/scala/editions/src/main/scala/org/enso/editions/Editions.scala b/lib/scala/editions/src/main/scala/org/enso/editions/Editions.scala index 3493b64fe009..c169e8cbd408 100644 --- a/lib/scala/editions/src/main/scala/org/enso/editions/Editions.scala +++ b/lib/scala/editions/src/main/scala/org/enso/editions/Editions.scala @@ -1,9 +1,9 @@ package org.enso.editions +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.enso.semver.{SemVer, SemVerYaml} import org.yaml.snakeyaml.nodes.{MappingNode, Node, ScalarNode} -import org.enso.yaml.{YamlDecoder, YamlEncoder} -import org.enso.yaml.YamlDecoder.MapKeyField +import YamlDecoder.MapKeyField import org.yaml.snakeyaml.error.YAMLException import java.util diff --git a/lib/scala/editions/src/main/scala/org/enso/editions/LibraryName.scala b/lib/scala/editions/src/main/scala/org/enso/editions/LibraryName.scala index 1e77808b03e1..6af3f4a8117e 100644 --- a/lib/scala/editions/src/main/scala/org/enso/editions/LibraryName.scala +++ b/lib/scala/editions/src/main/scala/org/enso/editions/LibraryName.scala @@ -2,7 +2,7 @@ package org.enso.editions import io.circe.syntax.EncoderOps import io.circe.{Decoder, DecodingFailure, Encoder} -import org.enso.yaml.{YamlDecoder, YamlEncoder} +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{MappingNode, Node, ScalarNode} diff --git a/lib/scala/editions/src/main/scala/org/enso/editions/repository/Manifest.scala b/lib/scala/editions/src/main/scala/org/enso/editions/repository/Manifest.scala index 5b1a597b8df7..1075f39fda87 100644 --- a/lib/scala/editions/src/main/scala/org/enso/editions/repository/Manifest.scala +++ b/lib/scala/editions/src/main/scala/org/enso/editions/repository/Manifest.scala @@ -1,7 +1,7 @@ package org.enso.editions.repository import org.enso.editions.EditionName -import org.enso.yaml.{YamlDecoder, YamlEncoder} +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{MappingNode, Node, ScalarNode, SequenceNode} diff --git a/lib/scala/editions/src/main/scala/org/enso/yaml/YamlHelper.scala b/lib/scala/editions/src/main/scala/org/enso/yaml/YamlHelper.scala index cd9e2fdca460..eb0f9ba36613 100644 --- a/lib/scala/editions/src/main/scala/org/enso/yaml/YamlHelper.scala +++ b/lib/scala/editions/src/main/scala/org/enso/yaml/YamlHelper.scala @@ -1,5 +1,6 @@ package org.enso.yaml +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.nodes.Tag import org.yaml.snakeyaml.{DumperOptions, Yaml} diff --git a/lib/scala/library-manager/src/main/scala/org/enso/librarymanager/published/repository/LibraryManifest.scala b/lib/scala/library-manager/src/main/scala/org/enso/librarymanager/published/repository/LibraryManifest.scala index 7fcc01dc740a..b54810368bc8 100644 --- a/lib/scala/library-manager/src/main/scala/org/enso/librarymanager/published/repository/LibraryManifest.scala +++ b/lib/scala/library-manager/src/main/scala/org/enso/librarymanager/published/repository/LibraryManifest.scala @@ -1,7 +1,7 @@ package org.enso.librarymanager.published.repository import org.enso.editions.LibraryName -import org.enso.yaml.{YamlDecoder, YamlEncoder} +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{MappingNode, Node} diff --git a/lib/scala/pkg/src/main/scala/org/enso/pkg/ComponentGroup.scala b/lib/scala/pkg/src/main/scala/org/enso/pkg/ComponentGroup.scala index 823429d0dc0b..4d1c826ae522 100644 --- a/lib/scala/pkg/src/main/scala/org/enso/pkg/ComponentGroup.scala +++ b/lib/scala/pkg/src/main/scala/org/enso/pkg/ComponentGroup.scala @@ -3,9 +3,9 @@ package org.enso.pkg import io.circe._ import io.circe.syntax._ import org.enso.editions.LibraryName +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{MappingNode, Node, ScalarNode, SequenceNode} -import org.enso.yaml.{YamlDecoder, YamlEncoder} import java.util diff --git a/lib/scala/pkg/src/main/scala/org/enso/pkg/Config.scala b/lib/scala/pkg/src/main/scala/org/enso/pkg/Config.scala index 827bdf35b953..46435a9b6544 100644 --- a/lib/scala/pkg/src/main/scala/org/enso/pkg/Config.scala +++ b/lib/scala/pkg/src/main/scala/org/enso/pkg/Config.scala @@ -4,7 +4,7 @@ import org.yaml.snakeyaml.nodes.Tag import org.enso.semver.SemVer import org.enso.editions.{EditionName, Editions} import org.enso.pkg.validation.NameValidation -import org.enso.yaml.{YamlDecoder, YamlEncoder} +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.{DumperOptions, Yaml} import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{MappingNode, Node} diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Manifest.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Manifest.scala index 13abe895ac5c..3c9a5859b8e1 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Manifest.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Manifest.scala @@ -11,7 +11,8 @@ import org.enso.runtimeversionmanager.components.Manifest.{ RequiredInstallerVersions } import org.enso.runtimeversionmanager.components -import org.enso.yaml.{ParseError, YamlDecoder} +import org.enso.scala.yaml.YamlDecoder +import org.enso.yaml.ParseError import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{MappingNode, Node} @@ -179,7 +180,7 @@ object Manifest { val snakeYaml = new org.yaml.snakeyaml.Yaml() Try(snakeYaml.compose(reader)) .flatMap( - implicitly[enso.yaml.YamlDecoder[Manifest]].decode(_).toTry + implicitly[YamlDecoder[Manifest]].decode(_).toTry ) }.flatten.recoverWith { error => Failure(ManifestLoadingError.fromThrowable(error)) @@ -192,7 +193,7 @@ object Manifest { def fromYaml(yamlString: String): Try[Manifest] = { val snakeYaml = new org.yaml.snakeyaml.Yaml() Try(snakeYaml.compose(new StringReader(yamlString))).toEither - .flatMap(implicitly[enso.yaml.YamlDecoder[Manifest]].decode(_)) + .flatMap(implicitly[YamlDecoder[Manifest]].decode(_)) .left .map(ParseError(_)) .toTry diff --git a/lib/scala/semver/src/main/scala/org/enso/semver/SemVerYaml.scala b/lib/scala/semver/src/main/scala/org/enso/semver/SemVerYaml.scala index 8db803815873..8a30fcde02f6 100644 --- a/lib/scala/semver/src/main/scala/org/enso/semver/SemVerYaml.scala +++ b/lib/scala/semver/src/main/scala/org/enso/semver/SemVerYaml.scala @@ -1,6 +1,6 @@ package org.enso.semver -import org.enso.yaml.{YamlDecoder, YamlEncoder} +import org.enso.scala.yaml.{YamlDecoder, YamlEncoder} import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes.{Node, ScalarNode} diff --git a/lib/scala/yaml/src/main/java/module-info.java b/lib/scala/yaml/src/main/java/module-info.java new file mode 100644 index 000000000000..bbb0a27120a0 --- /dev/null +++ b/lib/scala/yaml/src/main/java/module-info.java @@ -0,0 +1,5 @@ +module org.enso.scala.yaml { + requires scala.library; + requires org.enso.scalalibs.wrapper; + requires org.yaml.snakeyaml; +} diff --git a/lib/scala/yaml/src/main/scala/org/enso/yaml/YamlDecoder.scala b/lib/scala/yaml/src/main/scala/org/enso/scala/yaml/YamlDecoder.scala similarity index 96% rename from lib/scala/yaml/src/main/scala/org/enso/yaml/YamlDecoder.scala rename to lib/scala/yaml/src/main/scala/org/enso/scala/yaml/YamlDecoder.scala index 1a5624abe6fe..db273b871423 100644 --- a/lib/scala/yaml/src/main/scala/org/enso/yaml/YamlDecoder.scala +++ b/lib/scala/yaml/src/main/scala/org/enso/scala/yaml/YamlDecoder.scala @@ -1,14 +1,10 @@ -package org.enso.yaml +package org.enso.scala.yaml -import org.yaml.snakeyaml.nodes.Node -import org.yaml.snakeyaml.nodes.ScalarNode -import org.yaml.snakeyaml.nodes.MappingNode -import org.yaml.snakeyaml.nodes.SequenceNode -import org.yaml.snakeyaml.nodes.Tag import org.yaml.snakeyaml.error.YAMLException +import org.yaml.snakeyaml.nodes._ +import scala.collection.{BuildFrom, mutable} import scala.jdk.CollectionConverters.CollectionHasAsScala -import scala.collection.{mutable, BuildFrom} abstract class YamlDecoder[T] { def decode(node: Node): Either[Throwable, T] diff --git a/lib/scala/yaml/src/main/scala/org/enso/yaml/YamlEncoder.scala b/lib/scala/yaml/src/main/scala/org/enso/scala/yaml/YamlEncoder.scala similarity index 98% rename from lib/scala/yaml/src/main/scala/org/enso/yaml/YamlEncoder.scala rename to lib/scala/yaml/src/main/scala/org/enso/scala/yaml/YamlEncoder.scala index cadc9f662515..5e3d611bba62 100644 --- a/lib/scala/yaml/src/main/scala/org/enso/yaml/YamlEncoder.scala +++ b/lib/scala/yaml/src/main/scala/org/enso/scala/yaml/YamlEncoder.scala @@ -1,4 +1,4 @@ -package org.enso.yaml +package org.enso.scala.yaml import java.util From d6403422c142ce2f00e487155470a6d8857bd9c4 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 13:08:07 +0200 Subject: [PATCH 050/268] Add scala-compiler to scala-libs-wrapper --- build.sbt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build.sbt b/build.sbt index 9c3c1b39d7cb..2cb624df2f8a 100644 --- a/build.sbt +++ b/build.sbt @@ -1011,10 +1011,14 @@ lazy val `scala-libs-wrapper` = project "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "org.typelevel" %% "cats-core" % "2.10.0", + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.jline" % "jline" % jlineVersion, ), moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.jline" % "jline" % jlineVersion, ), shouldCompileModuleInfoManually := true, excludeFilter := excludeFilter.value || "module-info.java", @@ -1040,6 +1044,9 @@ lazy val `scala-libs-wrapper` = project "org.slf4j" % "slf4j-api" % slf4jVersion, "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "io.github.java-diff-utils" % "java-diff-utils" % "4.12", + "org.jline" % "jline" % jlineVersion, ), streams.value.log, shouldContainAll = true From 38e8a0a59bed244ed4cdbd437454a0d1f7f6accf Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 13:09:54 +0200 Subject: [PATCH 051/268] cli depends on scala-library module --- build.sbt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.sbt b/build.sbt index 2cb624df2f8a..a740b1480d20 100644 --- a/build.sbt +++ b/build.sbt @@ -1084,6 +1084,7 @@ lazy val `scala-libs-wrapper` = project lazy val cli = project .in(file("lib/scala/cli")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, @@ -1094,6 +1095,9 @@ lazy val cli = project "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), Test / parallelExecution := false ) .dependsOn(`scala-yaml`) From 80a7d94ba3b860fd52b2786b2e5598b8517923bc Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 13:10:36 +0200 Subject: [PATCH 052/268] Add dependencies for distribution-manager module --- build.sbt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.sbt b/build.sbt index a740b1480d20..be20d5b54a96 100644 --- a/build.sbt +++ b/build.sbt @@ -2953,6 +2953,12 @@ lazy val `distribution-manager` = project ), moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion + ), + internalModuleDependencies := Seq( + (`cli` / exportedModule).value, + (`logging-utils` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value, + (`scala-yaml` / exportedModule).value, ) ) .dependsOn(editions) From 3fd51fbb774f469723674b4115f464f9108d78b8 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 13:11:01 +0200 Subject: [PATCH 053/268] Add some scala-library dependencies in some modules --- build.sbt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index be20d5b54a96..48a23f5511e3 100644 --- a/build.sbt +++ b/build.sbt @@ -826,7 +826,8 @@ lazy val pkg = (project in file("lib/scala/pkg")) ), moduleDependencies := { Seq( - "org.apache.commons" % "commons-compress" % commonsCompressVersion + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.scala-lang" % "scala-library" % scalacVersion ) } ) @@ -895,7 +896,8 @@ lazy val `logging-utils` = project compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] moduleDependencies := { Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ) } ) @@ -2589,8 +2591,8 @@ lazy val `engine-runner-common` = project "commons-cli" % "commons-cli" % commonsCliVersion ), moduleDependencies := Seq( - "commons-cli" % "commons-cli" % commonsCliVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ) ) .dependsOn(`polyglot-api`) From 1b37040e3e98b1d555b8dd71e3ac1e8412188320 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 13:13:40 +0200 Subject: [PATCH 054/268] engine-runner uses internalModuleDependencies --- build.sbt | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/build.sbt b/build.sbt index 48a23f5511e3..853c1692c68b 100644 --- a/build.sbt +++ b/build.sbt @@ -2676,9 +2676,6 @@ lazy val `engine-runner` = project "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test, "org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion ), - Compile / compile := (Compile / compile) - .dependsOn(`runtime-parser` / Compile / compileModuleInfo) - .value, moduleDependencies := { Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -2687,21 +2684,26 @@ lazy val `engine-runner` = project "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, "commons-cli" % "commons-cli" % commonsCliVersion, "org.jline" % "jline" % jlineVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - (`profiling-utils` / projectID).value, - (`semver` / projectID).value, - (`cli` / projectID).value, - (`distribution-manager` / projectID).value, - (`editions` / projectID).value, - (`edition-updater` / projectID).value, - (`library-manager` / projectID).value, - (`pkg` / projectID).value, - (`engine-runner-common` / projectID).value, - (`runtime-parser` / projectID).value, - (`version-output` / projectID).value, - (`engine-common` / projectID).value, + "org.slf4j" % "slf4j-api" % slf4jVersion ) }, + internalModuleDependencies := Seq( + (`profiling-utils` / exportedModule).value, + (`semver` / exportedModule).value, + (`cli` / exportedModule).value, + (`distribution-manager` / exportedModule).value, + (`editions` / exportedModule).value, + (`edition-updater` / exportedModule).value, + (`library-manager` / exportedModule).value, + (`pkg` / exportedModule).value, + (`engine-runner-common` / exportedModule).value, + (`runtime-parser` / exportedModule).value, + (`version-output` / exportedModule).value, + (`engine-common` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + (`logging-config` / exportedModule).value, + (`logging-utils` / exportedModule).value + ), run / connectInput := true ) .settings( From 0820a43674ca11e40251973f2bc15f410d4fc15d Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 13:25:10 +0200 Subject: [PATCH 055/268] Fix module dependencies of library-manager --- build.sbt | 11 +++++++++++ lib/scala/cli/src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 1 + lib/scala/editions/src/main/java/module-info.java | 1 + .../library-manager/src/main/java/module-info.java | 4 ++++ 5 files changed, 18 insertions(+) diff --git a/build.sbt b/build.sbt index 853c1692c68b..c03d11295602 100644 --- a/build.sbt +++ b/build.sbt @@ -1100,6 +1100,9 @@ lazy val cli = project moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), + internalModuleDependencies := Seq( + (`scala-yaml` / exportedModule).value + ), Test / parallelExecution := false ) .dependsOn(`scala-yaml`) @@ -3143,6 +3146,9 @@ lazy val editions = project ), moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion + ), + internalModuleDependencies := Seq( + (`scala-yaml` / exportedModule).value ) ) .settings( @@ -3273,6 +3279,11 @@ lazy val `library-manager` = project libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test + ), + internalModuleDependencies := Seq( + (`distribution-manager` / exportedModule).value, + (`cli` / exportedModule).value, + (`editions` / exportedModule).value, ) ) .dependsOn(`version-output`) // Note [Default Editions] diff --git a/lib/scala/cli/src/main/java/module-info.java b/lib/scala/cli/src/main/java/module-info.java index 161bb4b17535..ddf84e366990 100644 --- a/lib/scala/cli/src/main/java/module-info.java +++ b/lib/scala/cli/src/main/java/module-info.java @@ -1,5 +1,6 @@ module org.enso.cli { requires scala.library; + requires org.enso.scala.yaml; exports org.enso.cli; exports org.enso.cli.task; diff --git a/lib/scala/distribution-manager/src/main/java/module-info.java b/lib/scala/distribution-manager/src/main/java/module-info.java index 019a7f7067e9..13d2c4fcd591 100644 --- a/lib/scala/distribution-manager/src/main/java/module-info.java +++ b/lib/scala/distribution-manager/src/main/java/module-info.java @@ -3,6 +3,7 @@ requires org.enso.cli; requires org.enso.logging.utils; requires org.enso.scalalibs.wrapper; + requires org.enso.scala.yaml; exports org.enso.distribution; exports org.enso.distribution.config; diff --git a/lib/scala/editions/src/main/java/module-info.java b/lib/scala/editions/src/main/java/module-info.java index a8ab16fe4c41..57893edef78a 100644 --- a/lib/scala/editions/src/main/java/module-info.java +++ b/lib/scala/editions/src/main/java/module-info.java @@ -1,5 +1,6 @@ module org.enso.editions { requires scala.library; + requires org.enso.scala.yaml; exports org.enso.editions; exports org.enso.editions.provider; diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java index 12cc61a9eb5a..5bc785e032a8 100644 --- a/lib/scala/library-manager/src/main/java/module-info.java +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -1,4 +1,8 @@ module org.enso.librarymanager { + requires org.enso.distribution; + requires org.enso.cli; + requires org.enso.editions; + exports org.enso.librarymanager; exports org.enso.librarymanager.dependencies; exports org.enso.librarymanager.published; From 7feaf0363b97969e4276775788d592475cc06a81 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 13:26:14 +0200 Subject: [PATCH 056/268] Rename org.enso.scalalibs.wrapper to org.enso.scala.wrapper --- build.sbt | 2 +- lib/java/scala-libs-wrapper/src/main/java/module-info.java | 2 +- lib/scala/distribution-manager/src/main/java/module-info.java | 2 +- lib/scala/yaml/src/main/java/module-info.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index c03d11295602..54089e6aad36 100644 --- a/build.sbt +++ b/build.sbt @@ -1008,7 +1008,7 @@ lazy val `scala-libs-wrapper` = project .in(file("lib/java/scala-libs-wrapper")) .enablePlugins(JPMSPlugin) .settings( - javaModuleName := "org.enso.scalalibs.wrapper", + javaModuleName := "org.enso.scala.wrapper", libraryDependencies ++= circe ++ Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, diff --git a/lib/java/scala-libs-wrapper/src/main/java/module-info.java b/lib/java/scala-libs-wrapper/src/main/java/module-info.java index f88772bb66bf..6154f06fb054 100644 --- a/lib/java/scala-libs-wrapper/src/main/java/module-info.java +++ b/lib/java/scala-libs-wrapper/src/main/java/module-info.java @@ -1,4 +1,4 @@ -module org.enso.scalalibs.wrapper { +module org.enso.scala.wrapper { requires scala.library; requires scala.reflect; // scala-compiler.jar diff --git a/lib/scala/distribution-manager/src/main/java/module-info.java b/lib/scala/distribution-manager/src/main/java/module-info.java index 13d2c4fcd591..6e97dbc599cd 100644 --- a/lib/scala/distribution-manager/src/main/java/module-info.java +++ b/lib/scala/distribution-manager/src/main/java/module-info.java @@ -2,7 +2,7 @@ requires scala.library; requires org.enso.cli; requires org.enso.logging.utils; - requires org.enso.scalalibs.wrapper; + requires org.enso.scala.wrapper; requires org.enso.scala.yaml; exports org.enso.distribution; diff --git a/lib/scala/yaml/src/main/java/module-info.java b/lib/scala/yaml/src/main/java/module-info.java index bbb0a27120a0..22c47cd36895 100644 --- a/lib/scala/yaml/src/main/java/module-info.java +++ b/lib/scala/yaml/src/main/java/module-info.java @@ -1,5 +1,5 @@ module org.enso.scala.yaml { requires scala.library; - requires org.enso.scalalibs.wrapper; + requires org.enso.scala.wrapper; requires org.yaml.snakeyaml; } From 8d60965a29fa529d8a39c56b22cc016536e6382a Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 14:31:47 +0200 Subject: [PATCH 057/268] Add jsoniter-scala-macros to org.enso.scala.wrapper fat module --- build.sbt | 3 +++ lib/java/scala-libs-wrapper/src/main/java/module-info.java | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/build.sbt b/build.sbt index 54089e6aad36..9203a7eab750 100644 --- a/build.sbt +++ b/build.sbt @@ -1015,6 +1015,7 @@ lazy val `scala-libs-wrapper` = project "org.typelevel" %% "cats-core" % "2.10.0", "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion, + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, ), moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -1071,6 +1072,8 @@ lazy val `scala-libs-wrapper` = project "org.typelevel" % ("cats-kernel_" + scalaVer) % "2.10.0", "org.typelevel" % ("jawn-parser_" + scalaVer) % "1.5.1", "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", + "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-macros_" + scalaVer) % jsoniterVersion, + "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-core_" + scalaVer) % jsoniterVersion, ), streams.value.log, shouldContainAll = true diff --git a/lib/java/scala-libs-wrapper/src/main/java/module-info.java b/lib/java/scala-libs-wrapper/src/main/java/module-info.java index 6154f06fb054..d9d5b0673539 100644 --- a/lib/java/scala-libs-wrapper/src/main/java/module-info.java +++ b/lib/java/scala-libs-wrapper/src/main/java/module-info.java @@ -44,6 +44,12 @@ exports cats.kernel.instances.string; exports cats.kernel.instances.sortedSet; + // "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-core_" + scalaVer) % jsoniterVersion, + exports com.github.plokhotnyuk.jsoniter_scala.core; + + // "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-macros_" + scalaVer) % jsoniterVersion, + exports com.github.plokhotnyuk.jsoniter_scala.macros; + // "com.typesafe.scala-logging" % ("scala-logging_" + scalaVer) % scalaLoggingVersion, exports com.typesafe.scalalogging; From 9db3799e0aa805453fb94baefe176e19d9f10d3f Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 14:32:11 +0200 Subject: [PATCH 058/268] Fix dependencies of some projects --- build.sbt | 16 +++++++++++++++- .../polyglot-api/src/main/java/module-info.java | 3 +++ .../runner-common/src/main/java/module-info.java | 6 ++++++ .../src/main/java/module-info.java | 2 ++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 9203a7eab750..0e69a0c5cafc 100644 --- a/build.sbt +++ b/build.sbt @@ -1642,6 +1642,10 @@ lazy val `polyglot-api` = project "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion ), + internalModuleDependencies := Seq( + (`scala-libs-wrapper` / exportedModule).value, + (`engine-common` / exportedModule).value, + ), GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task ) @@ -2598,7 +2602,14 @@ lazy val `engine-runner-common` = project ), moduleDependencies := Seq( "commons-cli" % "commons-cli" % commonsCliVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion + "org.slf4j" % "slf4j-api" % slf4jVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + ), + internalModuleDependencies := Seq( + (`pkg` / exportedModule).value, + (`editions` / exportedModule).value, + (`engine-common` / exportedModule).value, ) ) .dependsOn(`polyglot-api`) @@ -3283,6 +3294,9 @@ lazy val `library-manager` = project "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + ), internalModuleDependencies := Seq( (`distribution-manager` / exportedModule).value, (`cli` / exportedModule).value, diff --git a/engine/polyglot-api/src/main/java/module-info.java b/engine/polyglot-api/src/main/java/module-info.java index 79c1be3bdfe1..20e5eff4fb17 100644 --- a/engine/polyglot-api/src/main/java/module-info.java +++ b/engine/polyglot-api/src/main/java/module-info.java @@ -1,6 +1,9 @@ module org.enso.polyglot.api { requires flatbuffers.java; requires org.graalvm.truffle; + requires org.graalvm.polyglot; + requires org.enso.engine.common; + requires org.enso.scala.wrapper; exports org.enso.polyglot; exports org.enso.polyglot.debugger; diff --git a/engine/runner-common/src/main/java/module-info.java b/engine/runner-common/src/main/java/module-info.java index 624ca4fbd45c..3fb73a5af635 100644 --- a/engine/runner-common/src/main/java/module-info.java +++ b/engine/runner-common/src/main/java/module-info.java @@ -1,5 +1,11 @@ module org.enso.runner.common { requires commons.cli; + requires org.apache.commons.io; + requires org.enso.pkg; + requires org.enso.editions; + requires org.enso.engine.common; requires org.slf4j; + requires scala.library; + exports org.enso.runner.common; } diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java index 5bc785e032a8..4c237aba24cc 100644 --- a/lib/scala/library-manager/src/main/java/module-info.java +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -1,4 +1,6 @@ module org.enso.librarymanager { + requires scala.library; + requires org.enso.distribution; requires org.enso.cli; requires org.enso.editions; From b89c1131261addc3b335639a47143cd01d02f4c7 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 14:54:44 +0200 Subject: [PATCH 059/268] polyglot-api does not depend on truffle-api --- build.sbt | 1 - lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala | 4 ---- 2 files changed, 5 deletions(-) diff --git a/build.sbt b/build.sbt index 0e69a0c5cafc..65cb1f2b7024 100644 --- a/build.sbt +++ b/build.sbt @@ -818,7 +818,6 @@ lazy val pkg = (project in file("lib/scala/pkg")) compileOrder := CompileOrder.ScalaThenJava, version := "0.1", libraryDependencies ++= Seq( - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", "io.circe" %% "circe-core" % circeVersion % "provided", "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test, diff --git a/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala b/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala index f59ed1f16ff3..c3581dbcecfc 100644 --- a/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala +++ b/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala @@ -1,7 +1,5 @@ package org.enso.pkg -import com.oracle.truffle.api.CompilerDirectives - import scala.jdk.CollectionConverters._ /** Represents a qualified name of a source item. @@ -15,7 +13,6 @@ case class QualifiedName(path: List[String], item: String) { private lazy val qualifiedNameString: String = (path :+ item).mkString(QualifiedName.separator) - @CompilerDirectives.TruffleBoundary override def toString: String = qualifiedNameString @@ -31,7 +28,6 @@ case class QualifiedName(path: List[String], item: String) { * @param name the name of a child node. * @return a new qualified name based on this name. */ - @CompilerDirectives.TruffleBoundary def createChild(name: String): QualifiedName = QualifiedName(path :+ item, name) From 479fa2f4b28f9348203bda67716e426698c2e3c7 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 21 Aug 2024 18:29:36 +0200 Subject: [PATCH 060/268] Fix dependencies of some projects --- build.sbt | 32 +++++++++++++++++-- .../src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 3 +- .../downloader/src/main/java/module-info.java | 14 ++++++++ .../archive/internal/package-info.java | 1 - .../src/main/java/module-info.java | 10 ++++++ lib/scala/pkg/src/main/java/module-info.java | 8 ++++- 7 files changed, 64 insertions(+), 5 deletions(-) create mode 100644 lib/scala/downloader/src/main/java/module-info.java delete mode 100644 lib/scala/downloader/src/main/java/org/enso/downloader/archive/internal/package-info.java diff --git a/build.sbt b/build.sbt index 65cb1f2b7024..810eec95e1dc 100644 --- a/build.sbt +++ b/build.sbt @@ -826,9 +826,16 @@ lazy val pkg = (project in file("lib/scala/pkg")) moduleDependencies := { Seq( "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "org.scala-lang" % "scala-library" % scalacVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, ) - } + }, + internalModuleDependencies := Seq( + (`editions` / exportedModule).value, + (`semver` / exportedModule).value, + (`scala-yaml` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value, + ) ) .dependsOn(editions) @@ -1634,6 +1641,7 @@ lazy val `polyglot-api` = project // Note [Compile module-info] excludeFilter := excludeFilter.value || "module-info.java", moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, @@ -2609,6 +2617,7 @@ lazy val `engine-runner-common` = project (`pkg` / exportedModule).value, (`editions` / exportedModule).value, (`engine-common` / exportedModule).value, + (`library-manager` / exportedModule).value, ) ) .dependsOn(`polyglot-api`) @@ -3225,6 +3234,7 @@ lazy val semver = project .dependsOn(`scala-yaml`) lazy val downloader = (project in file("lib/scala/downloader")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, // Fork the tests to make sure that the withDebug command works (we can @@ -3240,6 +3250,17 @@ lazy val downloader = (project in file("lib/scala/downloader")) "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test, "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test + ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + ), + excludeFilter := excludeFilter.value || "module-info.java", + internalModuleDependencies := Seq( + (`cli` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value, ) ) .dependsOn(cli) @@ -3295,11 +3316,18 @@ lazy val `library-manager` = project ), moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, ), internalModuleDependencies := Seq( (`distribution-manager` / exportedModule).value, + (`downloader` / exportedModule).value, (`cli` / exportedModule).value, (`editions` / exportedModule).value, + (`pkg` / exportedModule).value, + (`semver` / exportedModule).value, + (`logging-utils` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value, + (`scala-yaml` / exportedModule).value, ) ) .dependsOn(`version-output`) // Note [Default Editions] diff --git a/engine/polyglot-api/src/main/java/module-info.java b/engine/polyglot-api/src/main/java/module-info.java index 20e5eff4fb17..825922ae7ae1 100644 --- a/engine/polyglot-api/src/main/java/module-info.java +++ b/engine/polyglot-api/src/main/java/module-info.java @@ -4,6 +4,7 @@ requires org.graalvm.polyglot; requires org.enso.engine.common; requires org.enso.scala.wrapper; + requires scala.library; exports org.enso.polyglot; exports org.enso.polyglot.debugger; diff --git a/engine/runner-common/src/main/java/module-info.java b/engine/runner-common/src/main/java/module-info.java index 3fb73a5af635..9fbddeea1414 100644 --- a/engine/runner-common/src/main/java/module-info.java +++ b/engine/runner-common/src/main/java/module-info.java @@ -1,9 +1,10 @@ module org.enso.runner.common { requires commons.cli; requires org.apache.commons.io; - requires org.enso.pkg; requires org.enso.editions; requires org.enso.engine.common; + requires org.enso.librarymanager; + requires org.enso.pkg; requires org.slf4j; requires scala.library; diff --git a/lib/scala/downloader/src/main/java/module-info.java b/lib/scala/downloader/src/main/java/module-info.java new file mode 100644 index 000000000000..afe275974923 --- /dev/null +++ b/lib/scala/downloader/src/main/java/module-info.java @@ -0,0 +1,14 @@ +module org.enso.downloader { + requires java.net.http; + requires scala.library; + + requires org.apache.commons.compress; + requires org.apache.commons.io; + + requires org.enso.cli; + // For com.typesafe.scalalogging.Logger + requires org.enso.scala.wrapper; + + requires org.slf4j; + +} diff --git a/lib/scala/downloader/src/main/java/org/enso/downloader/archive/internal/package-info.java b/lib/scala/downloader/src/main/java/org/enso/downloader/archive/internal/package-info.java deleted file mode 100644 index fafc01f0c9ba..000000000000 --- a/lib/scala/downloader/src/main/java/org/enso/downloader/archive/internal/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.downloader.archive.internal; diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java index 4c237aba24cc..6968bcd94d45 100644 --- a/lib/scala/library-manager/src/main/java/module-info.java +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -2,11 +2,21 @@ requires scala.library; requires org.enso.distribution; + requires org.enso.downloader; requires org.enso.cli; requires org.enso.editions; + requires org.enso.pkg; + requires org.enso.semver; + requires org.enso.logging.utils; + // For com.typesafe.scalalogging.Logger + requires org.enso.scala.wrapper; + requires org.enso.scala.yaml; + + requires org.yaml.snakeyaml; exports org.enso.librarymanager; exports org.enso.librarymanager.dependencies; + exports org.enso.librarymanager.local; exports org.enso.librarymanager.published; exports org.enso.libraryupload; exports org.enso.libraryupload.auth; diff --git a/lib/scala/pkg/src/main/java/module-info.java b/lib/scala/pkg/src/main/java/module-info.java index bf97e169828d..24a9663d031a 100644 --- a/lib/scala/pkg/src/main/java/module-info.java +++ b/lib/scala/pkg/src/main/java/module-info.java @@ -1,6 +1,12 @@ module org.enso.pkg { - requires org.apache.commons.compress; requires scala.library; + requires org.apache.commons.compress; + requires org.enso.editions; + requires org.enso.semver; + requires org.enso.scala.yaml; + // For io.circe + requires org.enso.scala.wrapper; + requires org.yaml.snakeyaml; exports org.enso.pkg; } From 94b37b8688117f790a4305aaf8da1f36f98af83d Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 10:22:17 +0200 Subject: [PATCH 061/268] runtime does not use com.google.common --- .../node/expression/builtin/meta/HashCodeNode.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java index 88aeb124ab35..e9e2c5ef6530 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java @@ -1,6 +1,6 @@ package org.enso.interpreter.node.expression.builtin.meta; -import com.google.common.base.Objects; +import java.util.Objects; import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; @@ -130,7 +130,7 @@ long hashCodeForUnresolvedSymbol( @Shared("hashCodeNode") @Cached HashCodeNode hashCodeNode) { long nameHash = hashCodeNode.execute(unresolvedSymbol.getName()); long scopeHash = hashCodeNode.execute(unresolvedSymbol.getScope()); - return Objects.hashCode(nameHash, scopeHash); + return Objects.hash(nameHash, scopeHash); } @Specialization From e9d558bb417c8bbd50d8967fa33617e05d159046 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 10:29:17 +0200 Subject: [PATCH 062/268] runtime is a module --- build.sbt | 25 ++++++++++++++++++- engine/runtime/src/main/java/module-info.java | 23 +++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 engine/runtime/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 810eec95e1dc..35740026d387 100644 --- a/build.sbt +++ b/build.sbt @@ -2056,7 +2056,30 @@ lazy val runtime = (project in file("engine/runtime")) val tools = GraalVM.toolsPkgs.map(_.withConfigurations(Some(Runtime.name))) necessaryModules ++ langs ++ tools - } + }, + excludeFilter := excludeFilter.value || "module-info.java", + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "org.apache.tika" % "tika-core" % tikaVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "com.ibm.icu" % "icu4j" % icuVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + ), + internalModuleDependencies := Seq( + (`library-manager` / exportedModule).value, + (`logging-utils` / exportedModule).value, + (`pkg` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + (`runtime-parser` / exportedModule).value, + (`syntax-rust-definition` / exportedModule).value, + (`version-output` / exportedModule).value, + ) ) .settings( (Runtime / compile) := (Runtime / compile) diff --git a/engine/runtime/src/main/java/module-info.java b/engine/runtime/src/main/java/module-info.java new file mode 100644 index 000000000000..549434b09032 --- /dev/null +++ b/engine/runtime/src/main/java/module-info.java @@ -0,0 +1,23 @@ +module org.enso.runtime { + requires java.logging; + requires scala.library; + + requires org.enso.librarymanager; + requires org.enso.logging.utils; + requires org.enso.pkg; + requires org.enso.polyglot.api; + requires org.enso.runtime.parser; + requires org.enso.syntax; + requires org.enso.version.output; + + requires org.apache.commons.lang3; + requires org.apache.tika.core; + requires org.graalvm.collections; + requires org.graalvm.truffle; + requires org.openide.util.lookup.RELEASE180; + requires org.slf4j; + requires com.ibm.icu; + + provides com.oracle.truffle.api.provider.TruffleLanguageProvider with + org.enso.interpreter.EnsoLanguageProvider; +} From 21dc34134f1f9f1476fc66a8a607128d033f77c5 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 10:29:39 +0200 Subject: [PATCH 063/268] text-buffer is a module --- build.sbt | 7 ++++++- lib/scala/text-buffer/src/main/java/module-info.java | 7 +++++++ .../src/main/java/org/enso/text/package-info.java | 1 - 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 lib/scala/text-buffer/src/main/java/module-info.java delete mode 100644 lib/scala/text-buffer/src/main/java/org/enso/text/package-info.java diff --git a/build.sbt b/build.sbt index 35740026d387..befa84f62949 100644 --- a/build.sbt +++ b/build.sbt @@ -653,6 +653,7 @@ lazy val compileModuleInfo = taskKey[Unit]("Compiles `module-info.java`") lazy val `text-buffer` = project .in(file("lib/scala/text-buffer")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, @@ -660,7 +661,11 @@ lazy val `text-buffer` = project libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test - ) + ), + excludeFilter := excludeFilter.value || "module-info.java", + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + ), ) lazy val rustParserTargetDirectory = diff --git a/lib/scala/text-buffer/src/main/java/module-info.java b/lib/scala/text-buffer/src/main/java/module-info.java new file mode 100644 index 000000000000..31effe9d5adf --- /dev/null +++ b/lib/scala/text-buffer/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module org.enso.text.buffer { + requires scala.library; + + exports org.enso.text; + exports org.enso.text.buffer; + exports org.enso.text.editing; +} diff --git a/lib/scala/text-buffer/src/main/java/org/enso/text/package-info.java b/lib/scala/text-buffer/src/main/java/org/enso/text/package-info.java deleted file mode 100644 index 612cdc183950..000000000000 --- a/lib/scala/text-buffer/src/main/java/org/enso/text/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.text; From efdb8aa3ce37d75d43e2cffc0ca096577bc8e1fa Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 10:30:02 +0200 Subject: [PATCH 064/268] refactoring-utils is a module --- build.sbt | 9 +++++++++ .../refactoring-utils/src/main/java/module-info.java | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 lib/scala/refactoring-utils/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index befa84f62949..6019d6c93167 100644 --- a/build.sbt +++ b/build.sbt @@ -1159,6 +1159,7 @@ lazy val `version-output` = (project in file("lib/scala/version-output")) lazy val `refactoring-utils` = project .in(file("lib/scala/refactoring-utils")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, @@ -1167,6 +1168,14 @@ lazy val `refactoring-utils` = project libraryDependencies ++= Seq( "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test + ), + excludeFilter := excludeFilter.value || "module-info.java", + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + ), + internalModuleDependencies := Seq( + (`text-buffer` / exportedModule).value, + (`runtime-parser` / exportedModule).value, ) ) .dependsOn(`runtime-parser`) diff --git a/lib/scala/refactoring-utils/src/main/java/module-info.java b/lib/scala/refactoring-utils/src/main/java/module-info.java new file mode 100644 index 000000000000..42becbdac8b9 --- /dev/null +++ b/lib/scala/refactoring-utils/src/main/java/module-info.java @@ -0,0 +1,9 @@ +module org.enso.refactoring { + requires scala.library; + + requires org.enso.text.buffer; + requires org.enso.runtime.parser; + + exports org.enso.refactoring; + exports org.enso.refactoring.validation; +} From c0f1ae7f5cf590af4706e7d99b48461cacac4354 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 10:31:19 +0200 Subject: [PATCH 065/268] runtime-compiler is a module --- build.sbt | 12 ++++++++++++ .../src/main/java/module-info.java | 15 +++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 engine/runtime-compiler/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 6019d6c93167..16149d0bfcc4 100644 --- a/build.sbt +++ b/build.sbt @@ -2378,6 +2378,7 @@ lazy val `runtime-parser` = lazy val `runtime-compiler` = (project in file("engine/runtime-compiler")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, annotationProcSetting, @@ -2387,6 +2388,17 @@ lazy val `runtime-compiler` = "com.github.sbt" % "junit-interface" % junitIfVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" + ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + ), + excludeFilter := excludeFilter.value || "module-info.java", + internalModuleDependencies := Seq( + (`engine-common` / exportedModule).value, + (`pkg` / exportedModule).value, + (`runtime-parser` / exportedModule).value, ) ) .dependsOn(`runtime-parser`) diff --git a/engine/runtime-compiler/src/main/java/module-info.java b/engine/runtime-compiler/src/main/java/module-info.java new file mode 100644 index 000000000000..c1a313a90286 --- /dev/null +++ b/engine/runtime-compiler/src/main/java/module-info.java @@ -0,0 +1,15 @@ +module org.enso.runtime.compiler { + requires java.logging; + requires scala.library; + + requires org.enso.engine.common; + requires org.enso.pkg; + requires org.enso.runtime.parser; + + requires org.openide.util.lookup.RELEASE180; + requires org.slf4j; + + exports org.enso.compiler; + exports org.enso.compiler.context; + exports org.enso.compiler.data; +} From a218661cd2c1e3f65ff1be896bc4fd5ae960dc61 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 10:31:48 +0200 Subject: [PATCH 066/268] runtime-instrument-common is a module --- build.sbt | 26 +++++++++++++++++++ .../src/main/java/module-info.java | 24 +++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 engine/runtime-instrument-common/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 16149d0bfcc4..51d549dc78ad 100644 --- a/build.sbt +++ b/build.sbt @@ -2424,6 +2424,7 @@ lazy val `runtime-suggestions` = lazy val `runtime-instrument-common` = (project in file("engine/runtime-instrument-common")) + .enablePlugins(JPMSPlugin) .configs(Benchmark) .settings( frgaalJavaCompilerSetting, @@ -2445,6 +2446,31 @@ lazy val `runtime-instrument-common` = "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test + ), + excludeFilter := excludeFilter.value || "module-info.java", + moduleDependencies := Seq( + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + ), + internalModuleDependencies := Seq( + (`cli` / exportedModule).value, + (`distribution-manager` / exportedModule).value, + (`connected-lock-manager` / exportedModule).value, + (`logging-utils` / exportedModule).value, + (`editions` / exportedModule).value, + (`engine-common` / exportedModule).value, + (`refactoring-utils` / exportedModule).value, + (`runtime` / exportedModule).value, + (`runtime-compiler` / exportedModule).value, + (`runtime-parser` / exportedModule).value, + (`text-buffer` / exportedModule).value, + (`pkg` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value, ) ) .dependsOn(`refactoring-utils`) diff --git a/engine/runtime-instrument-common/src/main/java/module-info.java b/engine/runtime-instrument-common/src/main/java/module-info.java new file mode 100644 index 000000000000..e6a4624b061d --- /dev/null +++ b/engine/runtime-instrument-common/src/main/java/module-info.java @@ -0,0 +1,24 @@ +module org.enso.runtime.instrument.common { + requires java.logging; + requires scala.library; + + requires org.enso.cli; + requires org.enso.distribution; + requires org.enso.lockmanager; + requires org.enso.logging.utils; + requires org.enso.editions; + requires org.enso.engine.common; + requires org.enso.refactoring; + requires org.enso.runtime; + requires org.enso.runtime.compiler; + requires org.enso.runtime.parser; + requires org.enso.text.buffer; + requires org.enso.pkg; + requires org.enso.polyglot.api; + // For com.typesafe.scalalogging + requires org.enso.scala.wrapper; + + requires org.graalvm.truffle; + requires org.graalvm.polyglot; + // TODO: com.oracle.truffle.api.TruffleContext? +} From d84fbf584bc01a1dd819f946bafaf0bf5657fe4d Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 10:32:10 +0200 Subject: [PATCH 067/268] connected-lock-manager is a module --- build.sbt | 10 ++++++++++ .../src/main/java/module-info.java | 9 +++++++++ .../java/org/enso/lockmanager/server/package-info.java | 1 - 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 lib/scala/connected-lock-manager/src/main/java/module-info.java delete mode 100644 lib/scala/connected-lock-manager/src/main/java/org/enso/lockmanager/server/package-info.java diff --git a/build.sbt b/build.sbt index 51d549dc78ad..4a645e142039 100644 --- a/build.sbt +++ b/build.sbt @@ -3434,12 +3434,22 @@ lazy val `library-manager-test` = project lazy val `connected-lock-manager` = project .in(file("lib/scala/connected-lock-manager")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test + ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + ), + internalModuleDependencies := Seq( + (`distribution-manager` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value, ) ) .dependsOn(`distribution-manager`) diff --git a/lib/scala/connected-lock-manager/src/main/java/module-info.java b/lib/scala/connected-lock-manager/src/main/java/module-info.java new file mode 100644 index 000000000000..7c3b71ce6307 --- /dev/null +++ b/lib/scala/connected-lock-manager/src/main/java/module-info.java @@ -0,0 +1,9 @@ +module org.enso.lockmanager { + requires scala.library; + + requires org.enso.distribution; + requires org.enso.polyglot.api; + requires org.enso.scala.wrapper; + + exports org.enso.lockmanager.client; +} diff --git a/lib/scala/connected-lock-manager/src/main/java/org/enso/lockmanager/server/package-info.java b/lib/scala/connected-lock-manager/src/main/java/org/enso/lockmanager/server/package-info.java deleted file mode 100644 index 71efd791b661..000000000000 --- a/lib/scala/connected-lock-manager/src/main/java/org/enso/lockmanager/server/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.lockmanager.server; From beb1cf3a95c266f4c4f2adf24cd7911ea4909429 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 12:37:50 +0200 Subject: [PATCH 068/268] JPMSUtils reports project name in some error messages --- build.sbt | 10 ++++++++-- project/JPMSPlugin.scala | 1 + project/JPMSUtils.scala | 20 ++++++++++++-------- project/NativeImage.scala | 1 + 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/build.sbt b/build.sbt index 4a645e142039..016c1ae8ecfb 100644 --- a/build.sbt +++ b/build.sbt @@ -627,6 +627,7 @@ lazy val componentModulesPaths = fullCp, thirdPartyModIds, log, + projName = moduleName.value, shouldContainAll = true ) val thirdPartyModFiles = thirdPartyMods.map(_.data) @@ -1063,6 +1064,7 @@ lazy val `scala-libs-wrapper` = project "org.jline" % "jline" % jlineVersion, ), streams.value.log, + moduleName.value, shouldContainAll = true ) }, @@ -1087,6 +1089,7 @@ lazy val `scala-libs-wrapper` = project "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-core_" + scalaVer) % jsoniterVersion, ), streams.value.log, + moduleName.value, shouldContainAll = true ) Map( @@ -1228,7 +1231,8 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) JPMSUtils.filterModulesFromClasspath( ourFullCp, pkgsToExclude, - streams.value.log + streams.value.log, + moduleName.value ) }, assembly / assemblyMergeStrategy := { @@ -1796,6 +1800,7 @@ lazy val `language-server` = (project in file("engine/language-server")) "org.apache.tika" % "tika-core" % tikaVersion ), streams.value.log, + moduleName.value, shouldContainAll = true ) Map( @@ -2592,7 +2597,8 @@ lazy val `runtime-fat-jar` = val excludedExternalPkgs = JPMSUtils.filterModulesFromClasspath( ourFullCp, pkgsToExclude, - streams.value.log + streams.value.log, + moduleName.value ) val syntaxJar = (`syntax-rust-definition` / Compile / exportedProducts).value diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 0f172c3e19ac..c581f4dc1d78 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -279,6 +279,7 @@ object JPMSPlugin extends AutoPlugin { classPath, moduleDeps, logger, + currProjName, shouldContainAll = true ) val externalFiles = cp.map(_.data) diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index c344cc3990ab..45f22edab6b9 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -44,6 +44,7 @@ object JPMSUtils { * * @param cp The classpath to filter * @param modules These modules are looked for in the class path, can be duplicated. + * @param projName Name of the current sbt project for debugging. * @param shouldContainAll If true, the method will throw an exception if not all modules were found * in the classpath. * @return The classpath with only the provided modules searched by their IDs. @@ -52,6 +53,7 @@ object JPMSUtils { cp: Def.Classpath, modules: Seq[ModuleID], log: sbt.util.Logger, + projName: String, shouldContainAll: Boolean = false ): Def.Classpath = { val distinctModules = modules.distinct @@ -70,13 +72,13 @@ object JPMSUtils { }) if (shouldContainAll) { if (ret.size < distinctModules.size) { - log.error("[JPMSUtils] Not all modules from classpath were found") + log.error(s"[JPMSUtils/$projName] Not all modules from classpath were found") log.error( - "[JPMSUtils] Ensure libraryDependencies and moduleDependencies are correct" + s"[JPMSUtils/$projName] Ensure libraryDependencies and moduleDependencies are correct" ) - log.error(s"[JPMSUtils] Returned (${ret.size}): $ret") + log.error(s"[JPMSUtils/$projName] Returned (${ret.size}): $ret") log.error( - s"[JPMSUtils] Expected: (${distinctModules.size}): $distinctModules" + s"[JPMSUtils/$projName] Expected: (${distinctModules.size}): $distinctModules" ) } } @@ -88,6 +90,7 @@ object JPMSUtils { * @param updateReport The update report to filter. This is the result of `update.value`. * @param modules The modules to filter from the update report. Can be duplicated. * @param log The logger to use for logging. + * @param projName Name of the current sbt project for debugging. * @param shouldContainAll If true, the method will log an error if not all modules were found. * @return The list of files (Jar archives, directories, etc.) that were found in the update report. */ @@ -95,6 +98,7 @@ object JPMSUtils { updateReport: UpdateReport, modules: Seq[ModuleID], log: sbt.util.Logger, + projName: String, shouldContainAll: Boolean = false ): Seq[File] = { val distinctModules = modules.distinct @@ -112,13 +116,13 @@ object JPMSUtils { ) if (shouldContainAll) { if (foundFiles.size < distinctModules.size) { - log.error("[JPMSUtils] Not all modules from update were found") + log.error(s"[JPMSUtils/$projName] Not all modules from update were found") log.error( - "[JPMSUtils] Ensure libraryDependencies and moduleDependencies are correct" + s"[JPMSUtils/$projName] Ensure libraryDependencies and moduleDependencies are correct" ) - log.error(s"[JPMSUtils] Returned (${foundFiles.size}): $foundFiles") + log.error(s"[JPMSUtils/$projName] Returned (${foundFiles.size}): $foundFiles") log.error( - s"[JPMSUtils] Expected: (${distinctModules.size}): $distinctModules" + s"[JPMSUtils/$projName] Expected: (${distinctModules.size}): $distinctModules" ) } } diff --git a/project/NativeImage.scala b/project/NativeImage.scala index 367c01e8448e..f79754894aaf 100644 --- a/project/NativeImage.scala +++ b/project/NativeImage.scala @@ -204,6 +204,7 @@ object NativeImage { cpToSearch, JPMSUtils.componentModules, log, + projName = (moduleName.value), shouldContainAll = true ) .map(_.data.getAbsolutePath) From 5ea093a49fbef786d75b1d219a494b35040b0a35 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 13:09:21 +0200 Subject: [PATCH 069/268] Modularize some instruments --- build.sbt | 42 +++++++++++++++++-- .../src/main/java/module-info.java | 2 + .../src/main/java/module-info.java | 2 + .../interpreter/service/ExecutionService.java | 4 +- .../instrument}/ChangesetBuilder.scala | 19 +++------ .../instrument/job/AnalyzeModuleJob.scala | 2 +- .../instrument/job/EnsureCompiledJob.scala | 22 +++------- .../instrument/service/InteractiveMode.scala | 2 +- .../test/context/ChangesetBuilderTest.scala | 2 +- .../src/main/java/module-info.java | 8 ++++ .../execution}/IdExecutionInstrument.java | 3 +- .../src/main/java/module-info.java | 11 +++++ .../debugger}/ReplDebuggerInstrument.java | 4 +- .../instrument/RuntimeServerInstrument.java | 2 + engine/runtime/src/main/java/module-info.java | 26 +++++++++--- .../org/enso/interpreter/EnsoLanguage.java | 8 ++-- .../expression/builtin/meta/Instrumentor.java | 2 +- .../enso/interpreter/runtime/EnsoContext.java | 2 +- .../runtime/DefaultPackageRepository.scala | 2 +- .../instrument/NotificationHandler.scala | 2 +- .../{ => runtime}/instrument/Timer.scala | 2 +- 21 files changed, 113 insertions(+), 56 deletions(-) rename engine/runtime-instrument-common/src/main/scala/org/enso/{compiler/context => interpreter/instrument}/ChangesetBuilder.scala (98%) create mode 100644 engine/runtime-instrument-id-execution/src/main/java/module-info.java rename engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/{ => id/execution}/IdExecutionInstrument.java (99%) create mode 100644 engine/runtime-instrument-repl-debugger/src/main/java/module-info.java rename engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/{ => repl/debugger}/ReplDebuggerInstrument.java (98%) rename engine/runtime/src/main/scala/org/enso/interpreter/{ => runtime}/instrument/NotificationHandler.scala (98%) rename engine/runtime/src/main/scala/org/enso/interpreter/{ => runtime}/instrument/Timer.scala (87%) diff --git a/build.sbt b/build.sbt index 016c1ae8ecfb..d6282f08378c 100644 --- a/build.sbt +++ b/build.sbt @@ -2091,11 +2091,17 @@ lazy val runtime = (project in file("engine/runtime")) "org.apache.commons" % "commons-lang3" % commonsLangVersion, ), internalModuleDependencies := Seq( + (`distribution-manager` / exportedModule).value, + (`engine-common` / exportedModule).value, (`library-manager` / exportedModule).value, + (`connected-lock-manager` / exportedModule).value, (`logging-utils` / exportedModule).value, - (`pkg` / exportedModule).value, - (`polyglot-api` / exportedModule).value, + (`runtime-compiler` / exportedModule).value, (`runtime-parser` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + (`pkg` / exportedModule).value, + (`cli` / exportedModule).value, + (`editions` / exportedModule).value, (`syntax-rust-definition` / exportedModule).value, (`version-output` / exportedModule).value, ) @@ -2487,19 +2493,47 @@ lazy val `runtime-instrument-common` = lazy val `runtime-instrument-id-execution` = (project in file("engine/runtime-instrument-id-execution")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, inConfig(Compile)(truffleRunOptionsSettings), - instrumentationSettings + instrumentationSettings, + moduleDependencies := Seq( + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + ), + internalModuleDependencies := Seq( + (`runtime` / exportedModule).value, + (`runtime-compiler` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + ) ) .dependsOn(LocalProject("runtime")) .dependsOn(`runtime-instrument-common`) lazy val `runtime-instrument-repl-debugger` = (project in file("engine/runtime-instrument-repl-debugger")) + .enablePlugins(JPMSPlugin) .settings( inConfig(Compile)(truffleRunOptionsSettings), - instrumentationSettings + instrumentationSettings, + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + ), + internalModuleDependencies := Seq( + (`runtime-instrument-common` / exportedModule).value, + (`runtime` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + (`runtime-compiler` / exportedModule).value, + ) ) .dependsOn(LocalProject("runtime")) .dependsOn(`runtime-instrument-common`) diff --git a/engine/runtime-compiler/src/main/java/module-info.java b/engine/runtime-compiler/src/main/java/module-info.java index c1a313a90286..62ace998460f 100644 --- a/engine/runtime-compiler/src/main/java/module-info.java +++ b/engine/runtime-compiler/src/main/java/module-info.java @@ -12,4 +12,6 @@ exports org.enso.compiler; exports org.enso.compiler.context; exports org.enso.compiler.data; + exports org.enso.compiler.dump; + exports org.enso.compiler.exception; } diff --git a/engine/runtime-instrument-common/src/main/java/module-info.java b/engine/runtime-instrument-common/src/main/java/module-info.java index e6a4624b061d..d52362a04b94 100644 --- a/engine/runtime-instrument-common/src/main/java/module-info.java +++ b/engine/runtime-instrument-common/src/main/java/module-info.java @@ -21,4 +21,6 @@ requires org.graalvm.truffle; requires org.graalvm.polyglot; // TODO: com.oracle.truffle.api.TruffleContext? + + exports org.enso.interpreter.instrument; } diff --git a/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionService.java b/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionService.java index fb810b90421f..cb8df9b4fa01 100644 --- a/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionService.java +++ b/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionService.java @@ -30,9 +30,9 @@ import org.enso.compiler.suggestions.SimpleUpdate; import org.enso.interpreter.instrument.Endpoint; import org.enso.interpreter.instrument.MethodCallsCache; -import org.enso.interpreter.instrument.NotificationHandler; +import org.enso.interpreter.runtime.instrument.NotificationHandler; import org.enso.interpreter.instrument.RuntimeCache; -import org.enso.interpreter.instrument.Timer; +import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.instrument.UpdatesSynchronizationState; import org.enso.interpreter.instrument.VisualizationHolder; import org.enso.interpreter.instrument.profiling.ProfilingInfo; diff --git a/engine/runtime-instrument-common/src/main/scala/org/enso/compiler/context/ChangesetBuilder.scala b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/ChangesetBuilder.scala similarity index 98% rename from engine/runtime-instrument-common/src/main/scala/org/enso/compiler/context/ChangesetBuilder.scala rename to engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/ChangesetBuilder.scala index 3db6f8849292..f98b7a0a14aa 100644 --- a/engine/runtime-instrument-common/src/main/scala/org/enso/compiler/context/ChangesetBuilder.scala +++ b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/ChangesetBuilder.scala @@ -1,26 +1,17 @@ -package org.enso.compiler.context +package org.enso.interpreter.instrument import com.oracle.truffle.api.source.Source - -import java.util.UUID -import org.enso.compiler.core.{ - CompilerError, - EnsoParser, - ExternalID, - IR, - Identifier -} import org.enso.compiler.core.Implicits.AsMetadata -import org.enso.compiler.core.ir.Literal -import org.enso.compiler.core.ir.Location -import org.enso.compiler.core.ir.Name -import org.enso.compiler.suggestions.SimpleUpdate +import org.enso.compiler.core.ir.{Literal, Location, Name} import org.enso.compiler.core.ir.module.scope.definition +import org.enso.compiler.core._ import org.enso.compiler.pass.analyse.DataflowAnalysis +import org.enso.compiler.suggestions.SimpleUpdate import org.enso.interpreter.instrument.execution.model.PendingEdit import org.enso.text.editing.model.{IdMap, TextEdit} import org.enso.text.editing.{IndexedSource, TextEditor} +import java.util.UUID import scala.collection.mutable import scala.util.Using diff --git a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/AnalyzeModuleJob.scala b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/AnalyzeModuleJob.scala index eca4ecb8f3b0..6c662b24ed1d 100644 --- a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/AnalyzeModuleJob.scala +++ b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/AnalyzeModuleJob.scala @@ -1,6 +1,5 @@ package org.enso.interpreter.instrument.job -import org.enso.compiler.context.Changeset import org.enso.compiler.suggestions.{ ExportsBuilder, ModuleExportsDiff, @@ -8,6 +7,7 @@ import org.enso.compiler.suggestions.{ SuggestionDiff } import org.enso.compiler.core.IR +import org.enso.interpreter.instrument.Changeset import org.enso.interpreter.instrument.execution.ModuleIndexing.IndexState import org.enso.interpreter.instrument.execution.RuntimeContext import org.enso.interpreter.runtime.Module diff --git a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala index 1f6b1b7e79b8..4c108cace230 100644 --- a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala +++ b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala @@ -2,27 +2,16 @@ package org.enso.interpreter.instrument.job import com.oracle.truffle.api.TruffleLogger import org.enso.common.CompilationStage -import org.enso.compiler.{data, CompilerResult} +import org.enso.compiler.{CompilerResult, data} import org.enso.compiler.context._ import org.enso.compiler.core.Implicits.AsMetadata import org.enso.compiler.core.{ExternalID, IR} import org.enso.compiler.core.ir -import org.enso.compiler.core.ir.{expression, Location} +import org.enso.compiler.core.ir.{Location, expression} import org.enso.compiler.data.BindingsMap -import org.enso.compiler.pass.analyse.{ - CachePreferenceAnalysis, - DataflowAnalysis, - GatherDiagnostics -} -import org.enso.interpreter.instrument.execution.{ - LocationResolver, - RuntimeContext -} -import org.enso.interpreter.instrument.{ - CacheInvalidation, - InstrumentFrame, - Visualization -} +import org.enso.compiler.pass.analyse.{CachePreferenceAnalysis, DataflowAnalysis, GatherDiagnostics} +import org.enso.interpreter.instrument.execution.{LocationResolver, RuntimeContext} +import org.enso.interpreter.instrument.{CacheInvalidation, Changeset, ChangesetBuilder, InstrumentFrame, Visualization} import org.enso.interpreter.runtime.Module import org.enso.interpreter.service.error.ModuleNotFoundForFileException import org.enso.logger.masking.MaskedPath @@ -36,7 +25,6 @@ import java.io.File import java.util import java.util.UUID import java.util.logging.Level - import scala.jdk.OptionConverters._ /** A job that ensures that specified files are compiled. diff --git a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/service/InteractiveMode.scala b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/service/InteractiveMode.scala index cbf66928dd1f..46220d19d38f 100644 --- a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/service/InteractiveMode.scala +++ b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/service/InteractiveMode.scala @@ -6,9 +6,9 @@ import org.enso.distribution.ProgressAndLockNotificationForwarder import org.enso.editions.{LibraryName, LibraryVersion} import org.enso.pkg.QualifiedName import org.enso.polyglot.runtime.Runtime.{Api, ApiResponse} -import org.enso.interpreter.instrument.NotificationHandler import org.enso.interpreter.instrument.ProgressNotificationTranslator import org.enso.interpreter.instrument.Endpoint +import org.enso.interpreter.runtime.instrument.NotificationHandler import java.nio.file.Path diff --git a/engine/runtime-instrument-common/src/test/scala/org/enso/compiler/test/context/ChangesetBuilderTest.scala b/engine/runtime-instrument-common/src/test/scala/org/enso/compiler/test/context/ChangesetBuilderTest.scala index f50c44759fe6..8c3491211942 100644 --- a/engine/runtime-instrument-common/src/test/scala/org/enso/compiler/test/context/ChangesetBuilderTest.scala +++ b/engine/runtime-instrument-common/src/test/scala/org/enso/compiler/test/context/ChangesetBuilderTest.scala @@ -2,7 +2,6 @@ package org.enso.compiler.test.context import org.enso.compiler.Passes import org.enso.compiler.context.{ - ChangesetBuilder, FreshNameSupply, InlineContext, ModuleContext @@ -15,6 +14,7 @@ import org.enso.compiler.core.ir.module.scope.definition import org.enso.compiler.pass.PassManager import org.enso.compiler.test.CompilerTestSetup import org.enso.compiler.context.LocalScope +import org.enso.interpreter.instrument.ChangesetBuilder import org.enso.text.buffer.Rope import org.enso.text.editing.JavaEditorAdapter import org.enso.text.editing.model.{Position, Range, TextEdit} diff --git a/engine/runtime-instrument-id-execution/src/main/java/module-info.java b/engine/runtime-instrument-id-execution/src/main/java/module-info.java new file mode 100644 index 000000000000..fe3b05b0c24e --- /dev/null +++ b/engine/runtime-instrument-id-execution/src/main/java/module-info.java @@ -0,0 +1,8 @@ +module org.enso.runtime.instrument.id.execution { + requires org.enso.runtime; + requires org.enso.polyglot.api; + requires org.graalvm.truffle; + + provides com.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProvider with + org.enso.interpreter.instrument.id.execution.IdExecutionInstrumentProvider; +} diff --git a/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/IdExecutionInstrument.java b/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/id/execution/IdExecutionInstrument.java similarity index 99% rename from engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/IdExecutionInstrument.java rename to engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/id/execution/IdExecutionInstrument.java index 3c0e1aff122f..0c3b31441860 100644 --- a/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/IdExecutionInstrument.java +++ b/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/id/execution/IdExecutionInstrument.java @@ -1,4 +1,4 @@ -package org.enso.interpreter.instrument; +package org.enso.interpreter.instrument.id.execution; import com.oracle.truffle.api.CallTarget; import com.oracle.truffle.api.CompilerDirectives; @@ -22,6 +22,7 @@ import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.source.SourceSection; import java.util.UUID; +import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.node.ClosureRootNode; import org.enso.interpreter.node.EnsoRootNode; import org.enso.interpreter.node.ExpressionNode; diff --git a/engine/runtime-instrument-repl-debugger/src/main/java/module-info.java b/engine/runtime-instrument-repl-debugger/src/main/java/module-info.java new file mode 100644 index 000000000000..8ee409ceb919 --- /dev/null +++ b/engine/runtime-instrument-repl-debugger/src/main/java/module-info.java @@ -0,0 +1,11 @@ +module org.enso.runtime.instrument.repl.debugger { + requires scala.library; + requires org.enso.runtime.instrument.common; + requires org.enso.runtime; + requires org.enso.polyglot.api; + requires org.enso.runtime.compiler; + requires org.graalvm.truffle; + + provides com.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProvider with + org.enso.interpreter.instrument.repl.debugger.ReplDebuggerInstrumentProvider; +} diff --git a/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java b/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/repl/debugger/ReplDebuggerInstrument.java similarity index 98% rename from engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java rename to engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/repl/debugger/ReplDebuggerInstrument.java index 9ec70f210129..20d0634ff39c 100644 --- a/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/ReplDebuggerInstrument.java +++ b/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/repl/debugger/ReplDebuggerInstrument.java @@ -1,4 +1,4 @@ -package org.enso.interpreter.instrument; +package org.enso.interpreter.instrument.repl.debugger; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.TruffleLogger; @@ -18,6 +18,8 @@ import java.util.HashMap; import java.util.Map; import org.enso.compiler.context.FramePointer; +import org.enso.interpreter.instrument.DebuggerMessageHandler; +import org.enso.interpreter.instrument.ReplExecutionEventNode; import org.enso.interpreter.node.expression.builtin.debug.DebugBreakpointNode; import org.enso.interpreter.node.expression.builtin.text.util.ToJavaStringNode; import org.enso.interpreter.node.expression.debug.CaptureResultScopeNode; diff --git a/engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/RuntimeServerInstrument.java b/engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/RuntimeServerInstrument.java index befa84fb837a..74782f62fcca 100644 --- a/engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/RuntimeServerInstrument.java +++ b/engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/RuntimeServerInstrument.java @@ -12,6 +12,8 @@ import java.util.Optional; import org.enso.distribution.locking.LockManager; import org.enso.interpreter.runtime.EnsoContext; +import org.enso.interpreter.runtime.instrument.NotificationHandler; +import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.service.ExecutionService; import org.enso.lockmanager.client.ConnectedLockManager; import org.enso.polyglot.RuntimeServerInfo; diff --git a/engine/runtime/src/main/java/module-info.java b/engine/runtime/src/main/java/module-info.java index 549434b09032..4ac9ff79edcc 100644 --- a/engine/runtime/src/main/java/module-info.java +++ b/engine/runtime/src/main/java/module-info.java @@ -1,12 +1,15 @@ module org.enso.runtime { requires java.logging; - requires scala.library; + requires org.enso.cli; + requires org.enso.distribution; + requires org.enso.editions; + requires org.enso.engine.common; requires org.enso.librarymanager; + requires org.enso.lockmanager; requires org.enso.logging.utils; requires org.enso.pkg; - requires org.enso.polyglot.api; - requires org.enso.runtime.parser; + requires org.enso.runtime.compiler; requires org.enso.syntax; requires org.enso.version.output; @@ -14,10 +17,23 @@ requires org.apache.tika.core; requires org.graalvm.collections; requires org.graalvm.truffle; - requires org.openide.util.lookup.RELEASE180; - requires org.slf4j; requires com.ibm.icu; + exports org.enso.interpreter.node.expression.debug; + exports org.enso.interpreter.node; + exports org.enso.interpreter.runtime.callable; + exports org.enso.interpreter.runtime.state; + exports org.enso.interpreter.runtime; + exports org.enso.interpreter.runtime.data.text; + exports org.enso.interpreter.node.callable; + exports org.enso.interpreter.runtime.control; + exports org.enso.interpreter.runtime.callable.function; + exports org.enso.interpreter.runtime.error; + exports org.enso.interpreter.runtime.instrument; + exports org.enso.interpreter.runtime.tag; + exports org.enso.interpreter.node.expression.builtin.debug; + exports org.enso.interpreter.node.expression.builtin.text.util; + provides com.oracle.truffle.api.provider.TruffleLanguageProvider with org.enso.interpreter.EnsoLanguageProvider; } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java b/engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java index 206144f55e12..c842f9704893 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java @@ -27,10 +27,10 @@ import org.enso.distribution.Environment; import org.enso.distribution.locking.LockManager; import org.enso.distribution.locking.ThreadSafeFileLockManager; -import org.enso.interpreter.instrument.NotificationHandler; -import org.enso.interpreter.instrument.NotificationHandler.Forwarder; -import org.enso.interpreter.instrument.NotificationHandler.TextMode$; -import org.enso.interpreter.instrument.Timer; +import org.enso.interpreter.runtime.instrument.NotificationHandler; +import org.enso.interpreter.runtime.instrument.NotificationHandler.Forwarder; +import org.enso.interpreter.runtime.instrument.NotificationHandler.TextMode$; +import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.node.EnsoRootNode; import org.enso.interpreter.node.ExpressionNode; import org.enso.interpreter.node.ProgramRootNode; diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/Instrumentor.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/Instrumentor.java index 8b8a64952cf5..14751689467f 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/Instrumentor.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/Instrumentor.java @@ -6,7 +6,7 @@ import com.oracle.truffle.api.interop.InteropException; import com.oracle.truffle.api.interop.InteropLibrary; import org.enso.interpreter.EnsoLanguage; -import org.enso.interpreter.instrument.Timer; +import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.node.callable.FunctionCallInstrumentationNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.Module; diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java index be434fb65b59..3f3ece4a108c 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java @@ -48,7 +48,7 @@ import org.enso.editions.LibraryName; import org.enso.interpreter.EnsoLanguage; import org.enso.interpreter.OptionsHelper; -import org.enso.interpreter.instrument.NotificationHandler; +import org.enso.interpreter.runtime.instrument.NotificationHandler; import org.enso.interpreter.runtime.builtin.Builtins; import org.enso.interpreter.runtime.data.Type; import org.enso.interpreter.runtime.data.text.Text; diff --git a/engine/runtime/src/main/scala/org/enso/interpreter/runtime/DefaultPackageRepository.scala b/engine/runtime/src/main/scala/org/enso/interpreter/runtime/DefaultPackageRepository.scala index e1d571cb3131..976fa8ddfd14 100644 --- a/engine/runtime/src/main/scala/org/enso/interpreter/runtime/DefaultPackageRepository.scala +++ b/engine/runtime/src/main/scala/org/enso/interpreter/runtime/DefaultPackageRepository.scala @@ -34,8 +34,8 @@ import org.enso.distribution.locking.ResourceManager import org.enso.distribution.{DistributionManager, LanguageHome} import org.enso.editions.updater.EditionManager import org.enso.editions.{DefaultEdition, Editions, LibraryName} -import org.enso.interpreter.instrument.NotificationHandler import org.enso.interpreter.runtime.builtin.Builtins +import org.enso.interpreter.runtime.instrument.NotificationHandler import org.enso.librarymanager.DefaultLibraryProvider import org.enso.pkg.{ComponentGroups, Package} diff --git a/engine/runtime/src/main/scala/org/enso/interpreter/instrument/NotificationHandler.scala b/engine/runtime/src/main/scala/org/enso/interpreter/runtime/instrument/NotificationHandler.scala similarity index 98% rename from engine/runtime/src/main/scala/org/enso/interpreter/instrument/NotificationHandler.scala rename to engine/runtime/src/main/scala/org/enso/interpreter/runtime/instrument/NotificationHandler.scala index dbb26a429448..641ad27ad17f 100644 --- a/engine/runtime/src/main/scala/org/enso/interpreter/instrument/NotificationHandler.scala +++ b/engine/runtime/src/main/scala/org/enso/interpreter/runtime/instrument/NotificationHandler.scala @@ -1,4 +1,4 @@ -package org.enso.interpreter.instrument +package org.enso.interpreter.runtime.instrument import com.typesafe.scalalogging.Logger import org.enso.cli.ProgressBar diff --git a/engine/runtime/src/main/scala/org/enso/interpreter/instrument/Timer.scala b/engine/runtime/src/main/scala/org/enso/interpreter/runtime/instrument/Timer.scala similarity index 87% rename from engine/runtime/src/main/scala/org/enso/interpreter/instrument/Timer.scala rename to engine/runtime/src/main/scala/org/enso/interpreter/runtime/instrument/Timer.scala index c1dbbe83f0db..de7829e0019c 100644 --- a/engine/runtime/src/main/scala/org/enso/interpreter/instrument/Timer.scala +++ b/engine/runtime/src/main/scala/org/enso/interpreter/runtime/instrument/Timer.scala @@ -1,4 +1,4 @@ -package org.enso.interpreter.instrument +package org.enso.interpreter.runtime.instrument /** A very simple timer. */ trait Timer { From 28f417a5f587166e50b4025a8d2483774f863a74 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 13:09:43 +0200 Subject: [PATCH 070/268] module-info compilation is cached --- project/JPMSUtils.scala | 58 +++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index 45f22edab6b9..a698a3619379 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -273,6 +273,7 @@ object JPMSUtils { */ def compileModuleInfo(): Def.Initialize[Task[Unit]] = Def.task { val moduleInfo = (Compile / javaSource).value / "module-info.java" + val projName = moduleName.value val log = streams.value.log val incToolOpts = IncToolOptionsUtil.defaultIncToolOptions() val reporter = (Compile / compile / bspReporter).value @@ -283,29 +284,40 @@ object JPMSUtils { val cp = (Compile / fullClasspath).value val javaCompiler = (Compile / compile / compilers).value.javaTools.javac() - log.info(s"Compiling $moduleInfo with javac") - val allOpts = baseJavacOpts ++ Seq( - "--class-path", - cp.map(_.data.getAbsolutePath).mkString(File.pathSeparator), - "--module-path", - mp.map(_.getAbsolutePath).mkString(File.pathSeparator), - "-d", - outputPath.toAbsolutePath.toString - ) - log.debug(s"javac options: $allOpts") - val succ = javaCompiler.run( - Array(PlainVirtualFile(moduleInfo.toPath)), - allOpts.toArray, - output, - incToolOpts, - reporter, - log - ) - if (!succ) { - val msg = s"Compilation of ${moduleInfo} failed" - log.error(s"javac options: $allOpts") - log.error(msg) - throw new IllegalStateException(msg) + val cache = + streams.value.cacheStoreFactory.make("cache-module-info-" + projName) + + Tracked.diffInputs(cache, FileInfo.lastModified) ( + Set(moduleInfo) + ) { changeReport => + if ( + changeReport.modified.nonEmpty || changeReport.added.nonEmpty + ) { + log.info(s"Compiling $moduleInfo with javac") + val allOpts = baseJavacOpts ++ Seq( + "--class-path", + cp.map(_.data.getAbsolutePath).mkString(File.pathSeparator), + "--module-path", + mp.map(_.getAbsolutePath).mkString(File.pathSeparator), + "-d", + outputPath.toAbsolutePath.toString + ) + log.debug(s"javac options: $allOpts") + val succ = javaCompiler.run( + Array(PlainVirtualFile(moduleInfo.toPath)), + allOpts.toArray, + output, + incToolOpts, + reporter, + log + ) + if (!succ) { + val msg = s"Compilation of ${moduleInfo} failed" + log.error(s"javac options: $allOpts") + log.error(msg) + throw new IllegalStateException(msg) + } + } } } From 861c9f0b2af2b69a380ba707b35dd708f1c4f7fe Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 13:25:18 +0200 Subject: [PATCH 071/268] runtime-instrument-runtime-server is module --- build.sbt | 21 ++++++++++++++++++- .../src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 15 +++++++++++++ .../server}/RuntimeServerInstrument.java | 5 ++++- 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 engine/runtime-instrument-runtime-server/src/main/java/module-info.java rename engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/{ => runtime/server}/RuntimeServerInstrument.java (96%) diff --git a/build.sbt b/build.sbt index d6282f08378c..4cec7f417e66 100644 --- a/build.sbt +++ b/build.sbt @@ -2540,9 +2540,28 @@ lazy val `runtime-instrument-repl-debugger` = lazy val `runtime-instrument-runtime-server` = (project in file("engine/runtime-instrument-runtime-server")) + .enablePlugins(JPMSPlugin) .settings( inConfig(Compile)(truffleRunOptionsSettings), - instrumentationSettings + instrumentationSettings, + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion + ), + internalModuleDependencies := Seq( + (`runtime-instrument-common` / exportedModule).value, + (`engine-common` / exportedModule).value, + (`distribution-manager` / exportedModule).value, + (`runtime` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + (`runtime-compiler` / exportedModule).value, + (`connected-lock-manager` / exportedModule).value, + ) ) .dependsOn(LocalProject("runtime")) .dependsOn(`runtime-instrument-common` % "test->test;compile->compile") diff --git a/engine/runtime-instrument-common/src/main/java/module-info.java b/engine/runtime-instrument-common/src/main/java/module-info.java index d52362a04b94..a1c010a6ed3e 100644 --- a/engine/runtime-instrument-common/src/main/java/module-info.java +++ b/engine/runtime-instrument-common/src/main/java/module-info.java @@ -23,4 +23,5 @@ // TODO: com.oracle.truffle.api.TruffleContext? exports org.enso.interpreter.instrument; + exports org.enso.interpreter.service; } diff --git a/engine/runtime-instrument-runtime-server/src/main/java/module-info.java b/engine/runtime-instrument-runtime-server/src/main/java/module-info.java new file mode 100644 index 000000000000..43a76d573318 --- /dev/null +++ b/engine/runtime-instrument-runtime-server/src/main/java/module-info.java @@ -0,0 +1,15 @@ +module org.enso.runtime.instrument.runtime.server { + requires org.enso.runtime.instrument.common; + requires org.enso.runtime; + requires org.enso.polyglot.api; + requires org.enso.engine.common; + requires org.enso.distribution; + requires org.enso.lockmanager; + + requires org.openide.util.lookup.RELEASE180; + requires org.graalvm.polyglot; + requires org.graalvm.truffle; + + provides com.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProvider with + org.enso.interpreter.instrument.runtime.server.RuntimeServerInstrumentProvider; +} diff --git a/engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/RuntimeServerInstrument.java b/engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/runtime/server/RuntimeServerInstrument.java similarity index 96% rename from engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/RuntimeServerInstrument.java rename to engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/runtime/server/RuntimeServerInstrument.java index 74782f62fcca..ccb742c4ca50 100644 --- a/engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/RuntimeServerInstrument.java +++ b/engine/runtime-instrument-runtime-server/src/main/java/org/enso/interpreter/instrument/runtime/server/RuntimeServerInstrument.java @@ -1,4 +1,4 @@ -package org.enso.interpreter.instrument; +package org.enso.interpreter.instrument.runtime.server; import com.oracle.truffle.api.TruffleContext; import com.oracle.truffle.api.TruffleOptions; @@ -11,6 +11,9 @@ import java.util.Arrays; import java.util.Optional; import org.enso.distribution.locking.LockManager; +import org.enso.interpreter.instrument.Handler; +import org.enso.interpreter.instrument.HandlerFactory; +import org.enso.interpreter.instrument.HandlerFactoryImpl; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.instrument.NotificationHandler; import org.enso.interpreter.runtime.instrument.Timer; From eb734fa696109b64446b75998d412be9e123c6e5 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 13:28:47 +0200 Subject: [PATCH 072/268] runtime-language-epb is module --- build.sbt | 10 +++++++++- .../src/main/java/module-info.java | 7 +++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 engine/runtime-language-epb/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 4cec7f417e66..65cac3a74d1b 100644 --- a/build.sbt +++ b/build.sbt @@ -1958,6 +1958,7 @@ lazy val instrumentationSettings = lazy val `runtime-language-epb` = (project in file("engine/runtime-language-epb")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, inConfig(Compile)(truffleRunOptionsSettings), @@ -1971,7 +1972,14 @@ lazy val `runtime-language-epb` = "com.github.sbt" % "junit-interface" % junitIfVersion % Test, "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", "org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided" - ) + ), + moduleDependencies := Seq( + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + ), ) lazy val `runtime-language-arrow` = diff --git a/engine/runtime-language-epb/src/main/java/module-info.java b/engine/runtime-language-epb/src/main/java/module-info.java new file mode 100644 index 000000000000..700bb1d7b119 --- /dev/null +++ b/engine/runtime-language-epb/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module org.enso.runtime.language.epb { + requires java.logging; + requires org.graalvm.truffle; + + provides com.oracle.truffle.api.provider.TruffleLanguageProvider with + org.enso.interpreter.epb.EpbLanguageProvider; +} From 2bc70d4714d37fb0acd077c077e5e664cb895521 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 13:34:34 +0200 Subject: [PATCH 073/268] Remove runtime-fat-jar --- build.sbt | 296 +----------------- .../src/main/java/module-info.java | 41 --- 2 files changed, 3 insertions(+), 334 deletions(-) delete mode 100644 engine/runtime-fat-jar/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 65cac3a74d1b..d69f46f891b8 100644 --- a/build.sbt +++ b/build.sbt @@ -325,7 +325,6 @@ lazy val enso = (project in file(".")) `runtime-benchmarks`, `runtime-parser`, `runtime-compiler`, - `runtime-fat-jar`, `runtime-suggestions`, `runtime-language-epb`, `runtime-language-arrow`, @@ -596,8 +595,7 @@ lazy val componentModulesIds = (`runtime-language-arrow` / projectID).value, (`syntax-rust-definition` / projectID).value, (`ydoc-server` / projectID).value, - (`profiling-utils` / projectID).value, - (`runtime-fat-jar` / projectID).value + (`profiling-utils` / projectID).value ) } @@ -635,9 +633,7 @@ lazy val componentModulesPaths = val syntax = (`syntax-rust-definition` / Compile / packageBin).value val ydoc = (`ydoc-server` / Compile / packageBin).value val profilingUtils = (`profiling-utils` / Compile / packageBin).value - val runtime = (`runtime-fat-jar` / assembly / assemblyOutputPath).value val ourMods = Seq( - runtime, arrow, syntax, ydoc, @@ -1262,7 +1258,6 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) necessaryModules }, Test / addModules := Seq( - (`runtime-fat-jar` / javaModuleName).value, (`syntax-rust-definition` / javaModuleName).value, (`profiling-utils` / javaModuleName).value, (`ydoc-server` / javaModuleName).value @@ -1271,7 +1266,6 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) 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, (`ydoc-server` / projectID).value, (`syntax-rust-definition` / projectID).value, (`profiling-utils` / projectID).value @@ -1322,7 +1316,6 @@ 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) @@ -1640,11 +1633,6 @@ lazy val `polyglot-api` = project "-Dpolyglot.engine.WarnInterpreterOnly=false", "-Dpolyglotimpl.DisableClassPathIsolation=true" ), - // Append enso language on the class-path - Test / unmanagedClasspath := - (LocalProject( - "runtime-fat-jar" - ) / Compile / fullClasspath).value, libraryDependencies ++= Seq( "io.circe" %% "circe-core" % circeVersion % "provided", "org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided", @@ -1744,7 +1732,6 @@ lazy val `language-server` = (project in file("engine/language-server")) necessaryModules }, Test / addModules := Seq( - (`runtime-fat-jar` / javaModuleName).value, (`syntax-rust-definition` / javaModuleName).value, (`profiling-utils` / javaModuleName).value, (`ydoc-server` / javaModuleName).value @@ -1753,65 +1740,12 @@ lazy val `language-server` = (project in file("engine/language-server")) 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, - 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 ++ - (LocalProject("persistance") / Compile / productDirectories).value ++ - (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 - (LocalProject("runtime") / Compile / productDirectories).value - val extraModsToPatch = JPMSUtils.filterModulesFromUpdate( - (Test / update).value, - Seq( - "org.apache.tika" % "tika-core" % tikaVersion - ), - streams.value.log, - moduleName.value, - shouldContainAll = true - ) - Map( - (`runtime-fat-jar` / javaModuleName).value -> (modulesToPatchIntoRuntime ++ extraModsToPatch) - ) - }, - Test / addReads := { - Map( - (`runtime-fat-jar` / javaModuleName).value -> Seq("ALL-UNNAMED") - ) - }, Test / addExports := { val profModName = (`profiling-utils` / javaModuleName).value Map( @@ -1820,9 +1754,6 @@ lazy val `language-server` = (project in file("engine/language-server")) } ) .settings( - Test / compile := (Test / compile) - .dependsOn(`runtime-fat-jar` / Compile / compileModuleInfo) - .value, Test / envVars ++= Map( "ENSO_EDITION_PATH" -> file("distribution/editions").getCanonicalPath ) @@ -1845,7 +1776,6 @@ 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`) @@ -2170,9 +2100,6 @@ lazy val `runtime-integration-tests` = "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, @@ -2190,7 +2117,6 @@ lazy val `runtime-integration-tests` = Test / javaOptions ++= testLogProviderOptions, Test / addModules := Seq( (`runtime-test-instruments` / javaModuleName).value, - (`runtime-fat-jar` / javaModuleName).value, (`syntax-rust-definition` / javaModuleName).value, (`profiling-utils` / javaModuleName).value, (`ydoc-server` / javaModuleName).value @@ -2205,79 +2131,19 @@ lazy val `runtime-integration-tests` = "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 := { - - /** 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) .dependsOn(`connected-lock-manager-server`) .dependsOn(`test-utils`) -/** 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. +/** A project that holds only benchmarks for `runtime`. */ lazy val `runtime-benchmarks` = (project in file("engine/runtime-benchmarks")) @@ -2304,25 +2170,17 @@ lazy val `runtime-benchmarks` = frgaalSourceLevel, "--enable-preview" ), - Compile / compile := (Compile / compile) - .dependsOn(`runtime-fat-jar` / assembly) - .value, parallelExecution := false, 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 := { - val runtimeModuleName = (`runtime-fat-jar` / javaModuleName).value - Seq(runtimeModuleName) - }, addExports := { Map("org.slf4j.nop/org.slf4j.nop" -> Seq("org.slf4j")) }, @@ -2355,7 +2213,6 @@ lazy val `runtime-benchmarks` = } }.evaluated ) - .dependsOn(`runtime-fat-jar`) .dependsOn(`benchmarks-common`) .dependsOn(`test-utils`) @@ -2574,139 +2431,6 @@ lazy val `runtime-instrument-runtime-server` = .dependsOn(LocalProject("runtime")) .dependsOn(`runtime-instrument-common` % "test->test;compile->compile") -/** 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( - // 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 - }, - 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"), - LocalProject("runtime-instrument-runtime-server") - ), - inConfigurations(Compile) - ), - modulePath = JPMSUtils.componentModules ++ helidon - ) - } - .dependsOn(Compile / compile) - .value, - // Note [Compile module-info] - 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. - */ - .settings( - libraryDependencies ++= { - val graalMods = - GraalVM.modules.map(_.withConfigurations(Some(Runtime.name))) - val langMods = - GraalVM.langsPkgs.map(_.withConfigurations(Some(Runtime.name))) - val logbackMods = - logbackPkg.map(_.withConfigurations(Some(Runtime.name))) - val helidonMods = helidon.map(_.withConfigurations(Some(Runtime.name))) - graalMods ++ langMods ++ logbackMods ++ helidonMods - } - ) - /** Assembling Uber Jar */ - .settings( - assembly := assembly - .dependsOn(Compile / compile) - .dependsOn(Compile / compileModuleInfo) - //`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) - .value, - assembly / assemblyJarName := "runtime.jar", - assembly / test := {}, - assembly / assemblyOutputPath := file("runtime.jar"), - assembly / assemblyExcludedJars := { - val pkgsToExclude = JPMSUtils.componentModules ++ helidon ++ Seq( - "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion - ) - val ourFullCp = (Runtime / fullClasspath).value - val excludedExternalPkgs = JPMSUtils.filterModulesFromClasspath( - ourFullCp, - pkgsToExclude, - streams.value.log, - moduleName.value - ) - 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 - }, - 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 - case PathList("module-info.class") => - MergeStrategy.preferProject - // remove once https://github.com/snakeyaml/snakeyaml/pull/12 gets integrated - case PathList("org", "yaml", "snakeyaml", "introspector", xs @ _*) => - MergeStrategy.preferProject - case PathList(xs @ _*) if xs.last.contains("module-info.class") => - MergeStrategy.discard - case _ => MergeStrategy.first - } - ) - .dependsOn(`runtime-instrument-common`) - .dependsOn(`runtime-instrument-id-execution`) - .dependsOn(`runtime-instrument-repl-debugger`) - .dependsOn(`runtime-instrument-runtime-server`) - .dependsOn(`runtime-language-epb`) - .dependsOn(`ydoc-server`) - .dependsOn(yaml) - .dependsOn(LocalProject("runtime")) /* Note [Unmanaged Classpath] * ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2953,9 +2677,6 @@ lazy val `engine-runner` = project ) smallJdkDirectory }, - assembly := assembly - .dependsOn(`runtime-fat-jar` / assembly) - .value, rebuildNativeImage := Def .taskDyn { NativeImage @@ -3213,10 +2934,7 @@ lazy val `bench-processor` = (project in file("lib/scala/bench-processor")) Seq( "-Dpolyglot.engine.WarnInterpreterOnly=false", "-Dpolyglotimpl.DisableClassPathIsolation=true" - ), - // Append enso language on the class-path - (Test / unmanagedClasspath) := - (LocalProject("runtime-fat-jar") / Compile / fullClasspath).value + ) ) .dependsOn(`benchmarks-common`) .dependsOn(`polyglot-api`) @@ -3242,9 +2960,6 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) run / connectInput := true, mainClass := (LocalProject("bench-processor") / mainClass).value, - Compile / compile := (Compile / compile) - .dependsOn(`runtime-fat-jar` / assembly) - .value, Compile / javacOptions ++= Seq( "-Xlint:unchecked", "-J-Dpolyglotimpl.DisableClassPathIsolation=true", @@ -3255,10 +2970,6 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) "org.slf4j" % "slf4j-nop" % slf4jVersion ) }, - addModules := { - val runtimeModuleName = (`runtime-fat-jar` / javaModuleName).value - Seq(runtimeModuleName) - }, addExports := { Map("org.slf4j.nop/org.slf4j.nop" -> Seq("org.slf4j")) }, @@ -3291,7 +3002,6 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) }.evaluated ) .dependsOn(`bench-processor`) - .dependsOn(`runtime-fat-jar`) .dependsOn(`std-table` % "provided") .dependsOn(`std-base` % "provided") .dependsOn(`benchmark-java-helpers` % "provided") diff --git a/engine/runtime-fat-jar/src/main/java/module-info.java b/engine/runtime-fat-jar/src/main/java/module-info.java deleted file mode 100644 index 1f5b2eee274d..000000000000 --- a/engine/runtime-fat-jar/src/main/java/module-info.java +++ /dev/null @@ -1,41 +0,0 @@ -open module org.enso.runtime { - requires java.base; - requires java.net.http; - // Because of akka.util.Unsafe - requires jdk.unsupported; - requires org.enso.syntax; - // org.enso.profiling and org.enso.doc are not needed for runtime. It is needed for runner.jar, - // but we have to include it here so that the forwarding in IsolatedClassLoader - // works. - requires org.enso.profiling; - requires org.enso.ydoc; - requires org.graalvm.polyglot; - requires org.graalvm.truffle; - requires static org.slf4j; - // ydoc-server - requires io.helidon.webclient; - requires io.helidon.webclient.websocket; - requires io.helidon.webserver; - requires io.helidon.webserver.websocket; - - uses org.slf4j.spi.SLF4JServiceProvider; - uses org.enso.interpreter.instrument.HandlerFactory; - - provides com.oracle.truffle.api.provider.TruffleLanguageProvider with - org.enso.interpreter.EnsoLanguageProvider, - org.enso.interpreter.epb.EpbLanguageProvider; - - provides com.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProvider with - org.enso.interpreter.instrument.ReplDebuggerInstrumentProvider, - org.enso.interpreter.instrument.RuntimeServerInstrumentProvider, - org.enso.interpreter.instrument.IdExecutionInstrumentProvider; - - - // java.beans.Transient needed by Jackson jackson.databind.ext.Java7SupportImpl - requires java.desktop; - // also needed by Jackson to avoid - // com.fasterxml.jackson.databind.exc.InvalidTypeIdException: - // Could not resolve type id 'org.enso.polyglot.data.Tree$Node' as a subtype of - // `org.enso.polyglot.data.Tree$Node`: Not a subtype - requires java.se; -} From 76d21cc6367a9c531bca958a71a9e47e97888e51 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 13:47:24 +0200 Subject: [PATCH 074/268] engine-runner is not a fat jar --- build.sbt | 54 +----------------------------------------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/build.sbt b/build.sbt index d69f46f891b8..8d14b698a471 100644 --- a/build.sbt +++ b/build.sbt @@ -582,6 +582,7 @@ val jnaVersion = "5.14.0" // === Utility methods ===================================================== // ============================================================================ +// TODO: Remove lazy val componentModulesIds = taskKey[Seq[ModuleID]]( "Gather all sbt module IDs that will be put on the module-path for the engine runner" @@ -599,7 +600,6 @@ lazy val componentModulesIds = ) } -// 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" + @@ -2505,55 +2505,6 @@ lazy val `engine-runner` = project ), Compile / run / mainClass := Some("org.enso.runner.Main"), compileOrder := CompileOrder.JavaThenScala, - assembly / mainClass := (Compile / run / mainClass).value, - assembly / assemblyJarName := "runner.jar", - assembly / test := {}, - assembly / assemblyOutputPath := file("runner.jar"), - assembly / assemblyExcludedJars := { - val excludedExternalPkgs = JPMSUtils.filterArtifacts( - (Compile / fullClasspath).value, - "graalvm", - "truffle", - "helidon" - ) - 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 runner.jar fat jar." - ) - } - } - excludedInternalPkgs ++ excludedExternalPkgs - }, - 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 - // remove once https://github.com/snakeyaml/snakeyaml/pull/12 gets integrated - case PathList("org", "yaml", "snakeyaml", "introspector", xs @ _*) => - MergeStrategy.preferProject - case PathList(xs @ _*) if xs.last.contains("module-info") => - // runner.jar must not be a JPMS module - MergeStrategy.discard - case x => - MergeStrategy.first - }, commands += WithDebugCommand.withDebug, inConfig(Compile)(truffleRunOptionsSettings), libraryDependencies ++= Seq( @@ -3800,7 +3751,6 @@ projectManagerDistributionRoot := lazy val buildEngineDistribution = taskKey[Unit]("Builds the engine distribution") buildEngineDistribution := { - val _ = (`engine-runner` / assembly).value updateLibraryManifests.value val modulesToCopy = componentModulesPaths.value val root = engineDistributionRoot.value @@ -3836,7 +3786,6 @@ ThisBuild / engineDistributionRoot := { lazy val buildEngineDistributionNoIndex = taskKey[Unit]("Builds the engine distribution without generating indexes") buildEngineDistributionNoIndex := { - val _ = (`engine-runner` / assembly).value updateLibraryManifests.value val modulesToCopy = componentModulesPaths.value val root = engineDistributionRoot.value @@ -4078,7 +4027,6 @@ lazy val updateLibraryManifests = "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 => From f0dac21a8f1601c2e64c72a93d31fe60827e96f1 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 13:47:44 +0200 Subject: [PATCH 075/268] JPMSPlugin defines exportedModuleBin task --- project/JPMSPlugin.scala | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index c581f4dc1d78..6fbde63dcfdf 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -77,6 +77,11 @@ object JPMSPlugin extends AutoPlugin { |""".stripMargin ) + val exportedModuleBin = taskKey[File]( + "Similar to `packageBin` task. This task returns a modular JAR archive that can be " + + "directly put on module-path" + ) + /** * Should module-info.java be compiled manually? True iff there is `module-info.java` * in java sources and if the compile order is Mixed. In such case, sbt tries to first @@ -148,6 +153,10 @@ object JPMSPlugin extends AutoPlugin { } targetClassDir }, + exportedModuleBin := { + exportedModule.value + (Compile / packageBin).value + }, patchModules := Map.empty, addExports := Map.empty, addReads := Map.empty, From a04254be706ab69fe145a03000545604e178e981 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 13:47:57 +0200 Subject: [PATCH 076/268] Redefine componentModulesPaths task --- build.sbt | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index 8d14b698a471..a473bd92dbf6 100644 --- a/build.sbt +++ b/build.sbt @@ -629,15 +629,36 @@ lazy val componentModulesPaths = shouldContainAll = true ) val thirdPartyModFiles = thirdPartyMods.map(_.data) - val arrow = (`runtime-language-arrow` / Compile / packageBin).value - val syntax = (`syntax-rust-definition` / Compile / packageBin).value - val ydoc = (`ydoc-server` / Compile / packageBin).value - val profilingUtils = (`profiling-utils` / Compile / packageBin).value val ourMods = Seq( - arrow, - syntax, - ydoc, - profilingUtils + (`engine-common` / exportedModuleBin).value, + (`engine-runner` / exportedModuleBin).value, + (`engine-runner-common` / exportedModuleBin).value, + (`polyglot-api` / exportedModuleBin).value, + (`runtime` / exportedModuleBin).value, + (`runtime-compiler` / exportedModuleBin).value, + (`runtime-parser` / exportedModuleBin).value, + (`runtime-instrument-common` / exportedModuleBin).value, + (`runtime-instrument-id-execution` / exportedModuleBin).value, + (`runtime-instrument-repl-debugger` / exportedModuleBin).value, + (`runtime-instrument-runtime-server` / exportedModuleBin).value, + (`runtime-language-arrow` / exportedModuleBin).value, + (`runtime-language-epb` / exportedModuleBin).value, + (`persistance` / exportedModuleBin).value, + (`cli` / exportedModuleBin).value, + (`connected-lock-manager` / exportedModuleBin).value, + (`distribution-manager` / exportedModuleBin).value, + (`downloader` / exportedModuleBin).value, + (`editions` / exportedModuleBin).value, + (`library-manager` / exportedModuleBin).value, + (`logging-config` / exportedModuleBin).value, + (`logging-utils` / exportedModuleBin).value, + (`pkg` / exportedModuleBin).value, + (`refactoring-utils` / exportedModuleBin).value, + (`semver` / exportedModuleBin).value, + (`text-buffer` / exportedModuleBin).value, + (`version-output` / exportedModuleBin).value, + (`scala-yaml` / exportedModuleBin).value, + (`scala-libs-wrapper` / exportedModuleBin).value, ) ourMods ++ thirdPartyModFiles } From 58ec09027beee33d5b2c6540fcd9d8225d728380 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 17:51:57 +0200 Subject: [PATCH 077/268] interpreter-dsl is module --- build.sbt | 8 ++++++++ lib/scala/interpreter-dsl/src/main/java/module-info.java | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 lib/scala/interpreter-dsl/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index a473bd92dbf6..19085d0fe9c1 100644 --- a/build.sbt +++ b/build.sbt @@ -1534,6 +1534,7 @@ lazy val `persistance-dsl` = (project in file("lib/java/persistance-dsl")) ) lazy val `interpreter-dsl` = (project in file("lib/scala/interpreter-dsl")) + .enablePlugins(JPMSPlugin) .settings( version := "0.1", frgaalJavaCompilerSetting, @@ -1548,6 +1549,11 @@ lazy val `interpreter-dsl` = (project in file("lib/scala/interpreter-dsl")) "org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided", "com.google.guava" % "guava" % guavaVersion exclude ("com.google.code.findbugs", "jsr305") + ), + moduleDependencies := Seq( + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "com.google.guava" % "guava" % guavaVersion ) ) @@ -2063,6 +2069,8 @@ lazy val runtime = (project in file("engine/runtime")) (`editions` / exportedModule).value, (`syntax-rust-definition` / exportedModule).value, (`version-output` / exportedModule).value, + (`interpreter-dsl` / exportedModule).value, + (`persistance` / exportedModule).value ) ) .settings( diff --git a/lib/scala/interpreter-dsl/src/main/java/module-info.java b/lib/scala/interpreter-dsl/src/main/java/module-info.java new file mode 100644 index 000000000000..be837a03d1d0 --- /dev/null +++ b/lib/scala/interpreter-dsl/src/main/java/module-info.java @@ -0,0 +1,8 @@ +module org.enso.interpreter.dsl { + requires com.google.common; + requires java.compiler; + requires org.apache.commons.lang3; + requires org.openide.util.lookup.RELEASE180; + + exports org.enso.interpreter.dsl; +} From e106c34e828d0816bb92bedf9e6634c3fee1c245 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 17:52:29 +0200 Subject: [PATCH 078/268] Redefine componentModulesPaths task --- build.sbt | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 19085d0fe9c1..e5adbfc281fd 100644 --- a/build.sbt +++ b/build.sbt @@ -616,16 +616,30 @@ lazy val componentModulesPaths = 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 + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "org.jline" % "jline" % jlineVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.apache.tika" % "tika-core" % tikaVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion, + "com.ibm.icu" % "icu4j" % icuVersion ) val thirdPartyMods = JPMSUtils.filterModulesFromClasspath( fullCp, thirdPartyModIds, log, - projName = moduleName.value, + projName = moduleName.value, shouldContainAll = true ) val thirdPartyModFiles = thirdPartyMods.map(_.data) @@ -635,6 +649,7 @@ lazy val componentModulesPaths = (`engine-runner-common` / exportedModuleBin).value, (`polyglot-api` / exportedModuleBin).value, (`runtime` / exportedModuleBin).value, + (`syntax-rust-definition` / exportedModuleBin).value, (`runtime-compiler` / exportedModuleBin).value, (`runtime-parser` / exportedModuleBin).value, (`runtime-instrument-common` / exportedModuleBin).value, @@ -659,6 +674,8 @@ lazy val componentModulesPaths = (`version-output` / exportedModuleBin).value, (`scala-yaml` / exportedModuleBin).value, (`scala-libs-wrapper` / exportedModuleBin).value, + (`edition-updater` / exportedModuleBin).value, + (`profiling-utils` / exportedModuleBin).value ) ourMods ++ thirdPartyModFiles } From 047a258cab5af2e0838027c8777f029d179d99cb Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 17:53:38 +0200 Subject: [PATCH 079/268] fmt sbt --- build.sbt | 214 +++++++++++++++++++------------------- project/JPMSPlugin.scala | 18 ++-- project/JPMSUtils.scala | 22 ++-- project/NativeImage.scala | 2 +- 4 files changed, 128 insertions(+), 128 deletions(-) diff --git a/build.sbt b/build.sbt index e5adbfc281fd..c9af5408a8f9 100644 --- a/build.sbt +++ b/build.sbt @@ -699,8 +699,8 @@ lazy val `text-buffer` = project ), excludeFilter := excludeFilter.value || "module-info.java", moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - ), + "org.scala-lang" % "scala-library" % scalacVersion + ) ) lazy val rustParserTargetDirectory = @@ -837,12 +837,12 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) frgaalJavaCompilerSetting, excludeFilter := excludeFilter.value || "module-info.java", libraryDependencies ++= Seq( - "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", - "com.chuusai" %% "shapeless" % "2.3.10", + "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", + "com.chuusai" %% "shapeless" % "2.3.10" ), moduleDependencies ++= Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion ), internalModuleDependencies := Seq( (`scala-libs-wrapper` / exportedModule).value @@ -858,23 +858,23 @@ lazy val pkg = (project in file("lib/scala/pkg")) compileOrder := CompileOrder.ScalaThenJava, version := "0.1", libraryDependencies ++= Seq( - "io.circe" %% "circe-core" % circeVersion % "provided", - "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", - "org.scalatest" %% "scalatest" % scalatestVersion % Test, - "org.apache.commons" % "commons-compress" % commonsCompressVersion + "io.circe" %% "circe-core" % circeVersion % "provided", + "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", + "org.scalatest" %% "scalatest" % scalatestVersion % Test, + "org.apache.commons" % "commons-compress" % commonsCompressVersion ), moduleDependencies := { Seq( "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.scala-lang" % "scala-library" % scalacVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion ) }, internalModuleDependencies := Seq( (`editions` / exportedModule).value, (`semver` / exportedModule).value, (`scala-yaml` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value ) ) .dependsOn(editions) @@ -1056,29 +1056,28 @@ lazy val `scala-libs-wrapper` = project .settings( javaModuleName := "org.enso.scala.wrapper", libraryDependencies ++= circe ++ Seq( - "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.typelevel" %% "cats-core" % "2.10.0", - "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.jline" % "jline" % jlineVersion, - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, + "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.typelevel" %% "cats-core" % "2.10.0", + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.jline" % "jline" % jlineVersion, + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion ), moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.jline" % "jline" % jlineVersion, + "org.jline" % "jline" % jlineVersion ), shouldCompileModuleInfoManually := true, excludeFilter := excludeFilter.value || "module-info.java", compileModuleInfo := { - JPMSUtils.compileModuleInfo() - .value + JPMSUtils.compileModuleInfo().value }, javacOptions ++= { JPMSPlugin.constructOptions( streams.value.log, - modulePath = modulePath.value, + modulePath = modulePath.value, patchModules = patchModules.value ) }, @@ -1090,12 +1089,12 @@ lazy val `scala-libs-wrapper` = project JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, "io.github.java-diff-utils" % "java-diff-utils" % "4.12", - "org.jline" % "jline" % jlineVersion, + "org.jline" % "jline" % jlineVersion ), streams.value.log, moduleName.value, @@ -1109,18 +1108,18 @@ lazy val `scala-libs-wrapper` = project val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.typesafe.scala-logging" % ("scala-logging_" + scalaVer) % scalaLoggingVersion, - "io.circe" % ("circe-core_" + scalaVer) % circeVersion, - "io.circe" % ("circe-generic_" + scalaVer) % circeVersion, - "io.circe" % ("circe-parser_" + scalaVer) % circeVersion, - "io.circe" % ("circe-jawn_" + scalaVer) % circeVersion, - "io.circe" % ("circe-numbers_" + scalaVer) % circeVersion, - "org.typelevel" % ("cats-core_" + scalaVer) % "2.10.0", - "org.typelevel" % ("cats-kernel_" + scalaVer) % "2.10.0", - "org.typelevel" % ("jawn-parser_" + scalaVer) % "1.5.1", - "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", + "com.typesafe.scala-logging" % ("scala-logging_" + scalaVer) % scalaLoggingVersion, + "io.circe" % ("circe-core_" + scalaVer) % circeVersion, + "io.circe" % ("circe-generic_" + scalaVer) % circeVersion, + "io.circe" % ("circe-parser_" + scalaVer) % circeVersion, + "io.circe" % ("circe-jawn_" + scalaVer) % circeVersion, + "io.circe" % ("circe-numbers_" + scalaVer) % circeVersion, + "org.typelevel" % ("cats-core_" + scalaVer) % "2.10.0", + "org.typelevel" % ("cats-kernel_" + scalaVer) % "2.10.0", + "org.typelevel" % ("jawn-parser_" + scalaVer) % "1.5.1", + "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-macros_" + scalaVer) % jsoniterVersion, - "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-core_" + scalaVer) % jsoniterVersion, + "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-core_" + scalaVer) % jsoniterVersion ), streams.value.log, moduleName.value, @@ -1208,11 +1207,11 @@ lazy val `refactoring-utils` = project ), excludeFilter := excludeFilter.value || "module-info.java", moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-library" % scalacVersion ), internalModuleDependencies := Seq( (`text-buffer` / exportedModule).value, - (`runtime-parser` / exportedModule).value, + (`runtime-parser` / exportedModule).value ) ) .dependsOn(`runtime-parser`) @@ -1443,7 +1442,7 @@ lazy val `ydoc-server` = project }, internalModuleDependencies := Seq( (`syntax-rust-definition` / exportedModule).value, - (`profiling-utils` / exportedModule).value, + (`profiling-utils` / exportedModule).value ), libraryDependencies ++= Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", @@ -1525,7 +1524,7 @@ lazy val `persistance` = (project in file("lib/java/persistance")) ), moduleDependencies := Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ) ) .dependsOn(`persistance-dsl` % Test) @@ -1701,7 +1700,7 @@ lazy val `polyglot-api` = project ), internalModuleDependencies := Seq( (`scala-libs-wrapper` / exportedModule).value, - (`engine-common` / exportedModule).value, + (`engine-common` / exportedModule).value ), GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task @@ -1948,12 +1947,12 @@ lazy val `runtime-language-epb` = "org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided" ), moduleDependencies := Seq( - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, - ), + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion + ) ) lazy val `runtime-language-arrow` = @@ -2060,17 +2059,17 @@ lazy val runtime = (project in file("engine/runtime")) }, excludeFilter := excludeFilter.value || "module-info.java", moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-library" % scalacVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "org.apache.tika" % "tika-core" % tikaVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, - "com.ibm.icu" % "icu4j" % icuVersion, - "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "com.ibm.icu" % "icu4j" % icuVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion ), internalModuleDependencies := Seq( (`distribution-manager` / exportedModule).value, @@ -2181,7 +2180,7 @@ lazy val `runtime-integration-tests` = (`syntax-rust-definition` / projectID).value, (`profiling-utils` / projectID).value ) - }, + } ) .dependsOn(`runtime-test-instruments`) .dependsOn(`logging-service-logback` % "test->test") @@ -2289,7 +2288,7 @@ lazy val `runtime-parser` = }, internalModuleDependencies := Seq( (`syntax-rust-definition` / exportedModule).value, - (`persistance` / exportedModule).value, + (`persistance` / exportedModule).value ), // Note [Compile module-info] excludeFilter := excludeFilter.value || "module-info.java" @@ -2312,15 +2311,15 @@ lazy val `runtime-compiler` = "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ), excludeFilter := excludeFilter.value || "module-info.java", internalModuleDependencies := Seq( (`engine-common` / exportedModule).value, (`pkg` / exportedModule).value, - (`runtime-parser` / exportedModule).value, + (`runtime-parser` / exportedModule).value ) ) .dependsOn(`runtime-parser`) @@ -2371,12 +2370,12 @@ lazy val `runtime-instrument-common` = ), excludeFilter := excludeFilter.value || "module-info.java", moduleDependencies := Seq( - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.scala-lang" % "scala-library" % scalacVersion, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.scala-lang" % "scala-library" % scalacVersion ), internalModuleDependencies := Seq( (`cli` / exportedModule).value, @@ -2392,7 +2391,7 @@ lazy val `runtime-instrument-common` = (`text-buffer` / exportedModule).value, (`pkg` / exportedModule).value, (`polyglot-api` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value ) ) .dependsOn(`refactoring-utils`) @@ -2410,16 +2409,16 @@ lazy val `runtime-instrument-id-execution` = inConfig(Compile)(truffleRunOptionsSettings), instrumentationSettings, moduleDependencies := Seq( - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion ), internalModuleDependencies := Seq( (`runtime` / exportedModule).value, (`runtime-compiler` / exportedModule).value, - (`polyglot-api` / exportedModule).value, + (`polyglot-api` / exportedModule).value ) ) .dependsOn(LocalProject("runtime")) @@ -2432,18 +2431,18 @@ lazy val `runtime-instrument-repl-debugger` = inConfig(Compile)(truffleRunOptionsSettings), instrumentationSettings, moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion ), internalModuleDependencies := Seq( (`runtime-instrument-common` / exportedModule).value, (`runtime` / exportedModule).value, (`polyglot-api` / exportedModule).value, - (`runtime-compiler` / exportedModule).value, + (`runtime-compiler` / exportedModule).value ) ) .dependsOn(LocalProject("runtime")) @@ -2456,13 +2455,13 @@ lazy val `runtime-instrument-runtime-server` = inConfig(Compile)(truffleRunOptionsSettings), instrumentationSettings, moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ), internalModuleDependencies := Seq( (`runtime-instrument-common` / exportedModule).value, @@ -2471,13 +2470,12 @@ lazy val `runtime-instrument-runtime-server` = (`runtime` / exportedModule).value, (`polyglot-api` / exportedModule).value, (`runtime-compiler` / exportedModule).value, - (`connected-lock-manager` / exportedModule).value, + (`connected-lock-manager` / exportedModule).value ) ) .dependsOn(LocalProject("runtime")) .dependsOn(`runtime-instrument-common` % "test->test;compile->compile") - /* Note [Unmanaged Classpath] * ~~~~~~~~~~~~~~~~~~~~~~~~~~ * As the definition of the core primitives in `core_definition` is achieved @@ -2520,16 +2518,16 @@ lazy val `engine-runner-common` = project "commons-cli" % "commons-cli" % commonsCliVersion ), moduleDependencies := Seq( - "commons-cli" % "commons-cli" % commonsCliVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "commons-io" % "commons-io" % commonsIoVersion, - "org.scala-lang" % "scala-library" % scalacVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "org.scala-lang" % "scala-library" % scalacVersion ), internalModuleDependencies := Seq( (`pkg` / exportedModule).value, (`editions` / exportedModule).value, (`engine-common` / exportedModule).value, - (`library-manager` / exportedModule).value, + (`library-manager` / exportedModule).value ) ) .dependsOn(`polyglot-api`) @@ -2847,7 +2845,7 @@ lazy val `distribution-manager` = project (`cli` / exportedModule).value, (`logging-utils` / exportedModule).value, (`scala-libs-wrapper` / exportedModule).value, - (`scala-yaml` / exportedModule).value, + (`scala-yaml` / exportedModule).value ) ) .dependsOn(editions) @@ -3101,15 +3099,15 @@ lazy val downloader = (project in file("lib/scala/downloader")) "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test ), moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "commons-io" % "commons-io" % commonsIoVersion, - "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ), excludeFilter := excludeFilter.value || "module-info.java", internalModuleDependencies := Seq( (`cli` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value ) ) .dependsOn(cli) @@ -3164,8 +3162,8 @@ lazy val `library-manager` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test ), moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion ), internalModuleDependencies := Seq( (`distribution-manager` / exportedModule).value, @@ -3176,7 +3174,7 @@ lazy val `library-manager` = project (`semver` / exportedModule).value, (`logging-utils` / exportedModule).value, (`scala-libs-wrapper` / exportedModule).value, - (`scala-yaml` / exportedModule).value, + (`scala-yaml` / exportedModule).value ) ) .dependsOn(`version-output`) // Note [Default Editions] @@ -3218,12 +3216,12 @@ lazy val `connected-lock-manager` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test ), moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-library" % scalacVersion ), internalModuleDependencies := Seq( (`distribution-manager` / exportedModule).value, (`polyglot-api` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value ) ) .dependsOn(`distribution-manager`) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 6fbde63dcfdf..783b4a68e02c 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -82,15 +82,14 @@ object JPMSPlugin extends AutoPlugin { "directly put on module-path" ) - /** - * Should module-info.java be compiled manually? True iff there is `module-info.java` - * in java sources and if the compile order is Mixed. In such case, sbt tries to first - * parse all the Java sources via its internal parser, and that fails for `modue-info`. - * In these cases, we need to exclude `module-info.java` from the sources and compile it - * manually. - * - * WARNING: Do not use override this task directly if you don't know exactly what you are doing. - */ + /** Should module-info.java be compiled manually? True iff there is `module-info.java` + * in java sources and if the compile order is Mixed. In such case, sbt tries to first + * parse all the Java sources via its internal parser, and that fails for `modue-info`. + * In these cases, we need to exclude `module-info.java` from the sources and compile it + * manually. + * + * WARNING: Do not use override this task directly if you don't know exactly what you are doing. + */ val shouldCompileModuleInfoManually = taskKey[Boolean]( "Should module-info.java be compiled manually?" ) @@ -98,7 +97,6 @@ object JPMSPlugin extends AutoPlugin { import autoImport._ - override lazy val projectSettings: Seq[Setting[_]] = Seq( addModules := Seq.empty, moduleDependencies := Seq.empty, diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index a698a3619379..c9b729a466e5 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -44,7 +44,7 @@ object JPMSUtils { * * @param cp The classpath to filter * @param modules These modules are looked for in the class path, can be duplicated. - * @param projName Name of the current sbt project for debugging. + * @param projName Name of the current sbt project for debugging. * @param shouldContainAll If true, the method will throw an exception if not all modules were found * in the classpath. * @return The classpath with only the provided modules searched by their IDs. @@ -72,7 +72,9 @@ object JPMSUtils { }) if (shouldContainAll) { if (ret.size < distinctModules.size) { - log.error(s"[JPMSUtils/$projName] Not all modules from classpath were found") + log.error( + s"[JPMSUtils/$projName] Not all modules from classpath were found" + ) log.error( s"[JPMSUtils/$projName] Ensure libraryDependencies and moduleDependencies are correct" ) @@ -90,7 +92,7 @@ object JPMSUtils { * @param updateReport The update report to filter. This is the result of `update.value`. * @param modules The modules to filter from the update report. Can be duplicated. * @param log The logger to use for logging. - * @param projName Name of the current sbt project for debugging. + * @param projName Name of the current sbt project for debugging. * @param shouldContainAll If true, the method will log an error if not all modules were found. * @return The list of files (Jar archives, directories, etc.) that were found in the update report. */ @@ -116,11 +118,15 @@ object JPMSUtils { ) if (shouldContainAll) { if (foundFiles.size < distinctModules.size) { - log.error(s"[JPMSUtils/$projName] Not all modules from update were found") + log.error( + s"[JPMSUtils/$projName] Not all modules from update were found" + ) log.error( s"[JPMSUtils/$projName] Ensure libraryDependencies and moduleDependencies are correct" ) - log.error(s"[JPMSUtils/$projName] Returned (${foundFiles.size}): $foundFiles") + log.error( + s"[JPMSUtils/$projName] Returned (${foundFiles.size}): $foundFiles" + ) log.error( s"[JPMSUtils/$projName] Expected: (${distinctModules.size}): $distinctModules" ) @@ -287,12 +293,10 @@ object JPMSUtils { val cache = streams.value.cacheStoreFactory.make("cache-module-info-" + projName) - Tracked.diffInputs(cache, FileInfo.lastModified) ( + Tracked.diffInputs(cache, FileInfo.lastModified)( Set(moduleInfo) ) { changeReport => - if ( - changeReport.modified.nonEmpty || changeReport.added.nonEmpty - ) { + if (changeReport.modified.nonEmpty || changeReport.added.nonEmpty) { log.info(s"Compiling $moduleInfo with javac") val allOpts = baseJavacOpts ++ Seq( "--class-path", diff --git a/project/NativeImage.scala b/project/NativeImage.scala index f79754894aaf..09febb8c70e3 100644 --- a/project/NativeImage.scala +++ b/project/NativeImage.scala @@ -204,7 +204,7 @@ object NativeImage { cpToSearch, JPMSUtils.componentModules, log, - projName = (moduleName.value), + projName = (moduleName.value), shouldContainAll = true ) .map(_.data.getAbsolutePath) From 5d8565ffcc0f704d5145d049ffc4b35431d8ea2b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 17:54:06 +0200 Subject: [PATCH 080/268] scala-libs-wrapper is a modular fat jar --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index c9af5408a8f9..00f4d28e37d8 100644 --- a/build.sbt +++ b/build.sbt @@ -1081,6 +1081,7 @@ lazy val `scala-libs-wrapper` = project patchModules = patchModules.value ) }, + exportedModuleBin := assembly.value, // Ensure that `module-info.class` is included in the assembled Jar assembly := assembly .dependsOn(compileModuleInfo) From aa619937e074497778b440d9ffecbcf7d90e131a Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 17:54:28 +0200 Subject: [PATCH 081/268] Add some module deps to org.enso.runtime --- engine/runtime/src/main/java/module-info.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/runtime/src/main/java/module-info.java b/engine/runtime/src/main/java/module-info.java index 4ac9ff79edcc..fbd1b85a9b6d 100644 --- a/engine/runtime/src/main/java/module-info.java +++ b/engine/runtime/src/main/java/module-info.java @@ -5,11 +5,15 @@ requires org.enso.distribution; requires org.enso.editions; requires org.enso.engine.common; + requires static org.enso.interpreter.dsl; + requires static org.enso.persistance; requires org.enso.librarymanager; requires org.enso.lockmanager; requires org.enso.logging.utils; requires org.enso.pkg; + requires org.enso.polyglot.api; requires org.enso.runtime.compiler; + requires org.enso.runtime.parser; requires org.enso.syntax; requires org.enso.version.output; From c6ac4a38f4daecbc82ec1de4f45eb5244bae0217 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 18:03:22 +0200 Subject: [PATCH 082/268] engine-runner is not a fat jar --- build.sbt | 3 --- 1 file changed, 3 deletions(-) diff --git a/build.sbt b/build.sbt index 00f4d28e37d8..bbf54f901463 100644 --- a/build.sbt +++ b/build.sbt @@ -2714,7 +2714,6 @@ lazy val `engine-runner` = project } .dependsOn(NativeImage.additionalCp) .dependsOn(NativeImage.smallJdk) - .dependsOn(assembly) .dependsOn( buildEngineDistribution ) @@ -4081,9 +4080,7 @@ updateLibraryManifests := { val runtimeCp = (LocalProject("runtime") / Runtime / fullClasspath).value val fullCp = (runnerCp ++ runtimeCp).distinct val modulePath = componentModulesPaths.value - val runnerJar = (LocalProject("engine-runner") / assembly).value val javaOpts = Seq( - "-Denso.runner=" + runnerJar.getAbsolutePath, "--module-path", modulePath.map(_.getAbsolutePath).mkString(File.pathSeparator), "-m", From 1618e9b884e5c28be68539f9d2e0a3cf9bcef334 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 18:17:23 +0200 Subject: [PATCH 083/268] Rename package in logging-config --- docs/infrastructure/logging.md | 12 ++++----- .../java/org/enso/common/ContextFactory.java | 2 +- .../enso/launcher/cli/LauncherLogging.scala | 2 +- .../java/org/enso/runner/RunnerLogging.java | 2 +- .../src/main/java/module-info.java | 4 ++- .../{logger => logging}/config/Appender.java | 2 +- .../config/BaseConfig.java | 2 +- .../config/ConsoleAppender.java | 2 +- .../config/FileAppender.java | 2 +- .../{logger => logging}/config/LogToFile.java | 2 +- .../config/LoggerSetup.java | 2 +- .../config/LoggersLevels.java | 2 +- .../config/LoggingServer.java | 2 +- .../config/LoggingServiceConfig.java | 2 +- .../config/MemoryAppender.java | 2 +- .../config/MissingConfigurationField.java | 2 +- .../config/SentryAppender.java | 2 +- .../config/SocketAppender.java | 2 +- .../org/enso/logger/ApplicationFilter.java | 2 +- .../java/org/enso/logger/LogbackSetup.java | 25 +++++++++++-------- .../java/org/enso/logging/LoggingServer.java | 2 +- .../java/org/enso/logger/TestLogProvider.java | 2 +- .../java/org/enso/logging/LoggingService.java | 2 +- .../enso/logging/LoggingServiceManager.java | 2 +- .../org/enso/logging/LoggingSetupHelper.java | 4 +-- .../boot/command/CommandHandler.scala | 2 +- .../enso/projectmanager/BaseServerSpec.scala | 2 +- 27 files changed, 49 insertions(+), 42 deletions(-) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/Appender.java (98%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/BaseConfig.java (94%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/ConsoleAppender.java (97%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/FileAppender.java (99%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/LogToFile.java (97%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/LoggerSetup.java (99%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/LoggersLevels.java (99%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/LoggingServer.java (98%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/LoggingServiceConfig.java (99%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/MemoryAppender.java (97%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/MissingConfigurationField.java (84%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/SentryAppender.java (98%) rename lib/scala/logging-config/src/main/java/org/enso/{logger => logging}/config/SocketAppender.java (98%) diff --git a/docs/infrastructure/logging.md b/docs/infrastructure/logging.md index 21bebc68ad53..654217bd7e68 100644 --- a/docs/infrastructure/logging.md +++ b/docs/infrastructure/logging.md @@ -52,7 +52,7 @@ The configuration has two main sections: During component's setup, its `application.conf` config file is parsed. The config's keys and values are validated and, if correct, the parsed representation is available as an instance of -`org.enso.logger.config.LoggingServiceConfig` class. The class encapsulates the +`org.enso.logging.config.LoggingServiceConfig` class. The class encapsulates the `logging-service` section of `application.conf` file and is used to programmatically initialize loggers. @@ -191,7 +191,7 @@ File appender directs all log events to a log file: Rolling policy is a fully optional property of File Appender that would trigger automatic log rotation. All properties are optional with some reasonable -defaults if missing (defined in `org.enso.logger.config.FileAppender` config +defaults if missing (defined in `org.enso.logging.config.FileAppender` config class). #### Socket Appender @@ -281,9 +281,9 @@ The `org.slf4j.Logger` instances have to know where to send log events. This setting is typically performed once, when the service starts, and applies globally during its execution. Currently, it is not possible to dynamically change where log events are being stored. The main (abstract) class used for -setting up logging is `org.enso.logger.config.LoggerSetup`. An instance of that class -can be retrieved with the thread-safe `org.enso.logger.config.LoggerSetup.get` factory -method. `org.enso.logger.config.LoggerSetup` provides a number of `setupXYZAppender` +setting up logging is `org.enso.logging.config.LoggerSetup`. An instance of that class +can be retrieved with the thread-safe `org.enso.logging.config.LoggerSetup.get` factory +method. `org.enso.logging.config.LoggerSetup` provides a number of `setupXYZAppender` methods that will direct loggers to send log events to an `XYZ` appender. Setting a specific hard-coded appender programmatically should however be avoided by the users. Instead, one should invoke one of the overloaded `setup` @@ -292,7 +292,7 @@ configuration. ```java package foo; -import org.enso.logger.config.LoggerSetup; +import org.enso.logging.config.LoggerSetup; import org.slf4j.event.Level; public class MyService { diff --git a/engine/common/src/main/java/org/enso/common/ContextFactory.java b/engine/common/src/main/java/org/enso/common/ContextFactory.java index 45eb59d7d4ab..67a4d0f0a7d3 100644 --- a/engine/common/src/main/java/org/enso/common/ContextFactory.java +++ b/engine/common/src/main/java/org/enso/common/ContextFactory.java @@ -7,7 +7,7 @@ import org.enso.logger.Converter; import org.enso.logger.JulHandler; -import org.enso.logger.config.LoggerSetup; +import org.enso.logging.config.LoggerSetup; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.HostAccess; import org.graalvm.polyglot.io.MessageTransport; diff --git a/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala b/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala index 610394a650f1..7eceabde78be 100644 --- a/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala +++ b/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala @@ -2,9 +2,9 @@ package org.enso.launcher.cli import java.nio.file.Path import org.enso.launcher.distribution.DefaultManagers -import org.enso.logger.config.LoggerSetup import org.slf4j.event.Level import org.enso.logging.LoggingSetupHelper +import org.enso.logging.config.LoggerSetup import scala.concurrent.ExecutionContext.Implicits.global /** Manages setting up the logging service within the launcher. diff --git a/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java b/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java index 4141e3adc544..2b5cc0d1310d 100644 --- a/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java +++ b/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java @@ -4,7 +4,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import org.enso.logger.config.LoggerSetup; +import org.enso.logging.config.LoggerSetup; import org.enso.logger.masking.Masking; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/lib/scala/logging-config/src/main/java/module-info.java b/lib/scala/logging-config/src/main/java/module-info.java index a68492a69834..62964697245d 100644 --- a/lib/scala/logging-config/src/main/java/module-info.java +++ b/lib/scala/logging-config/src/main/java/module-info.java @@ -2,5 +2,7 @@ requires org.slf4j; requires typesafe.config; - exports org.enso.logger.config; + exports org.enso.logging.config; + + uses org.enso.logging.config.LoggerSetup; } diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/Appender.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/Appender.java similarity index 98% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/Appender.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/Appender.java index 3986a9d98275..84a5861732de 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/Appender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/Appender.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import com.typesafe.config.Config; import java.nio.file.Path; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/BaseConfig.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/BaseConfig.java similarity index 94% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/BaseConfig.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/BaseConfig.java index 10a56b3c5873..ba308c2d2205 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/BaseConfig.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/BaseConfig.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import java.util.Map; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/ConsoleAppender.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/ConsoleAppender.java similarity index 97% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/ConsoleAppender.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/ConsoleAppender.java index 1a4253080a10..acd217d3df2f 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/ConsoleAppender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/ConsoleAppender.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import com.typesafe.config.Config; import java.nio.file.Path; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/FileAppender.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/FileAppender.java similarity index 99% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/FileAppender.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/FileAppender.java index 36a3e862ff99..04bc46ee3958 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/FileAppender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/FileAppender.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import com.typesafe.config.Config; import java.nio.file.Path; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/LogToFile.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/LogToFile.java similarity index 97% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/LogToFile.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/LogToFile.java index ca2147ece1e7..e4a8c224bee1 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/LogToFile.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/LogToFile.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import com.typesafe.config.Config; import org.slf4j.event.Level; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggerSetup.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggerSetup.java similarity index 99% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggerSetup.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggerSetup.java index d23c4593cc3a..9aee8525b18c 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggerSetup.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggerSetup.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import java.nio.file.Path; import java.util.ServiceLoader; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggersLevels.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggersLevels.java similarity index 99% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggersLevels.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggersLevels.java index 530123a3d8b4..d87da9750bc1 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggersLevels.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggersLevels.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggingServer.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggingServer.java similarity index 98% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggingServer.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggingServer.java index 7a76b317ab40..9c0895b84c77 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggingServer.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggingServer.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import com.typesafe.config.Config; import java.util.HashMap; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggingServiceConfig.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggingServiceConfig.java similarity index 99% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggingServiceConfig.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggingServiceConfig.java index d5f69263311a..9a25afebeaee 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/LoggingServiceConfig.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/LoggingServiceConfig.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import com.typesafe.config.Config; import com.typesafe.config.ConfigException; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/MemoryAppender.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/MemoryAppender.java similarity index 97% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/MemoryAppender.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/MemoryAppender.java index f60b1d2881fc..132210e51326 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/MemoryAppender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/MemoryAppender.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import com.typesafe.config.Config; import java.nio.file.Path; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/MissingConfigurationField.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/MissingConfigurationField.java similarity index 84% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/MissingConfigurationField.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/MissingConfigurationField.java index 95749dd6d93c..b28f38dc64c9 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/MissingConfigurationField.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/MissingConfigurationField.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; public class MissingConfigurationField extends Exception { public MissingConfigurationField(String name) { diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/SentryAppender.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/SentryAppender.java similarity index 98% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/SentryAppender.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/SentryAppender.java index 8a19768f1233..6aa73dc5ea3e 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/SentryAppender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/SentryAppender.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import com.typesafe.config.Config; import java.nio.file.Path; diff --git a/lib/scala/logging-config/src/main/java/org/enso/logger/config/SocketAppender.java b/lib/scala/logging-config/src/main/java/org/enso/logging/config/SocketAppender.java similarity index 98% rename from lib/scala/logging-config/src/main/java/org/enso/logger/config/SocketAppender.java rename to lib/scala/logging-config/src/main/java/org/enso/logging/config/SocketAppender.java index 9ee8dc47844a..6a088783951e 100644 --- a/lib/scala/logging-config/src/main/java/org/enso/logger/config/SocketAppender.java +++ b/lib/scala/logging-config/src/main/java/org/enso/logging/config/SocketAppender.java @@ -1,4 +1,4 @@ -package org.enso.logger.config; +package org.enso.logging.config; import com.typesafe.config.Config; import org.slf4j.event.Level; diff --git a/lib/scala/logging-service-logback/src/main/java/org/enso/logger/ApplicationFilter.java b/lib/scala/logging-service-logback/src/main/java/org/enso/logger/ApplicationFilter.java index 49f7b6cfe792..5c1f0bf64116 100644 --- a/lib/scala/logging-service-logback/src/main/java/org/enso/logger/ApplicationFilter.java +++ b/lib/scala/logging-service-logback/src/main/java/org/enso/logger/ApplicationFilter.java @@ -4,7 +4,7 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.filter.Filter; import ch.qos.logback.core.spi.FilterReply; -import org.enso.logger.config.LoggersLevels; +import org.enso.logging.config.LoggersLevels; /** * An implementation of ch.qos.logback.core.filter.Filter that is created from configuration's and diff --git a/lib/scala/logging-service-logback/src/main/java/org/enso/logger/LogbackSetup.java b/lib/scala/logging-service-logback/src/main/java/org/enso/logger/LogbackSetup.java index 2e2f759e085b..63545ebe316f 100644 --- a/lib/scala/logging-service-logback/src/main/java/org/enso/logger/LogbackSetup.java +++ b/lib/scala/logging-service-logback/src/main/java/org/enso/logger/LogbackSetup.java @@ -22,7 +22,12 @@ import java.nio.file.Path; import java.time.LocalDate; import java.time.format.DateTimeFormatter; -import org.enso.logger.config.*; +import org.enso.logging.config.Appender; +import org.enso.logging.config.BaseConfig; +import org.enso.logging.config.LoggerSetup; +import org.enso.logging.config.LoggersLevels; +import org.enso.logging.config.LoggingServiceConfig; +import org.enso.logging.config.MissingConfigurationField; import org.slf4j.LoggerFactory; import org.slf4j.event.Level; @@ -126,7 +131,7 @@ public boolean setupSocketAppender(Level logLevel, String hostname, int port) { } LoggerAndContext env = contextInit(targetLogLevel, config, true); - org.enso.logger.config.SocketAppender appenderConfig = config.getSocketAppender(); + org.enso.logging.config.SocketAppender appenderConfig = config.getSocketAppender(); SocketAppender socketAppender = new SocketAppender(); socketAppender.setName("enso-socket"); @@ -145,9 +150,9 @@ public boolean setupSocketAppender(Level logLevel, String hostname, int port) { public boolean setupFileAppender(Level logLevel, Path logRoot, String logPrefix) { try { LoggerAndContext env = contextInit(logLevel, config, true); - org.enso.logger.config.FileAppender appenderConfig = config.getFileAppender(); + org.enso.logging.config.FileAppender appenderConfig = config.getFileAppender(); if (appenderConfig == null) { - throw new MissingConfigurationField(org.enso.logger.config.FileAppender.appenderName); + throw new MissingConfigurationField(org.enso.logging.config.FileAppender.appenderName); } final PatternLayoutEncoder encoder = new PatternLayoutEncoder(); encoder.setPattern(appenderConfig.getPattern()); @@ -169,7 +174,7 @@ public boolean setupFileAppender(Level logLevel, Path logRoot, String logPrefix) logRoot.toAbsolutePath() + File.separator + logPrefix + "-" + "%d{yyyy-MM-dd}"; } - org.enso.logger.config.FileAppender.RollingPolicy rollingPolicy = + org.enso.logging.config.FileAppender.RollingPolicy rollingPolicy = appenderConfig.getRollingPolicy(); SizeAndTimeBasedRollingPolicy logbackRollingPolicy = new SizeAndTimeBasedRollingPolicy(); logbackRollingPolicy.setContext(env.ctx); @@ -218,7 +223,7 @@ public boolean setupConsoleAppender(Level logLevel) { private ch.qos.logback.core.Appender getConsoleAppender( LoggerContext ctx, LoggingServiceConfig config) { - org.enso.logger.config.ConsoleAppender appenderConfig = config.getConsoleAppender(); + org.enso.logging.config.ConsoleAppender appenderConfig = config.getConsoleAppender(); final PatternLayoutEncoder encoder = new PatternLayoutEncoder(); try { if (appenderConfig != null) { @@ -242,10 +247,10 @@ private ch.qos.logback.core.Appender getConsoleAppender( @Override public boolean setupMemoryAppender(Level logLevel) { LoggerAndContext env = contextInit(logLevel, config, !logToFileEnabled()); - org.enso.logger.config.MemoryAppender appenderConfig = config.getMemoryAppender(); + org.enso.logging.config.MemoryAppender appenderConfig = config.getMemoryAppender(); ch.qos.logback.core.Appender target; switch (appenderConfig.getTarget()) { - case org.enso.logger.config.ConsoleAppender.appenderName: + case org.enso.logging.config.ConsoleAppender.appenderName: target = getConsoleAppender(env.ctx, config); break; default: @@ -268,9 +273,9 @@ public boolean setupSentryAppender(Level logLevel, Path logRoot) { try { LoggerAndContext env = contextInit(logLevel, config, !logToFileEnabled()); - org.enso.logger.config.SentryAppender appenderConfig = config.getSentryAppender(); + org.enso.logging.config.SentryAppender appenderConfig = config.getSentryAppender(); if (appenderConfig == null) { - throw new MissingConfigurationField(org.enso.logger.config.SentryAppender.appenderName); + throw new MissingConfigurationField(org.enso.logging.config.SentryAppender.appenderName); } SentryAppender appender = new SentryAppender(); SentryOptions opts = new SentryOptions(); diff --git a/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java index a58de6ffd6d7..7c1c4e54710b 100644 --- a/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java +++ b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java @@ -6,7 +6,7 @@ import java.net.URISyntaxException; import java.nio.file.Path; import org.enso.logger.LogbackSetup; -import org.enso.logger.config.BaseConfig; +import org.enso.logging.config.BaseConfig; import org.slf4j.event.Level; class LoggingServer extends LoggingService { diff --git a/lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java b/lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java index f8ccb63e9294..0be0d02f7f6a 100644 --- a/lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java +++ b/lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java @@ -2,7 +2,7 @@ import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.spi.LogbackServiceProvider; -import org.enso.logger.config.MissingConfigurationField; +import org.enso.logging.config.MissingConfigurationField; import org.slf4j.ILoggerFactory; import org.slf4j.IMarkerFactory; import org.slf4j.spi.MDCAdapter; diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingService.java b/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingService.java index e2b75592a2b9..4f1ecfa6e3d0 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingService.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingService.java @@ -1,7 +1,7 @@ package org.enso.logging; import java.nio.file.Path; -import org.enso.logger.config.BaseConfig; +import org.enso.logging.config.BaseConfig; import org.slf4j.event.Level; /** diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceManager.java b/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceManager.java index 16733df855ad..ea8137fe0329 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceManager.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceManager.java @@ -2,7 +2,7 @@ import java.net.URI; import java.nio.file.Path; -import org.enso.logger.config.LoggingServer; +import org.enso.logging.config.LoggingServer; import org.slf4j.event.Level; import scala.concurrent.ExecutionContext; import scala.concurrent.Future; diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java b/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java index 24ce945db4cc..5a22db6dd560 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java @@ -4,8 +4,8 @@ import java.nio.file.Path; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.enso.logger.config.LoggerSetup; -import org.enso.logger.config.MissingConfigurationField; +import org.enso.logging.config.LoggerSetup; +import org.enso.logging.config.MissingConfigurationField; import org.enso.logger.masking.Masking; import org.slf4j.event.Level; import scala.Option; diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/command/CommandHandler.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/command/CommandHandler.scala index 4798b4f9a575..304391a252f6 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/command/CommandHandler.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/command/CommandHandler.scala @@ -1,7 +1,7 @@ package org.enso.projectmanager.boot.command import org.enso.jsonrpc.{Id, JsonProtocol, Protocol} -import org.enso.logger.config.LoggerSetup +import org.enso.logging.config.LoggerSetup import org.enso.projectmanager.boot.Globals.SuccessExitCode import org.enso.projectmanager.requesthandler.FailureMapper import zio.{Console, ExitCode, ZAny, ZIO} diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/BaseServerSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/BaseServerSpec.scala index 2cb4ca47e99f..b757ebba2dfa 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/BaseServerSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/BaseServerSpec.scala @@ -16,7 +16,7 @@ import org.enso.editions.Editions import org.enso.cli.OS import org.enso.jsonrpc.test.JsonRpcServerTestKit import org.enso.jsonrpc.{ClientControllerFactory, ProtocolFactory} -import org.enso.logger.config.LoggerSetup +import org.enso.logging.config.LoggerSetup import org.enso.pkg.{Config, PackageManager} import org.enso.projectmanager.boot.Globals.{ConfigFilename, ConfigNamespace} import org.enso.projectmanager.boot.configuration._ From 56c9fe8ce625e59924ce9e6e51d49ef0b1c66dfe Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 18:18:39 +0200 Subject: [PATCH 084/268] Rename package in logging-service --- docs/infrastructure/logging.md | 4 ++-- .../libraries/handler/LibraryPublishHandler.scala | 2 +- .../main/scala/org/enso/launcher/cli/LauncherLogging.scala | 2 +- .../src/main/java/org/enso/EngineRunnerBootLoader.java | 1 + .../java/org/enso/logging/LogbackLoggingServiceFactory.java | 2 ++ .../src/main/java/org/enso/logging/LoggingServer.java | 1 + .../logging/{ => service}/LoggerInitializationFailed.java | 2 +- .../java/org/enso/logging/{ => service}/LoggingService.java | 2 +- .../logging/{ => service}/LoggingServiceAlreadySetup.java | 2 +- .../org/enso/logging/{ => service}/LoggingServiceFactory.java | 2 +- .../org/enso/logging/{ => service}/LoggingServiceManager.java | 2 +- .../org/enso/logging/{ => service}/LoggingSetupHelper.java | 2 +- .../src/main/scala/org/enso/projectmanager/boot/Logging.scala | 2 +- .../languageserver/ExecutorWithUnlimitedPool.scala | 2 +- 14 files changed, 16 insertions(+), 12 deletions(-) rename lib/scala/logging-service/src/main/java/org/enso/logging/{ => service}/LoggerInitializationFailed.java (82%) rename lib/scala/logging-service/src/main/java/org/enso/logging/{ => service}/LoggingService.java (96%) rename lib/scala/logging-service/src/main/java/org/enso/logging/{ => service}/LoggingServiceAlreadySetup.java (82%) rename lib/scala/logging-service/src/main/java/org/enso/logging/{ => service}/LoggingServiceFactory.java (96%) rename lib/scala/logging-service/src/main/java/org/enso/logging/{ => service}/LoggingServiceManager.java (98%) rename lib/scala/logging-service/src/main/java/org/enso/logging/{ => service}/LoggingSetupHelper.java (99%) diff --git a/docs/infrastructure/logging.md b/docs/infrastructure/logging.md index 654217bd7e68..36c5e678823a 100644 --- a/docs/infrastructure/logging.md +++ b/docs/infrastructure/logging.md @@ -308,12 +308,12 @@ public class MyService { } ``` -`org.enso.logging.LoggingSetupHelper` class was introduced to help with the most +`org.enso.logging.service.LoggingSetupHelper` class was introduced to help with the most common use cases - establishing a file-based logging in the Enso's dedicated directories or connecting to an existing logging server once it starts accepting connections. That is why services don't call `LoggerSetup` directly but instead provide a service-specific implementation of -`org.enso.logging.LoggingSetupHelper`. `LoggingSetupHelper` and `LoggerSetup` +`org.enso.logging.service.LoggingSetupHelper`. `LoggingSetupHelper` and `LoggerSetup` provide `teardown` methods to properly dispose of log events. ### Log Masking diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/libraries/handler/LibraryPublishHandler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/libraries/handler/LibraryPublishHandler.scala index 3396430bfa14..84660be65e5f 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/libraries/handler/LibraryPublishHandler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/libraries/handler/LibraryPublishHandler.scala @@ -17,7 +17,7 @@ import org.enso.languageserver.libraries.BlockingOperation import org.enso.languageserver.requesthandler.RequestTimeout import org.enso.languageserver.util.UnhandledLogging import org.enso.libraryupload.{auth, LibraryUploader} -import org.enso.logging.LoggingServiceManager +import org.enso.logging.service.LoggingServiceManager import scala.concurrent.Future import scala.concurrent.duration.FiniteDuration diff --git a/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala b/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala index 7eceabde78be..4d5f590256ac 100644 --- a/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala +++ b/engine/launcher/src/main/scala/org/enso/launcher/cli/LauncherLogging.scala @@ -3,8 +3,8 @@ package org.enso.launcher.cli import java.nio.file.Path import org.enso.launcher.distribution.DefaultManagers import org.slf4j.event.Level -import org.enso.logging.LoggingSetupHelper import org.enso.logging.config.LoggerSetup +import org.enso.logging.service.LoggingSetupHelper import scala.concurrent.ExecutionContext.Implicits.global /** Manages setting up the logging service within the launcher. diff --git a/engine/runtime/src/main/java/org/enso/EngineRunnerBootLoader.java b/engine/runtime/src/main/java/org/enso/EngineRunnerBootLoader.java index 24ae4899ef8c..0a3eefd36e66 100644 --- a/engine/runtime/src/main/java/org/enso/EngineRunnerBootLoader.java +++ b/engine/runtime/src/main/java/org/enso/EngineRunnerBootLoader.java @@ -8,6 +8,7 @@ import java.nio.file.Path; import java.util.Enumeration; +// TODO: Remove /** * {@code runner.jar} is a fat jar containing all the dependencies for engine-runner, however, it * cannot be put on module-path, neither class-path, because it cannot be used in conjunction with diff --git a/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LogbackLoggingServiceFactory.java b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LogbackLoggingServiceFactory.java index 495031a6151f..56d79ea7b862 100644 --- a/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LogbackLoggingServiceFactory.java +++ b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LogbackLoggingServiceFactory.java @@ -1,6 +1,8 @@ package org.enso.logging; import java.net.URI; +import org.enso.logging.service.LoggingService; +import org.enso.logging.service.LoggingServiceFactory; @org.openide.util.lookup.ServiceProvider(service = LoggingServiceFactory.class) public class LogbackLoggingServiceFactory extends LoggingServiceFactory { diff --git a/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java index 7c1c4e54710b..b4cc81fc9571 100644 --- a/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java +++ b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java @@ -7,6 +7,7 @@ import java.nio.file.Path; import org.enso.logger.LogbackSetup; import org.enso.logging.config.BaseConfig; +import org.enso.logging.service.LoggingService; import org.slf4j.event.Level; class LoggingServer extends LoggingService { diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggerInitializationFailed.java b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggerInitializationFailed.java similarity index 82% rename from lib/scala/logging-service/src/main/java/org/enso/logging/LoggerInitializationFailed.java rename to lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggerInitializationFailed.java index 94da192c6f74..0e5791c0ea1f 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggerInitializationFailed.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggerInitializationFailed.java @@ -1,4 +1,4 @@ -package org.enso.logging; +package org.enso.logging.service; public class LoggerInitializationFailed extends RuntimeException { public LoggerInitializationFailed() { diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingService.java b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingService.java similarity index 96% rename from lib/scala/logging-service/src/main/java/org/enso/logging/LoggingService.java rename to lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingService.java index 4f1ecfa6e3d0..f656bc106875 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingService.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingService.java @@ -1,4 +1,4 @@ -package org.enso.logging; +package org.enso.logging.service; import java.nio.file.Path; import org.enso.logging.config.BaseConfig; diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceAlreadySetup.java b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingServiceAlreadySetup.java similarity index 82% rename from lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceAlreadySetup.java rename to lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingServiceAlreadySetup.java index 159b8191e012..2d73dc5e1e0a 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceAlreadySetup.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingServiceAlreadySetup.java @@ -1,4 +1,4 @@ -package org.enso.logging; +package org.enso.logging.service; public class LoggingServiceAlreadySetup extends RuntimeException { public LoggingServiceAlreadySetup() { diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceFactory.java b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingServiceFactory.java similarity index 96% rename from lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceFactory.java rename to lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingServiceFactory.java index 97513a8fa80c..590a5fa99e85 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceFactory.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingServiceFactory.java @@ -1,4 +1,4 @@ -package org.enso.logging; +package org.enso.logging.service; import java.net.URI; import java.util.ServiceLoader; diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceManager.java b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingServiceManager.java similarity index 98% rename from lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceManager.java rename to lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingServiceManager.java index ea8137fe0329..01ea2615cbc6 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingServiceManager.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingServiceManager.java @@ -1,4 +1,4 @@ -package org.enso.logging; +package org.enso.logging.service; import java.net.URI; import java.nio.file.Path; diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingSetupHelper.java similarity index 99% rename from lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java rename to lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingSetupHelper.java index 5a22db6dd560..4bd39b18d36e 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/LoggingSetupHelper.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingSetupHelper.java @@ -1,4 +1,4 @@ -package org.enso.logging; +package org.enso.logging.service; import java.net.URI; import java.nio.file.Path; diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/Logging.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/Logging.scala index a2b7b649a18f..4577e1480da1 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/Logging.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/Logging.scala @@ -1,5 +1,6 @@ package org.enso.projectmanager.boot +import org.enso.logging.service.LoggingSetupHelper import java.nio.file.Path import org.enso.projectmanager.service.LoggingServiceDescriptor import org.enso.projectmanager.versionmanagement.DefaultDistributionConfiguration @@ -8,7 +9,6 @@ import org.slf4j.event.Level import java.net.URI import scala.concurrent.Future -import org.enso.logging.LoggingSetupHelper import scala.concurrent.ExecutionContext.Implicits.global /** A helper for setting up the logging service in the Project Manager. */ diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ExecutorWithUnlimitedPool.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ExecutorWithUnlimitedPool.scala index 790b3c021581..d77361ae0615 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ExecutorWithUnlimitedPool.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/ExecutorWithUnlimitedPool.scala @@ -4,7 +4,7 @@ import akka.actor.ActorRef import com.typesafe.scalalogging.Logger import org.apache.commons.lang3.concurrent.BasicThreadFactory import org.enso.logger.masking.Masking -import org.enso.logging.LoggingServiceManager +import org.enso.logging.service.LoggingServiceManager import org.enso.projectmanager.boot.Cli.{PROFILING_PATH, PROFILING_TIME} import org.enso.projectmanager.service.versionmanagement.RuntimeVersionManagerFactory import org.enso.runtimeversionmanager.config.GlobalRunnerConfigurationManager From f6b529d3772a86d862399f0b3f315923c0047ee1 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 22 Aug 2024 18:21:28 +0200 Subject: [PATCH 085/268] Rename package in logging-service-logback --- .../{logger => logging/service/logback}/ApplicationFilter.java | 2 +- .../{ => service/logback}/LogbackLoggingServiceFactory.java | 2 +- .../enso/{logger => logging/service/logback}/LogbackSetup.java | 2 +- .../org/enso/logging/{ => service/logback}/LoggingServer.java | 3 +-- .../{logger => logging/service/logback}/MemoryAppender.java | 2 +- .../src/test/java/org/enso/logger/TestLogProvider.java | 1 + .../src/test/scala/org/enso/logger/ReportLogsOnFailure.scala | 1 + 7 files changed, 7 insertions(+), 6 deletions(-) rename lib/scala/logging-service-logback/src/main/java/org/enso/{logger => logging/service/logback}/ApplicationFilter.java (98%) rename lib/scala/logging-service-logback/src/main/java/org/enso/logging/{ => service/logback}/LogbackLoggingServiceFactory.java (90%) rename lib/scala/logging-service-logback/src/main/java/org/enso/{logger => logging/service/logback}/LogbackSetup.java (99%) rename lib/scala/logging-service-logback/src/main/java/org/enso/logging/{ => service/logback}/LoggingServer.java (94%) rename lib/scala/logging-service-logback/src/main/java/org/enso/{logger => logging/service/logback}/MemoryAppender.java (96%) diff --git a/lib/scala/logging-service-logback/src/main/java/org/enso/logger/ApplicationFilter.java b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/ApplicationFilter.java similarity index 98% rename from lib/scala/logging-service-logback/src/main/java/org/enso/logger/ApplicationFilter.java rename to lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/ApplicationFilter.java index 5c1f0bf64116..f47b282a6cc3 100644 --- a/lib/scala/logging-service-logback/src/main/java/org/enso/logger/ApplicationFilter.java +++ b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/ApplicationFilter.java @@ -1,4 +1,4 @@ -package org.enso.logger; +package org.enso.logging.service.logback; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.spi.ILoggingEvent; diff --git a/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LogbackLoggingServiceFactory.java b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/LogbackLoggingServiceFactory.java similarity index 90% rename from lib/scala/logging-service-logback/src/main/java/org/enso/logging/LogbackLoggingServiceFactory.java rename to lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/LogbackLoggingServiceFactory.java index 56d79ea7b862..1e5c7cf375ed 100644 --- a/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LogbackLoggingServiceFactory.java +++ b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/LogbackLoggingServiceFactory.java @@ -1,4 +1,4 @@ -package org.enso.logging; +package org.enso.logging.service.logback; import java.net.URI; import org.enso.logging.service.LoggingService; diff --git a/lib/scala/logging-service-logback/src/main/java/org/enso/logger/LogbackSetup.java b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/LogbackSetup.java similarity index 99% rename from lib/scala/logging-service-logback/src/main/java/org/enso/logger/LogbackSetup.java rename to lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/LogbackSetup.java index 63545ebe316f..3bfa08be31fc 100644 --- a/lib/scala/logging-service-logback/src/main/java/org/enso/logger/LogbackSetup.java +++ b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/LogbackSetup.java @@ -1,4 +1,4 @@ -package org.enso.logger; +package org.enso.logging.service.logback; import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; diff --git a/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/LoggingServer.java similarity index 94% rename from lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java rename to lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/LoggingServer.java index b4cc81fc9571..8427ed37181f 100644 --- a/lib/scala/logging-service-logback/src/main/java/org/enso/logging/LoggingServer.java +++ b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/LoggingServer.java @@ -1,11 +1,10 @@ -package org.enso.logging; +package org.enso.logging.service.logback; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.net.SimpleSocketServer; import java.net.URI; import java.net.URISyntaxException; import java.nio.file.Path; -import org.enso.logger.LogbackSetup; import org.enso.logging.config.BaseConfig; import org.enso.logging.service.LoggingService; import org.slf4j.event.Level; diff --git a/lib/scala/logging-service-logback/src/main/java/org/enso/logger/MemoryAppender.java b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/MemoryAppender.java similarity index 96% rename from lib/scala/logging-service-logback/src/main/java/org/enso/logger/MemoryAppender.java rename to lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/MemoryAppender.java index fd05de121622..f4660812137c 100644 --- a/lib/scala/logging-service-logback/src/main/java/org/enso/logger/MemoryAppender.java +++ b/lib/scala/logging-service-logback/src/main/java/org/enso/logging/service/logback/MemoryAppender.java @@ -1,4 +1,4 @@ -package org.enso.logger; +package org.enso.logging.service.logback; import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.Appender; diff --git a/lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java b/lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java index 0be0d02f7f6a..eecc6afd0587 100644 --- a/lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java +++ b/lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java @@ -3,6 +3,7 @@ import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.spi.LogbackServiceProvider; import org.enso.logging.config.MissingConfigurationField; +import org.enso.logging.service.logback.LogbackSetup; import org.slf4j.ILoggerFactory; import org.slf4j.IMarkerFactory; import org.slf4j.spi.MDCAdapter; diff --git a/lib/scala/logging-service-logback/src/test/scala/org/enso/logger/ReportLogsOnFailure.scala b/lib/scala/logging-service-logback/src/test/scala/org/enso/logger/ReportLogsOnFailure.scala index 06c123d38382..2d7fa70757e0 100644 --- a/lib/scala/logging-service-logback/src/test/scala/org/enso/logger/ReportLogsOnFailure.scala +++ b/lib/scala/logging-service-logback/src/test/scala/org/enso/logger/ReportLogsOnFailure.scala @@ -2,6 +2,7 @@ package org.enso.logger import ch.qos.logback.classic.spi.ILoggingEvent import ch.qos.logback.core.Appender +import org.enso.logging.service.logback.MemoryAppender import org.scalatest.{Args, Failed, Outcome, Status, TestSuite} import org.slf4j.{Logger, LoggerFactory} From 0e736cbed134f2c5be33481e6439a02a77b64305 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 23 Aug 2024 11:12:11 +0200 Subject: [PATCH 086/268] Fix dependencies of exportedModuleBin task --- project/JPMSPlugin.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 783b4a68e02c..8c60a8007510 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -152,8 +152,9 @@ object JPMSPlugin extends AutoPlugin { targetClassDir }, exportedModuleBin := { - exportedModule.value - (Compile / packageBin).value + (Compile / packageBin) + .dependsOn(exportedModule) + .value }, patchModules := Map.empty, addExports := Map.empty, From 42fe73646e953b1af22101a0154e646d291fe6fc Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 23 Aug 2024 13:00:19 +0200 Subject: [PATCH 087/268] Mixed projects have own compileJava task this task does not compile only module-info.java but all the java sources. So that we can see errors more easily. When only module-info.java is compiled, the only errors that we can see are that we did not include some modules on module-path. --- project/JPMSPlugin.scala | 2 +- project/JPMSUtils.scala | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 8c60a8007510..0b0592aca199 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -175,7 +175,7 @@ object JPMSPlugin extends AutoPlugin { ) } JPMSUtils - .compileModuleInfo() + .compileJava() .dependsOn(Compile / compile) .value } else { diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index c9b729a466e5..21d658cc38b9 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -5,6 +5,7 @@ import sbt.internal.inc.{CompileOutput, PlainVirtualFile} import sbt.util.CacheStore import sbtassembly.Assembly.{Dependency, JarEntry, Project} import sbtassembly.{CustomMergeStrategy, MergeStrategy} +import xsbti.VirtualFile import xsbti.compile.IncToolOptionsUtil import java.io.File @@ -325,6 +326,65 @@ object JPMSUtils { } } + /** + * Compile everything including module-info.java in mixed projects. + * @return + */ + def compileJava(): Def.Initialize[Task[Unit]] = Def.task { + val moduleInfo = (Compile / javaSource).value / "module-info.java" + val projName = moduleName.value + val log = streams.value.log + val incToolOpts = IncToolOptionsUtil.defaultIncToolOptions() + val reporter = (Compile / compile / bspReporter).value + val output = CompileOutput((Compile / classDirectory).value.toPath) + val outputPath: Path = output.getSingleOutputAsPath.get() + val mp = (Compile / modulePath).value + val baseJavacOpts = (Compile / javacOptions).value + val cp = (Compile / fullClasspath).value + val javaCompiler = + (Compile / compile / compilers).value.javaTools.javac() + val cache = + streams.value.cacheStoreFactory.make("java-src-" + projName) + val otherJavaSources = (Compile / unmanagedSources) + .value + .filter(_.name.endsWith(".java")) + val allJavaSources = Set(moduleInfo) ++ otherJavaSources.toSet + + Tracked.diffInputs(cache, FileInfo.lastModified)( + allJavaSources + ) { changeReport => + if (changeReport.modified.nonEmpty || changeReport.added.nonEmpty) { + log.info(s"[JPMSUtils/$projName] Compiling ${allJavaSources.size} Java sources, including module-info.java") + val allOpts = baseJavacOpts ++ Seq( + "--class-path", + cp.map(_.data.getAbsolutePath).mkString(File.pathSeparator), + "--module-path", + mp.map(_.getAbsolutePath).mkString(File.pathSeparator), + "-d", + outputPath.toAbsolutePath.toString + ) + log.debug(s"javac options: $allOpts") + val virtualFiles: Array[VirtualFile] = allJavaSources + .map(file => PlainVirtualFile(file.toPath)) + .toArray + val succ = javaCompiler.run( + virtualFiles, + allOpts.toArray, + output, + incToolOpts, + reporter, + log + ) + if (!succ) { + val msg = s"Compilation of ${moduleInfo} failed" + log.error(s"javac options: $allOpts") + log.error(msg) + throw new IllegalStateException(msg) + } + } + } + } + /** Copies all classes from all the dependencies `classes` directories into the target directory. * @param sourceClassesDir Directory from where the classes will be copied. * @param output Target directory where all the classes from all the dependencies From b508d00b79e736c453684135b449b0e50160ae2b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 23 Aug 2024 13:00:46 +0200 Subject: [PATCH 088/268] Fix definition of exportedModule task. --- project/JPMSPlugin.scala | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 0b0592aca199..ab7d8b5b8034 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -134,23 +134,26 @@ object JPMSPlugin extends AutoPlugin { moduleName.value ) }, - exportedModule := { - // Ensure module-info.java is compiled - compileModuleInfo.value - val logger = streams.value.log - val projName = moduleName.value - val targetClassDir = (Compile / exportedProducts).value + // Returns the reference to target/classes directory and ensures that module-info + // is compiled and present in the target directory. + exportedModule := Def.task { + val targetClassDir = (Compile / exportedProducts) + .value .map(_.data) .head + val logger = streams.value.log + val projName = moduleName.value if (!isModule(targetClassDir)) { logger.error( s"[JPMSPlugin/$projName] The target classes directory ${targetClassDir.getAbsolutePath} is not " + - "a module - it does not contain module-info.class. Make sure the `compileModuleInfo` task " + - "is set correctly." + "a module - it does not contain module-info.class. Make sure the `compileModuleInfo` task " + + "is set correctly." ) } targetClassDir - }, + } + .dependsOn(compileModuleInfo) + .value, exportedModuleBin := { (Compile / packageBin) .dependsOn(exportedModule) From e814ccc02c60313cc0704f3581e56db64f00c18c Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 23 Aug 2024 13:01:27 +0200 Subject: [PATCH 089/268] Remove usages of non-existing buildInfo and replace it with BuildVersion --- .../published/repository/DummyRepository.scala | 3 ++- .../org/enso/runtimeversionmanager/CurrentVersion.scala | 8 ++++---- .../enso/runtimeversionmanager/components/Manifest.scala | 1 - .../releases/testing/TestArchivePackager.scala | 3 ++- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/DummyRepository.scala b/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/DummyRepository.scala index f1e6d08945e6..7c99813c91c3 100644 --- a/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/DummyRepository.scala +++ b/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/DummyRepository.scala @@ -8,6 +8,7 @@ import org.enso.editions.Editions.RawEdition import org.enso.editions.{Editions, LibraryName} import org.enso.pkg.{Package, PackageManager} import org.enso.process.WrappedProcess +import org.enso.version.BuildVersion import org.enso.yaml.YamlHelper import java.io.File @@ -125,7 +126,7 @@ abstract class DummyRepository(toolsRootDirectory: Path) { */ def createEdition(repoUrl: String): RawEdition = { Editions.Raw.Edition( - parent = Some(buildinfo.Info.currentEdition), + parent = Some(BuildVersion.currentEdition), repositories = Map(repoName -> Editions.Repository(repoName, repoUrl)), libraries = Map.from(libraries.map { lib => lib.libraryName -> Editions.Raw diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/CurrentVersion.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/CurrentVersion.scala index ec0b7988847e..49eb82d6795d 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/CurrentVersion.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/CurrentVersion.scala @@ -1,8 +1,8 @@ package org.enso.runtimeversionmanager -import buildinfo.Info import com.typesafe.scalalogging.Logger import org.enso.semver.SemVer +import org.enso.version.BuildVersion /** Helper object that allows to get the current application version. * @@ -12,12 +12,12 @@ import org.enso.semver.SemVer object CurrentVersion { private var currentVersion: SemVer = - SemVer.parse(Info.ensoVersion).getOrElse { + SemVer.parse(BuildVersion.ensoVersion).getOrElse { throw new IllegalStateException("Cannot parse the built-in version.") } private val defaultDevEnsoVersion: SemVer = - SemVer.parse(Info.defaultDevEnsoVersion).getOrElse { + SemVer.parse(BuildVersion.defaultDevEnsoVersion).getOrElse { throw new IllegalStateException("Cannot parse the built-in dev version.") } @@ -36,7 +36,7 @@ object CurrentVersion { * calls to [[version]]. */ def internalOverrideVersion(newVersion: SemVer): Unit = - if (Info.isRelease) + if (BuildVersion.isRelease) throw new IllegalStateException( "Internal testing function internalOverrideVersion used in a " + "release build." diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Manifest.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Manifest.scala index 3c9a5859b8e1..79ab174fa4d2 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Manifest.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Manifest.scala @@ -2,7 +2,6 @@ package org.enso.runtimeversionmanager.components import java.io.{FileReader, StringReader} import java.nio.file.Path -import org.enso import org.enso.semver.SemVer import org.enso.cli.OS import org.enso.semver.SemVerYaml._ diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/releases/testing/TestArchivePackager.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/releases/testing/TestArchivePackager.scala index d9678421c179..7f75e9f8571e 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/releases/testing/TestArchivePackager.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/releases/testing/TestArchivePackager.scala @@ -2,6 +2,7 @@ package org.enso.runtimeversionmanager.releases.testing import org.enso.cli.OS import org.enso.distribution.FileSystem +import org.enso.version.BuildVersion import java.nio.file.Path import scala.sys.process.Process @@ -16,7 +17,7 @@ object TestArchivePackager { * workflow. */ def packArchive(source: Path, destination: Path): Unit = { - if (buildinfo.Info.isRelease) + if (BuildVersion.isRelease) throw new IllegalStateException( "Internal TestArchivePackager called in release mode." ) From 4e78e46391598a2e9d2c1789a2bf84b808704e31 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 23 Aug 2024 14:11:13 +0200 Subject: [PATCH 090/268] Fix some dependencies of org.enso.runtime module --- build.sbt | 60 +++++++++++++++++-- .../src/main/java/module-info.java | 2 + .../src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 7 +++ .../src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 11 ++++ engine/runtime/src/main/java/module-info.java | 4 ++ .../src/main/java/module-info.java | 5 ++ .../src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 15 +++++ .../src/main/java/module-info.java | 7 +++ lib/scala/pkg/src/main/java/module-info.java | 1 + lib/scala/yaml/src/main/java/module-info.java | 2 + 14 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 engine/runtime-suggestions/src/main/java/module-info.java create mode 100644 lib/scala/common-polyglot-core-utils/src/main/java/module-info.java create mode 100644 lib/scala/logging-service-logback/src/main/java/module-info.java create mode 100644 lib/scala/logging-service/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index bbf54f901463..660fb5c62e36 100644 --- a/build.sbt +++ b/build.sbt @@ -633,7 +633,9 @@ lazy val componentModulesPaths = "org.slf4j" % "slf4j-api" % slf4jVersion, "ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-core" % logbackClassicVersion, - "com.ibm.icu" % "icu4j" % icuVersion + "com.ibm.icu" % "icu4j" % icuVersion, + "io.sentry" % "sentry-logback" % "6.28.0", + "io.sentry" % "sentry" % "6.28.0" ) val thirdPartyMods = JPMSUtils.filterModulesFromClasspath( fullCp, @@ -667,6 +669,8 @@ lazy val componentModulesPaths = (`library-manager` / exportedModuleBin).value, (`logging-config` / exportedModuleBin).value, (`logging-utils` / exportedModuleBin).value, + (`logging-service` / exportedModuleBin).value, + (`logging-service-logback` / exportedModuleBin).value, (`pkg` / exportedModuleBin).value, (`refactoring-utils` / exportedModuleBin).value, (`semver` / exportedModuleBin).value, @@ -950,6 +954,7 @@ lazy val `logging-utils` = project lazy val `logging-service` = project .in(file("lib/scala/logging-service")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, @@ -958,6 +963,14 @@ lazy val `logging-service` = project "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe" % "config" % typesafeConfigVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test + ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + ), + internalModuleDependencies := Seq( + (`logging-config` / exportedModule).value, + (`logging-utils` / exportedModule).value, ) ) .dependsOn(`logging-utils`) @@ -982,6 +995,7 @@ lazy val `logging-config` = project lazy val `logging-service-logback` = project .in(file("lib/scala/logging-service-logback")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, @@ -992,7 +1006,19 @@ lazy val `logging-service-logback` = project "io.sentry" % "sentry" % "6.28.0", "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" - ) ++ logbackPkg + ) ++ logbackPkg, + moduleDependencies := Seq( + "org.slf4j" % "slf4j-api" % slf4jVersion, + "io.sentry" % "sentry-logback" % "6.28.0", + "io.sentry" % "sentry" % "6.28.0", + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided", + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion + ), + internalModuleDependencies := Seq( + (`logging-service` / exportedModule).value, + (`logging-config` / exportedModule).value, + ) ) .dependsOn(`logging-config`) .dependsOn(`logging-service`) @@ -1701,7 +1727,8 @@ lazy val `polyglot-api` = project ), internalModuleDependencies := Seq( (`scala-libs-wrapper` / exportedModule).value, - (`engine-common` / exportedModule).value + (`engine-common` / exportedModule).value, + (`logging-utils` / exportedModule).value, ), GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task @@ -2080,14 +2107,17 @@ lazy val runtime = (project in file("engine/runtime")) (`logging-utils` / exportedModule).value, (`runtime-compiler` / exportedModule).value, (`runtime-parser` / exportedModule).value, + (`runtime-suggestions` / exportedModule).value, (`polyglot-api` / exportedModule).value, + (`common-polyglot-core-utils` / exportedModule).value, (`pkg` / exportedModule).value, (`cli` / exportedModule).value, (`editions` / exportedModule).value, (`syntax-rust-definition` / exportedModule).value, (`version-output` / exportedModule).value, (`interpreter-dsl` / exportedModule).value, - (`persistance` / exportedModule).value + (`persistance` / exportedModule).value, + (`text-buffer` / exportedModule).value, ) ) .settings( @@ -2320,7 +2350,10 @@ lazy val `runtime-compiler` = internalModuleDependencies := Seq( (`engine-common` / exportedModule).value, (`pkg` / exportedModule).value, - (`runtime-parser` / exportedModule).value + (`runtime-parser` / exportedModule).value, + (`syntax-rust-definition` / exportedModule).value, + (`persistance` / exportedModule).value, + (`editions` / exportedModule).value, ) ) .dependsOn(`runtime-parser`) @@ -2331,6 +2364,7 @@ lazy val `runtime-compiler` = lazy val `runtime-suggestions` = (project in file("engine/runtime-suggestions")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, (Test / fork) := true, @@ -2339,6 +2373,17 @@ lazy val `runtime-suggestions` = "com.github.sbt" % "junit-interface" % junitIfVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" + ), + excludeFilter := excludeFilter.value || "module-info.java", + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + ), + internalModuleDependencies := Seq( + (`pkg` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + (`runtime-compiler` / exportedModule).value, + (`runtime-parser` / exportedModule).value, + (`text-buffer` / exportedModule).value ) ) .dependsOn(`runtime-compiler`) @@ -2526,6 +2571,7 @@ lazy val `engine-runner-common` = project ), internalModuleDependencies := Seq( (`pkg` / exportedModule).value, + (`polyglot-api` / exportedModule).value, (`editions` / exportedModule).value, (`engine-common` / exportedModule).value, (`library-manager` / exportedModule).value @@ -3358,6 +3404,7 @@ lazy val `std-base` = project lazy val `common-polyglot-core-utils` = project .in(file("lib/scala/common-polyglot-core-utils")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, autoScalaLibrary := false, @@ -3366,6 +3413,9 @@ lazy val `common-polyglot-core-utils` = project libraryDependencies ++= Seq( "com.ibm.icu" % "icu4j" % icuVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided" + ), + moduleDependencies := Seq( + "com.ibm.icu" % "icu4j" % icuVersion, ) ) diff --git a/engine/polyglot-api/src/main/java/module-info.java b/engine/polyglot-api/src/main/java/module-info.java index 825922ae7ae1..5307644e3fc8 100644 --- a/engine/polyglot-api/src/main/java/module-info.java +++ b/engine/polyglot-api/src/main/java/module-info.java @@ -3,9 +3,11 @@ requires org.graalvm.truffle; requires org.graalvm.polyglot; requires org.enso.engine.common; + requires org.enso.logging.utils; requires org.enso.scala.wrapper; requires scala.library; exports org.enso.polyglot; exports org.enso.polyglot.debugger; + exports org.enso.polyglot.data; } diff --git a/engine/runner-common/src/main/java/module-info.java b/engine/runner-common/src/main/java/module-info.java index 9fbddeea1414..7cd5ff083b4c 100644 --- a/engine/runner-common/src/main/java/module-info.java +++ b/engine/runner-common/src/main/java/module-info.java @@ -5,6 +5,7 @@ requires org.enso.engine.common; requires org.enso.librarymanager; requires org.enso.pkg; + requires org.enso.polyglot.api; requires org.slf4j; requires scala.library; diff --git a/engine/runtime-compiler/src/main/java/module-info.java b/engine/runtime-compiler/src/main/java/module-info.java index 62ace998460f..efe98bbdb168 100644 --- a/engine/runtime-compiler/src/main/java/module-info.java +++ b/engine/runtime-compiler/src/main/java/module-info.java @@ -3,8 +3,11 @@ requires scala.library; requires org.enso.engine.common; + requires org.enso.editions; requires org.enso.pkg; requires org.enso.runtime.parser; + requires static org.enso.persistance; + requires org.enso.syntax; requires org.openide.util.lookup.RELEASE180; requires org.slf4j; @@ -14,4 +17,8 @@ exports org.enso.compiler.data; exports org.enso.compiler.dump; exports org.enso.compiler.exception; + exports org.enso.compiler.phase; + exports org.enso.compiler.pass.analyse; + exports org.enso.compiler.pass.analyse.alias; + exports org.enso.compiler.pass.analyse.alias.graph; } diff --git a/engine/runtime-parser/src/main/java/module-info.java b/engine/runtime-parser/src/main/java/module-info.java index 23710fed72ee..79de84d6dc8f 100644 --- a/engine/runtime-parser/src/main/java/module-info.java +++ b/engine/runtime-parser/src/main/java/module-info.java @@ -12,4 +12,5 @@ exports org.enso.compiler.core.ir.module.scope; exports org.enso.compiler.core.ir.module.scope.definition; exports org.enso.compiler.core.ir.module.scope.imports; + exports org.enso.compiler.core.ir.type; } diff --git a/engine/runtime-suggestions/src/main/java/module-info.java b/engine/runtime-suggestions/src/main/java/module-info.java new file mode 100644 index 000000000000..f176d07b73ef --- /dev/null +++ b/engine/runtime-suggestions/src/main/java/module-info.java @@ -0,0 +1,11 @@ +module org.enso.runtime.suggestions { + requires scala.library; + + requires org.enso.pkg; + requires org.enso.polyglot.api; + requires org.enso.runtime.parser; + requires org.enso.runtime.compiler; + requires org.enso.text.buffer; + + exports org.enso.compiler.suggestions; +} diff --git a/engine/runtime/src/main/java/module-info.java b/engine/runtime/src/main/java/module-info.java index fbd1b85a9b6d..547e1f3102e0 100644 --- a/engine/runtime/src/main/java/module-info.java +++ b/engine/runtime/src/main/java/module-info.java @@ -2,6 +2,7 @@ requires java.logging; requires org.enso.cli; + requires org.enso.common.polyglot.core.utils; requires org.enso.distribution; requires org.enso.editions; requires org.enso.engine.common; @@ -14,11 +15,14 @@ requires org.enso.polyglot.api; requires org.enso.runtime.compiler; requires org.enso.runtime.parser; + requires org.enso.runtime.suggestions; + requires org.enso.text.buffer; requires org.enso.syntax; requires org.enso.version.output; requires org.apache.commons.lang3; requires org.apache.tika.core; + requires org.slf4j; requires org.graalvm.collections; requires org.graalvm.truffle; requires com.ibm.icu; diff --git a/lib/scala/common-polyglot-core-utils/src/main/java/module-info.java b/lib/scala/common-polyglot-core-utils/src/main/java/module-info.java new file mode 100644 index 000000000000..ee4c98e73932 --- /dev/null +++ b/lib/scala/common-polyglot-core-utils/src/main/java/module-info.java @@ -0,0 +1,5 @@ +module org.enso.common.polyglot.core.utils { + requires com.ibm.icu; + + exports org.enso.polyglot.common_utils; +} diff --git a/lib/scala/interpreter-dsl/src/main/java/module-info.java b/lib/scala/interpreter-dsl/src/main/java/module-info.java index be837a03d1d0..30cfe105a677 100644 --- a/lib/scala/interpreter-dsl/src/main/java/module-info.java +++ b/lib/scala/interpreter-dsl/src/main/java/module-info.java @@ -5,4 +5,5 @@ requires org.openide.util.lookup.RELEASE180; exports org.enso.interpreter.dsl; + exports org.enso.interpreter.dsl.atom; } diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java index 6968bcd94d45..00d5cc93eb81 100644 --- a/lib/scala/library-manager/src/main/java/module-info.java +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -18,6 +18,7 @@ exports org.enso.librarymanager.dependencies; exports org.enso.librarymanager.local; exports org.enso.librarymanager.published; + exports org.enso.librarymanager.resolved; exports org.enso.libraryupload; exports org.enso.libraryupload.auth; } diff --git a/lib/scala/logging-service-logback/src/main/java/module-info.java b/lib/scala/logging-service-logback/src/main/java/module-info.java new file mode 100644 index 000000000000..09fffa97b3c7 --- /dev/null +++ b/lib/scala/logging-service-logback/src/main/java/module-info.java @@ -0,0 +1,15 @@ +import org.enso.logging.config.LoggerSetup; +import org.enso.logging.service.logback.LogbackSetup; + +module org.enso.logging.service.logback { + requires ch.qos.logback.classic; + requires ch.qos.logback.core; + requires sentry; + requires sentry.logback; + requires org.enso.logging.service; + requires org.enso.logging.config; + requires org.slf4j; + requires org.openide.util.lookup.RELEASE180; + + provides LoggerSetup with LogbackSetup; +} diff --git a/lib/scala/logging-service/src/main/java/module-info.java b/lib/scala/logging-service/src/main/java/module-info.java new file mode 100644 index 000000000000..f54313cef95a --- /dev/null +++ b/lib/scala/logging-service/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module org.enso.logging.service { + exports org.enso.logging.service; + requires org.enso.logging.config; + requires org.enso.logging.utils; + requires org.slf4j; + requires scala.library; +} diff --git a/lib/scala/pkg/src/main/java/module-info.java b/lib/scala/pkg/src/main/java/module-info.java index 24a9663d031a..d1753358feac 100644 --- a/lib/scala/pkg/src/main/java/module-info.java +++ b/lib/scala/pkg/src/main/java/module-info.java @@ -9,4 +9,5 @@ requires org.yaml.snakeyaml; exports org.enso.pkg; + exports org.enso.filesystem; } diff --git a/lib/scala/yaml/src/main/java/module-info.java b/lib/scala/yaml/src/main/java/module-info.java index 22c47cd36895..c3985705d42a 100644 --- a/lib/scala/yaml/src/main/java/module-info.java +++ b/lib/scala/yaml/src/main/java/module-info.java @@ -2,4 +2,6 @@ requires scala.library; requires org.enso.scala.wrapper; requires org.yaml.snakeyaml; + + exports org.enso.scala.yaml; } From b13c45bf48b5fa80eca5e6eae3a563ced8ea92bf Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 23 Aug 2024 16:10:10 +0200 Subject: [PATCH 091/268] module-info compilation is handled directly by FrgaalCompiler --- build.sbt | 64 ++++++++++++++++++++++++++------ project/FrgaalJavaCompiler.scala | 46 ++++++++++++++++++++--- project/JPMSPlugin.scala | 61 +----------------------------- project/JPMSUtils.scala | 59 ----------------------------- 4 files changed, 94 insertions(+), 136 deletions(-) diff --git a/build.sbt b/build.sbt index 660fb5c62e36..7c2454097549 100644 --- a/build.sbt +++ b/build.sbt @@ -684,8 +684,6 @@ lazy val componentModulesPaths = ourMods ++ thirdPartyModFiles } -lazy val compileModuleInfo = taskKey[Unit]("Compiles `module-info.java`") - // ============================================================================ // === Internal Libraries ===================================================== // ============================================================================ @@ -1095,11 +1093,7 @@ lazy val `scala-libs-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion ), - shouldCompileModuleInfoManually := true, excludeFilter := excludeFilter.value || "module-info.java", - compileModuleInfo := { - JPMSUtils.compileModuleInfo().value - }, javacOptions ++= { JPMSPlugin.constructOptions( streams.value.log, @@ -1108,10 +1102,6 @@ lazy val `scala-libs-wrapper` = project ) }, exportedModuleBin := assembly.value, - // Ensure that `module-info.class` is included in the assembled Jar - assembly := assembly - .dependsOn(compileModuleInfo) - .value, assembly / assemblyExcludedJars := { JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, @@ -1918,6 +1908,16 @@ lazy val javadocSettings = Seq( ) ) +lazy val shouldCompileModuleInfo = taskKey[Boolean]( + "Determines whether the module-info.java file should be compiled. " + + "Used in mixed Scala/Java projects where module-info.java compilation cannot be " + + "done by sbt automatically." +) + +lazy val isJPMSModule = taskKey[Boolean]( + "Determines whether the project is a JPMS module." +) + /** A setting to replace javac with Frgaal compiler, allowing to use latest Java features in the code * and still compile down to JDK 17 */ @@ -1925,10 +1925,52 @@ lazy val frgaalJavaCompilerSetting = customFrgaalJavaCompilerSettings(targetJavaVersion) def customFrgaalJavaCompilerSettings(targetJdk: String) = Seq( + isJPMSModule := { + // modulePath task is defined by the JPMSPlugin. The following code checks whether + // the `modulePath` task is defined in the current project. + // Note that there is no simple way how to check whether the project has `JPMSPlugin`. + modulePath.?.value.isDefined + }, + shouldCompileModuleInfo := Def.taskIf { + if (isJPMSModule.value) { + val javaSrcDir = (Compile / javaSource).value + val modInfo = + javaSrcDir.toPath.resolve("module-info.java").toFile + val hasModInfo = modInfo.exists + val projName = moduleName.value + val logger = streams.value.log + val hasScalaSources = (Compile / scalaSource).value.exists() + val _compileOrder = (Compile / compileOrder).value + val res = + _compileOrder == CompileOrder.Mixed && + hasModInfo && + hasScalaSources + if (res) { + logger.warn( + s"[FrgaalJavaCompilerSetting] Project '$projName' will have `module-info.java` compiled " + + "manually. If this is not the intended behavior, consult the documentation " + + "of JPMSPlugin." + ) + } + // Check excludeFilter - there should be module-info.java specified + if (res && !excludeFilter.value.accept(modInfo)) { + logger.error( + s"[FrgaalJavaCompilerSetting/$projName] `module-info.java` is not in `excludeFilter`. " + + "You should add module-info.java to " + + "`excludedFilter` so that sbt does not handle the compilation. Check docs of JPMSPlugin." + ) + } + res + } else { + false + } + }.value, Compile / compile / compilers := FrgaalJavaCompiler.compilers( (Compile / dependencyClasspath).value, compilers.value, - targetJdk + targetJdk, + shouldCompileModuleInfo.value, + (Compile / javaSource).value ), // 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 diff --git a/project/FrgaalJavaCompiler.scala b/project/FrgaalJavaCompiler.scala index 1e10363d2fab..b73aa1c7f55f 100644 --- a/project/FrgaalJavaCompiler.scala +++ b/project/FrgaalJavaCompiler.scala @@ -34,10 +34,24 @@ object FrgaalJavaCompiler { val debugArg = "-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:8000" + /** + * Returns custom setting for compiler that delegates to `Frgaal`. + * @param classpath The dependencyClasspath of the current project + * @param sbtCompilers Configuration for compilers for current sbt project + * @param javaVersion Target Java version + * @param shouldCompileModuleInfo If true, module-info.java will be compiled + * in addition to other Java sources. See the docs + * of `shouldCompileModuleInfo` task in `build.sbt` and + * the docs of [[JPMSPlugin]]. + * @param javaSourceDir The directory where Java sources are located + * @return + */ def compilers( classpath: sbt.Keys.Classpath, sbtCompilers: xsbti.compile.Compilers, - javaVersion: String + javaVersion: String, + shouldCompileModuleInfo: Boolean, + javaSourceDir: File ) = { // Enable Java 11+ features by invoking Frgaal instead of regular javac val javaHome = Option(System.getProperty("java.home")).map(Paths.get(_)) @@ -63,7 +77,9 @@ object FrgaalJavaCompiler { val frgaalJavac = new FrgaalJavaCompiler( javaHome, frgaalOnClasspath.get, - target = javaVersion + javaSourceDir = javaSourceDir, + target = javaVersion, + shouldCompileModuleInfo = shouldCompileModuleInfo ) val javaTools = sbt.internal.inc.javac .JavaTools(frgaalJavac, sbtCompilers.javaTools.javadoc()) @@ -81,7 +97,9 @@ object FrgaalJavaCompiler { log: Logger, reporter: Reporter, source: Option[String], - target: String + target: String, + shouldCompileModuleInfo: Boolean, + javaSourceDir: File ): Boolean = { val (jArgs, nonJArgs) = options.partition(_.startsWith("-J")) val debugAnotProcessorOpt = jArgs.contains(debugArg) @@ -119,6 +137,18 @@ object FrgaalJavaCompiler { val out = output.getSingleOutputAsPath().get() val shared = sources0.fold(out)(asCommon).asInstanceOf[Path] + val allSources = if (shouldCompileModuleInfo) { + val moduleInfo = javaSourceDir.toPath.resolve("module-info.java").toFile + if (!moduleInfo.exists()) { + log.error(s"[FrgaalJavaCompiler] module-info.java not found in $javaSourceDir") + } + log.info(s"[FrgaalJavaCompiler] compiling ${sources.size + 1} Java sources with module-info.java to $out ...") + Seq(moduleInfo.getAbsolutePath) ++ sources + } else { + log.info(s"[FrgaalJavaCompiler] compiling ${sources.size} Java sources to $out ...") + sources + } + // searching for $shared/src/main/java or // $shared/src/test/java or // $shared/src/bench/java or etc. @@ -217,7 +247,7 @@ object FrgaalJavaCompiler { "-target", target ) - val allArguments = outputOption ++ frgaalOptions ++ nonJArgs ++ sources + val allArguments = outputOption ++ frgaalOptions ++ nonJArgs ++ allSources withArgumentFile(allArguments) { argsFile => // List of modules that Frgaal can use for compilation @@ -318,7 +348,9 @@ final class FrgaalJavaCompiler( javaHome: Option[Path], compilerPath: Path, target: String, - source: Option[String] = None + javaSourceDir: File, + source: Option[String] = None, + shouldCompileModuleInfo: Boolean = false ) extends XJavaCompiler { def run( sources: Array[VirtualFile], @@ -337,6 +369,8 @@ final class FrgaalJavaCompiler( log, reporter, source, - target + target, + shouldCompileModuleInfo, + javaSourceDir ) } diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index ab7d8b5b8034..86fa96596b9f 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -62,9 +62,6 @@ object JPMSPlugin extends AutoPlugin { |""".stripMargin ) - // TODO: Make this private - val compileModuleInfo = taskKey[Unit]("Compile module-info.java") - val exportedModule = taskKey[File]( """ |Similarly to `exportedProducts` task, this task returns a file that can be @@ -81,18 +78,6 @@ object JPMSPlugin extends AutoPlugin { "Similar to `packageBin` task. This task returns a modular JAR archive that can be " + "directly put on module-path" ) - - /** Should module-info.java be compiled manually? True iff there is `module-info.java` - * in java sources and if the compile order is Mixed. In such case, sbt tries to first - * parse all the Java sources via its internal parser, and that fails for `modue-info`. - * In these cases, we need to exclude `module-info.java` from the sources and compile it - * manually. - * - * WARNING: Do not use override this task directly if you don't know exactly what you are doing. - */ - val shouldCompileModuleInfoManually = taskKey[Boolean]( - "Should module-info.java be compiled manually?" - ) } import autoImport._ @@ -101,27 +86,6 @@ object JPMSPlugin extends AutoPlugin { addModules := Seq.empty, moduleDependencies := Seq.empty, internalModuleDependencies := Seq.empty, - shouldCompileModuleInfoManually := { - val javaSrcDir = (Compile / javaSource).value - val hasModInfo = - javaSrcDir.toPath.resolve("module-info.java").toFile.exists() - val projName = moduleName.value - val logger = streams.value.log - val hasScalaSources = (Compile / scalaSource).value.exists() - val _compileOrder = (Compile / compileOrder).value - val res = - _compileOrder == CompileOrder.Mixed && - hasModInfo && - hasScalaSources - if (res) { - logger.warn( - s"[JPMSPlugin] Project '$projName' will have `module-info.java` compiled " + - "manually. If this is not the intended behavior, consult the documentation " + - "of JPMSPlugin." - ) - } - res - }, // modulePath is set based on moduleDependencies modulePath := { // Do not use fullClasspath here - it will result in an infinite recursion @@ -152,7 +116,7 @@ object JPMSPlugin extends AutoPlugin { } targetClassDir } - .dependsOn(compileModuleInfo) + .dependsOn(Compile / compile) .value, exportedModuleBin := { (Compile / packageBin) @@ -162,29 +126,6 @@ object JPMSPlugin extends AutoPlugin { patchModules := Map.empty, addExports := Map.empty, addReads := Map.empty, - compileModuleInfo := Def.taskIf { - if (shouldCompileModuleInfoManually.value) { - val projectName = moduleName.value - val logger = streams.value.log - val sources = (Compile / unmanagedSources).value - val moduleInfo = sources.find(_.name == "module-info.java") - if (moduleInfo.isDefined) { - logger.error( - s"[JPMSPlugin/$projectName] module-info.java is contained in `Compile / unmanagedSources`. " + - s"This means that it is not excluded from the default sbt compilation. " + - """Declare `excludedFilter := excludedFilter.value || \"module-info.java\"` in settings. """ + - s"Otherwise, JPMSPlugin cannot manually compile module-info.java. " + - s"(See the docs for `JPMSPlugin.shouldCompileModuleInfoManually`)" - ) - } - JPMSUtils - .compileJava() - .dependsOn(Compile / compile) - .value - } else { - (Compile / compile).value - } - }.value, // javacOptions only inject --module-path and --add-modules, not the rest of the // options. Compile / javacOptions ++= { diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index 21d658cc38b9..704d4afbfe30 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -326,65 +326,6 @@ object JPMSUtils { } } - /** - * Compile everything including module-info.java in mixed projects. - * @return - */ - def compileJava(): Def.Initialize[Task[Unit]] = Def.task { - val moduleInfo = (Compile / javaSource).value / "module-info.java" - val projName = moduleName.value - val log = streams.value.log - val incToolOpts = IncToolOptionsUtil.defaultIncToolOptions() - val reporter = (Compile / compile / bspReporter).value - val output = CompileOutput((Compile / classDirectory).value.toPath) - val outputPath: Path = output.getSingleOutputAsPath.get() - val mp = (Compile / modulePath).value - val baseJavacOpts = (Compile / javacOptions).value - val cp = (Compile / fullClasspath).value - val javaCompiler = - (Compile / compile / compilers).value.javaTools.javac() - val cache = - streams.value.cacheStoreFactory.make("java-src-" + projName) - val otherJavaSources = (Compile / unmanagedSources) - .value - .filter(_.name.endsWith(".java")) - val allJavaSources = Set(moduleInfo) ++ otherJavaSources.toSet - - Tracked.diffInputs(cache, FileInfo.lastModified)( - allJavaSources - ) { changeReport => - if (changeReport.modified.nonEmpty || changeReport.added.nonEmpty) { - log.info(s"[JPMSUtils/$projName] Compiling ${allJavaSources.size} Java sources, including module-info.java") - val allOpts = baseJavacOpts ++ Seq( - "--class-path", - cp.map(_.data.getAbsolutePath).mkString(File.pathSeparator), - "--module-path", - mp.map(_.getAbsolutePath).mkString(File.pathSeparator), - "-d", - outputPath.toAbsolutePath.toString - ) - log.debug(s"javac options: $allOpts") - val virtualFiles: Array[VirtualFile] = allJavaSources - .map(file => PlainVirtualFile(file.toPath)) - .toArray - val succ = javaCompiler.run( - virtualFiles, - allOpts.toArray, - output, - incToolOpts, - reporter, - log - ) - if (!succ) { - val msg = s"Compilation of ${moduleInfo} failed" - log.error(s"javac options: $allOpts") - log.error(msg) - throw new IllegalStateException(msg) - } - } - } - } - /** Copies all classes from all the dependencies `classes` directories into the target directory. * @param sourceClassesDir Directory from where the classes will be copied. * @param output Target directory where all the classes from all the dependencies From 103c9c3e38bf2dcc0cca25e3cfb6fdd840392fd8 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 23 Aug 2024 17:35:45 +0200 Subject: [PATCH 092/268] module-info compilation is forced for projects that has only Scala sources with single module-info.java --- build.sbt | 71 +++++++++++------------------------- project/JPMSPlugin.scala | 77 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 96 insertions(+), 52 deletions(-) diff --git a/build.sbt b/build.sbt index 7c2454097549..cf0cc2c4603e 100644 --- a/build.sbt +++ b/build.sbt @@ -1078,6 +1078,7 @@ lazy val `scala-libs-wrapper` = project .in(file("lib/java/scala-libs-wrapper")) .enablePlugins(JPMSPlugin) .settings( + frgaalJavaCompilerSetting, javaModuleName := "org.enso.scala.wrapper", libraryDependencies ++= circe ++ Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, @@ -1093,7 +1094,6 @@ lazy val `scala-libs-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion ), - excludeFilter := excludeFilter.value || "module-info.java", javacOptions ++= { JPMSPlugin.constructOptions( streams.value.log, @@ -1101,7 +1101,13 @@ lazy val `scala-libs-wrapper` = project patchModules = patchModules.value ) }, - exportedModuleBin := assembly.value, + forceModuleInfoCompilation := true, + exportedModuleBin := assembly + .dependsOn(compileModuleInfo) + .value, + exportedModule := assembly + .dependsOn(compileModuleInfo) + .value, assembly / assemblyExcludedJars := { JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, @@ -1146,9 +1152,6 @@ lazy val `scala-libs-wrapper` = project javaModuleName.value -> scalaLibs ) }, - exportedModule := { - (assembly / assembly).value - } ) lazy val cli = project @@ -1925,53 +1928,19 @@ lazy val frgaalJavaCompilerSetting = customFrgaalJavaCompilerSettings(targetJavaVersion) def customFrgaalJavaCompilerSettings(targetJdk: String) = Seq( - isJPMSModule := { - // modulePath task is defined by the JPMSPlugin. The following code checks whether - // the `modulePath` task is defined in the current project. - // Note that there is no simple way how to check whether the project has `JPMSPlugin`. - modulePath.?.value.isDefined + Compile / compile / compilers := { + // True if there is module-info.java in the sources, and this is a mixed + // project, and module-info.java is excluded from the compilation + val shouldCompileModInfo = shouldCompileModuleInfoManually.?.value.isDefined + + FrgaalJavaCompiler.compilers( + (Compile / dependencyClasspath).value, + compilers.value, + targetJdk, + shouldCompileModInfo, + (Compile / javaSource).value + ) }, - shouldCompileModuleInfo := Def.taskIf { - if (isJPMSModule.value) { - val javaSrcDir = (Compile / javaSource).value - val modInfo = - javaSrcDir.toPath.resolve("module-info.java").toFile - val hasModInfo = modInfo.exists - val projName = moduleName.value - val logger = streams.value.log - val hasScalaSources = (Compile / scalaSource).value.exists() - val _compileOrder = (Compile / compileOrder).value - val res = - _compileOrder == CompileOrder.Mixed && - hasModInfo && - hasScalaSources - if (res) { - logger.warn( - s"[FrgaalJavaCompilerSetting] Project '$projName' will have `module-info.java` compiled " + - "manually. If this is not the intended behavior, consult the documentation " + - "of JPMSPlugin." - ) - } - // Check excludeFilter - there should be module-info.java specified - if (res && !excludeFilter.value.accept(modInfo)) { - logger.error( - s"[FrgaalJavaCompilerSetting/$projName] `module-info.java` is not in `excludeFilter`. " + - "You should add module-info.java to " + - "`excludedFilter` so that sbt does not handle the compilation. Check docs of JPMSPlugin." - ) - } - res - } else { - false - } - }.value, - Compile / compile / compilers := FrgaalJavaCompiler.compilers( - (Compile / dependencyClasspath).value, - compilers.value, - targetJdk, - shouldCompileModuleInfo.value, - (Compile / javaSource).value - ), // 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. diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 86fa96596b9f..42e160059d36 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -78,15 +78,87 @@ object JPMSPlugin extends AutoPlugin { "Similar to `packageBin` task. This task returns a modular JAR archive that can be " + "directly put on module-path" ) + + val shouldCompileModuleInfoManually = taskKey[Boolean] ( + "If module-info.java should be compiled by us and not by sbt. " + + "DO NOT USE DIRECTLY." + ) + + val forceModuleInfoCompilation = taskKey[Boolean]( + "Force module-info.java compilation. " + + "DO NOT USE DIRECTLY." + ) + + val compileModuleInfo = taskKey[Unit] ( + "Compiles only module-info.java in some special cases. " + + "DO NOT USE DIRECTLY." + ) + } import autoImport._ + override lazy val projectSettings: Seq[Setting[_]] = Seq( addModules := Seq.empty, moduleDependencies := Seq.empty, internalModuleDependencies := Seq.empty, - // modulePath is set based on moduleDependencies + shouldCompileModuleInfoManually := { + val javaSrcDir = (Compile / javaSource).value + val modInfo = + javaSrcDir.toPath.resolve("module-info.java").toFile + val hasModInfo = modInfo.exists + val projName = moduleName.value + val logger = streams.value.log + val hasScalaSources = (Compile / scalaSource).value.exists() + val _compileOrder = (Compile / compileOrder).value + val res = + _compileOrder == CompileOrder.Mixed && + hasModInfo && + hasScalaSources + if (res) { + logger.warn( + s"[JPMSPlugin] Project '$projName' will have `module-info.java` compiled " + + "manually. If this is not the intended behavior, consult the documentation " + + "of JPMSPlugin." + ) + } + // Check excludeFilter - there should be module-info.java specified + if (res && !excludeFilter.value.accept(modInfo)) { + logger.error( + s"[JPMSPlugin/$projName] `module-info.java` is not in `excludeFilter`. " + + "You should add module-info.java to " + + "`excludedFilter` so that sbt does not handle the compilation. Check docs of JPMSPlugin." + ) + } + res + }, + + // module-info.java compilation will be forced iff there are no other Java sources except + // for module-info.java. + forceModuleInfoCompilation := Def.taskIf { + if (shouldCompileModuleInfoManually.value) { + val javaSources = (Compile / unmanagedSources) + .value + .filter(_.getName.endsWith(".java")) + // If there are no Java source in `unmanagedSources`, it means that sbt will + // not call Java compiler. So we force it to compile `module-info.java`. + javaSources.isEmpty + } else { + false + } + }.value, + + compileModuleInfo := Def.taskIf { + if (forceModuleInfoCompilation.value) { + JPMSUtils.compileModuleInfo().value + } else { + // nop + () + } + }.value, + + // modulePath is set based on `moduleDependencies` and `internalModuleDependencies` modulePath := { // Do not use fullClasspath here - it will result in an infinite recursion // and sbt will not be able to detect the cycle. @@ -98,6 +170,7 @@ object JPMSPlugin extends AutoPlugin { moduleName.value ) }, + // Returns the reference to target/classes directory and ensures that module-info // is compiled and present in the target directory. exportedModule := Def.task { @@ -116,8 +189,10 @@ object JPMSPlugin extends AutoPlugin { } targetClassDir } + .dependsOn(compileModuleInfo) .dependsOn(Compile / compile) .value, + exportedModuleBin := { (Compile / packageBin) .dependsOn(exportedModule) From 426146bda44d5bc794383b232579bb29455a707f Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 23 Aug 2024 17:50:47 +0200 Subject: [PATCH 093/268] Fix compilation of org.enso.runtime --- build.sbt | 1 + engine/polyglot-api/src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 1 + engine/runtime/src/main/java/module-info.java | 12 +++++++++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index cf0cc2c4603e..d1bdf196f4b4 100644 --- a/build.sbt +++ b/build.sbt @@ -2445,6 +2445,7 @@ lazy val `runtime-instrument-common` = (`runtime` / exportedModule).value, (`runtime-compiler` / exportedModule).value, (`runtime-parser` / exportedModule).value, + (`runtime-suggestions` / exportedModule).value, (`text-buffer` / exportedModule).value, (`pkg` / exportedModule).value, (`polyglot-api` / exportedModule).value, diff --git a/engine/polyglot-api/src/main/java/module-info.java b/engine/polyglot-api/src/main/java/module-info.java index 5307644e3fc8..1046b5b50d63 100644 --- a/engine/polyglot-api/src/main/java/module-info.java +++ b/engine/polyglot-api/src/main/java/module-info.java @@ -10,4 +10,5 @@ exports org.enso.polyglot; exports org.enso.polyglot.debugger; exports org.enso.polyglot.data; + exports org.enso.polyglot.runtime; } diff --git a/engine/runtime-instrument-common/src/main/java/module-info.java b/engine/runtime-instrument-common/src/main/java/module-info.java index a1c010a6ed3e..cbc368636342 100644 --- a/engine/runtime-instrument-common/src/main/java/module-info.java +++ b/engine/runtime-instrument-common/src/main/java/module-info.java @@ -12,6 +12,7 @@ requires org.enso.runtime; requires org.enso.runtime.compiler; requires org.enso.runtime.parser; + requires org.enso.runtime.suggestions; requires org.enso.text.buffer; requires org.enso.pkg; requires org.enso.polyglot.api; diff --git a/engine/runtime/src/main/java/module-info.java b/engine/runtime/src/main/java/module-info.java index 547e1f3102e0..7521ed57f191 100644 --- a/engine/runtime/src/main/java/module-info.java +++ b/engine/runtime/src/main/java/module-info.java @@ -1,5 +1,6 @@ module org.enso.runtime { requires java.logging; + requires scala.library; requires org.enso.cli; requires org.enso.common.polyglot.core.utils; @@ -27,20 +28,29 @@ requires org.graalvm.truffle; requires com.ibm.icu; - exports org.enso.interpreter.node.expression.debug; exports org.enso.interpreter.node; exports org.enso.interpreter.runtime.callable; exports org.enso.interpreter.runtime.state; exports org.enso.interpreter.runtime; + exports org.enso.interpreter.runtime.data; + exports org.enso.interpreter.runtime.data.atom; exports org.enso.interpreter.runtime.data.text; exports org.enso.interpreter.node.callable; exports org.enso.interpreter.runtime.control; exports org.enso.interpreter.runtime.callable.function; + exports org.enso.interpreter.runtime.library.dispatch; exports org.enso.interpreter.runtime.error; exports org.enso.interpreter.runtime.instrument; exports org.enso.interpreter.runtime.tag; + exports org.enso.interpreter.runtime.scope; + exports org.enso.interpreter.runtime.type; + exports org.enso.interpreter.runtime.warning; + exports org.enso.interpreter.node.expression.builtin; exports org.enso.interpreter.node.expression.builtin.debug; exports org.enso.interpreter.node.expression.builtin.text.util; + exports org.enso.interpreter.node.expression.debug; + exports org.enso.interpreter.util; + exports org.enso.interpreter.service.error; provides com.oracle.truffle.api.provider.TruffleLanguageProvider with org.enso.interpreter.EnsoLanguageProvider; From 4b1f0d68b695011dd1f4a7b37d26195cb8e6e6a2 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 23 Aug 2024 17:55:13 +0200 Subject: [PATCH 094/268] manual module-info compilation is not a warning --- project/JPMSPlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 42e160059d36..55fe2c52a82d 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -117,7 +117,7 @@ object JPMSPlugin extends AutoPlugin { hasModInfo && hasScalaSources if (res) { - logger.warn( + logger.debug( s"[JPMSPlugin] Project '$projName' will have `module-info.java` compiled " + "manually. If this is not the intended behavior, consult the documentation " + "of JPMSPlugin." From c7b51dac016b27440b06b93bb434b68e74c83aac Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 11:45:42 +0200 Subject: [PATCH 095/268] Rename packages in logging-utils-akka --- .../main/scala/org/enso/languageserver/boot/MainModule.scala | 2 +- .../protocol/json/JsonConnectionController.scala | 2 +- .../requesthandler/ai/AICompletion2Handler.scala | 2 +- .../org/enso/languageserver/runtime/ContextRegistry.scala | 2 +- .../org/enso/languageserver/runtime/RuntimeConnector.scala | 2 +- .../org/enso/languageserver/util/UnhandledLogging.scala | 2 +- .../enso/{logger => logging/utils}/akka/AkkaConverter.java | 2 +- .../{logger => logging/utils}/akka/ActorLoggingReceive.scala | 2 +- .../{logger => logging/utils}/akka/ActorMessageLogging.scala | 5 ++--- .../main/scala/org/enso/projectmanager/boot/MainModule.scala | 2 +- .../languageserver/LanguageServerBootLoader.scala | 2 +- .../languageserver/LanguageServerController.scala | 2 +- .../org/enso/projectmanager/util/UnhandledLogging.scala | 2 +- 13 files changed, 14 insertions(+), 15 deletions(-) rename lib/scala/logging-utils-akka/src/main/java/org/enso/{logger => logging/utils}/akka/AkkaConverter.java (97%) rename lib/scala/logging-utils-akka/src/main/scala/org/enso/{logger => logging/utils}/akka/ActorLoggingReceive.scala (97%) rename lib/scala/logging-utils-akka/src/main/scala/org/enso/{logger => logging/utils}/akka/ActorMessageLogging.scala (91%) diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala b/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala index c7759a5dd708..8fbfd132f194 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/boot/MainModule.scala @@ -46,9 +46,9 @@ import org.enso.librarymanager.local.DefaultLocalLibraryProvider import org.enso.librarymanager.published.PublishedLibraryCache import org.enso.lockmanager.server.LockManagerService import org.enso.logger.masking.Masking -import org.enso.logger.akka.AkkaConverter import org.enso.common.RuntimeOptions import org.enso.common.ContextFactory +import org.enso.logging.utils.akka.AkkaConverter import org.enso.polyglot.RuntimeServerInfo import org.enso.profiling.events.NoopEventsMonitor import org.enso.searcher.memory.InMemorySuggestionsRepo diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala b/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala index 106627a169b0..5841cf11dd1c 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/protocol/json/JsonConnectionController.scala @@ -97,7 +97,7 @@ import org.enso.languageserver.text.TextProtocol import org.enso.languageserver.util.UnhandledLogging import org.enso.languageserver.vcsmanager.VcsManagerApi._ import org.enso.languageserver.workspace.WorkspaceApi.ProjectInfo -import org.enso.logger.akka.ActorMessageLogging +import org.enso.logging.utils.akka.ActorMessageLogging import org.enso.polyglot.runtime.Runtime.Api import org.enso.polyglot.runtime.Runtime.Api.ProgressNotification import org.enso.version.BuildVersion diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/ai/AICompletion2Handler.scala b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/ai/AICompletion2Handler.scala index db9e13e7c894..116825c9e445 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/ai/AICompletion2Handler.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/requesthandler/ai/AICompletion2Handler.scala @@ -26,7 +26,7 @@ import org.enso.languageserver.runtime.{ } import org.enso.languageserver.session.JsonSession import org.enso.languageserver.util.UnhandledLogging -import org.enso.logger.akka.ActorMessageLogging +import org.enso.logging.utils.akka.ActorMessageLogging import org.enso.polyglot.runtime.Runtime.Api import java.nio.charset.StandardCharsets diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistry.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistry.scala index fa17bb783e32..b740444483ce 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistry.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/ContextRegistry.scala @@ -11,7 +11,7 @@ import org.enso.languageserver.event.{ import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong} import org.enso.languageserver.runtime.handler._ import org.enso.languageserver.util.UnhandledLogging -import org.enso.logger.akka.ActorMessageLogging +import org.enso.logging.utils.akka.ActorMessageLogging import org.enso.polyglot.runtime.Runtime.Api import org.enso.polyglot.runtime.Runtime.Api.ContextId diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeConnector.scala b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeConnector.scala index 499355ec02b7..ca6f8f186e93 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeConnector.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/runtime/RuntimeConnector.scala @@ -9,8 +9,8 @@ import org.enso.languageserver.runtime.RuntimeConnector.{ } import org.enso.languageserver.util.UnhandledLogging import org.enso.lockmanager.server.LockManagerService -import org.enso.logger.akka.ActorMessageLogging import org.enso.logger.masking.ToLogString +import org.enso.logging.utils.akka.ActorMessageLogging import org.enso.polyglot.runtime.Runtime import org.enso.polyglot.runtime.Runtime.{Api, ApiEnvelope} import org.enso.polyglot.runtime.serde.ApiSerde diff --git a/engine/language-server/src/main/scala/org/enso/languageserver/util/UnhandledLogging.scala b/engine/language-server/src/main/scala/org/enso/languageserver/util/UnhandledLogging.scala index 3e70882a0c22..fb4f83cefa4a 100644 --- a/engine/language-server/src/main/scala/org/enso/languageserver/util/UnhandledLogging.scala +++ b/engine/language-server/src/main/scala/org/enso/languageserver/util/UnhandledLogging.scala @@ -2,7 +2,7 @@ package org.enso.languageserver.util import akka.actor.Actor import com.typesafe.scalalogging.LazyLogging -import org.enso.logger.akka.AkkaConverter +import org.enso.logging.utils.akka.AkkaConverter import org.slf4j.event.Level trait UnhandledLogging extends LazyLogging { this: Actor => diff --git a/lib/scala/logging-utils-akka/src/main/java/org/enso/logger/akka/AkkaConverter.java b/lib/scala/logging-utils-akka/src/main/java/org/enso/logging/utils/akka/AkkaConverter.java similarity index 97% rename from lib/scala/logging-utils-akka/src/main/java/org/enso/logger/akka/AkkaConverter.java rename to lib/scala/logging-utils-akka/src/main/java/org/enso/logging/utils/akka/AkkaConverter.java index d262fb2e2c45..b1a8e9e3d07e 100644 --- a/lib/scala/logging-utils-akka/src/main/java/org/enso/logger/akka/AkkaConverter.java +++ b/lib/scala/logging-utils-akka/src/main/java/org/enso/logging/utils/akka/AkkaConverter.java @@ -1,4 +1,4 @@ -package org.enso.logger.akka; +package org.enso.logging.utils.akka; import static org.slf4j.event.Level.*; diff --git a/lib/scala/logging-utils-akka/src/main/scala/org/enso/logger/akka/ActorLoggingReceive.scala b/lib/scala/logging-utils-akka/src/main/scala/org/enso/logging/utils/akka/ActorLoggingReceive.scala similarity index 97% rename from lib/scala/logging-utils-akka/src/main/scala/org/enso/logger/akka/ActorLoggingReceive.scala rename to lib/scala/logging-utils-akka/src/main/scala/org/enso/logging/utils/akka/ActorLoggingReceive.scala index 3382e6796398..fcaa9e792790 100644 --- a/lib/scala/logging-utils-akka/src/main/scala/org/enso/logger/akka/ActorLoggingReceive.scala +++ b/lib/scala/logging-utils-akka/src/main/scala/org/enso/logging/utils/akka/ActorLoggingReceive.scala @@ -1,4 +1,4 @@ -package org.enso.logger.akka +package org.enso.logging.utils.akka import akka.actor.Actor.Receive import akka.actor.ActorContext diff --git a/lib/scala/logging-utils-akka/src/main/scala/org/enso/logger/akka/ActorMessageLogging.scala b/lib/scala/logging-utils-akka/src/main/scala/org/enso/logging/utils/akka/ActorMessageLogging.scala similarity index 91% rename from lib/scala/logging-utils-akka/src/main/scala/org/enso/logger/akka/ActorMessageLogging.scala rename to lib/scala/logging-utils-akka/src/main/scala/org/enso/logging/utils/akka/ActorMessageLogging.scala index a54e1332788e..ab58e8e1d216 100644 --- a/lib/scala/logging-utils-akka/src/main/scala/org/enso/logger/akka/ActorMessageLogging.scala +++ b/lib/scala/logging-utils-akka/src/main/scala/org/enso/logging/utils/akka/ActorMessageLogging.scala @@ -1,7 +1,6 @@ -package org.enso.logger.akka +package org.enso.logging.utils.akka -import akka.actor.Actor -import akka.actor.ActorContext +import akka.actor.{Actor, ActorContext} import org.slf4j.LoggerFactory /** A trait providing functions for logging received actor messages. */ diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/MainModule.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/MainModule.scala index 9c67770b1a61..f5709f33d71d 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/MainModule.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/boot/MainModule.scala @@ -4,7 +4,7 @@ import akka.actor.ActorSystem import akka.stream.SystemMaterializer import cats.MonadError import org.enso.jsonrpc.JsonRpcServer -import org.enso.logger.akka.AkkaConverter +import org.enso.logging.utils.akka.AkkaConverter import org.enso.projectmanager.boot.configuration.{ MainProcessConfig, ProjectManagerConfig diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerBootLoader.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerBootLoader.scala index 43a44bec326b..be8213a8ee81 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerBootLoader.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerBootLoader.scala @@ -2,7 +2,7 @@ package org.enso.projectmanager.infrastructure.languageserver import akka.actor.{Actor, ActorRef, Props} import com.typesafe.scalalogging.LazyLogging -import org.enso.logger.akka.ActorMessageLogging +import org.enso.logging.utils.akka.ActorMessageLogging import org.enso.projectmanager.boot.configuration.BootloaderConfig import org.enso.projectmanager.infrastructure.languageserver.LanguageServerBootLoader.{ ServerBootFailed, diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerController.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerController.scala index 4140089ef76c..83a9f55bc045 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerController.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerController.scala @@ -11,8 +11,8 @@ import akka.actor.{ Terminated } import com.typesafe.scalalogging.LazyLogging +import org.enso.logging.utils.akka.ActorMessageLogging import org.enso.semver.SemVer -import org.enso.logger.akka.ActorMessageLogging import org.enso.projectmanager.boot.configuration._ import org.enso.projectmanager.data.{LanguageServerSockets, Socket} import org.enso.projectmanager.event.ClientEvent.{ diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/util/UnhandledLogging.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/util/UnhandledLogging.scala index d48262a4ba04..8a818912d2fb 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/util/UnhandledLogging.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/util/UnhandledLogging.scala @@ -2,7 +2,7 @@ package org.enso.projectmanager.util import akka.actor.Actor import com.typesafe.scalalogging.LazyLogging -import org.enso.logger.akka.AkkaConverter +import org.enso.logging.utils.akka.AkkaConverter import org.slf4j.event.Level trait UnhandledLogging extends LazyLogging { this: Actor => From 0632194dd5adf4a794e1a76cf18bd479a66792f8 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 12:37:11 +0200 Subject: [PATCH 096/268] Create org.enso.language.server.deps.wrapper module --- build.sbt | 63 +++++++++++++++++++ .../src/main/java/module-info.java | 6 ++ 2 files changed, 69 insertions(+) create mode 100644 lib/java/language-server-deps-wrapper/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index d1bdf196f4b4..bbe6f3681466 100644 --- a/build.sbt +++ b/build.sbt @@ -1154,6 +1154,69 @@ lazy val `scala-libs-wrapper` = project }, ) +/** + * Wrapper project for dependencies of `language-server` that cannot be used as + * JPMS modules (cannot be put directly on module-path). + */ +lazy val `language-server-deps-wrapper` = project + .in(file("lib/java/language-server-deps-wrapper")) + .enablePlugins(JPMSPlugin) + .settings( + frgaalJavaCompilerSetting, + libraryDependencies ++= Seq( + "com.github.pureconfig" %% "pureconfig" % pureconfigVersion, + "com.chuusai" %% "shapeless" % "2.3.10", + "com.typesafe" % "config" % typesafeConfigVersion + ), + javaModuleName := "org.enso.language.server.deps.wrapper", + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + javacOptions ++= { + JPMSPlugin.constructOptions( + streams.value.log, + modulePath = modulePath.value, + patchModules = patchModules.value + ) + }, + forceModuleInfoCompilation := true, + exportedModuleBin := assembly + .dependsOn(compileModuleInfo) + .value, + exportedModule := assembly + .dependsOn(compileModuleInfo) + .value, + assembly / assemblyExcludedJars := { + val scalaVer = scalaBinaryVersion.value + JPMSUtils.filterModulesFromClasspath( + (Compile / fullClasspath).value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", + "com.typesafe" % "config" % typesafeConfigVersion + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + }, + patchModules := { + val scalaVer = scalaBinaryVersion.value + val scalaLibs = JPMSUtils.filterModulesFromUpdate( + update.value, + Seq( + "com.github.pureconfig" % ("pureconfig_" + scalaVer) % pureconfigVersion, + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + Map( + javaModuleName.value -> scalaLibs + ) + } + ) + lazy val cli = project .in(file("lib/scala/cli")) .enablePlugins(JPMSPlugin) diff --git a/lib/java/language-server-deps-wrapper/src/main/java/module-info.java b/lib/java/language-server-deps-wrapper/src/main/java/module-info.java new file mode 100644 index 000000000000..bdfc2c79e4b6 --- /dev/null +++ b/lib/java/language-server-deps-wrapper/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module org.enso.language.server.deps.wrapper { + requires scala.library; + + // pureconfig-core_2.13-0.17.4.jar + //exports pureconfig; +} From 1674eed5bc1e35ec22734b81e73140147143ca32 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 12:37:48 +0200 Subject: [PATCH 097/268] language-server is module --- build.sbt | 68 ++++++++++++++++++- .../src/main/java/module-info.java | 29 ++++++++ .../src/main/java/module-info.java | 8 +++ .../src/main/java/module-info.java | 7 ++ .../searcher/src/main/java/module-info.java | 7 ++ 5 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 engine/language-server/src/main/java/module-info.java create mode 100644 lib/scala/json-rpc-server/src/main/java/module-info.java create mode 100644 lib/scala/logging-utils-akka/src/main/java/module-info.java create mode 100644 lib/scala/searcher/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index bbe6f3681466..5250d88b20d4 100644 --- a/build.sbt +++ b/build.sbt @@ -1023,14 +1023,24 @@ lazy val `logging-service-logback` = project lazy val `logging-utils-akka` = project .in(file("lib/scala/logging-utils-akka")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, version := "0.1", + compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe.akka" %% "akka-actor" % akkaVersion - ) + ), + moduleDependencies := { + val scalaVer = scalaBinaryVersion.value + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "com.typesafe.akka" % ("akka-actor_" + scalaVer) % akkaVersion + ) + } ) lazy val filewatcher = project @@ -1441,6 +1451,7 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) lazy val `json-rpc-server` = project .in(file("lib/scala/json-rpc-server")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, libraryDependencies ++= akka ++ logbackTest, @@ -1455,6 +1466,18 @@ lazy val `json-rpc-server` = project "org.apache.httpcomponents" % "httpclient" % httpComponentsVersion % Test, "org.apache.httpcomponents" % "httpcore" % httpComponentsVersion % Test, "commons-io" % "commons-io" % commonsIoVersion % Test + ), + excludeFilter := excludeFilter.value || "module-info.java", + moduleDependencies := { + val scalaVer = scalaBinaryVersion.value + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, + akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, + ) + }, + internalModuleDependencies := Seq( + (`scala-libs-wrapper` / exportedModule).value ) ) @@ -1488,13 +1511,21 @@ lazy val testkit = project lazy val searcher = project .in(file("lib/scala/searcher")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, annotationProcSetting, libraryDependencies ++= jmh ++ Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test - ) ++ logbackTest + ) ++ logbackTest, + compileOrder := CompileOrder.ScalaThenJava, + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + internalModuleDependencies := Seq( + (`polyglot-api` / exportedModule).value + ) ) .configs(Benchmark) .settings( @@ -1833,6 +1864,39 @@ lazy val `language-server` = (project in file("engine/language-server")) "org.bouncycastle" % "bcprov-jdk18on" % "1.76" % Test, "org.apache.tika" % "tika-core" % tikaVersion % Test ), + excludeFilter := excludeFilter.value || "module-info.java", + moduleDependencies := { + val scalaVer = scalaBinaryVersion.value + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, + akkaURL % ("akka-http_" + scalaVer) % akkaHTTPVersion, + "dev.zio" % ("zio_" + scalaVer) % zioVersion, + + ) + }, + internalModuleDependencies := Seq( + (`scala-libs-wrapper` / exportedModule).value, + (`language-server-deps-wrapper` / exportedModule).value, + (`engine-runner-common` / exportedModule).value, + (`ydoc-server` / exportedModule).value, + (`logging-utils` / exportedModule).value, + (`logging-utils-akka` / exportedModule).value, + (`engine-common` / exportedModule).value, + (`library-manager` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + (`json-rpc-server` / exportedModule).value, + (`profiling-utils` / exportedModule).value, + (`searcher` / exportedModule).value, + (`text-buffer` / exportedModule).value, + (`version-output` / exportedModule).value, + ), Test / testOptions += Tests .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), Test / envVars ++= distributionEnvironmentOverrides, diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java new file mode 100644 index 000000000000..a184f3724043 --- /dev/null +++ b/engine/language-server/src/main/java/module-info.java @@ -0,0 +1,29 @@ +module org.enso.language.server { + requires java.logging; + requires scala.library; + + requires akka.actor; + requires akka.http; + requires commons.cli; + requires dev.zio.zio; + requires flatbuffers.java; + requires org.apache.commons.io; + requires org.graalvm.polyglot; + requires org.openide.util.lookup.RELEASE180; + requires org.slf4j; + + requires org.enso.runner.common; + requires org.enso.engine.common; + requires org.enso.json.rpc.server; + requires org.enso.logging.utils; + requires org.enso.logging.utils.akka; + requires org.enso.librarymanager; + requires org.enso.polyglot.api; + requires org.enso.profiling; + requires org.enso.scala.wrapper; + requires org.enso.language.server.deps.wrapper; + requires org.enso.searcher; + requires org.enso.version.output; + requires org.enso.text.buffer; + requires org.enso.ydoc; +} diff --git a/lib/scala/json-rpc-server/src/main/java/module-info.java b/lib/scala/json-rpc-server/src/main/java/module-info.java new file mode 100644 index 000000000000..5168e7a14170 --- /dev/null +++ b/lib/scala/json-rpc-server/src/main/java/module-info.java @@ -0,0 +1,8 @@ +module org.enso.json.rpc.server { + exports org.enso.jsonrpc; + requires akka.actor; + requires akka.stream; + requires scala.library; + requires org.enso.scala.wrapper; + +} diff --git a/lib/scala/logging-utils-akka/src/main/java/module-info.java b/lib/scala/logging-utils-akka/src/main/java/module-info.java new file mode 100644 index 000000000000..0384ff0e446f --- /dev/null +++ b/lib/scala/logging-utils-akka/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module org.enso.logging.utils.akka { + requires scala.library; + requires akka.actor; + requires org.slf4j; + + exports org.enso.logging.utils.akka; +} diff --git a/lib/scala/searcher/src/main/java/module-info.java b/lib/scala/searcher/src/main/java/module-info.java new file mode 100644 index 000000000000..14e1abdebf6f --- /dev/null +++ b/lib/scala/searcher/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module org.enso.searcher { + requires scala.library; + + requires org.enso.polyglot.api; + + exports org.enso.searcher.memory; +} From 44a935201f7d3e0bd24f7d01f7dd2cf03ceac0f0 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 17:50:20 +0200 Subject: [PATCH 098/268] Creat akka-wrapper modular fat jar --- build.sbt | 103 ++++++++++++++- .../src/main/java/module-info.java | 124 ++++++++++++++++++ 2 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 lib/java/akka-wrapper/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 5250d88b20d4..9ce57705dc0d 100644 --- a/build.sbt +++ b/build.sbt @@ -1215,7 +1215,108 @@ lazy val `language-server-deps-wrapper` = project val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.github.pureconfig" % ("pureconfig_" + scalaVer) % pureconfigVersion, + "com.github.pureconfig" % ("pureconfig_" + scalaVer) % pureconfigVersion + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + Map( + javaModuleName.value -> scalaLibs + ) + } + ) + +/** JPMS module wrapper for Akka. + */ +lazy val `akka-wrapper` = project + .in(file("lib/java/akka-wrapper")) + .enablePlugins(JPMSPlugin) + .settings( + frgaalJavaCompilerSetting, + libraryDependencies ++= akka ++ Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2", + "org.scala-lang.modules" %% "scala-java8-compat" % "1.0.0", + akkaURL %% "akka-http-core" % akkaHTTPVersion, + akkaURL %% "akka-slf4j" % akkaVersion, + akkaURL %% "akka-parsing" % "10.2.10", + akkaURL %% "akka-protobuf-v3" % akkaVersion, + akkaURL %% "akka-http-spray-json" % "10.2.10", + "com.typesafe" % "config" % typesafeConfigVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "com.google.protobuf" % "protobuf-java" % "3.25.1", + "io.github.java-diff-utils" % "java-diff-utils" % "4.12", + "org.reactivestreams" % "reactive-streams" % "1.0.3", + "org.jline" % "jline" % jlineVersion, + "net.java.dev.jna" % "jna" % "5.13.0", + "io.spray" %% "spray-json" % "1.3.6" + ), + javaModuleName := "org.enso.akka.wrapper", + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "com.google.protobuf" % "protobuf-java" % "3.25.1", + "org.reactivestreams" % "reactive-streams" % "1.0.3" + ), + javacOptions ++= { + JPMSPlugin.constructOptions( + streams.value.log, + modulePath = modulePath.value, + patchModules = patchModules.value + ) + }, + forceModuleInfoCompilation := true, + // First assemble, then compile `module-info.java` + exportedModuleBin := assembly + .dependsOn(compileModuleInfo) + .value, + exportedModule := exportedModuleBin.value, + assembly / assemblyExcludedJars := { + val scalaVer = scalaBinaryVersion.value + val excludedJars = JPMSUtils.filterModulesFromUpdate( + update.value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % "1.1.2", + "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % "1.0.0", + "org.slf4j" % "slf4j-api" % slf4jVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.github.java-diff-utils" % "java-diff-utils" % "4.12", + "org.jline" % "jline" % jlineVersion, + "com.google.protobuf" % "protobuf-java" % "3.25.1", + "org.reactivestreams" % "reactive-streams" % "1.0.3", + "net.java.dev.jna" % "jna" % "5.13.0" + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + excludedJars + .map(Attributed.blank) + }, + patchModules := { + val scalaVer = scalaBinaryVersion.value + val scalaLibs = JPMSUtils.filterModulesFromUpdate( + update.value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "io.spray" % ("spray-json_" + scalaVer) % "1.3.6", + akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, + akkaURL % ("akka-actor-typed_" + scalaVer) % akkaVersion, + akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, + akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, + akkaURL % ("akka-http-spray-json_" + scalaVer) % "10.2.10", + akkaURL % ("akka-slf4j_" + scalaVer) % akkaVersion, + akkaURL % ("akka-parsing_" + scalaVer) % "10.2.10", + akkaURL % ("akka-protobuf-v3_" + scalaVer) % akkaVersion ), streams.value.log, moduleName.value, diff --git a/lib/java/akka-wrapper/src/main/java/module-info.java b/lib/java/akka-wrapper/src/main/java/module-info.java new file mode 100644 index 000000000000..855050ccd0bf --- /dev/null +++ b/lib/java/akka-wrapper/src/main/java/module-info.java @@ -0,0 +1,124 @@ +module org.enso.akka.wrapper { + requires protobuf.java; + requires scala.library; + requires org.reactivestreams; + + // akka-actor + exports akka; + exports akka.actor; + exports akka.actor.dungeon; + exports akka.actor.setup; + exports akka.annotation; + exports akka.compat; + exports akka.dispatch; + exports akka.dispatch.affinity; + exports akka.dispatch.internal; + exports akka.dispatch.sysmsg; + exports akka.event; + exports akka.event.japi; + exports akka.event.jul; + exports akka.io; + exports akka.io.dns; + exports akka.io.dns.internal; + exports akka.japi; + exports akka.japi.function; + exports akka.japi.pf; + exports akka.japi.tuple; + exports akka.pattern; + exports akka.pattern.extended; + exports akka.pattern.internal; + exports akka.routing; + exports akka.serialization; + exports akka.util; + exports akka.util.ccompat; + + // akka-actor-typed + exports akka.actor.typed; + exports akka.actor.typed.delivery; + exports akka.actor.typed.delivery.internal; + exports akka.actor.typed.eventstream; + exports akka.actor.typed.internal; + exports akka.actor.typed.internal.adapter; + exports akka.actor.typed.internal.jfr; + exports akka.actor.typed.internal.pubsub; + exports akka.actor.typed.internal.receptionist; + exports akka.actor.typed.internal.routing; + exports akka.actor.typed.javadsl; + exports akka.actor.typed.pubsub; + exports akka.actor.typed.receptionist; + exports akka.actor.typed.scaladsl; + exports akka.actor.typed.scaladsl.adapter; + + // akka-http-core + exports akka.http; + exports akka.http.ccompat.imm; + exports akka.http.impl.engine; + exports akka.http.impl.engine.client; + exports akka.http.impl.engine.client.pool; + exports akka.http.impl.engine.http2; + exports akka.http.impl.engine.http2.client; + exports akka.http.impl.engine.http2.framing; + exports akka.http.impl.engine.http2.hpack; + exports akka.http.impl.engine.http2.util; + exports akka.http.impl.engine.parsing; + exports akka.http.impl.engine.rendering; + exports akka.http.impl.engine.server; + exports akka.http.impl.engine.ws; + exports akka.http.impl.model; + exports akka.http.impl.model.parser; + exports akka.http.impl.settings; + exports akka.http.impl.util; + exports akka.http.javadsl; + exports akka.http.javadsl.model; + exports akka.http.javadsl.model.headers; + exports akka.http.javadsl.model.sse; + exports akka.http.javadsl.model.ws; + exports akka.http.javadsl.settings; + exports akka.http.scaladsl; + exports akka.http.scaladsl.model; + exports akka.http.scaladsl.model.headers; + exports akka.http.scaladsl.model.http2; + exports akka.http.scaladsl.model.sse; + exports akka.http.scaladsl.model.ws; + exports akka.http.scaladsl.settings; + exports akka.http.scaladsl.util; + exports akka.http.shaded.com.twitter.hpack; + + // akka-http-spray-json_2.13:10.2.10 + exports akka.http.scaladsl.marshallers.sprayjson; + + // akka-parsing + exports akka.http.ccompat; + exports akka.macros; + exports akka.parboiled2; + exports akka.parboiled2.support; + exports akka.parboiled2.util; + exports akka.shapeless; + exports akka.shapeless.ops; + exports akka.shapeless.syntax; + + // akka-protobuf-v3 + exports akka.protobufv3.internal; + exports akka.protobufv3.internal.compiler; + + // akka-slf4j + exports akka.event.slf4j; + + // akka-stream + exports akka.stream; + exports akka.stream.impl; + exports akka.stream.impl.fusing; + exports akka.stream.impl.io; + exports akka.stream.impl.io.compression; + exports akka.stream.impl.streamref; + exports akka.stream.javadsl; + exports akka.stream.scaladsl; + exports akka.stream.serialization; + exports akka.stream.snapshot; + exports akka.stream.stage; + exports com.typesafe.sslconfig.akka; + exports com.typesafe.sslconfig.akka.util; + + // io.spray:spray-json_2.13 + exports spray.json; +} From 538c6581b2c8247a807c8ee127fd4078ce66967c Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 17:51:15 +0200 Subject: [PATCH 099/268] fmt --- build.sbt | 70 +++++++++---------- .../java/org/enso/runner/RunnerLogging.java | 2 +- .../interpreter/service/ExecutionService.java | 4 +- .../instrument/job/EnsureCompiledJob.scala | 23 ++++-- .../test/context/ChangesetBuilderTest.scala | 6 +- .../id/execution/IdExecutionInstrument.java | 2 +- .../src/main/java/module-info.java | 1 - .../org/enso/interpreter/EnsoLanguage.java | 8 +-- .../enso/interpreter/caches/ModuleCache.java | 5 +- .../interpreter/caches/SuggestionsCache.java | 3 +- .../expression/builtin/meta/HashCodeNode.java | 2 +- .../expression/builtin/meta/Instrumentor.java | 2 +- .../enso/interpreter/runtime/EnsoContext.java | 2 +- .../src/main/java/module-info.java | 1 - .../src/main/java/module-info.java | 2 - .../src/main/java/module-info.java | 3 +- .../src/main/java/module-info.java | 1 + .../logging/service/LoggingSetupHelper.java | 2 +- .../searcher/src/main/java/module-info.java | 1 - .../org/enso/scala/yaml/YamlDecoder.scala | 2 +- project/FrgaalJavaCompiler.scala | 41 ++++++----- project/JPMSPlugin.scala | 53 ++++++-------- 22 files changed, 121 insertions(+), 115 deletions(-) diff --git a/build.sbt b/build.sbt index 9ce57705dc0d..5f3dcf0dceaf 100644 --- a/build.sbt +++ b/build.sbt @@ -964,11 +964,11 @@ lazy val `logging-service` = project ), moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ), internalModuleDependencies := Seq( (`logging-config` / exportedModule).value, - (`logging-utils` / exportedModule).value, + (`logging-utils` / exportedModule).value ) ) .dependsOn(`logging-utils`) @@ -1010,12 +1010,12 @@ lazy val `logging-service-logback` = project "io.sentry" % "sentry-logback" % "6.28.0", "io.sentry" % "sentry" % "6.28.0", "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided", - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion ), internalModuleDependencies := Seq( (`logging-service` / exportedModule).value, - (`logging-config` / exportedModule).value, + (`logging-config` / exportedModule).value ) ) .dependsOn(`logging-config`) @@ -1036,8 +1036,8 @@ lazy val `logging-utils-akka` = project moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe.akka" % ("akka-actor_" + scalaVer) % akkaVersion ) } @@ -1161,13 +1161,12 @@ lazy val `scala-libs-wrapper` = project Map( javaModuleName.value -> scalaLibs ) - }, + } ) -/** - * Wrapper project for dependencies of `language-server` that cannot be used as - * JPMS modules (cannot be put directly on module-path). - */ +/** Wrapper project for dependencies of `language-server` that cannot be used as + * JPMS modules (cannot be put directly on module-path). + */ lazy val `language-server-deps-wrapper` = project .in(file("lib/java/language-server-deps-wrapper")) .enablePlugins(JPMSPlugin) @@ -1175,8 +1174,8 @@ lazy val `language-server-deps-wrapper` = project frgaalJavaCompilerSetting, libraryDependencies ++= Seq( "com.github.pureconfig" %% "pureconfig" % pureconfigVersion, - "com.chuusai" %% "shapeless" % "2.3.10", - "com.typesafe" % "config" % typesafeConfigVersion + "com.chuusai" %% "shapeless" % "2.3.10", + "com.typesafe" % "config" % typesafeConfigVersion ), javaModuleName := "org.enso.language.server.deps.wrapper", moduleDependencies := Seq( @@ -1201,9 +1200,9 @@ lazy val `language-server-deps-wrapper` = project JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", - "com.typesafe" % "config" % typesafeConfigVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", + "com.typesafe" % "config" % typesafeConfigVersion ), streams.value.log, moduleName.value, @@ -1572,9 +1571,9 @@ lazy val `json-rpc-server` = project moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, - akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, + akkaURL % ("akka-actor_" + scalaVer) % akkaVersion ) }, internalModuleDependencies := Seq( @@ -1916,7 +1915,7 @@ lazy val `polyglot-api` = project internalModuleDependencies := Seq( (`scala-libs-wrapper` / exportedModule).value, (`engine-common` / exportedModule).value, - (`logging-utils` / exportedModule).value, + (`logging-utils` / exportedModule).value ), GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task @@ -1969,17 +1968,16 @@ lazy val `language-server` = (project in file("engine/language-server")) moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, - "commons-cli" % "commons-cli" % commonsCliVersion, - "commons-io" % "commons-io" % commonsIoVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "commons-io" % "commons-io" % commonsIoVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, - akkaURL % ("akka-http_" + scalaVer) % akkaHTTPVersion, - "dev.zio" % ("zio_" + scalaVer) % zioVersion, - + akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, + akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, + "dev.zio" % ("zio_" + scalaVer) % zioVersion ) }, internalModuleDependencies := Seq( @@ -1996,7 +1994,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`profiling-utils` / exportedModule).value, (`searcher` / exportedModule).value, (`text-buffer` / exportedModule).value, - (`version-output` / exportedModule).value, + (`version-output` / exportedModule).value ), Test / testOptions += Tests .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), @@ -2356,7 +2354,7 @@ lazy val runtime = (project in file("engine/runtime")) (`version-output` / exportedModule).value, (`interpreter-dsl` / exportedModule).value, (`persistance` / exportedModule).value, - (`text-buffer` / exportedModule).value, + (`text-buffer` / exportedModule).value ) ) .settings( @@ -2592,7 +2590,7 @@ lazy val `runtime-compiler` = (`runtime-parser` / exportedModule).value, (`syntax-rust-definition` / exportedModule).value, (`persistance` / exportedModule).value, - (`editions` / exportedModule).value, + (`editions` / exportedModule).value ) ) .dependsOn(`runtime-parser`) @@ -2615,7 +2613,7 @@ lazy val `runtime-suggestions` = ), excludeFilter := excludeFilter.value || "module-info.java", moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-library" % scalacVersion ), internalModuleDependencies := Seq( (`pkg` / exportedModule).value, @@ -3655,7 +3653,7 @@ lazy val `common-polyglot-core-utils` = project "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided" ), moduleDependencies := Seq( - "com.ibm.icu" % "icu4j" % icuVersion, + "com.ibm.icu" % "icu4j" % icuVersion ) ) diff --git a/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java b/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java index 2b5cc0d1310d..24b1169f7f90 100644 --- a/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java +++ b/engine/runner/src/main/java/org/enso/runner/RunnerLogging.java @@ -4,8 +4,8 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import org.enso.logging.config.LoggerSetup; import org.enso.logger.masking.Masking; +import org.enso.logging.config.LoggerSetup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.event.Level; diff --git a/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionService.java b/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionService.java index cb8df9b4fa01..75b5aa9e9461 100644 --- a/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionService.java +++ b/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionService.java @@ -30,9 +30,7 @@ import org.enso.compiler.suggestions.SimpleUpdate; import org.enso.interpreter.instrument.Endpoint; import org.enso.interpreter.instrument.MethodCallsCache; -import org.enso.interpreter.runtime.instrument.NotificationHandler; import org.enso.interpreter.instrument.RuntimeCache; -import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.instrument.UpdatesSynchronizationState; import org.enso.interpreter.instrument.VisualizationHolder; import org.enso.interpreter.instrument.profiling.ProfilingInfo; @@ -47,6 +45,8 @@ import org.enso.interpreter.runtime.data.Type; import org.enso.interpreter.runtime.data.atom.AtomConstructor; import org.enso.interpreter.runtime.error.PanicException; +import org.enso.interpreter.runtime.instrument.NotificationHandler; +import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.runtime.scope.ModuleScope; import org.enso.interpreter.runtime.state.State; import org.enso.interpreter.service.error.FailedToApplyEditsException; diff --git a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala index 4c108cace230..21d04d68fefb 100644 --- a/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala +++ b/engine/runtime-instrument-common/src/main/scala/org/enso/interpreter/instrument/job/EnsureCompiledJob.scala @@ -2,16 +2,29 @@ package org.enso.interpreter.instrument.job import com.oracle.truffle.api.TruffleLogger import org.enso.common.CompilationStage -import org.enso.compiler.{CompilerResult, data} +import org.enso.compiler.{data, CompilerResult} import org.enso.compiler.context._ import org.enso.compiler.core.Implicits.AsMetadata import org.enso.compiler.core.{ExternalID, IR} import org.enso.compiler.core.ir -import org.enso.compiler.core.ir.{Location, expression} +import org.enso.compiler.core.ir.{expression, Location} import org.enso.compiler.data.BindingsMap -import org.enso.compiler.pass.analyse.{CachePreferenceAnalysis, DataflowAnalysis, GatherDiagnostics} -import org.enso.interpreter.instrument.execution.{LocationResolver, RuntimeContext} -import org.enso.interpreter.instrument.{CacheInvalidation, Changeset, ChangesetBuilder, InstrumentFrame, Visualization} +import org.enso.compiler.pass.analyse.{ + CachePreferenceAnalysis, + DataflowAnalysis, + GatherDiagnostics +} +import org.enso.interpreter.instrument.execution.{ + LocationResolver, + RuntimeContext +} +import org.enso.interpreter.instrument.{ + CacheInvalidation, + Changeset, + ChangesetBuilder, + InstrumentFrame, + Visualization +} import org.enso.interpreter.runtime.Module import org.enso.interpreter.service.error.ModuleNotFoundForFileException import org.enso.logger.masking.MaskedPath diff --git a/engine/runtime-instrument-common/src/test/scala/org/enso/compiler/test/context/ChangesetBuilderTest.scala b/engine/runtime-instrument-common/src/test/scala/org/enso/compiler/test/context/ChangesetBuilderTest.scala index 8c3491211942..acf8a172366b 100644 --- a/engine/runtime-instrument-common/src/test/scala/org/enso/compiler/test/context/ChangesetBuilderTest.scala +++ b/engine/runtime-instrument-common/src/test/scala/org/enso/compiler/test/context/ChangesetBuilderTest.scala @@ -1,11 +1,7 @@ package org.enso.compiler.test.context import org.enso.compiler.Passes -import org.enso.compiler.context.{ - FreshNameSupply, - InlineContext, - ModuleContext -} +import org.enso.compiler.context.{FreshNameSupply, InlineContext, ModuleContext} import org.enso.compiler.core.{ExternalID, IR, Identifier} import org.enso.compiler.core.ir.{CallArgument, Expression, Function} import org.enso.compiler.core.ir.expression.Application diff --git a/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/id/execution/IdExecutionInstrument.java b/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/id/execution/IdExecutionInstrument.java index 0c3b31441860..53537b45e231 100644 --- a/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/id/execution/IdExecutionInstrument.java +++ b/engine/runtime-instrument-id-execution/src/main/java/org/enso/interpreter/instrument/id/execution/IdExecutionInstrument.java @@ -22,7 +22,6 @@ import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.source.SourceSection; import java.util.UUID; -import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.node.ClosureRootNode; import org.enso.interpreter.node.EnsoRootNode; import org.enso.interpreter.node.ExpressionNode; @@ -38,6 +37,7 @@ import org.enso.interpreter.runtime.error.DataflowError; import org.enso.interpreter.runtime.error.PanicException; import org.enso.interpreter.runtime.error.PanicSentinel; +import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.runtime.state.State; import org.enso.interpreter.runtime.tag.AvoidIdInstrumentationTag; import org.enso.interpreter.runtime.tag.IdentifiedTag; diff --git a/engine/runtime-instrument-runtime-server/src/main/java/module-info.java b/engine/runtime-instrument-runtime-server/src/main/java/module-info.java index 43a76d573318..dc8eedcb9c66 100644 --- a/engine/runtime-instrument-runtime-server/src/main/java/module-info.java +++ b/engine/runtime-instrument-runtime-server/src/main/java/module-info.java @@ -5,7 +5,6 @@ requires org.enso.engine.common; requires org.enso.distribution; requires org.enso.lockmanager; - requires org.openide.util.lookup.RELEASE180; requires org.graalvm.polyglot; requires org.graalvm.truffle; diff --git a/engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java b/engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java index c842f9704893..374d3ff9326b 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/EnsoLanguage.java @@ -27,16 +27,16 @@ import org.enso.distribution.Environment; import org.enso.distribution.locking.LockManager; import org.enso.distribution.locking.ThreadSafeFileLockManager; -import org.enso.interpreter.runtime.instrument.NotificationHandler; -import org.enso.interpreter.runtime.instrument.NotificationHandler.Forwarder; -import org.enso.interpreter.runtime.instrument.NotificationHandler.TextMode$; -import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.node.EnsoRootNode; import org.enso.interpreter.node.ExpressionNode; import org.enso.interpreter.node.ProgramRootNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.IrToTruffle; import org.enso.interpreter.runtime.data.atom.AtomNewInstanceNode; +import org.enso.interpreter.runtime.instrument.NotificationHandler; +import org.enso.interpreter.runtime.instrument.NotificationHandler.Forwarder; +import org.enso.interpreter.runtime.instrument.NotificationHandler.TextMode$; +import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.runtime.state.ExecutionEnvironment; import org.enso.interpreter.runtime.tag.AvoidIdInstrumentationTag; import org.enso.interpreter.runtime.tag.IdentifiedTag; diff --git a/engine/runtime/src/main/java/org/enso/interpreter/caches/ModuleCache.java b/engine/runtime/src/main/java/org/enso/interpreter/caches/ModuleCache.java index 1cd8e1a12c26..b6be7640c8c0 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/caches/ModuleCache.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/caches/ModuleCache.java @@ -142,7 +142,10 @@ public Optional getCacheRoots(EnsoContext context) { var pathSegmentsJava = new ArrayList(); pathSegmentsJava.addAll( Arrays.asList( - Builtins.NAMESPACE, Builtins.PACKAGE_NAME, BuildVersion.ensoVersion(), BuildVersion.ensoVersion())); + Builtins.NAMESPACE, + Builtins.PACKAGE_NAME, + BuildVersion.ensoVersion(), + BuildVersion.ensoVersion())); pathSegmentsJava.addAll(module.getName().pathAsJava()); var path = distribution.LocallyInstalledDirectories() diff --git a/engine/runtime/src/main/java/org/enso/interpreter/caches/SuggestionsCache.java b/engine/runtime/src/main/java/org/enso/interpreter/caches/SuggestionsCache.java index a99e6f45173f..d7db6f24ace7 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/caches/SuggestionsCache.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/caches/SuggestionsCache.java @@ -106,7 +106,8 @@ public Optional getCacheRoots(EnsoContext context) { .getPackageForLibraryJava(libraryName) .map( pkg -> { - var bindingsCacheRoot = pkg.getSuggestionsCacheRootForPackage(BuildVersion.ensoVersion()); + var bindingsCacheRoot = + pkg.getSuggestionsCacheRootForPackage(BuildVersion.ensoVersion()); var localCacheRoot = bindingsCacheRoot.resolve(libraryName.namespace()); var distribution = context.getDistributionManager(); var pathSegments = diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java index e9e2c5ef6530..68bd6527e4a1 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java @@ -1,6 +1,5 @@ package org.enso.interpreter.node.expression.builtin.meta; -import java.util.Objects; import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; @@ -25,6 +24,7 @@ import java.time.LocalDateTime; import java.time.ZonedDateTime; import java.util.Arrays; +import java.util.Objects; import org.enso.interpreter.dsl.AcceptsError; import org.enso.interpreter.dsl.BuiltinMethod; import org.enso.interpreter.node.callable.InvokeCallableNode.ArgumentsExecutionMode; diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/Instrumentor.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/Instrumentor.java index 14751689467f..da77904cb888 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/Instrumentor.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/Instrumentor.java @@ -6,12 +6,12 @@ import com.oracle.truffle.api.interop.InteropException; import com.oracle.truffle.api.interop.InteropLibrary; import org.enso.interpreter.EnsoLanguage; -import org.enso.interpreter.runtime.instrument.Timer; import org.enso.interpreter.node.callable.FunctionCallInstrumentationNode; import org.enso.interpreter.runtime.EnsoContext; import org.enso.interpreter.runtime.Module; import org.enso.interpreter.runtime.data.EnsoObject; import org.enso.interpreter.runtime.data.vector.ArrayLikeHelpers; +import org.enso.interpreter.runtime.instrument.Timer; import org.enso.polyglot.debugger.IdExecutionService; final class Instrumentor implements EnsoObject, IdExecutionService.Callbacks { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java index 3f3ece4a108c..b26c67ea91ed 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/EnsoContext.java @@ -48,11 +48,11 @@ import org.enso.editions.LibraryName; import org.enso.interpreter.EnsoLanguage; import org.enso.interpreter.OptionsHelper; -import org.enso.interpreter.runtime.instrument.NotificationHandler; import org.enso.interpreter.runtime.builtin.Builtins; import org.enso.interpreter.runtime.data.Type; import org.enso.interpreter.runtime.data.text.Text; import org.enso.interpreter.runtime.error.PanicException; +import org.enso.interpreter.runtime.instrument.NotificationHandler; import org.enso.interpreter.runtime.scope.TopLevelScope; import org.enso.interpreter.runtime.state.ExecutionEnvironment; import org.enso.interpreter.runtime.state.State; diff --git a/lib/scala/connected-lock-manager/src/main/java/module-info.java b/lib/scala/connected-lock-manager/src/main/java/module-info.java index 7c3b71ce6307..afb3b144a79c 100644 --- a/lib/scala/connected-lock-manager/src/main/java/module-info.java +++ b/lib/scala/connected-lock-manager/src/main/java/module-info.java @@ -1,6 +1,5 @@ module org.enso.lockmanager { requires scala.library; - requires org.enso.distribution; requires org.enso.polyglot.api; requires org.enso.scala.wrapper; diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java index 00d5cc93eb81..e9688675300b 100644 --- a/lib/scala/library-manager/src/main/java/module-info.java +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -1,6 +1,5 @@ module org.enso.librarymanager { requires scala.library; - requires org.enso.distribution; requires org.enso.downloader; requires org.enso.cli; @@ -11,7 +10,6 @@ // For com.typesafe.scalalogging.Logger requires org.enso.scala.wrapper; requires org.enso.scala.yaml; - requires org.yaml.snakeyaml; exports org.enso.librarymanager; diff --git a/lib/scala/logging-service-logback/src/main/java/module-info.java b/lib/scala/logging-service-logback/src/main/java/module-info.java index 09fffa97b3c7..6c4d63e79904 100644 --- a/lib/scala/logging-service-logback/src/main/java/module-info.java +++ b/lib/scala/logging-service-logback/src/main/java/module-info.java @@ -11,5 +11,6 @@ requires org.slf4j; requires org.openide.util.lookup.RELEASE180; - provides LoggerSetup with LogbackSetup; + provides LoggerSetup with + LogbackSetup; } diff --git a/lib/scala/logging-service/src/main/java/module-info.java b/lib/scala/logging-service/src/main/java/module-info.java index f54313cef95a..b27a818373af 100644 --- a/lib/scala/logging-service/src/main/java/module-info.java +++ b/lib/scala/logging-service/src/main/java/module-info.java @@ -1,5 +1,6 @@ module org.enso.logging.service { exports org.enso.logging.service; + requires org.enso.logging.config; requires org.enso.logging.utils; requires org.slf4j; diff --git a/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingSetupHelper.java b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingSetupHelper.java index 4bd39b18d36e..c5e3e0ec47f0 100644 --- a/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingSetupHelper.java +++ b/lib/scala/logging-service/src/main/java/org/enso/logging/service/LoggingSetupHelper.java @@ -4,9 +4,9 @@ import java.nio.file.Path; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; +import org.enso.logger.masking.Masking; import org.enso.logging.config.LoggerSetup; import org.enso.logging.config.MissingConfigurationField; -import org.enso.logger.masking.Masking; import org.slf4j.event.Level; import scala.Option; import scala.Unit$; diff --git a/lib/scala/searcher/src/main/java/module-info.java b/lib/scala/searcher/src/main/java/module-info.java index 14e1abdebf6f..8a8400488ca4 100644 --- a/lib/scala/searcher/src/main/java/module-info.java +++ b/lib/scala/searcher/src/main/java/module-info.java @@ -1,6 +1,5 @@ module org.enso.searcher { requires scala.library; - requires org.enso.polyglot.api; exports org.enso.searcher.memory; diff --git a/lib/scala/yaml/src/main/scala/org/enso/scala/yaml/YamlDecoder.scala b/lib/scala/yaml/src/main/scala/org/enso/scala/yaml/YamlDecoder.scala index db273b871423..81444ce7a226 100644 --- a/lib/scala/yaml/src/main/scala/org/enso/scala/yaml/YamlDecoder.scala +++ b/lib/scala/yaml/src/main/scala/org/enso/scala/yaml/YamlDecoder.scala @@ -3,7 +3,7 @@ package org.enso.scala.yaml import org.yaml.snakeyaml.error.YAMLException import org.yaml.snakeyaml.nodes._ -import scala.collection.{BuildFrom, mutable} +import scala.collection.{mutable, BuildFrom} import scala.jdk.CollectionConverters.CollectionHasAsScala abstract class YamlDecoder[T] { diff --git a/project/FrgaalJavaCompiler.scala b/project/FrgaalJavaCompiler.scala index b73aa1c7f55f..3ef97c9c170c 100644 --- a/project/FrgaalJavaCompiler.scala +++ b/project/FrgaalJavaCompiler.scala @@ -34,18 +34,17 @@ object FrgaalJavaCompiler { val debugArg = "-J-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:8000" - /** - * Returns custom setting for compiler that delegates to `Frgaal`. - * @param classpath The dependencyClasspath of the current project - * @param sbtCompilers Configuration for compilers for current sbt project - * @param javaVersion Target Java version - * @param shouldCompileModuleInfo If true, module-info.java will be compiled - * in addition to other Java sources. See the docs - * of `shouldCompileModuleInfo` task in `build.sbt` and - * the docs of [[JPMSPlugin]]. - * @param javaSourceDir The directory where Java sources are located - * @return - */ + /** Returns custom setting for compiler that delegates to `Frgaal`. + * @param classpath The dependencyClasspath of the current project + * @param sbtCompilers Configuration for compilers for current sbt project + * @param javaVersion Target Java version + * @param shouldCompileModuleInfo If true, module-info.java will be compiled + * in addition to other Java sources. See the docs + * of `shouldCompileModuleInfo` task in `build.sbt` and + * the docs of [[JPMSPlugin]]. + * @param javaSourceDir The directory where Java sources are located + * @return + */ def compilers( classpath: sbt.Keys.Classpath, sbtCompilers: xsbti.compile.Compilers, @@ -77,8 +76,8 @@ object FrgaalJavaCompiler { val frgaalJavac = new FrgaalJavaCompiler( javaHome, frgaalOnClasspath.get, - javaSourceDir = javaSourceDir, - target = javaVersion, + javaSourceDir = javaSourceDir, + target = javaVersion, shouldCompileModuleInfo = shouldCompileModuleInfo ) val javaTools = sbt.internal.inc.javac @@ -140,12 +139,18 @@ object FrgaalJavaCompiler { val allSources = if (shouldCompileModuleInfo) { val moduleInfo = javaSourceDir.toPath.resolve("module-info.java").toFile if (!moduleInfo.exists()) { - log.error(s"[FrgaalJavaCompiler] module-info.java not found in $javaSourceDir") + log.error( + s"[FrgaalJavaCompiler] module-info.java not found in $javaSourceDir" + ) } - log.info(s"[FrgaalJavaCompiler] compiling ${sources.size + 1} Java sources with module-info.java to $out ...") + log.info( + s"[FrgaalJavaCompiler] compiling ${sources.size + 1} Java sources with module-info.java to $out ..." + ) Seq(moduleInfo.getAbsolutePath) ++ sources } else { - log.info(s"[FrgaalJavaCompiler] compiling ${sources.size} Java sources to $out ...") + log.info( + s"[FrgaalJavaCompiler] compiling ${sources.size} Java sources to $out ..." + ) sources } @@ -349,7 +354,7 @@ final class FrgaalJavaCompiler( compilerPath: Path, target: String, javaSourceDir: File, - source: Option[String] = None, + source: Option[String] = None, shouldCompileModuleInfo: Boolean = false ) extends XJavaCompiler { def run( diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 55fe2c52a82d..340a06fbc5df 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -79,7 +79,7 @@ object JPMSPlugin extends AutoPlugin { "directly put on module-path" ) - val shouldCompileModuleInfoManually = taskKey[Boolean] ( + val shouldCompileModuleInfoManually = taskKey[Boolean]( "If module-info.java should be compiled by us and not by sbt. " + "DO NOT USE DIRECTLY." ) @@ -89,7 +89,7 @@ object JPMSPlugin extends AutoPlugin { "DO NOT USE DIRECTLY." ) - val compileModuleInfo = taskKey[Unit] ( + val compileModuleInfo = taskKey[Unit]( "Compiles only module-info.java in some special cases. " + "DO NOT USE DIRECTLY." ) @@ -98,7 +98,6 @@ object JPMSPlugin extends AutoPlugin { import autoImport._ - override lazy val projectSettings: Seq[Setting[_]] = Seq( addModules := Seq.empty, moduleDependencies := Seq.empty, @@ -107,39 +106,37 @@ object JPMSPlugin extends AutoPlugin { val javaSrcDir = (Compile / javaSource).value val modInfo = javaSrcDir.toPath.resolve("module-info.java").toFile - val hasModInfo = modInfo.exists + val hasModInfo = modInfo.exists val projName = moduleName.value val logger = streams.value.log val hasScalaSources = (Compile / scalaSource).value.exists() val _compileOrder = (Compile / compileOrder).value val res = _compileOrder == CompileOrder.Mixed && - hasModInfo && - hasScalaSources + hasModInfo && + hasScalaSources if (res) { logger.debug( s"[JPMSPlugin] Project '$projName' will have `module-info.java` compiled " + - "manually. If this is not the intended behavior, consult the documentation " + - "of JPMSPlugin." + "manually. If this is not the intended behavior, consult the documentation " + + "of JPMSPlugin." ) } // Check excludeFilter - there should be module-info.java specified if (res && !excludeFilter.value.accept(modInfo)) { logger.error( s"[JPMSPlugin/$projName] `module-info.java` is not in `excludeFilter`. " + - "You should add module-info.java to " + - "`excludedFilter` so that sbt does not handle the compilation. Check docs of JPMSPlugin." + "You should add module-info.java to " + + "`excludedFilter` so that sbt does not handle the compilation. Check docs of JPMSPlugin." ) } res }, - // module-info.java compilation will be forced iff there are no other Java sources except // for module-info.java. forceModuleInfoCompilation := Def.taskIf { if (shouldCompileModuleInfoManually.value) { - val javaSources = (Compile / unmanagedSources) - .value + val javaSources = (Compile / unmanagedSources).value .filter(_.getName.endsWith(".java")) // If there are no Java source in `unmanagedSources`, it means that sbt will // not call Java compiler. So we force it to compile `module-info.java`. @@ -148,7 +145,6 @@ object JPMSPlugin extends AutoPlugin { false } }.value, - compileModuleInfo := Def.taskIf { if (forceModuleInfoCompilation.value) { JPMSUtils.compileModuleInfo().value @@ -157,7 +153,6 @@ object JPMSPlugin extends AutoPlugin { () } }.value, - // modulePath is set based on `moduleDependencies` and `internalModuleDependencies` modulePath := { // Do not use fullClasspath here - it will result in an infinite recursion @@ -170,29 +165,27 @@ object JPMSPlugin extends AutoPlugin { moduleName.value ) }, - // Returns the reference to target/classes directory and ensures that module-info // is compiled and present in the target directory. - exportedModule := Def.task { - val targetClassDir = (Compile / exportedProducts) - .value - .map(_.data) - .head - val logger = streams.value.log - val projName = moduleName.value - if (!isModule(targetClassDir)) { - logger.error( - s"[JPMSPlugin/$projName] The target classes directory ${targetClassDir.getAbsolutePath} is not " + + exportedModule := Def + .task { + val targetClassDir = (Compile / exportedProducts).value + .map(_.data) + .head + val logger = streams.value.log + val projName = moduleName.value + if (!isModule(targetClassDir)) { + logger.error( + s"[JPMSPlugin/$projName] The target classes directory ${targetClassDir.getAbsolutePath} is not " + "a module - it does not contain module-info.class. Make sure the `compileModuleInfo` task " + "is set correctly." - ) + ) + } + targetClassDir } - targetClassDir - } .dependsOn(compileModuleInfo) .dependsOn(Compile / compile) .value, - exportedModuleBin := { (Compile / packageBin) .dependsOn(exportedModule) From 7079e0b615ab8db9dd8a8aa283dd97dffe391580 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 19:04:22 +0200 Subject: [PATCH 100/268] Define common settings for modularFatJarWrapper --- build.sbt | 78 ++++++++++++++++++++++++------------------------------- 1 file changed, 34 insertions(+), 44 deletions(-) diff --git a/build.sbt b/build.sbt index 5f3dcf0dceaf..fadce81928ba 100644 --- a/build.sbt +++ b/build.sbt @@ -684,6 +684,37 @@ lazy val componentModulesPaths = ourMods ++ thirdPartyModFiles } +/** + * Common settings for our wrappers of some *problematic* dependencies that are not + * compatible with the JPMS system, i.e., these dependencies cannot be put on module-path. + * These projects contain only single `module-info.java` source. + * Before this source is compiled, all the dependencies are gathered via the `assembly` + * task into a Jar. + * The `module-info.java` exports all the packages from these dependencies. + * Note that this is the recommended way how to handle dependencies that are not + * JPMS-friendly. + * + * `exportedModule` of these projects return path to the assembled modular Jar. + * The projects should define: + * - `moduleDependencies` + * - `patchModules` + * - `assembly / assemblyExcludedJars` + */ +lazy val modularFatJarWrapperSettings = frgaalJavaCompilerSetting ++ Seq( + javacOptions ++= { + JPMSPlugin.constructOptions( + streams.value.log, + modulePath = modulePath.value, + patchModules = patchModules.value + ) + }, + forceModuleInfoCompilation := true, + exportedModuleBin := assembly + .dependsOn(compileModuleInfo) + .value, + exportedModule := exportedModuleBin.value, +) + // ============================================================================ // === Internal Libraries ===================================================== // ============================================================================ @@ -1088,7 +1119,7 @@ lazy val `scala-libs-wrapper` = project .in(file("lib/java/scala-libs-wrapper")) .enablePlugins(JPMSPlugin) .settings( - frgaalJavaCompilerSetting, + modularFatJarWrapperSettings, javaModuleName := "org.enso.scala.wrapper", libraryDependencies ++= circe ++ Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, @@ -1104,20 +1135,6 @@ lazy val `scala-libs-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion ), - javacOptions ++= { - JPMSPlugin.constructOptions( - streams.value.log, - modulePath = modulePath.value, - patchModules = patchModules.value - ) - }, - forceModuleInfoCompilation := true, - exportedModuleBin := assembly - .dependsOn(compileModuleInfo) - .value, - exportedModule := assembly - .dependsOn(compileModuleInfo) - .value, assembly / assemblyExcludedJars := { JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, @@ -1171,7 +1188,7 @@ lazy val `language-server-deps-wrapper` = project .in(file("lib/java/language-server-deps-wrapper")) .enablePlugins(JPMSPlugin) .settings( - frgaalJavaCompilerSetting, + modularFatJarWrapperSettings, libraryDependencies ++= Seq( "com.github.pureconfig" %% "pureconfig" % pureconfigVersion, "com.chuusai" %% "shapeless" % "2.3.10", @@ -1181,20 +1198,6 @@ lazy val `language-server-deps-wrapper` = project moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), - javacOptions ++= { - JPMSPlugin.constructOptions( - streams.value.log, - modulePath = modulePath.value, - patchModules = patchModules.value - ) - }, - forceModuleInfoCompilation := true, - exportedModuleBin := assembly - .dependsOn(compileModuleInfo) - .value, - exportedModule := assembly - .dependsOn(compileModuleInfo) - .value, assembly / assemblyExcludedJars := { val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( @@ -1232,7 +1235,7 @@ lazy val `akka-wrapper` = project .in(file("lib/java/akka-wrapper")) .enablePlugins(JPMSPlugin) .settings( - frgaalJavaCompilerSetting, + modularFatJarWrapperSettings, libraryDependencies ++= akka ++ Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, @@ -1259,19 +1262,6 @@ lazy val `akka-wrapper` = project "com.google.protobuf" % "protobuf-java" % "3.25.1", "org.reactivestreams" % "reactive-streams" % "1.0.3" ), - javacOptions ++= { - JPMSPlugin.constructOptions( - streams.value.log, - modulePath = modulePath.value, - patchModules = patchModules.value - ) - }, - forceModuleInfoCompilation := true, - // First assemble, then compile `module-info.java` - exportedModuleBin := assembly - .dependsOn(compileModuleInfo) - .value, - exportedModule := exportedModuleBin.value, assembly / assemblyExcludedJars := { val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( From 98e1cfcc5a204102e7aefe334826acd2b3d2c466 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 19:05:06 +0200 Subject: [PATCH 101/268] Fix compilation of json-rpc-server --- build.sbt | 9 ++++----- lib/scala/json-rpc-server/src/main/java/module-info.java | 5 ++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index fadce81928ba..3c08a3be24ad 100644 --- a/build.sbt +++ b/build.sbt @@ -1557,17 +1557,16 @@ lazy val `json-rpc-server` = project "org.apache.httpcomponents" % "httpcore" % httpComponentsVersion % Test, "commons-io" % "commons-io" % commonsIoVersion % Test ), - excludeFilter := excludeFilter.value || "module-info.java", + compileOrder := CompileOrder.ScalaThenJava, moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, - akkaURL % ("akka-actor_" + scalaVer) % akkaVersion + "org.scala-lang" % "scala-library" % scalacVersion, ) }, internalModuleDependencies := Seq( - (`scala-libs-wrapper` / exportedModule).value + (`scala-libs-wrapper` / exportedModule).value, + (`akka-wrapper` / exportedModule).value, ) ) diff --git a/lib/scala/json-rpc-server/src/main/java/module-info.java b/lib/scala/json-rpc-server/src/main/java/module-info.java index 5168e7a14170..afb020119d56 100644 --- a/lib/scala/json-rpc-server/src/main/java/module-info.java +++ b/lib/scala/json-rpc-server/src/main/java/module-info.java @@ -1,8 +1,7 @@ module org.enso.json.rpc.server { - exports org.enso.jsonrpc; - requires akka.actor; - requires akka.stream; requires scala.library; requires org.enso.scala.wrapper; + requires org.enso.akka.wrapper; + exports org.enso.jsonrpc; } From 66b61b4f8d5267da8843419558bda9575b40f229 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 19:05:53 +0200 Subject: [PATCH 102/268] Use akka and zio wrappers --- build.sbt | 64 ++++++++++++++++++- .../src/main/java/module-info.java | 5 +- .../src/main/java/module-info.java | 9 +++ .../src/main/java/module-info.java | 39 +++++++++++ .../src/main/java/module-info.java | 2 +- 5 files changed, 112 insertions(+), 7 deletions(-) create mode 100644 lib/java/zio-wrapper/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 3c08a3be24ad..6b602e751885 100644 --- a/build.sbt +++ b/build.sbt @@ -1069,9 +1069,11 @@ lazy val `logging-utils-akka` = project Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, - "com.typesafe.akka" % ("akka-actor_" + scalaVer) % akkaVersion ) - } + }, + internalModuleDependencies := Seq( + (`akka-wrapper` / exportedModule).value + ) ) lazy val filewatcher = project @@ -1270,7 +1272,6 @@ lazy val `akka-wrapper` = project "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % "1.1.2", "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % "1.0.0", "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe" % "config" % typesafeConfigVersion, @@ -1295,6 +1296,7 @@ lazy val `akka-wrapper` = project "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % "1.1.2", "com.typesafe" % "config" % typesafeConfigVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "io.spray" % ("spray-json_" + scalaVer) % "1.3.6", @@ -1317,6 +1319,60 @@ lazy val `akka-wrapper` = project } ) +lazy val `zio-wrapper` = project + .in(file("lib/java/zio-wrapper")) + .enablePlugins(JPMSPlugin) + .settings( + modularFatJarWrapperSettings, + javaModuleName := "org.enso.zio.wrapper", + libraryDependencies ++= zio ++ Seq( + "dev.zio" %% "zio-internal-macros" % zioVersion, + "dev.zio" %% "zio-stacktracer" % zioVersion, + "dev.zio" %% "izumi-reflect" % "2.3.8", + "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % "2.3.8", + ), + moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + ), + assembly / assemblyExcludedJars := { + val scalaVer = scalaBinaryVersion.value + val excludedJars = JPMSUtils.filterModulesFromUpdate( + update.value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "dev.zio" % ("zio-interop-cats_" + scalaVer) % zioInteropCatsVersion, + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + excludedJars + .map(Attributed.blank) + }, + patchModules := { + val scalaVer = scalaBinaryVersion.value + val scalaLibs = JPMSUtils.filterModulesFromUpdate( + update.value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "dev.zio" % ("zio_" + scalaVer) % zioVersion, + "dev.zio" % ("zio-internal-macros_" + scalaVer) % zioVersion, + "dev.zio" % ("zio-stacktracer_" + scalaVer) % zioVersion, + "dev.zio" % ("izumi-reflect_" + scalaVer) % "2.3.8", + "dev.zio" % ("izumi-reflect-thirdparty-boopickle-shaded_" + scalaVer) % "2.3.8", + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + Map( + javaModuleName.value -> scalaLibs + ) + } + ) + lazy val cli = project .in(file("lib/scala/cli")) .enablePlugins(JPMSPlugin) @@ -1970,6 +2026,8 @@ lazy val `language-server` = (project in file("engine/language-server")) ) }, internalModuleDependencies := Seq( + (`akka-wrapper` / exportedModule).value, + (`zio-wrapper` / exportedModule).value, (`scala-libs-wrapper` / exportedModule).value, (`language-server-deps-wrapper` / exportedModule).value, (`engine-runner-common` / exportedModule).value, diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index a184f3724043..c06b3f4f8e5a 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -2,16 +2,15 @@ requires java.logging; requires scala.library; - requires akka.actor; - requires akka.http; requires commons.cli; - requires dev.zio.zio; requires flatbuffers.java; requires org.apache.commons.io; requires org.graalvm.polyglot; requires org.openide.util.lookup.RELEASE180; requires org.slf4j; + requires org.enso.akka.wrapper; + requires org.enso.zio.wrapper; requires org.enso.runner.common; requires org.enso.engine.common; requires org.enso.json.rpc.server; diff --git a/lib/java/akka-wrapper/src/main/java/module-info.java b/lib/java/akka-wrapper/src/main/java/module-info.java index 855050ccd0bf..3277057e1136 100644 --- a/lib/java/akka-wrapper/src/main/java/module-info.java +++ b/lib/java/akka-wrapper/src/main/java/module-info.java @@ -121,4 +121,13 @@ // io.spray:spray-json_2.13 exports spray.json; + + // scala-lang.modules:scala-arser-combinators_2.13:1.1.2 + // Loaded by classes from com.typesafe.sslconfig.ssl.* + exports scala.util.parsing.combinator; + exports scala.util.parsing.combinator.lexical; + exports scala.util.parsing.combinator.syntactical; + exports scala.util.parsing.combinator.token; + exports scala.util.parsing.input; + exports scala.util.parsing.json; } diff --git a/lib/java/zio-wrapper/src/main/java/module-info.java b/lib/java/zio-wrapper/src/main/java/module-info.java new file mode 100644 index 000000000000..4403767c9cdf --- /dev/null +++ b/lib/java/zio-wrapper/src/main/java/module-info.java @@ -0,0 +1,39 @@ +module org.enso.zio.wrapper { + requires scala.library; + + // dev.zio:zio_2.13:2.0.14 + // dev.zio:zio-internal-macros_2.13:2.0.14 + exports zio; + exports zio.internal; + exports zio.internal.macros; + exports zio.internal.metrics; + exports zio.interop; + exports zio.metrics; + exports zio.metrics.jvm; + exports zio.stm; + + // dev.zio:zio-0stacktracer_2.13:2.0.14 + exports zio.internal.stacktracer; + exports zio.stacktracer; + + // dev.zio:zio-interop-cats_2.13:23.0.0.6 + //exports zio.interop.console; + //exports zio.interop.stm; + //exports zio.stream.interop; + + // dev.zio:izumi-reflect_2.13:2.3.8 + exports izumi.reflect; + exports izumi.reflect.internal; + exports izumi.reflect.internal.fundamentals.collections; + exports izumi.reflect.internal.fundamentals.functional; + exports izumi.reflect.internal.fundamentals.platform.assertions; + exports izumi.reflect.internal.fundamentals.platform.basics; + exports izumi.reflect.internal.fundamentals.platform.console; + exports izumi.reflect.internal.fundamentals.platform.language; + exports izumi.reflect.internal.fundamentals.platform.strings; + exports izumi.reflect.macrortti; + + // dev.zio:izumi-reflect-thirdparty-boopickle-shaded_2.13:2.3.8 + exports izumi.reflect.thirdparty.internal.boopickle; + +} diff --git a/lib/scala/logging-utils-akka/src/main/java/module-info.java b/lib/scala/logging-utils-akka/src/main/java/module-info.java index 0384ff0e446f..2db726bb6f52 100644 --- a/lib/scala/logging-utils-akka/src/main/java/module-info.java +++ b/lib/scala/logging-utils-akka/src/main/java/module-info.java @@ -1,6 +1,6 @@ module org.enso.logging.utils.akka { requires scala.library; - requires akka.actor; + requires org.enso.akka.wrapper; requires org.slf4j; exports org.enso.logging.utils.akka; From a5208594282de181c8185604c73d42dfdb9b23c8 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 19:06:08 +0200 Subject: [PATCH 103/268] language-server depends on org.eclipse.jgit --- build.sbt | 4 +--- engine/language-server/src/main/java/module-info.java | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 6b602e751885..89944588b216 100644 --- a/build.sbt +++ b/build.sbt @@ -2020,9 +2020,7 @@ lazy val `language-server` = (project in file("engine/language-server")) "commons-cli" % "commons-cli" % commonsCliVersion, "commons-io" % "commons-io" % commonsIoVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, - akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, - "dev.zio" % ("zio_" + scalaVer) % zioVersion + "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion ) }, internalModuleDependencies := Seq( diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index c06b3f4f8e5a..046612d12091 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -6,6 +6,7 @@ requires flatbuffers.java; requires org.apache.commons.io; requires org.graalvm.polyglot; + requires org.eclipse.jgit; requires org.openide.util.lookup.RELEASE180; requires org.slf4j; From 8dfc76e83e556b685d035a81cf44d5586cc6d2cc Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 19:30:53 +0200 Subject: [PATCH 104/268] Fix some dependencies - update library manifests works now! --- build.sbt | 36 ++++++++++++++----- engine/runtime/src/main/java/module-info.java | 2 ++ .../src/main/java/module-info.java | 1 + lib/scala/cli/src/main/java/module-info.java | 2 ++ .../src/main/java/module-info.java | 4 +++ .../editions/src/main/java/module-info.java | 7 ++++ .../src/main/java/module-info.java | 2 ++ .../semver/src/main/java/module-info.java | 2 ++ 8 files changed, 47 insertions(+), 9 deletions(-) diff --git a/build.sbt b/build.sbt index 89944588b216..d071d3d7d3e2 100644 --- a/build.sbt +++ b/build.sbt @@ -646,6 +646,7 @@ lazy val componentModulesPaths = ) val thirdPartyModFiles = thirdPartyMods.map(_.data) val ourMods = Seq( + (`common-polyglot-core-utils` / exportedModuleBin).value, (`engine-common` / exportedModuleBin).value, (`engine-runner` / exportedModuleBin).value, (`engine-runner-common` / exportedModuleBin).value, @@ -654,6 +655,7 @@ lazy val componentModulesPaths = (`syntax-rust-definition` / exportedModuleBin).value, (`runtime-compiler` / exportedModuleBin).value, (`runtime-parser` / exportedModuleBin).value, + (`runtime-suggestions` / exportedModuleBin).value, (`runtime-instrument-common` / exportedModuleBin).value, (`runtime-instrument-id-execution` / exportedModuleBin).value, (`runtime-instrument-repl-debugger` / exportedModuleBin).value, @@ -1135,7 +1137,8 @@ lazy val `scala-libs-wrapper` = project "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.jline" % "jline" % jlineVersion + "org.jline" % "jline" % jlineVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ), assembly / assemblyExcludedJars := { JPMSUtils.filterModulesFromClasspath( @@ -1390,6 +1393,7 @@ lazy val cli = project "org.scala-lang" % "scala-library" % scalacVersion ), internalModuleDependencies := Seq( + (`scala-libs-wrapper` / exportedModule).value, (`scala-yaml` / exportedModule).value ), Test / parallelExecution := false @@ -2395,11 +2399,13 @@ lazy val runtime = (project in file("engine/runtime")) (`pkg` / exportedModule).value, (`cli` / exportedModule).value, (`editions` / exportedModule).value, + (`edition-updater` / exportedModule).value, (`syntax-rust-definition` / exportedModule).value, (`version-output` / exportedModule).value, (`interpreter-dsl` / exportedModule).value, (`persistance` / exportedModule).value, - (`text-buffer` / exportedModule).value + (`text-buffer` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value, ) ) .settings( @@ -3168,13 +3174,16 @@ lazy val `distribution-manager` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test ), moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion ), internalModuleDependencies := Seq( (`cli` / exportedModule).value, (`logging-utils` / exportedModule).value, (`scala-libs-wrapper` / exportedModule).value, - (`scala-yaml` / exportedModule).value + (`scala-yaml` / exportedModule).value, + (`semver` / exportedModule).value ) ) .dependsOn(editions) @@ -3343,10 +3352,14 @@ lazy val editions = project "org.scalatest" %% "scalatest" % scalatestVersion % Test ), moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion ), internalModuleDependencies := Seq( - (`scala-yaml` / exportedModule).value + (`scala-yaml` / exportedModule).value, + (`version-output` / exportedModule).value, + (`semver` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value, ) ) .settings( @@ -3386,9 +3399,13 @@ lazy val semver = project ), moduleDependencies := { Seq( - "org.scala-lang" % "scala-library" % scalacVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion ) - } + }, + internalModuleDependencies := Seq( + (`scala-yaml` / exportedModule).value + ) ) .settings( (Compile / compile) := (Compile / compile) @@ -3492,7 +3509,8 @@ lazy val `library-manager` = project ), moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ), internalModuleDependencies := Seq( (`distribution-manager` / exportedModule).value, diff --git a/engine/runtime/src/main/java/module-info.java b/engine/runtime/src/main/java/module-info.java index 7521ed57f191..3d1bcface24d 100644 --- a/engine/runtime/src/main/java/module-info.java +++ b/engine/runtime/src/main/java/module-info.java @@ -6,6 +6,7 @@ requires org.enso.common.polyglot.core.utils; requires org.enso.distribution; requires org.enso.editions; + requires org.enso.editions.updater; requires org.enso.engine.common; requires static org.enso.interpreter.dsl; requires static org.enso.persistance; @@ -18,6 +19,7 @@ requires org.enso.runtime.parser; requires org.enso.runtime.suggestions; requires org.enso.text.buffer; + requires org.enso.scala.wrapper; requires org.enso.syntax; requires org.enso.version.output; diff --git a/lib/java/scala-libs-wrapper/src/main/java/module-info.java b/lib/java/scala-libs-wrapper/src/main/java/module-info.java index d9d5b0673539..4bbe9c7468a7 100644 --- a/lib/java/scala-libs-wrapper/src/main/java/module-info.java +++ b/lib/java/scala-libs-wrapper/src/main/java/module-info.java @@ -4,6 +4,7 @@ // scala-compiler.jar requires scala.tools.nsc; requires org.jline; + requires org.slf4j; // "org.typelevel" % ("cats-core_" + scalaVer) % "2.10.0", exports cats; diff --git a/lib/scala/cli/src/main/java/module-info.java b/lib/scala/cli/src/main/java/module-info.java index ddf84e366990..69c9eef79a8c 100644 --- a/lib/scala/cli/src/main/java/module-info.java +++ b/lib/scala/cli/src/main/java/module-info.java @@ -1,7 +1,9 @@ module org.enso.cli { requires scala.library; requires org.enso.scala.yaml; + requires org.enso.scala.wrapper; exports org.enso.cli; + exports org.enso.cli.arguments; exports org.enso.cli.task; } diff --git a/lib/scala/distribution-manager/src/main/java/module-info.java b/lib/scala/distribution-manager/src/main/java/module-info.java index 6e97dbc599cd..736bcd1e9d0b 100644 --- a/lib/scala/distribution-manager/src/main/java/module-info.java +++ b/lib/scala/distribution-manager/src/main/java/module-info.java @@ -4,6 +4,10 @@ requires org.enso.logging.utils; requires org.enso.scala.wrapper; requires org.enso.scala.yaml; + requires org.enso.semver; + + requires org.yaml.snakeyaml; + requires org.slf4j; exports org.enso.distribution; exports org.enso.distribution.config; diff --git a/lib/scala/editions/src/main/java/module-info.java b/lib/scala/editions/src/main/java/module-info.java index 57893edef78a..31d4777692a4 100644 --- a/lib/scala/editions/src/main/java/module-info.java +++ b/lib/scala/editions/src/main/java/module-info.java @@ -1,8 +1,15 @@ module org.enso.editions { requires scala.library; + + requires org.enso.semver; requires org.enso.scala.yaml; + requires org.enso.scala.wrapper; + requires org.enso.version.output; + + requires org.yaml.snakeyaml; exports org.enso.editions; exports org.enso.editions.provider; exports org.enso.editions.repository; + exports org.enso.yaml; } diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java index e9688675300b..3e8dd7515c8f 100644 --- a/lib/scala/library-manager/src/main/java/module-info.java +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -10,7 +10,9 @@ // For com.typesafe.scalalogging.Logger requires org.enso.scala.wrapper; requires org.enso.scala.yaml; + requires org.yaml.snakeyaml; + requires org.slf4j; exports org.enso.librarymanager; exports org.enso.librarymanager.dependencies; diff --git a/lib/scala/semver/src/main/java/module-info.java b/lib/scala/semver/src/main/java/module-info.java index 95927c10ebd1..c87a4555de47 100644 --- a/lib/scala/semver/src/main/java/module-info.java +++ b/lib/scala/semver/src/main/java/module-info.java @@ -1,5 +1,7 @@ module org.enso.semver { requires scala.library; + requires org.enso.scala.yaml; + requires org.yaml.snakeyaml; exports org.enso.semver; } From a71488660d07cf4affc27eb3a0c378cab61ed184 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 19:31:10 +0200 Subject: [PATCH 105/268] update library manifests invokes runner directly --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index d071d3d7d3e2..b7b775a2d03a 100644 --- a/build.sbt +++ b/build.sbt @@ -4435,7 +4435,7 @@ updateLibraryManifests := { "--module-path", modulePath.map(_.getAbsolutePath).mkString(File.pathSeparator), "-m", - "org.enso.runtime/org.enso.EngineRunnerBootLoader" + "org.enso.runner/org.enso.runner.Main" ) LibraryManifestGenerator.generateManifests( libraries, From d94512976c564694f5d18219a38fc4705f9f012b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 19:34:44 +0200 Subject: [PATCH 106/268] buildEngineDistribution does not copy runner.jar --- project/DistributionPackage.scala | 6 ------ 1 file changed, 6 deletions(-) diff --git a/project/DistributionPackage.scala b/project/DistributionPackage.scala index 6aa23cbaca83..079acc31dc0f 100644 --- a/project/DistributionPackage.scala +++ b/project/DistributionPackage.scala @@ -140,12 +140,6 @@ object DistributionPackage { distributionRoot / "component", cacheFactory.make("module jars") ) - // Put runner.jar into a nested directory, so that it is outside of the default - // module-path. - IO.copyFile( - file("runner.jar"), - distributionRoot / "component" / "runner" / "runner.jar" - ) val parser = targetDir / Platform.dynamicLibraryFileName("enso_parser") copyFilesIncremental( From d3e57e40ace0ad4fdd9245d189115cff677cbff0 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 19:41:02 +0200 Subject: [PATCH 107/268] Remove EngineRunnerBootLoader --- distribution/bin/enso | 2 +- distribution/bin/enso.bat | 2 +- .../java/org/enso/ClassLoaderConstants.java | 31 ------ .../java/org/enso/EngineRunnerBootLoader.java | 96 ------------------- .../interpreter/runtime/HostClassLoader.java | 33 +------ 5 files changed, 3 insertions(+), 161 deletions(-) delete mode 100644 engine/runtime/src/main/java/org/enso/ClassLoaderConstants.java delete mode 100644 engine/runtime/src/main/java/org/enso/EngineRunnerBootLoader.java diff --git a/distribution/bin/enso b/distribution/bin/enso index 08ee4a73ff6b..1939fc99dcd9 100755 --- a/distribution/bin/enso +++ b/distribution/bin/enso @@ -1,5 +1,5 @@ COMP_PATH=$(dirname "$0")/../component JAVA_OPTS="--add-opens=java.base/java.nio=ALL-UNNAMED $JAVA_OPTS" -exec java --module-path $COMP_PATH $JAVA_OPTS -m org.enso.runtime/org.enso.EngineRunnerBootLoader "$@" +exec java --module-path $COMP_PATH $JAVA_OPTS -m org.enso.runner/org.enso.runner.Main "$@" exit diff --git a/distribution/bin/enso.bat b/distribution/bin/enso.bat index d72536fab68c..11acf005409e 100644 --- a/distribution/bin/enso.bat +++ b/distribution/bin/enso.bat @@ -1,5 +1,5 @@ @echo off set comp-dir=%~dp0\..\component set JAVA_OPTS=%JAVA_OPTS% --add-opens=java.base/java.nio=ALL-UNNAMED -java --module-path %comp-dir% -Dpolyglot.compiler.IterativePartialEscape=true %JAVA_OPTS% -m org.enso.runtime/org.enso.EngineRunnerBootLoader %* +java --module-path %comp-dir% -Dpolyglot.compiler.IterativePartialEscape=true %JAVA_OPTS% -m org.enso.runner/org.enso.runner.Main %* exit /B %errorlevel% diff --git a/engine/runtime/src/main/java/org/enso/ClassLoaderConstants.java b/engine/runtime/src/main/java/org/enso/ClassLoaderConstants.java deleted file mode 100644 index 714b8ea68cd7..000000000000 --- a/engine/runtime/src/main/java/org/enso/ClassLoaderConstants.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.enso; - -import java.util.List; - -public class ClassLoaderConstants { - - /** - * Prefix of names of classes that are know to be on the system module-path, i.e., on the boot - * module layer. Engine is started from {@link EngineRunnerBootLoader} with a custom class loader - * that is isolated form the system's module-path. Delegating to either system class loader, or - * any other class loader that has access to the boot module layer, ensures that the Truffle - * polyglot environment is properly initialized and also that the global logging configuration is - * consistent. - */ - public static final List CLASS_DELEGATION_PATTERNS = - List.of( - "org.graalvm", - "java", - "org.slf4j", - "ch.qos", - "io.helidon", - "org.enso.profiling", - "org.enso.syntax2", - "org.enso.ydoc"); - - /** - * Path to the {@code runner.jar} fat jar. This must not be on the system's module-path, because - * the JVM would not be able to boot. - */ - static final String DEFAULT_RUNNER_JAR = "runner/runner.jar"; -} diff --git a/engine/runtime/src/main/java/org/enso/EngineRunnerBootLoader.java b/engine/runtime/src/main/java/org/enso/EngineRunnerBootLoader.java deleted file mode 100644 index 0a3eefd36e66..000000000000 --- a/engine/runtime/src/main/java/org/enso/EngineRunnerBootLoader.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.enso; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLClassLoader; -import java.nio.file.Path; -import java.util.Enumeration; - -// TODO: Remove -/** - * {@code runner.jar} is a fat jar containing all the dependencies for engine-runner, however, it - * cannot be put on module-path, neither class-path, because it cannot be used in conjunction with - * {@code runtime.jar} fat jar. For now, this class is a workaround that just tries to invoke {@link - * org.enso.runner.Main.main} from {@code runner.jar} using a custom class loader that loads classes - * only from {@code runner.jar}. - * - *

Note that it is vital that all akka related classes are loaded from {@code runner.jar} and not - * from {@code runtime.jar}. - */ -public final class EngineRunnerBootLoader { - - private EngineRunnerBootLoader() {} - - private static final ClassLoader loader; - - static { - var ensoRunnerProp = System.getProperty("enso.runner"); - var runnerJarPath = - ensoRunnerProp != null ? Path.of(ensoRunnerProp) : getDefaultRunnerJarPath(); - if (!runnerJarPath.toFile().exists()) { - throw new IllegalStateException("Cannot find runner fat jar at " + runnerJarPath); - } - URL url; - try { - url = runnerJarPath.toUri().toURL(); - } catch (MalformedURLException e) { - throw new IllegalStateException(e); - } - loader = new IsolatedClassLoader(url); - } - - public static void main(String[] args) throws Exception { - var clazz = loader.loadClass("org.enso.runner.Main"); - var main = clazz.getMethod("main", String[].class); - main.invoke(null, (Object) args); - } - - private static Path getDefaultRunnerJarPath() { - var runtimeJar = - EngineRunnerBootLoader.class.getProtectionDomain().getCodeSource().getLocation(); - try { - var runnerJarUri = runtimeJar.toURI().resolve(ClassLoaderConstants.DEFAULT_RUNNER_JAR); - return Path.of(runnerJarUri); - } catch (URISyntaxException e) { - throw new IllegalStateException(e); - } - } - - private static final class IsolatedClassLoader extends URLClassLoader { - private final ClassLoader systemClassLoader; - - public IsolatedClassLoader(URL runnerJarUrl) { - super("org.enso.IsolatedClassLoader", new URL[] {runnerJarUrl}, null); - this.systemClassLoader = ClassLoader.getSystemClassLoader(); - } - - @Override - public Class loadClass(String name) throws ClassNotFoundException { - if (ClassLoaderConstants.CLASS_DELEGATION_PATTERNS.stream().anyMatch(name::startsWith)) { - return systemClassLoader.loadClass(name); - } else { - return super.loadClass(name); - } - } - - @Override - public URL findResource(String name) { - if (ClassLoaderConstants.CLASS_DELEGATION_PATTERNS.stream().anyMatch(name::startsWith)) { - return systemClassLoader.getResource(name); - } else { - return super.findResource(name); - } - } - - @Override - public Enumeration findResources(String name) throws IOException { - if (ClassLoaderConstants.CLASS_DELEGATION_PATTERNS.stream().anyMatch(name::startsWith)) { - return systemClassLoader.getResources(name); - } else { - return super.findResources(name); - } - } - } -} diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java index 7a428b1fa2aa..4f8f957c2924 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java @@ -1,13 +1,9 @@ package org.enso.interpreter.runtime; -import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; -import java.util.Enumeration; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.enso.ClassLoaderConstants; -import org.graalvm.polyglot.Context; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,15 +17,9 @@ final class HostClassLoader extends URLClassLoader implements AutoCloseable { private final Map> loadedClasses = new ConcurrentHashMap<>(); private static final Logger logger = LoggerFactory.getLogger(HostClassLoader.class); - // Classes from "org.graalvm" packages are loaded either by a class loader for the boot - // module layer, or by a specific class loader, depending on how enso is run. For example, - // if enso is run via `org.graalvm.polyglot.Context.eval` from `javac`, then the graalvm - // classes are loaded via a class loader somehow created by `javac` and not by the boot - // module layer's class loader. - private static final ClassLoader polyglotClassLoader = Context.class.getClassLoader(); public HostClassLoader() { - super(new URL[0], polyglotClassLoader); + super(new URL[0]); } void add(URL u) { @@ -50,9 +40,6 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE logger.trace("Class {} found in cache", name); return l; } - if (ClassLoaderConstants.CLASS_DELEGATION_PATTERNS.stream().anyMatch(name::startsWith)) { - return polyglotClassLoader.loadClass(name); - } try { l = findClass(name); if (resolve) { @@ -67,24 +54,6 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE } } - @Override - public URL findResource(String name) { - if (ClassLoaderConstants.CLASS_DELEGATION_PATTERNS.stream().anyMatch(name::startsWith)) { - return polyglotClassLoader.getResource(name); - } else { - return super.findResource(name); - } - } - - @Override - public Enumeration findResources(String name) throws IOException { - if (ClassLoaderConstants.CLASS_DELEGATION_PATTERNS.stream().anyMatch(name::startsWith)) { - return polyglotClassLoader.getResources(name); - } else { - return super.findResources(name); - } - } - @Override public void close() { loadedClasses.clear(); From 71ff6fd6354e53d7396fb19af1587361bb13a267 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 26 Aug 2024 19:50:05 +0200 Subject: [PATCH 108/268] Fix compilation of std libs --- engine/runtime-compiler/src/main/java/module-info.java | 2 ++ engine/runtime/src/main/java/module-info.java | 1 + 2 files changed, 3 insertions(+) diff --git a/engine/runtime-compiler/src/main/java/module-info.java b/engine/runtime-compiler/src/main/java/module-info.java index efe98bbdb168..ce4dae7f460e 100644 --- a/engine/runtime-compiler/src/main/java/module-info.java +++ b/engine/runtime-compiler/src/main/java/module-info.java @@ -21,4 +21,6 @@ exports org.enso.compiler.pass.analyse; exports org.enso.compiler.pass.analyse.alias; exports org.enso.compiler.pass.analyse.alias.graph; + exports org.enso.compiler.pass.analyse.types; + exports org.enso.compiler.pass.resolve; } diff --git a/engine/runtime/src/main/java/module-info.java b/engine/runtime/src/main/java/module-info.java index 3d1bcface24d..e1dc99e61a86 100644 --- a/engine/runtime/src/main/java/module-info.java +++ b/engine/runtime/src/main/java/module-info.java @@ -30,6 +30,7 @@ requires org.graalvm.truffle; requires com.ibm.icu; + exports org.enso.interpreter.caches; exports org.enso.interpreter.node; exports org.enso.interpreter.runtime.callable; exports org.enso.interpreter.runtime.state; From 3acc3829420ba299192e37fbeb286e0c5fd83541 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 27 Aug 2024 11:19:40 +0200 Subject: [PATCH 109/268] --patch-module and --add-exports are also passed to javac --- project/JPMSPlugin.scala | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 340a06fbc5df..707d211274fe 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -194,13 +194,14 @@ object JPMSPlugin extends AutoPlugin { patchModules := Map.empty, addExports := Map.empty, addReads := Map.empty, - // javacOptions only inject --module-path and --add-modules, not the rest of the - // options. Compile / javacOptions ++= { constructOptions( streams.value.log, - modulePath = (Compile / modulePath).value, - addModules = (Compile / addModules).value + (Compile / modulePath).value, + (Compile / addModules).value, + (Compile / patchModules).value, + (Compile / addExports).value, + (Compile / addReads).value ) }, Compile / javaOptions ++= { @@ -225,8 +226,11 @@ object JPMSPlugin extends AutoPlugin { Test / javacOptions ++= { constructOptions( streams.value.log, - modulePath = (Test / modulePath).value, - addModules = (Test / addModules).value + (Test / modulePath).value, + (Test / addModules).value, + (Test / patchModules).value, + (Test / addExports).value, + (Test / addReads).value ) }, Test / javaOptions ++= { From dc727e34cb1ec5ab6f2eab7858dbdba340ca7e44 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 27 Aug 2024 11:21:12 +0200 Subject: [PATCH 110/268] Rename package in runtime-integration-tests. The package name org.enso.compiler clashes with the package from the module --- .../enso/compiler/{ => test}/AnnotationsCompilerTest.java | 4 ++-- .../{CompilerTest.java => test/CompilerTests.java} | 4 ++-- .../org/enso/compiler/{ => test}/ErrorCompilerTest.java | 4 ++-- .../org/enso/compiler/{ => test}/ExecCompilerTest.java | 2 +- .../enso/compiler/{ => test}/ExecStrictCompilerTest.java | 2 +- .../enso/compiler/{ => test}/ExportCycleDetectionTest.java | 2 +- .../org/enso/compiler/{ => test}/ExportedSymbolsTest.java | 2 +- .../compiler/{ => test}/ImportsAndFQNConsistencyTest.java | 2 +- .../org/enso/compiler/{ => test}/SerdeCompilerTest.java | 4 ++-- .../enso/compiler/{ => test}/SerializationManagerTest.java | 2 +- .../java/org/enso/compiler/{ => test}/SerializerTest.java | 2 +- .../org/enso/compiler/{ => test}/TypeInferenceTest.java | 7 ++++--- .../enso/compiler/{ => test}/VectorArraySignatureTest.java | 2 +- .../enso/compiler/{ => test}/passes/MethodCallsTest.java | 2 +- .../java/org/enso/interpreter/caches/ModuleCacheTest.java | 6 +++--- .../compiler/test/pass/analyse/AliasAnalysisTest.scala | 4 ++-- 16 files changed, 26 insertions(+), 25 deletions(-) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/AnnotationsCompilerTest.java (96%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{CompilerTest.java => test/CompilerTests.java} (98%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/ErrorCompilerTest.java (99%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/ExecCompilerTest.java (99%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/ExecStrictCompilerTest.java (99%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/ExportCycleDetectionTest.java (99%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/ExportedSymbolsTest.java (99%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/ImportsAndFQNConsistencyTest.java (99%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/SerdeCompilerTest.java (98%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/SerializationManagerTest.java (99%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/SerializerTest.java (98%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/TypeInferenceTest.java (99%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/VectorArraySignatureTest.java (99%) rename engine/runtime-integration-tests/src/test/java/org/enso/compiler/{ => test}/passes/MethodCallsTest.java (97%) diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/AnnotationsCompilerTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/AnnotationsCompilerTest.java similarity index 96% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/AnnotationsCompilerTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/AnnotationsCompilerTest.java index 87eda4ff434f..b78b8b06cd45 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/AnnotationsCompilerTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/AnnotationsCompilerTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; @@ -9,7 +9,7 @@ import org.enso.compiler.core.ir.module.scope.Definition; import org.junit.Test; -public class AnnotationsCompilerTest extends CompilerTest { +public class AnnotationsCompilerTest extends CompilerTests { @Test public void testModuleMethod() throws Exception { diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/CompilerTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/CompilerTests.java similarity index 98% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/CompilerTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/CompilerTests.java index 9dafb8d8df9a..7b01bed83311 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/CompilerTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/CompilerTests.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -14,7 +14,7 @@ import org.junit.AfterClass; import org.junit.BeforeClass; -public abstract class CompilerTest { +public abstract class CompilerTests { protected static EnsoParser ensoCompiler; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ErrorCompilerTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ErrorCompilerTest.java similarity index 99% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/ErrorCompilerTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ErrorCompilerTest.java index d81ecf2a57c0..0a64e35d8881 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ErrorCompilerTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ErrorCompilerTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -11,7 +11,7 @@ import org.junit.Test; import scala.collection.immutable.List; -public class ErrorCompilerTest extends CompilerTest { +public class ErrorCompilerTest extends CompilerTests { @Test public void unfinishedLiteral1() throws Exception { diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExecCompilerTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExecCompilerTest.java similarity index 99% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExecCompilerTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExecCompilerTest.java index bc9f0cf7fbf0..1852db8491d2 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExecCompilerTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExecCompilerTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExecStrictCompilerTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExecStrictCompilerTest.java similarity index 99% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExecStrictCompilerTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExecStrictCompilerTest.java index 256da1d16a7d..131da4a1f965 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExecStrictCompilerTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExecStrictCompilerTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExportCycleDetectionTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExportCycleDetectionTest.java similarity index 99% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExportCycleDetectionTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExportCycleDetectionTest.java index d6fe43456c2f..bd86cb230f72 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExportCycleDetectionTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExportCycleDetectionTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.allOf; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExportedSymbolsTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExportedSymbolsTest.java similarity index 99% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExportedSymbolsTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExportedSymbolsTest.java index a5e0e9a14a7f..1b8d45734564 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ExportedSymbolsTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ExportedSymbolsTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsInAnyOrder; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ImportsAndFQNConsistencyTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ImportsAndFQNConsistencyTest.java similarity index 99% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/ImportsAndFQNConsistencyTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ImportsAndFQNConsistencyTest.java index d724b8181a53..ea8a18c3ce94 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/ImportsAndFQNConsistencyTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/ImportsAndFQNConsistencyTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.greaterThan; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/SerdeCompilerTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/SerdeCompilerTest.java similarity index 98% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/SerdeCompilerTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/SerdeCompilerTest.java index 18d15cae5779..d070c83bc253 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/SerdeCompilerTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/SerdeCompilerTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -107,7 +107,7 @@ private void parseSerializedModule(String projectName, String forbiddenMessage) ctx.leave(); } - CompilerTest.assertIR("Serialized and deserialized IR for " + projectName, old, now); + CompilerTests.assertIR("Serialized and deserialized IR for " + projectName, old, now); } private Context ensoContextForPackage(String name, File pkgFile, boolean disableIrCaching) diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/SerializationManagerTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/SerializationManagerTest.java similarity index 99% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/SerializationManagerTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/SerializationManagerTest.java index 7a04b07d98fd..8c29b11ddaf1 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/SerializationManagerTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/SerializationManagerTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import com.oracle.truffle.api.TruffleFile; import java.nio.file.Path; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/SerializerTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/SerializerTest.java similarity index 98% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/SerializerTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/SerializerTest.java index 5ec0c09193d1..a2aa54510121 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/SerializerTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/SerializerTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/TypeInferenceTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/TypeInferenceTest.java similarity index 99% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/TypeInferenceTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/TypeInferenceTest.java index 2a83646cefad..6ac1f7c769c5 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/TypeInferenceTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/TypeInferenceTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; @@ -10,6 +10,8 @@ import java.util.List; import java.util.Optional; import java.util.Set; +import org.enso.compiler.Compiler; +import org.enso.compiler.Passes; import org.enso.compiler.context.FreshNameSupply; import org.enso.compiler.context.ModuleContext; import org.enso.compiler.core.IR; @@ -26,7 +28,6 @@ import org.enso.compiler.pass.analyse.types.InferredType; import org.enso.compiler.pass.analyse.types.TypeInference; import org.enso.compiler.pass.analyse.types.TypeRepresentation; -import org.enso.compiler.test.CompilerRunner; import org.enso.pkg.QualifiedName; import org.graalvm.polyglot.Source; import org.junit.Ignore; @@ -36,7 +37,7 @@ import scala.collection.immutable.Seq$; import scala.jdk.javaapi.CollectionConverters; -public class TypeInferenceTest extends CompilerTest { +public class TypeInferenceTest extends CompilerTests { @Ignore("TODO resolving global methods") @Test public void zeroAryCheck() throws Exception { diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/VectorArraySignatureTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/VectorArraySignatureTest.java similarity index 99% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/VectorArraySignatureTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/VectorArraySignatureTest.java index d5c2c9440a7b..5cabcd4cb387 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/VectorArraySignatureTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/VectorArraySignatureTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler; +package org.enso.compiler.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/passes/MethodCallsTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/passes/MethodCallsTest.java similarity index 97% rename from engine/runtime-integration-tests/src/test/java/org/enso/compiler/passes/MethodCallsTest.java rename to engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/passes/MethodCallsTest.java index ae14fdd6e5d4..e4b5b79acf19 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/compiler/passes/MethodCallsTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/compiler/test/passes/MethodCallsTest.java @@ -1,4 +1,4 @@ -package org.enso.compiler.passes; +package org.enso.compiler.test.passes; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.instanceOf; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/caches/ModuleCacheTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/caches/ModuleCacheTest.java index a55cf495fe5a..0c3df4818a40 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/caches/ModuleCacheTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/caches/ModuleCacheTest.java @@ -9,7 +9,7 @@ import org.enso.common.LanguageInfo; import org.enso.common.MethodNames; import org.enso.common.RuntimeOptions; -import org.enso.compiler.CompilerTest; +import org.enso.compiler.test.CompilerTests; import org.enso.interpreter.runtime.EnsoContext; import org.enso.test.utils.ContextUtils; import org.graalvm.polyglot.Context; @@ -67,7 +67,7 @@ public void testCompareList() throws Exception { var meta = new ModuleCache.Metadata("hash", "code", CompilationStage.AFTER_CODEGEN.toString()); var cachedIr = mc.deserialize(ensoCtx, ByteBuffer.wrap(arr), meta, null); assertNotNull("IR read", cachedIr); - CompilerTest.assertIR(name, ir, cachedIr.moduleIR()); + CompilerTests.assertIR(name, ir, cachedIr.moduleIR()); } @Test @@ -97,6 +97,6 @@ public void testCompareWithWarning() throws Exception { var meta = new ModuleCache.Metadata("hash", "code", CompilationStage.AFTER_CODEGEN.toString()); var cachedIr = mc.deserialize(ensoCtx, ByteBuffer.wrap(arr), meta, null); assertNotNull("IR read", cachedIr); - CompilerTest.assertIR(name, ir, cachedIr.moduleIR()); + CompilerTests.assertIR(name, ir, cachedIr.moduleIR()); } } diff --git a/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala index da8d9d197f9b..9c1153366c93 100644 --- a/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala @@ -20,9 +20,9 @@ import org.enso.compiler.pass.analyse.alias.graph.Graph.Link import org.enso.compiler.pass.analyse.alias.AliasMetadata import org.enso.compiler.pass.analyse.alias.graph.{Graph, GraphOccurrence} import org.enso.compiler.pass.{PassConfiguration, PassGroup, PassManager} -import org.enso.compiler.test.CompilerTest +import org.enso.compiler.test.CompilerTests -class AliasAnalysisTest extends CompilerTest { +class AliasAnalysisTest extends CompilerTests { // === Utilities ============================================================ From b98da4653c291bf9f7787ec3ff02857cfc183919 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 27 Aug 2024 11:21:30 +0200 Subject: [PATCH 111/268] Remove usage of buildInfo --- .../org/enso/interpreter/test/instrument/TestEdition.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/TestEdition.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/TestEdition.scala index 3e45b2a31373..a2fef149c11a 100644 --- a/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/TestEdition.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/TestEdition.scala @@ -2,6 +2,7 @@ package org.enso.interpreter.test.instrument import org.enso.semver.SemVer import org.enso.editions.{Editions, LibraryName} +import org.enso.version.BuildVersion import java.io.File @@ -11,7 +12,7 @@ object TestEdition { val empty: Editions.RawEdition = Editions.Raw.Edition( - engineVersion = Some(SemVer.parse(buildinfo.Info.ensoVersion).get), + engineVersion = Some(SemVer.parse(BuildVersion.ensoVersion).get), repositories = Map("main" -> Editions.Repository("main", "http://example.com/")), libraries = Map() From 037c68da4e8c4624faa21c06bebd7f091c0f2e92 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 27 Aug 2024 11:22:22 +0200 Subject: [PATCH 112/268] FrgaalJavaCompiler can deal with non-existing module-info.java when shouldCompileModuleInfo is true. It just generates a warning in such case as it suggests that there is something wrong with the project configuration. --- project/FrgaalJavaCompiler.scala | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/project/FrgaalJavaCompiler.scala b/project/FrgaalJavaCompiler.scala index 3ef97c9c170c..7b32ebb9d26d 100644 --- a/project/FrgaalJavaCompiler.scala +++ b/project/FrgaalJavaCompiler.scala @@ -139,14 +139,21 @@ object FrgaalJavaCompiler { val allSources = if (shouldCompileModuleInfo) { val moduleInfo = javaSourceDir.toPath.resolve("module-info.java").toFile if (!moduleInfo.exists()) { - log.error( - s"[FrgaalJavaCompiler] module-info.java not found in $javaSourceDir" + log.warn( + s"[FrgaalJavaCompiler] module-info.java not found in $javaSourceDir, but " + + "settings of the project require to compile it. Ensure that the setting of " + + "`shouldCompileModuleInfoManually` is correctly set." ) + log.info( + s"[FrgaalJavaCompiler] compiling ${sources.size} Java sources to $out ..." + ) + sources + } else { + log.info( + s"[FrgaalJavaCompiler] compiling ${sources.size + 1} Java sources with module-info.java to $out ..." + ) + Seq(moduleInfo.getAbsolutePath) ++ sources } - log.info( - s"[FrgaalJavaCompiler] compiling ${sources.size + 1} Java sources with module-info.java to $out ..." - ) - Seq(moduleInfo.getAbsolutePath) ++ sources } else { log.info( s"[FrgaalJavaCompiler] compiling ${sources.size} Java sources to $out ..." @@ -191,7 +198,7 @@ object FrgaalJavaCompiler { } else { Some( findUnder( - 3, + 1, noTarget.tail.fold(asPath(noTarget.head))(asCommon).asInstanceOf[Path] ) ) From 9712a566da27bac99df7a27732fb8f87ac6290ca Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 27 Aug 2024 11:25:32 +0200 Subject: [PATCH 113/268] Revert AliasAnalysisTest.scala --- .../test/pass/analyse/AliasAnalysisTest.scala | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala index 9c1153366c93..843a6aa910df 100644 --- a/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala @@ -3,15 +3,8 @@ package org.enso.compiler.test.pass.analyse import org.enso.compiler.Passes import org.enso.compiler.context.{FreshNameSupply, InlineContext, ModuleContext} import org.enso.compiler.core.Implicits.AsMetadata -import org.enso.compiler.core.ir.{ - CallArgument, - Expression, - Function, - Module, - Name, - Pattern -} -import org.enso.compiler.core.ir.expression.{errors, Application, Case} +import org.enso.compiler.core.ir.{CallArgument, Expression, Function, Module, Name, Pattern} +import org.enso.compiler.core.ir.expression.{Application, Case, errors} import org.enso.compiler.core.ir.module.scope.Definition import org.enso.compiler.core.ir.module.scope.definition import org.enso.compiler.pass.PassConfiguration._ @@ -20,9 +13,9 @@ import org.enso.compiler.pass.analyse.alias.graph.Graph.Link import org.enso.compiler.pass.analyse.alias.AliasMetadata import org.enso.compiler.pass.analyse.alias.graph.{Graph, GraphOccurrence} import org.enso.compiler.pass.{PassConfiguration, PassGroup, PassManager} -import org.enso.compiler.test.CompilerTests +import org.enso.compiler.test.CompilerTest -class AliasAnalysisTest extends CompilerTests { +class AliasAnalysisTest extends CompilerTest { // === Utilities ============================================================ From 10c25058cb5b192727e9f638ec3c25f58b42958c Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 27 Aug 2024 18:58:43 +0200 Subject: [PATCH 114/268] Fix dependencies and java cmdline options for runtime-integration-tests --- build.sbt | 139 ++++++++++++++++-- .../src/main/java/module-info.java | 4 +- .../src/main/java/module-info.java | 1 + project/PackageListPlugin.scala | 77 ++++++++++ 4 files changed, 204 insertions(+), 17 deletions(-) create mode 100644 project/PackageListPlugin.scala diff --git a/build.sbt b/build.sbt index b7b775a2d03a..26c01fe00b1e 100644 --- a/build.sbt +++ b/build.sbt @@ -16,6 +16,7 @@ import src.main.scala.licenses.{ // This import is unnecessary, but bit adds a proper code completion features // to IntelliJ. import JPMSPlugin.autoImport._ +import PackageListPlugin.autoImport._ import java.io.File import java.nio.file.Files @@ -728,6 +729,7 @@ lazy val `text-buffer` = project .settings( frgaalJavaCompilerSetting, commands += WithDebugCommand.withDebug, + javaModuleName := "org.enso.text.buffer", libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test @@ -1964,7 +1966,8 @@ lazy val `polyglot-api` = project internalModuleDependencies := Seq( (`scala-libs-wrapper` / exportedModule).value, (`engine-common` / exportedModule).value, - (`logging-utils` / exportedModule).value + (`logging-utils` / exportedModule).value, + (`text-buffer` / exportedModule).value ), GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task @@ -2371,6 +2374,7 @@ lazy val runtime = (project in file("engine/runtime")) GraalVM.toolsPkgs.map(_.withConfigurations(Some(Runtime.name))) necessaryModules ++ langs ++ tools }, + javaModuleName := "org.enso.runtime", excludeFilter := excludeFilter.value || "module-info.java", moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -2444,6 +2448,7 @@ lazy val runtime = (project in file("engine/runtime")) lazy val `runtime-integration-tests` = (project in file("engine/runtime-integration-tests")) .enablePlugins(JPMSPlugin) + .enablePlugins(PackageListPlugin) .settings( frgaalJavaCompilerSetting, annotationProcSetting, @@ -2453,16 +2458,18 @@ lazy val `runtime-integration-tests` = "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.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, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, "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 + "org.slf4j" % "slf4j-api" % slf4jVersion ), Test / fork := true, Test / parallelExecution := false, @@ -2479,14 +2486,15 @@ lazy val `runtime-integration-tests` = "-Dpolyglot.engine.AllowExperimentalOptions=true" ), Test / javaOptions ++= testLogProviderOptions, - Test / addModules := Seq( - (`runtime-test-instruments` / javaModuleName).value, - (`syntax-rust-definition` / javaModuleName).value, - (`profiling-utils` / javaModuleName).value, - (`ydoc-server` / javaModuleName).value - ), Test / moduleDependencies := { GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "org.apache.tika" % "tika-core" % tikaVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, @@ -2494,15 +2502,113 @@ lazy val `runtime-integration-tests` = "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, - (`ydoc-server` / projectID).value, - (`syntax-rust-definition` / projectID).value, - (`profiling-utils` / projectID).value + "com.ibm.icu" % "icu4j" % icuVersion, + "org.jline" % "jline" % jlineVersion, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.sentry" % "sentry-logback" % "6.28.0", + "io.sentry" % "sentry" % "6.28.0", + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion ) + }, + Test / internalModuleDependencies := Seq( + (`runtime` / exportedModule).value, + (`runtime-test-instruments` / exportedModule).value, + (`runtime-instrument-common` / exportedModule).value, + (`ydoc-server` / exportedModule).value, + (`syntax-rust-definition` / exportedModule).value, + (`profiling-utils` / exportedModule).value, + (`logging-service-logback` / exportedModule).value, + (`version-output` / exportedModule).value, + (`scala-libs-wrapper` / exportedModule).value, + (`text-buffer` / exportedModule).value, + (`runtime-suggestions` / exportedModule).value, + (`runtime-parser` / exportedModule).value, + (`runtime-compiler` / exportedModule).value, + (`polyglot-api` / exportedModule).value, + (`pkg` / exportedModule).value, + (`logging-utils` / exportedModule).value, + (`connected-lock-manager` / exportedModule).value, + (`library-manager` / exportedModule).value, + (`persistance` / exportedModule).value, + (`interpreter-dsl` / exportedModule).value, + (`engine-common` / exportedModule).value, + (`edition-updater` / exportedModule).value, + (`editions` / exportedModule).value, + (`distribution-manager` / exportedModule).value, + (`common-polyglot-core-utils` / exportedModule).value, + (`cli` / exportedModule).value, + (`refactoring-utils` / exportedModule).value, + (`scala-yaml` / exportedModule).value, + (`semver` / exportedModule).value, + (`downloader` / exportedModule).value, + (`logging-config` / exportedModule).value, + (`logging-service` / exportedModule).value, + ), + Test / patchModules := { + // 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 + // Patching with sources is useful for compilation, patching with compiled classes for runtime. + val javaSrcDir = (Test / javaSource).value + Map( + (`runtime` / javaModuleName).value -> Seq(javaSrcDir, testClassesDir) + ) + }, + // runtime-integration-tests does not have module descriptor on its own, so we have + // to explicitly add some modules to the resolution. + Test / addModules := Seq( + "scala.library", + (`runtime` / javaModuleName).value, + (`runtime-test-instruments` / javaModuleName).value, + (`ydoc-server` / javaModuleName).value, + (`runtime-instrument-common` / javaModuleName).value, + (`text-buffer` / javaModuleName).value, + "truffle.tck.tests" + ), + Test / addReads := { + val runtimeModName = (`runtime` / 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, + (`runtime-instrument-common` / javaModuleName).value, + (`text-buffer` / javaModuleName).value, + "truffle.tck.tests", + "org.openide.util.lookup.RELEASE180" + ), + testInstrumentsModName -> Seq(runtimeModName) + ) + }, + Test / addExports := { + val runtimeModName = (`runtime` / javaModuleName).value + val exports = Map( + (`runtime-instrument-common` / javaModuleName).value + "/org.enso.interpreter.instrument.job" -> Seq( + (`runtime` / javaModuleName).value + ), + (`runtime` / javaModuleName).value + "/org.enso.compiler.test" -> Seq( + "ALL-UNNAMED" + ) + ) + // Make sure that all the packages in test source directory are exported + // to all unnamed modules + val testPkgs = (Test / packages).value + val testPkgsExports = testPkgs.map { pkg => + runtimeModName + "/" + pkg -> Seq("ALL-UNNAMED") + } + .toMap + exports ++ testPkgsExports } ) + .dependsOn(`runtime`) .dependsOn(`runtime-test-instruments`) - .dependsOn(`logging-service-logback` % "test->test") + .dependsOn(`logging-service-logback`) .dependsOn(testkit % Test) .dependsOn(`connected-lock-manager-server`) .dependsOn(`test-utils`) @@ -2702,6 +2808,7 @@ lazy val `runtime-instrument-common` = "com.github.sbt" % "junit-interface" % junitIfVersion % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), + javaModuleName := "org.enso.runtime.instrument.common", excludeFilter := excludeFilter.value || "module-info.java", moduleDependencies := Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, diff --git a/engine/polyglot-api/src/main/java/module-info.java b/engine/polyglot-api/src/main/java/module-info.java index 1046b5b50d63..6e4fa1414ef1 100644 --- a/engine/polyglot-api/src/main/java/module-info.java +++ b/engine/polyglot-api/src/main/java/module-info.java @@ -1,11 +1,13 @@ module org.enso.polyglot.api { + requires scala.library; requires flatbuffers.java; requires org.graalvm.truffle; requires org.graalvm.polyglot; + requires org.enso.engine.common; requires org.enso.logging.utils; requires org.enso.scala.wrapper; - requires scala.library; + requires org.enso.text.buffer; exports org.enso.polyglot; exports org.enso.polyglot.debugger; diff --git a/engine/runtime-compiler/src/main/java/module-info.java b/engine/runtime-compiler/src/main/java/module-info.java index ce4dae7f460e..955d89da6415 100644 --- a/engine/runtime-compiler/src/main/java/module-info.java +++ b/engine/runtime-compiler/src/main/java/module-info.java @@ -18,6 +18,7 @@ exports org.enso.compiler.dump; exports org.enso.compiler.exception; exports org.enso.compiler.phase; + exports org.enso.compiler.pass; exports org.enso.compiler.pass.analyse; exports org.enso.compiler.pass.analyse.alias; exports org.enso.compiler.pass.analyse.alias.graph; diff --git a/project/PackageListPlugin.scala b/project/PackageListPlugin.scala new file mode 100644 index 000000000000..a601343253ac --- /dev/null +++ b/project/PackageListPlugin.scala @@ -0,0 +1,77 @@ +import sbt.* +import sbt.Keys.* +import sbt.AutoPlugin + +import java.io.File +import java.nio.file.Path +import scala.collection.mutable + +/** + * sbt plugin for gathering set of packages contained in the current project. + * The packages are gathered via recursive directory listing. + */ +object PackageListPlugin extends AutoPlugin { + object autoImport { + val packages = taskKey[Set[String]] ( + "Set of packages in the source directory" + ) + } + + import autoImport._ + + override lazy val projectSettings: Seq[Setting[_]] = Seq( + Compile / packages := listOfPackages( + ScopeFilter(configurations = inConfigurations(Compile)) + ).value, + Test / packages := listOfPackages( + ScopeFilter(configurations = inConfigurations(Test)) + ).value, + ) + + private def listOfPackages( + scopeFilter: ScopeFilter + ): Def.Initialize[Task[Set[String]]] = Def.task { + val javaSrcDir = javaSource.all(scopeFilter).value.head + val scalaSrcDir = scalaSource.all(scopeFilter).value.head + listOfPackages(List(javaSrcDir, scalaSrcDir)) + } + + + /** + * From the given source directory, iterates all files and gathers the list of packages. + * Implemented with recursive listing of directories. + * @param srcDir The source directory, either Java or Scala. + * @return Set of packages found in the source directory. + */ + private def listOfPackages(srcDirs: List[File]): Set[String] = { + val pkgs = mutable.HashSet.empty[String] + srcDirs.foreach { srcDir => + if (srcDir.isDirectory) { + listOfPackages(srcDir.toPath, srcDir, pkgs) + } + } + pkgs.toSet + } + + private def listOfPackages( + rootDir: Path, + curDir: File, + pkgs: mutable.Set[String] + ): Unit = { + assert(curDir.isDirectory) + val files = curDir.listFiles + for (file <- files) { + if (file.isFile) { + val fPath = file.toPath + val relativePath = rootDir.relativize(fPath) + val pkgPart = relativePath.subpath(0, relativePath.getNameCount - 1) + val pkg = pkgPart.toString.replace(File.separator, ".") + pkgs.add(pkg) + } + else if (file.isDirectory) { + listOfPackages(rootDir, file, pkgs) + } + } + + } +} From becb3cfe6f659fd0a124dbba333d7c0f3d8bd551 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 27 Aug 2024 18:59:23 +0200 Subject: [PATCH 115/268] Rename test package --- .../compiler/{ => test}/refactoring/IRUtilsTest.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename engine/runtime-integration-tests/src/test/scala/org/enso/compiler/{ => test}/refactoring/IRUtilsTest.scala (98%) diff --git a/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/refactoring/IRUtilsTest.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/refactoring/IRUtilsTest.scala similarity index 98% rename from engine/runtime-integration-tests/src/test/scala/org/enso/compiler/refactoring/IRUtilsTest.scala rename to engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/refactoring/IRUtilsTest.scala index bc9dcf70cefd..36e35bf442c2 100644 --- a/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/refactoring/IRUtilsTest.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/refactoring/IRUtilsTest.scala @@ -1,13 +1,13 @@ -package org.enso.compiler.refactoring +package org.enso.compiler.test.refactoring +import org.enso.common.{LanguageInfo, MethodNames} import org.enso.compiler.core.IR -import org.enso.compiler.core.ir.Module -import org.enso.compiler.core.ir.Name +import org.enso.compiler.core.ir.{Module, Name} +import org.enso.compiler.refactoring.IRUtils import org.enso.interpreter.runtime import org.enso.interpreter.runtime.EnsoContext import org.enso.interpreter.test.InterpreterContext import org.enso.pkg.QualifiedName -import org.enso.common.{LanguageInfo, MethodNames} import org.scalatest.OptionValues import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike From 4c33dda16323df4730a256258801462a2f21c118 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 27 Aug 2024 19:10:06 +0200 Subject: [PATCH 116/268] runtime-integration-test depends on logging-service-logback/Test/compile --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 26c01fe00b1e..4f8bf69a2351 100644 --- a/build.sbt +++ b/build.sbt @@ -2608,7 +2608,7 @@ lazy val `runtime-integration-tests` = ) .dependsOn(`runtime`) .dependsOn(`runtime-test-instruments`) - .dependsOn(`logging-service-logback`) + .dependsOn(`logging-service-logback` % "test->test") .dependsOn(testkit % Test) .dependsOn(`connected-lock-manager-server`) .dependsOn(`test-utils`) From f1bf7c8ddfb4e845e47d8818c81409af0b8765d1 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 27 Aug 2024 19:14:26 +0200 Subject: [PATCH 117/268] Rename package in logging-service-logback/Test --- .../boot/resource/RepoInitializationSpec.scala | 2 +- .../filemanager/ContentRootManagerSpec.scala | 2 +- .../filemanager/ContentRootSerializationSpec.scala | 2 +- .../enso/languageserver/filemanager/FileSystemSpec.scala | 2 +- .../libraries/ComponentGroupsResolverSpec.scala | 2 +- .../libraries/ComponentGroupsValidatorSpec.scala | 2 +- .../libraries/EditionNameSerializationSpec.scala | 2 +- .../libraries/LibraryEntrySerializationSpec.scala | 2 +- .../libraries/LocalLibraryManagerSpec.scala | 2 +- .../monitoring/HealthCheckEndpointSpec.scala | 2 +- .../languageserver/monitoring/IdlenessEndpointSpec.scala | 2 +- .../requesthandler/monitoring/PingHandlerSpec.scala | 2 +- .../runtime/ContextEventsListenerSpec.scala | 2 +- .../languageserver/search/SuggestionsHandlerSpec.scala | 2 +- .../org/enso/languageserver/vcsmanager/GitSpec.scala | 2 +- .../websocket/binary/BinaryFileManipulationTest.scala | 2 +- .../websocket/binary/BinarySessionManagementTest.scala | 2 +- .../websocket/binary/VisualizationProtocolTest.scala | 2 +- .../languageserver/websocket/json/CapabilitiesTest.scala | 2 +- .../websocket/json/ContextRegistryTest.scala | 2 +- .../languageserver/websocket/json/FileManagerTest.scala | 2 +- .../websocket/json/FileNotificationsTest.scala | 2 +- .../websocket/json/InputOutputRedirectionTest.scala | 2 +- .../languageserver/websocket/json/LibrariesTest.scala | 2 +- .../languageserver/websocket/json/MonitoringTest.scala | 2 +- .../websocket/json/ProfilingManagerTest.scala | 2 +- .../websocket/json/ProjectSettingsManagerTest.scala | 2 +- .../websocket/json/ReceivesTreeUpdatesHandlerTest.scala | 2 +- .../languageserver/websocket/json/RefactoringTest.scala | 2 +- .../enso/languageserver/websocket/json/RuntimeTest.scala | 2 +- .../websocket/json/SessionManagementTest.scala | 2 +- .../websocket/json/SuggestionsHandlerEventsTest.scala | 2 +- .../websocket/json/SuggestionsHandlerTest.scala | 2 +- .../websocket/json/TextOperationsTest.scala | 2 +- .../languageserver/websocket/json/VcsManagerTest.scala | 2 +- .../websocket/json/VisualizationOperationsTest.scala | 2 +- .../websocket/json/WorkspaceOperationsTest.scala | 2 +- .../enso/interpreter/test/TestLogProviderOnClasspath.java | 8 +++++--- .../service/logback/test/provider}/TestLogProvider.java | 2 +- .../logback/test/provider}/ReportLogsOnFailure.scala | 2 +- .../enso/projectmanager/TestLogProviderOnClasspath.java | 7 ++++--- .../languageserver/LanguageServerGatewaySpec.scala | 2 +- .../languageserver/LanguageServerSupervisorSpec.scala | 2 +- .../languageserver/ProjectRenameActionSpec.scala | 2 +- .../projectmanager/protocol/EngineManagementApiSpec.scala | 2 +- .../protocol/LoggingServiceEndpointSpec.scala | 2 +- .../protocol/ProjectCreateDefaultToLatestSpec.scala | 2 +- .../protocol/ProjectCreateHandleMissingRuntimeSpec.scala | 2 +- .../protocol/ProjectCreateMissingComponentsSpec.scala | 2 +- .../protocol/ProjectManagementApiSpec.scala | 2 +- .../protocol/ProjectOpenMissingComponentsSpec.scala | 3 ++- .../projectmanager/protocol/ProjectShutdownSpec.scala | 2 +- .../service/validation/ProjectNameValidatorSpec.scala | 2 +- 53 files changed, 61 insertions(+), 57 deletions(-) rename lib/scala/logging-service-logback/src/test/java/org/enso/{logger => logging/service/logback/test/provider}/TestLogProvider.java (96%) rename lib/scala/logging-service-logback/src/test/scala/org/enso/{logger => logging/service/logback/test/provider}/ReportLogsOnFailure.scala (96%) diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala index 317d6c657295..66ed7712c52a 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala @@ -8,7 +8,7 @@ import org.enso.languageserver.boot.StartupConfig import org.enso.languageserver.data._ import org.enso.languageserver.event.InitializedEvent import org.enso.languageserver.filemanager.{ContentRoot, ContentRootWithFile} -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.searcher.memory.InMemorySuggestionsRepo import org.enso.testkit.{FlakySpec, ToScalaFutureConversions} import org.scalatest.BeforeAndAfterAll diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala index a7134f4af547..2ead95d1cd10 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala @@ -10,7 +10,7 @@ import org.enso.languageserver.filemanager.ContentRootManagerProtocol.{ ContentRootsAddedNotification, SubscribeToNotifications } -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api import org.enso.testkit.{EitherValue, WithTemporaryDirectory} import org.scalatest.concurrent.Futures diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootSerializationSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootSerializationSpec.scala index 9e4a694ef75d..a00dd38807c0 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootSerializationSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootSerializationSpec.scala @@ -3,7 +3,7 @@ package org.enso.languageserver.filemanager import io.circe.Json import io.circe.syntax._ import io.circe.literal._ -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/FileSystemSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/FileSystemSpec.scala index d016820448fc..51431859edc5 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/FileSystemSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/FileSystemSpec.scala @@ -2,7 +2,7 @@ package org.enso.languageserver.filemanager import org.apache.commons.io.FileUtils import org.enso.languageserver.effect.Effects -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsResolverSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsResolverSpec.scala index f5de8b56a05f..d5461f6665d0 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsResolverSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsResolverSpec.scala @@ -1,7 +1,7 @@ package org.enso.languageserver.libraries import org.enso.editions.LibraryName -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.{ Component, ComponentGroup, diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsValidatorSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsValidatorSpec.scala index f8b7aa7b580c..62c340ac9f13 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsValidatorSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsValidatorSpec.scala @@ -1,7 +1,7 @@ package org.enso.languageserver.libraries import org.enso.editions.LibraryName -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.{ ComponentGroup, ComponentGroups, diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/EditionNameSerializationSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/EditionNameSerializationSpec.scala index c5d5974c550c..9e8da4a8b526 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/EditionNameSerializationSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/EditionNameSerializationSpec.scala @@ -5,7 +5,7 @@ import org.enso.languageserver.libraries.EditionReference.{ CurrentProjectEdition, NamedEdition } -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LibraryEntrySerializationSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LibraryEntrySerializationSpec.scala index a759c94a6d98..f37bbfb475aa 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LibraryEntrySerializationSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LibraryEntrySerializationSpec.scala @@ -1,7 +1,7 @@ package org.enso.languageserver.libraries import io.circe.syntax._ -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LocalLibraryManagerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LocalLibraryManagerSpec.scala index 15d21ec830e3..edb759118dbd 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LocalLibraryManagerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LocalLibraryManagerSpec.scala @@ -5,7 +5,7 @@ import akka.testkit._ import org.enso.distribution.FileSystem.PathSyntax import org.enso.editions.LibraryName import org.enso.librarymanager.LibraryLocations -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.PackageManager import org.enso.testkit.WithTemporaryDirectory import org.scalatest.matchers.should.Matchers diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/HealthCheckEndpointSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/HealthCheckEndpointSpec.scala index 45cb680b322a..55b67514ea04 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/HealthCheckEndpointSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/HealthCheckEndpointSpec.scala @@ -11,7 +11,7 @@ import org.enso.languageserver.monitoring.HealthCheckEndpointSpec.{ } import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong} import org.enso.languageserver.requesthandler.monitoring.PingHandler -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec import org.scalatest.flatspec.AnyFlatSpecLike import org.scalatest.matchers.must.Matchers diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/IdlenessEndpointSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/IdlenessEndpointSpec.scala index 065432e0a15b..8286ea52004c 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/IdlenessEndpointSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/IdlenessEndpointSpec.scala @@ -5,7 +5,7 @@ import akka.http.scaladsl.model.StatusCodes import akka.http.scaladsl.server.Directives import akka.http.scaladsl.testkit.{RouteTestTimeout, ScalatestRouteTest} import org.enso.languageserver.TestClock -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec import org.scalatest.flatspec.AnyFlatSpecLike import org.scalatest.matchers.should.Matchers diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/requesthandler/monitoring/PingHandlerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/requesthandler/monitoring/PingHandlerSpec.scala index a6d71fbe0966..a3045160abec 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/requesthandler/monitoring/PingHandlerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/requesthandler/monitoring/PingHandlerSpec.scala @@ -6,7 +6,7 @@ import org.enso.jsonrpc.Id.Number import org.enso.jsonrpc.{Request, ResponseResult, Unused} import org.enso.languageserver.monitoring.MonitoringApi import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong} -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec import org.scalatest.BeforeAndAfterAll import org.scalatest.flatspec.AnyFlatSpecLike diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala index 0e78c9e6cfcd..ba8e7d4bb3d3 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala @@ -20,7 +20,7 @@ import org.enso.languageserver.session.SessionRouter.{ DeliverToBinaryController, DeliverToJsonController } -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api import org.enso.testkit.RetrySpec import org.scalatest.BeforeAndAfterAll diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/search/SuggestionsHandlerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/search/SuggestionsHandlerSpec.scala index f2a590c642f1..f23e5867cba3 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/search/SuggestionsHandlerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/search/SuggestionsHandlerSpec.scala @@ -14,7 +14,7 @@ import org.enso.languageserver.event.InitializedEvent import org.enso.languageserver.filemanager._ import org.enso.languageserver.session.JsonSession import org.enso.languageserver.session.SessionRouter.DeliverToJsonController -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.data.{Tree, TypeGraph} import org.enso.polyglot.runtime.Runtime.Api import org.enso.polyglot.{ExportedSymbol, ModuleExports, Suggestion} diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/vcsmanager/GitSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/vcsmanager/GitSpec.scala index 5871a1fad934..4cee6f0f439a 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/vcsmanager/GitSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/vcsmanager/GitSpec.scala @@ -10,7 +10,7 @@ import org.eclipse.jgit.api.{Git => JGit} import org.eclipse.jgit.lib.Repository import org.eclipse.jgit.storage.file.FileRepositoryBuilder import org.eclipse.jgit.revwalk.RevCommit -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec import scala.concurrent.duration._ diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinaryFileManipulationTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinaryFileManipulationTest.scala index e7c5f69c374d..758113d830f1 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinaryFileManipulationTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinaryFileManipulationTest.scala @@ -5,7 +5,7 @@ import org.apache.commons.io.FileUtils import org.enso.languageserver.protocol.binary._ import org.enso.languageserver.util.binary.BinaryDecoder import org.enso.languageserver.websocket.binary.factory._ -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec import java.io.File diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinarySessionManagementTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinarySessionManagementTest.scala index 40079c775b99..73753ad321f6 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinarySessionManagementTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinarySessionManagementTest.scala @@ -12,7 +12,7 @@ import org.enso.languageserver.websocket.binary.factory.{ InboundMessageFactory, SessionInitFactory } -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec class BinarySessionManagementTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/VisualizationProtocolTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/VisualizationProtocolTest.scala index c0d28463ee1e..158e267e5616 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/VisualizationProtocolTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/VisualizationProtocolTest.scala @@ -12,7 +12,7 @@ import org.enso.languageserver.runtime.ContextRegistryProtocol.{ VisualizationUpdate } import org.enso.languageserver.util.binary.BinaryDecoder -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec import org.scalatest.concurrent.Eventually diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/CapabilitiesTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/CapabilitiesTest.scala index 3d1e32e7361c..b16c95fbc6ad 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/CapabilitiesTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/CapabilitiesTest.scala @@ -3,7 +3,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import io.circe.parser.parse import io.circe.syntax.EncoderOps -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api import java.util.UUID diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ContextRegistryTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ContextRegistryTest.scala index 27011b9622ac..d3a4edc236e2 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ContextRegistryTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ContextRegistryTest.scala @@ -11,7 +11,7 @@ import org.enso.languageserver.session.JsonSession import org.enso.languageserver.websocket.json.{ ExecutionContextJsonMessages => json } -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api import java.util.UUID diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileManagerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileManagerTest.scala index 6635b76ac3b9..c2a5c6ff564e 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileManagerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileManagerTest.scala @@ -7,7 +7,7 @@ import org.bouncycastle.util.encoders.Hex import org.enso.runner.common.ProfilingConfig import org.enso.languageserver.boot.StartupConfig import org.enso.languageserver.data._ -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api import org.enso.testkit.RetrySpec diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileNotificationsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileNotificationsTest.scala index 07dab225cb59..5a4d762eb39e 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileNotificationsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileNotificationsTest.scala @@ -2,7 +2,7 @@ package org.enso.languageserver.websocket.json import java.io.File import io.circe.literal._ -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api import org.enso.testkit.FlakySpec import org.enso.text.editing.model.{Position, Range, TextEdit} diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/InputOutputRedirectionTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/InputOutputRedirectionTest.scala index d295b3d333c8..47a6d0503a2c 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/InputOutputRedirectionTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/InputOutputRedirectionTest.scala @@ -1,6 +1,6 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api import org.enso.testkit.RetrySpec diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala index 76d4a009964f..0145fa025a5d 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala @@ -19,7 +19,7 @@ import org.enso.librarymanager.published.repository.{ ExampleRepository, LibraryManifest } -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.{Config, Contact, Package, PackageManager} import org.enso.testkit.FlakySpec import org.enso.yaml.YamlHelper diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/MonitoringTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/MonitoringTest.scala index 05e608b4748d..a4ef4d8baae6 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/MonitoringTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/MonitoringTest.scala @@ -1,7 +1,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec class MonitoringTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProfilingManagerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProfilingManagerTest.scala index 77852fcdebb8..a25a93c3a71f 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProfilingManagerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProfilingManagerTest.scala @@ -2,7 +2,7 @@ package org.enso.languageserver.websocket.json import org.enso.distribution.DistributionManager import org.enso.languageserver.profiling.ProfilingManager -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import java.nio.file.Files diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala index c4ab3587b565..69bca1fdc007 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala @@ -2,7 +2,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import org.enso.distribution.FileSystem -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import java.nio.file.Files diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ReceivesTreeUpdatesHandlerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ReceivesTreeUpdatesHandlerTest.scala index 42438f7cfe78..b7d41cda1701 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ReceivesTreeUpdatesHandlerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ReceivesTreeUpdatesHandlerTest.scala @@ -2,7 +2,7 @@ package org.enso.languageserver.websocket.json import java.nio.file.{Files, Paths} import io.circe.literal._ -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec class ReceivesTreeUpdatesHandlerTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RefactoringTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RefactoringTest.scala index 24c58ff658d0..2f572c5caf37 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RefactoringTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RefactoringTest.scala @@ -1,7 +1,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api import java.util.UUID diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RuntimeTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RuntimeTest.scala index fa9411cf67c7..de39cefce43f 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RuntimeTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RuntimeTest.scala @@ -2,7 +2,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import org.enso.languageserver.runtime.TestComponentGroups -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api class RuntimeTest extends BaseServerTest with ReportLogsOnFailure { diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SessionManagementTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SessionManagementTest.scala index b290b0f610aa..d9088894ec49 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SessionManagementTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SessionManagementTest.scala @@ -3,7 +3,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import io.circe.parser.parse import io.circe.syntax.EncoderOps -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure class SessionManagementTest extends BaseServerTest with ReportLogsOnFailure { diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerEventsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerEventsTest.scala index fe19731a6840..60a4e263f644 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerEventsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerEventsTest.scala @@ -3,7 +3,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import org.enso.languageserver.search.Suggestions import org.enso.languageserver.websocket.json.{SearchJsonMessages => json} -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.{ExportedSymbol, ModuleExports} import org.enso.polyglot.data.Tree import org.enso.polyglot.runtime.Runtime.Api diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerTest.scala index d3c07ea88b1a..ac09be380822 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerTest.scala @@ -1,7 +1,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import org.enso.languageserver.websocket.json.{SearchJsonMessages => json} -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.{FlakySpec, RetrySpec} class SuggestionsHandlerTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/TextOperationsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/TextOperationsTest.scala index 5cab56b284cb..2bf45524136a 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/TextOperationsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/TextOperationsTest.scala @@ -5,7 +5,7 @@ import io.circe.literal._ import org.enso.languageserver.event.{BufferClosed, JsonSessionTerminated} import org.enso.languageserver.filemanager.Path import org.enso.languageserver.session.JsonSession -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api import org.enso.testkit.FlakySpec import org.enso.text.editing.model diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VcsManagerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VcsManagerTest.scala index 102ebed8e1c0..0f74412a2357 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VcsManagerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VcsManagerTest.scala @@ -11,7 +11,7 @@ import org.enso.runner.common.ProfilingConfig import org.enso.languageserver.boot.StartupConfig import org.enso.languageserver.data._ import org.enso.languageserver.vcsmanager.VcsApi -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec import java.io.File diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VisualizationOperationsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VisualizationOperationsTest.scala index 95d07b6f2708..fa6e81e0e132 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VisualizationOperationsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VisualizationOperationsTest.scala @@ -5,7 +5,7 @@ import org.enso.languageserver.runtime.{ MethodPointer, VisualizationConfiguration } -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api import org.enso.text.editing.model diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala index 529ff7fff56e..f21f31b4cc17 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala @@ -3,7 +3,7 @@ package org.enso.languageserver.websocket.json import buildinfo.Info import io.circe.literal.JsonStringContext import org.enso.languageserver.data.Config -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec import java.io.{File, FileOutputStream} diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnClasspath.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnClasspath.java index 31ab81725ede..5dd8a87d6bb7 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnClasspath.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnClasspath.java @@ -7,11 +7,12 @@ import java.util.List; import java.util.ServiceLoader; import java.util.stream.Collectors; +import org.enso.logging.service.logback.test.provider.TestLogProvider; import org.junit.Test; import org.slf4j.spi.SLF4JServiceProvider; /** - * In the `runtime/Test` testing suite, {@link org.enso.logger.TestLogProvider} should be among the + * In the `runtime/Test` testing suite, {@link TestLogProvider} should be among the * logging providers, because it is explicitly chosen as the logging provider for the tests. */ public class TestLogProviderOnClasspath { @@ -25,12 +26,13 @@ public void testLogProviderOnClasspath() { } List providerNames = providers.stream().map(elem -> elem.getClass().getName()).collect(Collectors.toList()); - assertThat(providerNames, hasItem("org.enso.logger.TestLogProvider")); + assertThat(providerNames, hasItem("org.enso.logging.service.logback.test.provider.TestLogProvider")); } @Test public void testLogProviderIsInUnnamedModule() throws Exception { - var testLogProviderClass = Class.forName("org.enso.logger.TestLogProvider"); + var testLogProviderClass = Class.forName( + "org.enso.logging.service.logback.test.provider.TestLogProvider"); var mod = testLogProviderClass.getModule(); assertThat(mod, notNullValue()); assertThat("Should be an unnamed module - with null name", mod.getName(), nullValue()); diff --git a/lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java b/lib/scala/logging-service-logback/src/test/java/org/enso/logging/service/logback/test/provider/TestLogProvider.java similarity index 96% rename from lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java rename to lib/scala/logging-service-logback/src/test/java/org/enso/logging/service/logback/test/provider/TestLogProvider.java index eecc6afd0587..778a623c60da 100644 --- a/lib/scala/logging-service-logback/src/test/java/org/enso/logger/TestLogProvider.java +++ b/lib/scala/logging-service-logback/src/test/java/org/enso/logging/service/logback/test/provider/TestLogProvider.java @@ -1,4 +1,4 @@ -package org.enso.logger; +package org.enso.logging.service.logback.test.provider; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.spi.LogbackServiceProvider; diff --git a/lib/scala/logging-service-logback/src/test/scala/org/enso/logger/ReportLogsOnFailure.scala b/lib/scala/logging-service-logback/src/test/scala/org/enso/logging/service/logback/test/provider/ReportLogsOnFailure.scala similarity index 96% rename from lib/scala/logging-service-logback/src/test/scala/org/enso/logger/ReportLogsOnFailure.scala rename to lib/scala/logging-service-logback/src/test/scala/org/enso/logging/service/logback/test/provider/ReportLogsOnFailure.scala index 2d7fa70757e0..603dda6bae20 100644 --- a/lib/scala/logging-service-logback/src/test/scala/org/enso/logger/ReportLogsOnFailure.scala +++ b/lib/scala/logging-service-logback/src/test/scala/org/enso/logging/service/logback/test/provider/ReportLogsOnFailure.scala @@ -1,4 +1,4 @@ -package org.enso.logger +package org.enso.logging.service.logback.test.provider import ch.qos.logback.classic.spi.ILoggingEvent import ch.qos.logback.core.Appender diff --git a/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java b/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java index 4de17cdbd2b7..1a2e00b4b985 100644 --- a/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java +++ b/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java @@ -12,7 +12,7 @@ import org.slf4j.spi.SLF4JServiceProvider; /** - * In the `runtime/Test` testing suite, {@link }org.enso.logger.TestLogProvider} should be among the + * In the `runtime/Test` testing suite, {@link }org.enso.logging.service.logback.test.provider.TestLogProvider} should be among the * logging providers, because it is explicitly chosen as the logging provider for the tests. * *

Note that the same test is in the `runtime/Test` project. @@ -28,14 +28,15 @@ public void testLogProviderIsOnClasspath() { } List providerNames = providers.stream().map(elem -> elem.getClass().getName()).collect(Collectors.toList()); - assertThat(providerNames, hasItem("org.enso.logger.TestLogProvider")); + assertThat(providerNames, hasItem("org.enso.logging.service.logback.test.provider.TestLogProvider")); } @Test public void testLogProviderIsInUnnamedModule() { Class testLogProviderClass = null; try { - testLogProviderClass = Class.forName("org.enso.logger.TestLogProvider"); + testLogProviderClass = Class.forName( + "org.enso.logging.service.logback.test.provider.TestLogProvider"); } catch (ClassNotFoundException e) { fail("TestLogProvider class not found"); } diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerGatewaySpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerGatewaySpec.scala index 970319903947..ee22873a411d 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerGatewaySpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerGatewaySpec.scala @@ -2,8 +2,8 @@ package org.enso.projectmanager.infrastructure.languageserver import akka.testkit.TestDuration import io.circe.literal._ +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.semver.SemVer -import org.enso.logger.ReportLogsOnFailure import org.enso.projectmanager.test.Net._ import org.enso.projectmanager.{BaseServerSpec, ProjectManagementOps} import org.enso.runtimeversionmanager.test.OverrideTestVersionSuite diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisorSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisorSpec.scala index 857e4981850e..9162b9d5f505 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisorSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisorSpec.scala @@ -3,7 +3,7 @@ package org.enso.projectmanager.infrastructure.languageserver import akka.actor.{ActorRef, ActorSystem, Props} import akka.testkit.{ImplicitSender, TestActor, TestKit, TestProbe} import com.miguno.akka.testing.VirtualTime -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.boot.configuration.SupervisionConfig import org.enso.projectmanager.infrastructure.http.AkkaBasedWebSocketConnectionFactory import org.enso.projectmanager.infrastructure.languageserver.LanguageServerBootLoader.ServerBooted diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameActionSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameActionSpec.scala index 9a004ee37dbc..a90b232f16b6 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameActionSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameActionSpec.scala @@ -3,7 +3,7 @@ package org.enso.projectmanager.infrastructure.languageserver import akka.actor.ActorSystem import akka.testkit._ import com.miguno.akka.testing.VirtualTime -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.data.Socket import org.enso.projectmanager.infrastructure.languageserver.LanguageServerProtocol.{ ProjectRenamed, diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/EngineManagementApiSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/EngineManagementApiSpec.scala index 3da419f6db18..58ef5ce82b94 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/EngineManagementApiSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/EngineManagementApiSpec.scala @@ -2,7 +2,7 @@ package org.enso.projectmanager.protocol import akka.testkit.TestDuration import io.circe.literal._ -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.BaseServerSpec import org.enso.testkit.FlakySpec diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/LoggingServiceEndpointSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/LoggingServiceEndpointSpec.scala index 2a71ecf41de8..96561936dc8e 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/LoggingServiceEndpointSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/LoggingServiceEndpointSpec.scala @@ -1,7 +1,7 @@ package org.enso.projectmanager.protocol import io.circe.literal.JsonStringContext -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.BaseServerSpec import org.enso.testkit.FlakySpec diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateDefaultToLatestSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateDefaultToLatestSpec.scala index 1f1f8ae95377..c24c6e621483 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateDefaultToLatestSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateDefaultToLatestSpec.scala @@ -1,8 +1,8 @@ package org.enso.projectmanager.protocol import io.circe.literal.JsonStringContext +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.semver.SemVer -import org.enso.logger.ReportLogsOnFailure import org.enso.projectmanager.BaseServerSpec import org.enso.runtimeversionmanager.test.OverrideTestVersionSuite diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala index e254e8ac021a..19abf96026ff 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala @@ -1,6 +1,6 @@ package org.enso.projectmanager.protocol -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.TestDistributionConfiguration import org.enso.runtimeversionmanager.runner.JVMSettings import org.enso.runtimeversionmanager.test.FakeReleases diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateMissingComponentsSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateMissingComponentsSpec.scala index 31928b20bac6..f3d7ae1c2177 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateMissingComponentsSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateMissingComponentsSpec.scala @@ -1,6 +1,6 @@ package org.enso.projectmanager.protocol -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure class ProjectCreateMissingComponentsSpec extends ProjectCreateSpecBase diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectManagementApiSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectManagementApiSpec.scala index 77106d773c92..d1552ab089ba 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectManagementApiSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectManagementApiSpec.scala @@ -4,7 +4,7 @@ import akka.testkit.TestDuration import io.circe.literal._ import org.enso.semver.SemVer import org.apache.commons.io.FileUtils -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.validation.NameValidation import org.enso.projectmanager.boot.configuration.TimeoutConfig import org.enso.projectmanager.{BaseServerSpec, ProjectManagementOps} diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectOpenMissingComponentsSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectOpenMissingComponentsSpec.scala index f0cf86e20d0f..9a60feaaebbb 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectOpenMissingComponentsSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectOpenMissingComponentsSpec.scala @@ -1,6 +1,7 @@ package org.enso.projectmanager.protocol + +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.semver.SemVer -import org.enso.logger.ReportLogsOnFailure import org.enso.runtimeversionmanager.test.OverrideTestVersionSuite class ProjectOpenMissingComponentsSpec diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectShutdownSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectShutdownSpec.scala index 2b0800476535..6e18c39f2fe6 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectShutdownSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectShutdownSpec.scala @@ -4,7 +4,7 @@ import akka.actor.ActorRef import io.circe.literal._ import org.enso.semver.SemVer import org.enso.jsonrpc.ClientControllerFactory -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.boot.configuration.TimeoutConfig import org.enso.projectmanager.event.ClientEvent.ClientDisconnected import zio.{ZAny, ZIO} diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/service/validation/ProjectNameValidatorSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/service/validation/ProjectNameValidatorSpec.scala index 3df79af58591..c9893e241504 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/service/validation/ProjectNameValidatorSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/service/validation/ProjectNameValidatorSpec.scala @@ -1,6 +1,6 @@ package org.enso.projectmanager.service.validation -import org.enso.logger.ReportLogsOnFailure +import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.control.effect.Effects import org.scalatest.EitherValues import org.scalatest.matchers.must.Matchers From 9c73d73bf79fcfe13d182947475852236ef51494 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 28 Aug 2024 13:09:55 +0200 Subject: [PATCH 118/268] Fix FrgaalJavaCompiler creation for projects --- build.sbt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 4f8bf69a2351..3543ceaf1980 100644 --- a/build.sbt +++ b/build.sbt @@ -2208,9 +2208,11 @@ lazy val frgaalJavaCompilerSetting = def customFrgaalJavaCompilerSettings(targetJdk: String) = Seq( Compile / compile / compilers := { // True if there is module-info.java in the sources, and this is a mixed - // project, and module-info.java is excluded from the compilation - val shouldCompileModInfo = shouldCompileModuleInfoManually.?.value.isDefined - + // project, and module-info.java is excluded from the compilation. + // shouldCompileModuleInfoManually is a settingKey defined only in projects + // with JPMSPlugin. That's why we have to check first for its existance. + val settingOpt = shouldCompileModuleInfoManually.?.value + val shouldCompileModInfo = settingOpt.isDefined && settingOpt.get FrgaalJavaCompiler.compilers( (Compile / dependencyClasspath).value, compilers.value, From d8ac4357da937acf54de26914356d3a6988214ce Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 28 Aug 2024 13:38:29 +0200 Subject: [PATCH 119/268] Sanitize Test/javaOptions arguments --- project/JPMSPlugin.scala | 49 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 707d211274fe..1dd6acca052f 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -5,6 +5,7 @@ import sbt.internal.util.ManagedLogger import java.io.File import java.net.{URI, URL} import java.util.jar.JarFile +import scala.collection.mutable /** An automatic plugin that handles everything related to JPMS modules. One needs to explicitly * enable this plugin in a project with `.enablePlugins(JPMSPlugin)`. The keys and tasks provided by this plugin @@ -242,7 +243,10 @@ object JPMSPlugin extends AutoPlugin { (Test / addExports).value, (Test / addReads).value ) - } + }, + // Sanitize cmd line arguments + Test / javacOptions := joinModulePathOption((Test / javacOptions).value), + Test / javaOptions := joinModulePathOption((Test / javacOptions).value), ) /** @param moduleDeps External module dependencies, fetched from `moduleDependencies` task. @@ -380,4 +384,47 @@ object JPMSPlugin extends AutoPlugin { modulePathOpts ++ addModsOpts ++ patchOpts ++ addExportsOpts ++ addReadsOpts } + + /** + * Searches for multiple `--module-path` cmd line options and joins them into a single + * option. + * If there are multiple `--module-path` options passed to `java` or `javac`, only the + * last one specified is considered. + * Note that this is not an issue for other JPMS-related cmd line options, like + * `--add-modules` + * @param opts Current value of cmd line options + * @return + */ + private def joinModulePathOption( + opts: Seq[String] + ): Seq[String] = { + val modulePathOpt = new StringBuilder() + val optIdxToRemove = mutable.HashSet[Int]() + // Find all `--module-path` options and join them into a single option + for ((opt, idx) <- opts.zipWithIndex) { + if (opt == "--module-path" || opt == "-p") { + optIdxToRemove += idx + optIdxToRemove += idx + 1 + modulePathOpt.append(opts(idx + 1)) + modulePathOpt.append(":") + } + } + + if (modulePathOpt.nonEmpty) { + // Remove the last colon + modulePathOpt.deleteCharAt(modulePathOpt.length - 1) + val newOpts = mutable.ArrayBuffer[String]() + for ((opt, idx) <- opts.zipWithIndex) { + if (!optIdxToRemove.contains(idx)) { + newOpts += opt + } + } + Seq( + "--module-path", + modulePathOpt.toString + ) ++ newOpts + } else { + opts + } + } } From 39d01290b62ed0efe85d64c386e31aa4bcb8f470 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 28 Aug 2024 13:53:05 +0200 Subject: [PATCH 120/268] Sanitize Test/javaOptions arguments --- project/JPMSPlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 1dd6acca052f..26e4bb38e880 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -246,7 +246,7 @@ object JPMSPlugin extends AutoPlugin { }, // Sanitize cmd line arguments Test / javacOptions := joinModulePathOption((Test / javacOptions).value), - Test / javaOptions := joinModulePathOption((Test / javacOptions).value), + Test / javaOptions := joinModulePathOption((Test / javaOptions).value), ) /** @param moduleDeps External module dependencies, fetched from `moduleDependencies` task. From 10489168aca0839c10ffce5b4eb424c6d34ac28b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 28 Aug 2024 14:45:12 +0200 Subject: [PATCH 121/268] All the JPMSPlugin settings are scoped --- build.sbt | 620 ++++++++++++++++++++------------------- project/JPMSPlugin.scala | 270 ++++++++--------- 2 files changed, 437 insertions(+), 453 deletions(-) diff --git a/build.sbt b/build.sbt index 3543ceaf1980..b93032726fee 100644 --- a/build.sbt +++ b/build.sbt @@ -647,42 +647,42 @@ lazy val componentModulesPaths = ) val thirdPartyModFiles = thirdPartyMods.map(_.data) val ourMods = Seq( - (`common-polyglot-core-utils` / exportedModuleBin).value, - (`engine-common` / exportedModuleBin).value, - (`engine-runner` / exportedModuleBin).value, - (`engine-runner-common` / exportedModuleBin).value, - (`polyglot-api` / exportedModuleBin).value, - (`runtime` / exportedModuleBin).value, - (`syntax-rust-definition` / exportedModuleBin).value, - (`runtime-compiler` / exportedModuleBin).value, - (`runtime-parser` / exportedModuleBin).value, - (`runtime-suggestions` / exportedModuleBin).value, - (`runtime-instrument-common` / exportedModuleBin).value, - (`runtime-instrument-id-execution` / exportedModuleBin).value, - (`runtime-instrument-repl-debugger` / exportedModuleBin).value, - (`runtime-instrument-runtime-server` / exportedModuleBin).value, - (`runtime-language-arrow` / exportedModuleBin).value, - (`runtime-language-epb` / exportedModuleBin).value, - (`persistance` / exportedModuleBin).value, - (`cli` / exportedModuleBin).value, - (`connected-lock-manager` / exportedModuleBin).value, - (`distribution-manager` / exportedModuleBin).value, - (`downloader` / exportedModuleBin).value, - (`editions` / exportedModuleBin).value, - (`library-manager` / exportedModuleBin).value, - (`logging-config` / exportedModuleBin).value, - (`logging-utils` / exportedModuleBin).value, - (`logging-service` / exportedModuleBin).value, - (`logging-service-logback` / exportedModuleBin).value, - (`pkg` / exportedModuleBin).value, - (`refactoring-utils` / exportedModuleBin).value, - (`semver` / exportedModuleBin).value, - (`text-buffer` / exportedModuleBin).value, - (`version-output` / exportedModuleBin).value, - (`scala-yaml` / exportedModuleBin).value, - (`scala-libs-wrapper` / exportedModuleBin).value, - (`edition-updater` / exportedModuleBin).value, - (`profiling-utils` / exportedModuleBin).value + (`common-polyglot-core-utils` / Compile / exportedModuleBin).value, + (`engine-common` / Compile / exportedModuleBin).value, + (`engine-runner` / Compile / exportedModuleBin).value, + (`engine-runner-common` / Compile / exportedModuleBin).value, + (`polyglot-api` / Compile / exportedModuleBin).value, + (`runtime` / Compile / exportedModuleBin).value, + (`syntax-rust-definition` / Compile / exportedModuleBin).value, + (`runtime-compiler` / Compile / exportedModuleBin).value, + (`runtime-parser` / Compile / exportedModuleBin).value, + (`runtime-suggestions` / Compile / exportedModuleBin).value, + (`runtime-instrument-common` / Compile / exportedModuleBin).value, + (`runtime-instrument-id-execution` / Compile / exportedModuleBin).value, + (`runtime-instrument-repl-debugger` / Compile / exportedModuleBin).value, + (`runtime-instrument-runtime-server` / Compile / exportedModuleBin).value, + (`runtime-language-arrow` / Compile / exportedModuleBin).value, + (`runtime-language-epb` / Compile / exportedModuleBin).value, + (`persistance` / Compile / exportedModuleBin).value, + (`cli` / Compile / exportedModuleBin).value, + (`connected-lock-manager` / Compile / exportedModuleBin).value, + (`distribution-manager` / Compile / exportedModuleBin).value, + (`downloader` / Compile / exportedModuleBin).value, + (`editions` / Compile / exportedModuleBin).value, + (`library-manager` / Compile / exportedModuleBin).value, + (`logging-config` / Compile / exportedModuleBin).value, + (`logging-utils` / Compile / exportedModuleBin).value, + (`logging-service` / Compile / exportedModuleBin).value, + (`logging-service-logback` / Compile / exportedModuleBin).value, + (`pkg` / Compile / exportedModuleBin).value, + (`refactoring-utils` / Compile / exportedModuleBin).value, + (`semver` / Compile / exportedModuleBin).value, + (`text-buffer` / Compile / exportedModuleBin).value, + (`version-output` / Compile / exportedModuleBin).value, + (`scala-yaml` / Compile / exportedModuleBin).value, + (`scala-libs-wrapper` / Compile / exportedModuleBin).value, + (`edition-updater` / Compile / exportedModuleBin).value, + (`profiling-utils` / Compile / exportedModuleBin).value ) ourMods ++ thirdPartyModFiles } @@ -704,18 +704,18 @@ lazy val componentModulesPaths = * - `assembly / assemblyExcludedJars` */ lazy val modularFatJarWrapperSettings = frgaalJavaCompilerSetting ++ Seq( - javacOptions ++= { + Compile / javacOptions ++= { JPMSPlugin.constructOptions( streams.value.log, - modulePath = modulePath.value, - patchModules = patchModules.value + modulePath = (Compile / modulePath).value, + patchModules = (Compile / patchModules).value ) }, - forceModuleInfoCompilation := true, - exportedModuleBin := assembly - .dependsOn(compileModuleInfo) + Compile / forceModuleInfoCompilation := true, + Compile / exportedModuleBin := assembly + .dependsOn(Compile / compileModuleInfo) .value, - exportedModule := exportedModuleBin.value, + Compile / exportedModule := (Compile / exportedModuleBin).value, ) // ============================================================================ @@ -735,7 +735,7 @@ lazy val `text-buffer` = project "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test ), excludeFilter := excludeFilter.value || "module-info.java", - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ) ) @@ -877,12 +877,12 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "com.chuusai" %% "shapeless" % "2.3.10" ), - moduleDependencies ++= Seq( + Compile / moduleDependencies ++= Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion ), - internalModuleDependencies := Seq( - (`scala-libs-wrapper` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`scala-libs-wrapper` / Compile / exportedModule).value ) ) .dependsOn(`scala-libs-wrapper`) @@ -900,18 +900,18 @@ lazy val pkg = (project in file("lib/scala/pkg")) "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.apache.commons" % "commons-compress" % commonsCompressVersion ), - moduleDependencies := { + Compile / moduleDependencies := { Seq( "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.scala-lang" % "scala-library" % scalacVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion ) }, - internalModuleDependencies := Seq( - (`editions` / exportedModule).value, - (`semver` / exportedModule).value, - (`scala-yaml` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`editions` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value, + (`scala-yaml` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value ) ) .dependsOn(editions) @@ -957,7 +957,7 @@ lazy val `profiling-utils` = project "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), - moduleDependencies := { + Compile / moduleDependencies := { Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion @@ -977,7 +977,7 @@ lazy val `logging-utils` = project "org.slf4j" % "slf4j-api" % slf4jVersion ) ++ logbackTest, compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] - moduleDependencies := { + Compile / moduleDependencies := { Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion @@ -997,13 +997,13 @@ lazy val `logging-service` = project "com.typesafe" % "config" % typesafeConfigVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), - internalModuleDependencies := Seq( - (`logging-config` / exportedModule).value, - (`logging-utils` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`logging-config` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value ) ) .dependsOn(`logging-utils`) @@ -1020,7 +1020,7 @@ lazy val `logging-config` = project "com.typesafe" % "config" % typesafeConfigVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "com.typesafe" % "config" % typesafeConfigVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ) @@ -1040,7 +1040,7 @@ lazy val `logging-service-logback` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ) ++ logbackPkg, - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "io.sentry" % "sentry-logback" % "6.28.0", "io.sentry" % "sentry" % "6.28.0", @@ -1048,9 +1048,16 @@ lazy val `logging-service-logback` = project "ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-core" % logbackClassicVersion ), - internalModuleDependencies := Seq( - (`logging-service` / exportedModule).value, - (`logging-config` / exportedModule).value + compileOrder := CompileOrder.ScalaThenJava, + Compile / internalModuleDependencies := Seq( + (`logging-service` / Compile / exportedModule).value, + (`logging-config` / Compile / exportedModule).value + ), + Test / moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + Test / internalModuleDependencies := Seq( + (Compile / exportedModule).value ) ) .dependsOn(`logging-config`) @@ -1068,15 +1075,15 @@ lazy val `logging-utils-akka` = project "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe.akka" %% "akka-actor" % akkaVersion ), - moduleDependencies := { + Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, ) }, - internalModuleDependencies := Seq( - (`akka-wrapper` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`akka-wrapper` / Compile / exportedModule).value ) ) @@ -1135,7 +1142,7 @@ lazy val `scala-libs-wrapper` = project "org.jline" % "jline" % jlineVersion, "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, @@ -1160,7 +1167,7 @@ lazy val `scala-libs-wrapper` = project }, // Patch this JPMS module such that the JVM thinks that all the Scala stuff // is part of this module - patchModules := { + Compile / patchModules := { val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, @@ -1202,7 +1209,7 @@ lazy val `language-server-deps-wrapper` = project "com.typesafe" % "config" % typesafeConfigVersion ), javaModuleName := "org.enso.language.server.deps.wrapper", - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), assembly / assemblyExcludedJars := { @@ -1219,7 +1226,7 @@ lazy val `language-server-deps-wrapper` = project shouldContainAll = true ) }, - patchModules := { + Compile / patchModules := { val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, @@ -1264,7 +1271,7 @@ lazy val `akka-wrapper` = project "io.spray" %% "spray-json" % "1.3.6" ), javaModuleName := "org.enso.akka.wrapper", - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "com.google.protobuf" % "protobuf-java" % "3.25.1", "org.reactivestreams" % "reactive-streams" % "1.0.3" @@ -1293,7 +1300,7 @@ lazy val `akka-wrapper` = project excludedJars .map(Attributed.blank) }, - patchModules := { + Compile / patchModules := { val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, @@ -1336,7 +1343,7 @@ lazy val `zio-wrapper` = project "dev.zio" %% "izumi-reflect" % "2.3.8", "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % "2.3.8", ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, ), assembly / assemblyExcludedJars := { @@ -1356,7 +1363,7 @@ lazy val `zio-wrapper` = project excludedJars .map(Attributed.blank) }, - patchModules := { + Compile / patchModules := { val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, @@ -1391,12 +1398,12 @@ lazy val cli = project "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), - internalModuleDependencies := Seq( - (`scala-libs-wrapper` / exportedModule).value, - (`scala-yaml` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`scala-yaml` / Compile / exportedModule).value ), Test / parallelExecution := false ) @@ -1451,12 +1458,12 @@ lazy val `refactoring-utils` = project "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), excludeFilter := excludeFilter.value || "module-info.java", - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), - internalModuleDependencies := Seq( - (`text-buffer` / exportedModule).value, - (`runtime-parser` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`text-buffer` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value ) ) .dependsOn(`runtime-parser`) @@ -1620,15 +1627,15 @@ lazy val `json-rpc-server` = project "commons-io" % "commons-io" % commonsIoVersion % Test ), compileOrder := CompileOrder.ScalaThenJava, - moduleDependencies := { + Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( "org.scala-lang" % "scala-library" % scalacVersion, ) }, - internalModuleDependencies := Seq( - (`scala-libs-wrapper` / exportedModule).value, - (`akka-wrapper` / exportedModule).value, + Compile / internalModuleDependencies := Seq( + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`akka-wrapper` / Compile / exportedModule).value, ) ) @@ -1671,11 +1678,11 @@ lazy val searcher = project "org.scalatest" %% "scalatest" % scalatestVersion % Test ) ++ logbackTest, compileOrder := CompileOrder.ScalaThenJava, - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), - internalModuleDependencies := Seq( - (`polyglot-api` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`polyglot-api` / Compile / exportedModule).value ) ) .configs(Benchmark) @@ -1698,16 +1705,16 @@ lazy val `ydoc-server` = project autoScalaLibrary := false, Test / fork := true, commands += WithDebugCommand.withDebug, - moduleDependencies := { + Compile / 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 ) }, - internalModuleDependencies := Seq( - (`syntax-rust-definition` / exportedModule).value, - (`profiling-utils` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`syntax-rust-definition` / Compile / exportedModule).value, + (`profiling-utils` / Compile / exportedModule).value ), libraryDependencies ++= Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", @@ -1738,7 +1745,7 @@ lazy val `ydoc-server` = project // would result in an sbt caught in an infinite recursion. // Compile / run / javaOptions ++= { - val mp = modulePath.value ++ (`profiling-utils` / modulePath).value + val mp = (Compile / modulePath).value ++ (`profiling-utils` / Compile / modulePath).value val jar = (Compile / exportedProductJars).value.head val modName = javaModuleName.value val allMp = mp ++ Seq(jar.data.absolutePath) @@ -1787,7 +1794,7 @@ lazy val `persistance` = (project in file("lib/java/persistance")) "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ) @@ -1831,7 +1838,7 @@ lazy val `interpreter-dsl` = (project in file("lib/scala/interpreter-dsl")) "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided", "com.google.guava" % "guava" % guavaVersion exclude ("com.google.code.findbugs", "jsr305") ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "com.google.guava" % "guava" % guavaVersion @@ -1914,15 +1921,15 @@ lazy val `engine-common` = project libraryDependencies ++= Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided" ), - moduleDependencies := { + Compile / moduleDependencies := { Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ) }, - internalModuleDependencies := Seq( - (`logging-utils` / exportedModule).value, - (`logging-config` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`logging-utils` / Compile / exportedModule).value, + (`logging-config` / Compile / exportedModule).value ) ) .dependsOn(`logging-config`) @@ -1954,7 +1961,7 @@ lazy val `polyglot-api` = project javaModuleName := "org.enso.polyglot.api", // Note [Compile module-info] excludeFilter := excludeFilter.value || "module-info.java", - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, @@ -1963,11 +1970,11 @@ lazy val `polyglot-api` = project "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion ), - internalModuleDependencies := Seq( - (`scala-libs-wrapper` / exportedModule).value, - (`engine-common` / exportedModule).value, - (`logging-utils` / exportedModule).value, - (`text-buffer` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value, + (`text-buffer` / Compile / exportedModule).value ), GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task @@ -2017,7 +2024,7 @@ lazy val `language-server` = (project in file("engine/language-server")) "org.apache.tika" % "tika-core" % tikaVersion % Test ), excludeFilter := excludeFilter.value || "module-info.java", - moduleDependencies := { + Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -2030,23 +2037,23 @@ lazy val `language-server` = (project in file("engine/language-server")) "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion ) }, - internalModuleDependencies := Seq( - (`akka-wrapper` / exportedModule).value, - (`zio-wrapper` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value, - (`language-server-deps-wrapper` / exportedModule).value, - (`engine-runner-common` / exportedModule).value, - (`ydoc-server` / exportedModule).value, - (`logging-utils` / exportedModule).value, - (`logging-utils-akka` / exportedModule).value, - (`engine-common` / exportedModule).value, - (`library-manager` / exportedModule).value, - (`polyglot-api` / exportedModule).value, - (`json-rpc-server` / exportedModule).value, - (`profiling-utils` / exportedModule).value, - (`searcher` / exportedModule).value, - (`text-buffer` / exportedModule).value, - (`version-output` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`akka-wrapper` / Compile / exportedModule).value, + (`zio-wrapper` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`language-server-deps-wrapper` / Compile / exportedModule).value, + (`engine-runner-common` / Compile / exportedModule).value, + (`ydoc-server` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value, + (`logging-utils-akka` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, + (`library-manager` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`json-rpc-server` / Compile / exportedModule).value, + (`profiling-utils` / Compile / exportedModule).value, + (`searcher` / Compile / exportedModule).value, + (`text-buffer` / Compile / exportedModule).value, + (`version-output` / Compile / exportedModule).value ), Test / testOptions += Tests .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), @@ -2211,7 +2218,7 @@ def customFrgaalJavaCompilerSettings(targetJdk: String) = Seq( // project, and module-info.java is excluded from the compilation. // shouldCompileModuleInfoManually is a settingKey defined only in projects // with JPMSPlugin. That's why we have to check first for its existance. - val settingOpt = shouldCompileModuleInfoManually.?.value + val settingOpt = (Compile / shouldCompileModuleInfoManually).?.value val shouldCompileModInfo = settingOpt.isDefined && settingOpt.get FrgaalJavaCompiler.compilers( (Compile / dependencyClasspath).value, @@ -2265,7 +2272,7 @@ lazy val `runtime-language-epb` = "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", "org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided" ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, @@ -2291,7 +2298,7 @@ lazy val `runtime-language-arrow` = "org.apache.arrow" % "arrow-memory-netty" % apacheArrowVersion % Test ), javaModuleName := "org.enso.interpreter.arrow", - moduleDependencies := GraalVM.modules, + Compile / moduleDependencies := GraalVM.modules, Test / moduleDependencies += (LocalProject("runtime-language-arrow") / projectID).value, Test / patchModules := { @@ -2328,7 +2335,7 @@ lazy val `runtime-test-instruments` = "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), javaModuleName := "org.enso.runtime.test", - moduleDependencies := { + Compile / moduleDependencies := { GraalVM.modules ++ Seq( "org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion, "org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion, @@ -2378,7 +2385,7 @@ lazy val runtime = (project in file("engine/runtime")) }, javaModuleName := "org.enso.runtime", excludeFilter := excludeFilter.value || "module-info.java", - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "org.apache.tika" % "tika-core" % tikaVersion, @@ -2391,27 +2398,27 @@ lazy val runtime = (project in file("engine/runtime")) "com.ibm.icu" % "icu4j" % icuVersion, "org.apache.commons" % "commons-lang3" % commonsLangVersion ), - internalModuleDependencies := Seq( - (`distribution-manager` / exportedModule).value, - (`engine-common` / exportedModule).value, - (`library-manager` / exportedModule).value, - (`connected-lock-manager` / exportedModule).value, - (`logging-utils` / exportedModule).value, - (`runtime-compiler` / exportedModule).value, - (`runtime-parser` / exportedModule).value, - (`runtime-suggestions` / exportedModule).value, - (`polyglot-api` / exportedModule).value, - (`common-polyglot-core-utils` / exportedModule).value, - (`pkg` / exportedModule).value, - (`cli` / exportedModule).value, - (`editions` / exportedModule).value, - (`edition-updater` / exportedModule).value, - (`syntax-rust-definition` / exportedModule).value, - (`version-output` / exportedModule).value, - (`interpreter-dsl` / exportedModule).value, - (`persistance` / exportedModule).value, - (`text-buffer` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value, + Compile / internalModuleDependencies := Seq( + (`distribution-manager` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, + (`library-manager` / Compile / exportedModule).value, + (`connected-lock-manager` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value, + (`runtime-compiler` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value, + (`runtime-suggestions` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`common-polyglot-core-utils` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, + (`cli` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, + (`edition-updater` / Compile / exportedModule).value, + (`syntax-rust-definition` / Compile / exportedModule).value, + (`version-output` / Compile / exportedModule).value, + (`interpreter-dsl` / Compile / exportedModule).value, + (`persistance` / Compile / exportedModule).value, + (`text-buffer` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value, ) ) .settings( @@ -2516,38 +2523,38 @@ lazy val `runtime-integration-tests` = ) }, Test / internalModuleDependencies := Seq( - (`runtime` / exportedModule).value, - (`runtime-test-instruments` / exportedModule).value, - (`runtime-instrument-common` / exportedModule).value, - (`ydoc-server` / exportedModule).value, - (`syntax-rust-definition` / exportedModule).value, - (`profiling-utils` / exportedModule).value, - (`logging-service-logback` / exportedModule).value, - (`version-output` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value, - (`text-buffer` / exportedModule).value, - (`runtime-suggestions` / exportedModule).value, - (`runtime-parser` / exportedModule).value, - (`runtime-compiler` / exportedModule).value, - (`polyglot-api` / exportedModule).value, - (`pkg` / exportedModule).value, - (`logging-utils` / exportedModule).value, - (`connected-lock-manager` / exportedModule).value, - (`library-manager` / exportedModule).value, - (`persistance` / exportedModule).value, - (`interpreter-dsl` / exportedModule).value, - (`engine-common` / exportedModule).value, - (`edition-updater` / exportedModule).value, - (`editions` / exportedModule).value, - (`distribution-manager` / exportedModule).value, - (`common-polyglot-core-utils` / exportedModule).value, - (`cli` / exportedModule).value, - (`refactoring-utils` / exportedModule).value, - (`scala-yaml` / exportedModule).value, - (`semver` / exportedModule).value, - (`downloader` / exportedModule).value, - (`logging-config` / exportedModule).value, - (`logging-service` / exportedModule).value, + (`runtime` / Compile / exportedModule).value, + (`runtime-test-instruments` / Compile / exportedModule).value, + (`runtime-instrument-common` / Compile / exportedModule).value, + (`ydoc-server` / Compile / exportedModule).value, + (`syntax-rust-definition` / Compile / exportedModule).value, + (`profiling-utils` / Compile / exportedModule).value, + (`logging-service-logback` / Compile / exportedModule).value, + (`version-output` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`text-buffer` / Compile / exportedModule).value, + (`runtime-suggestions` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value, + (`runtime-compiler` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value, + (`connected-lock-manager` / Compile / exportedModule).value, + (`library-manager` / Compile / exportedModule).value, + (`persistance` / Compile / exportedModule).value, + (`interpreter-dsl` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, + (`edition-updater` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, + (`distribution-manager` / Compile / exportedModule).value, + (`common-polyglot-core-utils` / Compile / exportedModule).value, + (`cli` / Compile / exportedModule).value, + (`refactoring-utils` / Compile / exportedModule).value, + (`scala-yaml` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value, + (`downloader` / Compile / exportedModule).value, + (`logging-config` / Compile / exportedModule).value, + (`logging-service` / Compile / exportedModule).value, ), Test / patchModules := { // Patch test-classes into the runtime module. This is standard way to deal with the @@ -2555,6 +2562,7 @@ lazy val `runtime-integration-tests` = val testClassesDir = (Test / productDirectories).value.head // Patching with sources is useful for compilation, patching with compiled classes for runtime. val javaSrcDir = (Test / javaSource).value + //(`logging-service-logback`) Map( (`runtime` / javaModuleName).value -> Seq(javaSrcDir, testClassesDir) ) @@ -2643,7 +2651,7 @@ lazy val `runtime-benchmarks` = "--enable-preview" ), parallelExecution := false, - moduleDependencies := { + Compile / moduleDependencies := { GraalVM.modules ++ GraalVM.langsPkgs ++ helidon ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.slf4j" % "slf4j-nop" % slf4jVersion, @@ -2707,15 +2715,15 @@ lazy val `runtime-parser` = "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), javaModuleName := "org.enso.runtime.parser", - moduleDependencies := { + Compile / moduleDependencies := { Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ) }, - internalModuleDependencies := Seq( - (`syntax-rust-definition` / exportedModule).value, - (`persistance` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`syntax-rust-definition` / Compile / exportedModule).value, + (`persistance` / Compile / exportedModule).value ), // Note [Compile module-info] excludeFilter := excludeFilter.value || "module-info.java" @@ -2737,19 +2745,19 @@ lazy val `runtime-compiler` = "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ), excludeFilter := excludeFilter.value || "module-info.java", - internalModuleDependencies := Seq( - (`engine-common` / exportedModule).value, - (`pkg` / exportedModule).value, - (`runtime-parser` / exportedModule).value, - (`syntax-rust-definition` / exportedModule).value, - (`persistance` / exportedModule).value, - (`editions` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`engine-common` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value, + (`syntax-rust-definition` / Compile / exportedModule).value, + (`persistance` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value ) ) .dependsOn(`runtime-parser`) @@ -2771,15 +2779,15 @@ lazy val `runtime-suggestions` = "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), excludeFilter := excludeFilter.value || "module-info.java", - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), - internalModuleDependencies := Seq( - (`pkg` / exportedModule).value, - (`polyglot-api` / exportedModule).value, - (`runtime-compiler` / exportedModule).value, - (`runtime-parser` / exportedModule).value, - (`text-buffer` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`pkg` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`runtime-compiler` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value, + (`text-buffer` / Compile / exportedModule).value ) ) .dependsOn(`runtime-compiler`) @@ -2812,7 +2820,7 @@ lazy val `runtime-instrument-common` = ), javaModuleName := "org.enso.runtime.instrument.common", excludeFilter := excludeFilter.value || "module-info.java", - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, @@ -2820,22 +2828,22 @@ lazy val `runtime-instrument-common` = "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, "org.scala-lang" % "scala-library" % scalacVersion ), - internalModuleDependencies := Seq( - (`cli` / exportedModule).value, - (`distribution-manager` / exportedModule).value, - (`connected-lock-manager` / exportedModule).value, - (`logging-utils` / exportedModule).value, - (`editions` / exportedModule).value, - (`engine-common` / exportedModule).value, - (`refactoring-utils` / exportedModule).value, - (`runtime` / exportedModule).value, - (`runtime-compiler` / exportedModule).value, - (`runtime-parser` / exportedModule).value, - (`runtime-suggestions` / exportedModule).value, - (`text-buffer` / exportedModule).value, - (`pkg` / exportedModule).value, - (`polyglot-api` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`cli` / Compile / exportedModule).value, + (`distribution-manager` / Compile / exportedModule).value, + (`connected-lock-manager` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, + (`refactoring-utils` / Compile / exportedModule).value, + (`runtime` / Compile / exportedModule).value, + (`runtime-compiler` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value, + (`runtime-suggestions` / Compile / exportedModule).value, + (`text-buffer` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value ) ) .dependsOn(`refactoring-utils`) @@ -2852,17 +2860,17 @@ lazy val `runtime-instrument-id-execution` = frgaalJavaCompilerSetting, inConfig(Compile)(truffleRunOptionsSettings), instrumentationSettings, - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion ), - internalModuleDependencies := Seq( - (`runtime` / exportedModule).value, - (`runtime-compiler` / exportedModule).value, - (`polyglot-api` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`runtime` / Compile / exportedModule).value, + (`runtime-compiler` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value ) ) .dependsOn(LocalProject("runtime")) @@ -2874,7 +2882,7 @@ lazy val `runtime-instrument-repl-debugger` = .settings( inConfig(Compile)(truffleRunOptionsSettings), instrumentationSettings, - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, @@ -2882,11 +2890,11 @@ lazy val `runtime-instrument-repl-debugger` = "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion ), - internalModuleDependencies := Seq( - (`runtime-instrument-common` / exportedModule).value, - (`runtime` / exportedModule).value, - (`polyglot-api` / exportedModule).value, - (`runtime-compiler` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`runtime-instrument-common` / Compile / exportedModule).value, + (`runtime` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`runtime-compiler` / Compile / exportedModule).value ) ) .dependsOn(LocalProject("runtime")) @@ -2898,7 +2906,7 @@ lazy val `runtime-instrument-runtime-server` = .settings( inConfig(Compile)(truffleRunOptionsSettings), instrumentationSettings, - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, @@ -2907,14 +2915,14 @@ lazy val `runtime-instrument-runtime-server` = "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ), - internalModuleDependencies := Seq( - (`runtime-instrument-common` / exportedModule).value, - (`engine-common` / exportedModule).value, - (`distribution-manager` / exportedModule).value, - (`runtime` / exportedModule).value, - (`polyglot-api` / exportedModule).value, - (`runtime-compiler` / exportedModule).value, - (`connected-lock-manager` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`runtime-instrument-common` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, + (`distribution-manager` / Compile / exportedModule).value, + (`runtime` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`runtime-compiler` / Compile / exportedModule).value, + (`connected-lock-manager` / Compile / exportedModule).value ) ) .dependsOn(LocalProject("runtime")) @@ -2961,18 +2969,18 @@ lazy val `engine-runner-common` = project "commons-io" % "commons-io" % commonsIoVersion, "commons-cli" % "commons-cli" % commonsCliVersion ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "commons-cli" % "commons-cli" % commonsCliVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "commons-io" % "commons-io" % commonsIoVersion, "org.scala-lang" % "scala-library" % scalacVersion ), - internalModuleDependencies := Seq( - (`pkg` / exportedModule).value, - (`polyglot-api` / exportedModule).value, - (`editions` / exportedModule).value, - (`engine-common` / exportedModule).value, - (`library-manager` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`pkg` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, + (`library-manager` / Compile / exportedModule).value ) ) .dependsOn(`polyglot-api`) @@ -3007,7 +3015,7 @@ lazy val `engine-runner` = project "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test, "org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion ), - moduleDependencies := { + Compile / moduleDependencies := { Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, @@ -3018,22 +3026,22 @@ lazy val `engine-runner` = project "org.slf4j" % "slf4j-api" % slf4jVersion ) }, - internalModuleDependencies := Seq( - (`profiling-utils` / exportedModule).value, - (`semver` / exportedModule).value, - (`cli` / exportedModule).value, - (`distribution-manager` / exportedModule).value, - (`editions` / exportedModule).value, - (`edition-updater` / exportedModule).value, - (`library-manager` / exportedModule).value, - (`pkg` / exportedModule).value, - (`engine-runner-common` / exportedModule).value, - (`runtime-parser` / exportedModule).value, - (`version-output` / exportedModule).value, - (`engine-common` / exportedModule).value, - (`polyglot-api` / exportedModule).value, - (`logging-config` / exportedModule).value, - (`logging-utils` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`profiling-utils` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value, + (`cli` / Compile / exportedModule).value, + (`distribution-manager` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, + (`edition-updater` / Compile / exportedModule).value, + (`library-manager` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, + (`engine-runner-common` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value, + (`version-output` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`logging-config` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value ), run / connectInput := true ) @@ -3282,17 +3290,17 @@ lazy val `distribution-manager` = project "commons-io" % "commons-io" % commonsIoVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion ), - internalModuleDependencies := Seq( - (`cli` / exportedModule).value, - (`logging-utils` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value, - (`scala-yaml` / exportedModule).value, - (`semver` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`cli` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`scala-yaml` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value ) ) .dependsOn(editions) @@ -3407,7 +3415,7 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) "-J-Dpolyglotimpl.DisableClassPathIsolation=true", "-J-Dpolyglot.engine.WarnInterpreterOnly=false" ), - moduleDependencies := { + Compile / moduleDependencies := { componentModulesIds.value ++ Seq( "org.slf4j" % "slf4j-nop" % slf4jVersion ) @@ -3460,15 +3468,15 @@ lazy val editions = project "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion ), - internalModuleDependencies := Seq( - (`scala-yaml` / exportedModule).value, - (`version-output` / exportedModule).value, - (`semver` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value, + Compile / internalModuleDependencies := Seq( + (`scala-yaml` / Compile / exportedModule).value, + (`version-output` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value, ) ) .settings( @@ -3506,14 +3514,14 @@ lazy val semver = project "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), - moduleDependencies := { + Compile / moduleDependencies := { Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion ) }, - internalModuleDependencies := Seq( - (`scala-yaml` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`scala-yaml` / Compile / exportedModule).value ) ) .settings( @@ -3553,16 +3561,16 @@ lazy val downloader = (project in file("lib/scala/downloader")) "com.github.sbt" % "junit-interface" % junitIfVersion % Test, "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "commons-io" % "commons-io" % commonsIoVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), excludeFilter := excludeFilter.value || "module-info.java", - internalModuleDependencies := Seq( - (`cli` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`cli` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value ) ) .dependsOn(cli) @@ -3581,12 +3589,12 @@ lazy val `edition-updater` = project "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), - internalModuleDependencies := Seq( - (`distribution-manager` / exportedModule).value, - (`editions` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`distribution-manager` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value ) ) .dependsOn(editions) @@ -3616,21 +3624,21 @@ lazy val `library-manager` = project "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), - internalModuleDependencies := Seq( - (`distribution-manager` / exportedModule).value, - (`downloader` / exportedModule).value, - (`cli` / exportedModule).value, - (`editions` / exportedModule).value, - (`pkg` / exportedModule).value, - (`semver` / exportedModule).value, - (`logging-utils` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value, - (`scala-yaml` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`distribution-manager` / Compile / exportedModule).value, + (`downloader` / Compile / exportedModule).value, + (`cli` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`scala-yaml` / Compile / exportedModule).value ) ) .dependsOn(`version-output`) // Note [Default Editions] @@ -3671,13 +3679,13 @@ lazy val `connected-lock-manager` = project "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), - internalModuleDependencies := Seq( - (`distribution-manager` / exportedModule).value, - (`polyglot-api` / exportedModule).value, - (`scala-libs-wrapper` / exportedModule).value + Compile / internalModuleDependencies := Seq( + (`distribution-manager` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value ) ) .dependsOn(`distribution-manager`) @@ -3824,7 +3832,7 @@ lazy val `common-polyglot-core-utils` = project "com.ibm.icu" % "icu4j" % icuVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided" ), - moduleDependencies := Seq( + Compile / moduleDependencies := Seq( "com.ibm.icu" % "icu4j" % icuVersion ) ) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 26e4bb38e880..d0ec77cddbac 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -99,155 +99,131 @@ object JPMSPlugin extends AutoPlugin { import autoImport._ - override lazy val projectSettings: Seq[Setting[_]] = Seq( - addModules := Seq.empty, - moduleDependencies := Seq.empty, - internalModuleDependencies := Seq.empty, - shouldCompileModuleInfoManually := { - val javaSrcDir = (Compile / javaSource).value - val modInfo = - javaSrcDir.toPath.resolve("module-info.java").toFile - val hasModInfo = modInfo.exists - val projName = moduleName.value - val logger = streams.value.log - val hasScalaSources = (Compile / scalaSource).value.exists() - val _compileOrder = (Compile / compileOrder).value - val res = - _compileOrder == CompileOrder.Mixed && - hasModInfo && - hasScalaSources - if (res) { - logger.debug( - s"[JPMSPlugin] Project '$projName' will have `module-info.java` compiled " + - "manually. If this is not the intended behavior, consult the documentation " + - "of JPMSPlugin." - ) - } - // Check excludeFilter - there should be module-info.java specified - if (res && !excludeFilter.value.accept(modInfo)) { - logger.error( - s"[JPMSPlugin/$projName] `module-info.java` is not in `excludeFilter`. " + - "You should add module-info.java to " + - "`excludedFilter` so that sbt does not handle the compilation. Check docs of JPMSPlugin." - ) - } - res - }, - // module-info.java compilation will be forced iff there are no other Java sources except - // for module-info.java. - forceModuleInfoCompilation := Def.taskIf { - if (shouldCompileModuleInfoManually.value) { - val javaSources = (Compile / unmanagedSources).value - .filter(_.getName.endsWith(".java")) - // If there are no Java source in `unmanagedSources`, it means that sbt will - // not call Java compiler. So we force it to compile `module-info.java`. - javaSources.isEmpty - } else { - false - } - }.value, - compileModuleInfo := Def.taskIf { - if (forceModuleInfoCompilation.value) { - JPMSUtils.compileModuleInfo().value - } else { - // nop - () - } - }.value, - // modulePath is set based on `moduleDependencies` and `internalModuleDependencies` - modulePath := { - // Do not use fullClasspath here - it will result in an infinite recursion - // and sbt will not be able to detect the cycle. - transformModuleDependenciesToModulePath( - (Compile / moduleDependencies).value, - (Compile / internalModuleDependencies).value, - (Compile / dependencyClasspath).value, - streams.value.log, - moduleName.value - ) - }, - // Returns the reference to target/classes directory and ensures that module-info - // is compiled and present in the target directory. - exportedModule := Def - .task { - val targetClassDir = (Compile / exportedProducts).value - .map(_.data) - .head - val logger = streams.value.log - val projName = moduleName.value - if (!isModule(targetClassDir)) { - logger.error( - s"[JPMSPlugin/$projName] The target classes directory ${targetClassDir.getAbsolutePath} is not " + - "a module - it does not contain module-info.class. Make sure the `compileModuleInfo` task " + - "is set correctly." + override lazy val projectSettings: Seq[Setting[_]] = { + // All the settings are scoped for Compile and Test + Seq(Compile, Test).flatMap { config: Configuration => + Seq( + config / addModules := Seq.empty, + config / moduleDependencies := Seq.empty, + config / internalModuleDependencies := Seq.empty, + config / shouldCompileModuleInfoManually := { + val javaSrcDir = (config / javaSource).value + val modInfo = + javaSrcDir.toPath.resolve("module-info.java").toFile + val hasModInfo = modInfo.exists + val projName = moduleName.value + val logger = streams.value.log + val hasScalaSources = (config / scalaSource).value.exists() + val _compileOrder = (config / compileOrder).value + val res = + _compileOrder == CompileOrder.Mixed && + hasModInfo && + hasScalaSources + if (res) { + logger.debug( + s"[JPMSPlugin] Project '$projName' will have `module-info.java` compiled " + + "manually. If this is not the intended behavior, consult the documentation " + + "of JPMSPlugin." + ) + } + // Check excludeFilter - there should be module-info.java specified + if (res && !excludeFilter.value.accept(modInfo)) { + logger.error( + s"[JPMSPlugin/$projName] `module-info.java` is not in `excludeFilter`. " + + "You should add module-info.java to " + + "`excludedFilter` so that sbt does not handle the compilation. Check docs of JPMSPlugin." + ) + } + res + }, + // module-info.java compilation will be forced iff there are no other Java sources except + // for module-info.java. + config / forceModuleInfoCompilation := Def.taskIf { + if ((config / shouldCompileModuleInfoManually).value) { + val javaSources = (config / unmanagedSources).value + .filter(_.getName.endsWith(".java")) + // If there are no Java source in `unmanagedSources`, it means that sbt will + // not call Java compiler. So we force it to compile `module-info.java`. + javaSources.isEmpty + } else { + false + } + }.value, + config / compileModuleInfo := Def.taskIf { + if ((config / forceModuleInfoCompilation).value) { + JPMSUtils.compileModuleInfo().value + } else { + // nop + () + } + }.value, + // modulePath is set based on `moduleDependencies` and `internalModuleDependencies` + config / modulePath := { + // Do not use fullClasspath here - it will result in an infinite recursion + // and sbt will not be able to detect the cycle. + transformModuleDependenciesToModulePath( + (config / moduleDependencies).value, + (config / internalModuleDependencies).value, + (config / dependencyClasspath).value, + streams.value.log, + moduleName.value ) - } - targetClassDir - } - .dependsOn(compileModuleInfo) - .dependsOn(Compile / compile) - .value, - exportedModuleBin := { - (Compile / packageBin) - .dependsOn(exportedModule) - .value - }, - patchModules := Map.empty, - addExports := Map.empty, - addReads := Map.empty, - Compile / javacOptions ++= { - constructOptions( - streams.value.log, - (Compile / modulePath).value, - (Compile / addModules).value, - (Compile / patchModules).value, - (Compile / addExports).value, - (Compile / addReads).value - ) - }, - Compile / javaOptions ++= { - constructOptions( - streams.value.log, - (Compile / modulePath).value, - (Compile / addModules).value, - (Compile / patchModules).value, - (Compile / addExports).value, - (Compile / addReads).value - ) - }, - Test / modulePath := { - transformModuleDependenciesToModulePath( - (Test / moduleDependencies).value, - (Test / internalModuleDependencies).value, - (Test / dependencyClasspath).value, - streams.value.log, - moduleName.value - ) - }, - Test / javacOptions ++= { - constructOptions( - streams.value.log, - (Test / modulePath).value, - (Test / addModules).value, - (Test / patchModules).value, - (Test / addExports).value, - (Test / addReads).value - ) - }, - Test / javaOptions ++= { - constructOptions( - streams.value.log, - (Test / modulePath).value, - (Test / addModules).value, - (Test / patchModules).value, - (Test / addExports).value, - (Test / addReads).value + }, + // Returns the reference to target/classes directory and ensures that module-info + // is compiled and present in the target directory. + config / exportedModule := Def + .task { + val targetClassDir = (config / exportedProducts).value + .map(_.data) + .head + val logger = streams.value.log + val projName = moduleName.value + if (!isModule(targetClassDir)) { + logger.error( + s"[JPMSPlugin/$projName] The target classes directory ${targetClassDir.getAbsolutePath} is not " + + "a module - it does not contain module-info.class. Make sure the `compileModuleInfo` task " + + "is set correctly." + ) + } + targetClassDir + } + .dependsOn(config / compileModuleInfo) + .dependsOn(config / compile) + .value, + config / exportedModuleBin := { + (config / packageBin) + .dependsOn(config / exportedModule) + .value + }, + config / patchModules := Map.empty, + config / addExports := Map.empty, + config / addReads := Map.empty, + config / javacOptions ++= { + constructOptions( + streams.value.log, + (config / modulePath).value, + (config / addModules).value, + (config / patchModules).value, + (config / addExports).value, + (config / addReads).value + ) + }, + config / javaOptions ++= { + constructOptions( + streams.value.log, + (config / modulePath).value, + (config / addModules).value, + (config / patchModules).value, + (config / addExports).value, + (config / addReads).value + ) + }, + // Sanitize cmd line arguments + config / javacOptions := joinModulePathOption((config / javacOptions).value), + config / javaOptions := joinModulePathOption((config / javaOptions).value) ) - }, - // Sanitize cmd line arguments - Test / javacOptions := joinModulePathOption((Test / javacOptions).value), - Test / javaOptions := joinModulePathOption((Test / javaOptions).value), - ) + } + } /** @param moduleDeps External module dependencies, fetched from `moduleDependencies` task. * @param classPath Dependency class path of the project. From this class path, external dependencies From 545334a5e6fa05a3cf063684f7a5145d0517ed60 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 28 Aug 2024 17:03:19 +0200 Subject: [PATCH 122/268] Remove unused sbt tasks --- build.sbt | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/build.sbt b/build.sbt index b93032726fee..ff84f2f77ed0 100644 --- a/build.sbt +++ b/build.sbt @@ -2196,16 +2196,6 @@ lazy val javadocSettings = Seq( ) ) -lazy val shouldCompileModuleInfo = taskKey[Boolean]( - "Determines whether the module-info.java file should be compiled. " + - "Used in mixed Scala/Java projects where module-info.java compilation cannot be " + - "done by sbt automatically." -) - -lazy val isJPMSModule = taskKey[Boolean]( - "Determines whether the project is a JPMS module." -) - /** A setting to replace javac with Frgaal compiler, allowing to use latest Java features in the code * and still compile down to JDK 17 */ From 5c18e66dbf9c686a0ae21893b737a51592e602e8 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 28 Aug 2024 17:20:33 +0200 Subject: [PATCH 123/268] modularFatJarWrapperSettings do not override javacOptions --- build.sbt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/build.sbt b/build.sbt index ff84f2f77ed0..e6a64541d2e1 100644 --- a/build.sbt +++ b/build.sbt @@ -704,13 +704,6 @@ lazy val componentModulesPaths = * - `assembly / assemblyExcludedJars` */ lazy val modularFatJarWrapperSettings = frgaalJavaCompilerSetting ++ Seq( - Compile / javacOptions ++= { - JPMSPlugin.constructOptions( - streams.value.log, - modulePath = (Compile / modulePath).value, - patchModules = (Compile / patchModules).value - ) - }, Compile / forceModuleInfoCompilation := true, Compile / exportedModuleBin := assembly .dependsOn(Compile / compileModuleInfo) From 5091df87cba38d7876343fd16d4631a8b353d935 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 28 Aug 2024 17:33:35 +0200 Subject: [PATCH 124/268] Resolve issue "Cannot find TestLoggerProvider" in runtime-integration-tests --- build.sbt | 3 ++- .../src/main/java/module-info.java | 2 ++ .../src/test/java/module-info.java | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 lib/scala/logging-service-logback/src/test/java/module-info.java diff --git a/build.sbt b/build.sbt index e6a64541d2e1..aa4817b8647c 100644 --- a/build.sbt +++ b/build.sbt @@ -1893,7 +1893,7 @@ val truffleRunOptionsSettings = Seq( * the potential conflicts with other *.conf files. */ val testLogProviderOptions = Seq( - "-Dslf4j.provider=org.enso.logger.TestLogProvider", + "-Dslf4j.provider=org.enso.logging.service.logback.test.provider.TestLogProvider", "-Dconfig.resource=application-test.conf" ) @@ -2513,6 +2513,7 @@ lazy val `runtime-integration-tests` = (`syntax-rust-definition` / Compile / exportedModule).value, (`profiling-utils` / Compile / exportedModule).value, (`logging-service-logback` / Compile / exportedModule).value, + (`logging-service-logback` / Test / exportedModule).value, (`version-output` / Compile / exportedModule).value, (`scala-libs-wrapper` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, diff --git a/lib/scala/logging-service-logback/src/main/java/module-info.java b/lib/scala/logging-service-logback/src/main/java/module-info.java index 6c4d63e79904..04ca5dc0708c 100644 --- a/lib/scala/logging-service-logback/src/main/java/module-info.java +++ b/lib/scala/logging-service-logback/src/main/java/module-info.java @@ -11,6 +11,8 @@ requires org.slf4j; requires org.openide.util.lookup.RELEASE180; + exports org.enso.logging.service.logback; + provides LoggerSetup with LogbackSetup; } diff --git a/lib/scala/logging-service-logback/src/test/java/module-info.java b/lib/scala/logging-service-logback/src/test/java/module-info.java new file mode 100644 index 000000000000..22ee35bdea59 --- /dev/null +++ b/lib/scala/logging-service-logback/src/test/java/module-info.java @@ -0,0 +1,17 @@ +import org.slf4j.spi.SLF4JServiceProvider; + +module org.enso.logging.service.logback.test.provider { + requires scala.library; + requires ch.qos.logback.classic; + requires ch.qos.logback.core; + requires org.enso.logging.service; + requires org.enso.logging.service.logback; + requires org.enso.logging.config; + requires org.slf4j; + requires org.openide.util.lookup.RELEASE180; + + provides SLF4JServiceProvider with + org.enso.logging.service.logback.test.provider.TestLogProvider; + + exports org.enso.logging.service.logback.test.provider; +} From 56665fcbf54527ece0e74592bd3cbf3da161e523 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 29 Aug 2024 14:48:17 +0200 Subject: [PATCH 125/268] org.enso.runtime module is open --- engine/runtime/src/main/java/module-info.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/runtime/src/main/java/module-info.java b/engine/runtime/src/main/java/module-info.java index e1dc99e61a86..5145f3a59fe4 100644 --- a/engine/runtime/src/main/java/module-info.java +++ b/engine/runtime/src/main/java/module-info.java @@ -1,4 +1,4 @@ -module org.enso.runtime { +open module org.enso.runtime { requires java.logging; requires scala.library; @@ -51,6 +51,7 @@ exports org.enso.interpreter.node.expression.builtin; exports org.enso.interpreter.node.expression.builtin.debug; exports org.enso.interpreter.node.expression.builtin.text.util; + exports org.enso.interpreter.node.expression.builtin.runtime; exports org.enso.interpreter.node.expression.debug; exports org.enso.interpreter.util; exports org.enso.interpreter.service.error; From f84f444f9ce1c24d07b3ec1f23109d5146776f10 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 29 Aug 2024 14:48:38 +0200 Subject: [PATCH 126/268] Test that test classes are unconditionally opened and exported --- .../test/TestJPMSModuleConfiguration.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java new file mode 100644 index 000000000000..697396c1bf30 --- /dev/null +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java @@ -0,0 +1,49 @@ +package org.enso.interpreter.test; + + +import java.lang.invoke.MethodHandles; +import org.junit.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; + + +/** + * Test source in `runtime-integration-tests` sbt project should be patched to the + * `org.enso.runtime` module. This is necessary to allow calling Java methods from Enso code. + * Moreover, there are other testing facilities that require reflective access to the classes + * inside `org.enso.runtime` module. + * One of the facilities is + * {@link com.oracle.truffle.host.HostClassDesc#getLookup(Class, HostClassCache) truffle host lookup}. + */ +public class TestJPMSModuleConfiguration { + + @Test + public void testPackagesArePatchedToRuntimeModule() { + var clazz = VectorTest.class; + var modName = clazz.getModule().getName(); + assertThat( + "Test packages are patched to org.enso.runtime module", + modName, + is("org.enso.runtime")); + } + + @Test + public void testClassIsOpenForLookup() throws IllegalAccessException { + // org.enso.interpreter.test.VectorTest contains public static methods that + // are called from Enso test code. + var clazz = VectorTest.class; + assertThat( + "Test package is exported unconditionally", + clazz.getModule().isExported("org.enso.interpreter.test"), + is(true)); + assertThat( + "Package is opened unconditionally", + clazz.getModule().isOpen("org.enso.interpreter.test"), + is(true)); + var lookup = MethodHandles.publicLookup(); + var newClazz = lookup.accessClass(clazz); + assertThat(newClazz, is(notNullValue())); + } +} From be361dce6cc0f1ccac3f03efc7b29b13e41c4782 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 29 Aug 2024 14:49:44 +0200 Subject: [PATCH 127/268] polyglot-api-macros is a module --- build.sbt | 14 +++++++++++++- .../src/main/java/module-info.java | 7 +++++++ engine/polyglot-api/src/main/java/module-info.java | 2 ++ .../library-manager/src/main/java/module-info.java | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 engine/polyglot-api-macros/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index aa4817b8647c..d4701e45fac3 100644 --- a/build.sbt +++ b/build.sbt @@ -652,6 +652,7 @@ lazy val componentModulesPaths = (`engine-runner` / Compile / exportedModuleBin).value, (`engine-runner-common` / Compile / exportedModuleBin).value, (`polyglot-api` / Compile / exportedModuleBin).value, + (`polyglot-api-macros` / Compile / exportedModuleBin).value, (`runtime` / Compile / exportedModuleBin).value, (`syntax-rust-definition` / Compile / exportedModuleBin).value, (`runtime-compiler` / Compile / exportedModuleBin).value, @@ -1967,7 +1968,8 @@ lazy val `polyglot-api` = project (`scala-libs-wrapper` / Compile / exportedModule).value, (`engine-common` / Compile / exportedModule).value, (`logging-utils` / Compile / exportedModule).value, - (`text-buffer` / Compile / exportedModule).value + (`text-buffer` / Compile / exportedModule).value, + (`polyglot-api-macros` / Compile / exportedModule).value, ), GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task @@ -1981,11 +1983,19 @@ lazy val `polyglot-api` = project lazy val `polyglot-api-macros` = project .in(file("engine/polyglot-api-macros")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, libraryDependencies ++= Seq( "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion % "provided", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion % "provided" + ), + compileOrder := CompileOrder.ScalaThenJava, + Compile / moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + Compile / internalModuleDependencies := Seq( + (`scala-libs-wrapper` / Compile / exportedModule).value ) ) @@ -2509,6 +2519,7 @@ lazy val `runtime-integration-tests` = (`runtime` / Compile / exportedModule).value, (`runtime-test-instruments` / Compile / exportedModule).value, (`runtime-instrument-common` / Compile / exportedModule).value, + (`runtime-instrument-runtime-server` / Compile / exportedModule).value, (`ydoc-server` / Compile / exportedModule).value, (`syntax-rust-definition` / Compile / exportedModule).value, (`profiling-utils` / Compile / exportedModule).value, @@ -2521,6 +2532,7 @@ lazy val `runtime-integration-tests` = (`runtime-parser` / Compile / exportedModule).value, (`runtime-compiler` / Compile / exportedModule).value, (`polyglot-api` / Compile / exportedModule).value, + (`polyglot-api-macros` / Compile / exportedModule).value, (`pkg` / Compile / exportedModule).value, (`logging-utils` / Compile / exportedModule).value, (`connected-lock-manager` / Compile / exportedModule).value, diff --git a/engine/polyglot-api-macros/src/main/java/module-info.java b/engine/polyglot-api-macros/src/main/java/module-info.java new file mode 100644 index 000000000000..ab911c75ffdb --- /dev/null +++ b/engine/polyglot-api-macros/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module org.enso.polyglot.api.macros { + requires scala.library; + // For jsoniter_scala + requires org.enso.scala.wrapper; + + exports org.enso.polyglot.macros; +} diff --git a/engine/polyglot-api/src/main/java/module-info.java b/engine/polyglot-api/src/main/java/module-info.java index 6e4fa1414ef1..aa2a9a4f6ca2 100644 --- a/engine/polyglot-api/src/main/java/module-info.java +++ b/engine/polyglot-api/src/main/java/module-info.java @@ -7,10 +7,12 @@ requires org.enso.engine.common; requires org.enso.logging.utils; requires org.enso.scala.wrapper; + requires org.enso.polyglot.api.macros; requires org.enso.text.buffer; exports org.enso.polyglot; exports org.enso.polyglot.debugger; exports org.enso.polyglot.data; exports org.enso.polyglot.runtime; + exports org.enso.polyglot.runtime.serde; } diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java index 3e8dd7515c8f..a03867876a0c 100644 --- a/lib/scala/library-manager/src/main/java/module-info.java +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -18,6 +18,7 @@ exports org.enso.librarymanager.dependencies; exports org.enso.librarymanager.local; exports org.enso.librarymanager.published; + exports org.enso.librarymanager.published.repository; exports org.enso.librarymanager.resolved; exports org.enso.libraryupload; exports org.enso.libraryupload.auth; From 108e7211c13cbd9b0c538797f33c36bb904615f5 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 29 Aug 2024 14:50:05 +0200 Subject: [PATCH 128/268] JPMSPlugin handles --add-opens cmdline option --- project/JPMSPlugin.scala | 43 +++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index d0ec77cddbac..55af0866df18 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -63,6 +63,16 @@ object JPMSPlugin extends AutoPlugin { |""".stripMargin ) + val addOpens = taskKey[Map[String, Seq[String]]] ( + """ + |A map of module names with packages to modules that will be put into --add-opens option to java. + |Note that this option is not added to `javac`, only to `java`. + |For example `org.enso.runtime/org.enso.my.package=ALL-UNNAMED` will open the package + |`org.enso.my.package` in the module `org.enso.runtime` to all unnamed modules. + |Specify it as `addOpens := Map("org.enso.runtime/org.enso.my.package" -> List("ALL-UNNAMED"))`. + |""".stripMargin + ) + val exportedModule = taskKey[File]( """ |Similarly to `exportedProducts` task, this task returns a file that can be @@ -198,9 +208,12 @@ object JPMSPlugin extends AutoPlugin { config / patchModules := Map.empty, config / addExports := Map.empty, config / addReads := Map.empty, + config / addOpens := Map.empty, + // No --add-opens option to javac config / javacOptions ++= { constructOptions( streams.value.log, + moduleName.value, (config / modulePath).value, (config / addModules).value, (config / patchModules).value, @@ -211,11 +224,13 @@ object JPMSPlugin extends AutoPlugin { config / javaOptions ++= { constructOptions( streams.value.log, + moduleName.value, (config / modulePath).value, (config / addModules).value, (config / patchModules).value, (config / addExports).value, - (config / addReads).value + (config / addReads).value, + (config / addOpens).value ) }, // Sanitize cmd line arguments @@ -303,13 +318,15 @@ object JPMSPlugin extends AutoPlugin { } } - def constructOptions( + private def constructOptions( log: Logger, + curProjName: String, modulePath: Seq[File], addModules: Seq[String] = Seq.empty, patchModules: Map[String, Seq[File]] = Map.empty, addExports: Map[String, Seq[String]] = Map.empty, - addReads: Map[String, Seq[String]] = Map.empty + addReads: Map[String, Seq[String]] = Map.empty, + addOpens: Map[String, Seq[String]] = Map.empty ): Seq[String] = { val patchOpts: Seq[String] = patchModules.flatMap { case (moduleName, dirsToPatch) => @@ -325,7 +342,10 @@ object JPMSPlugin extends AutoPlugin { val addExportsOpts: Seq[String] = addExports.flatMap { case (modPkgName, targetModules) => if (!modPkgName.contains("/")) { - log.error(s"JPMSPlugin: Invalid module/package name: $modPkgName") + log.error( + s"[JPMSPlugin/$curProjName] Invalid module/package name: $modPkgName " + + "in `addExports` task." + ) } Seq( "--add-exports", @@ -358,7 +378,20 @@ object JPMSPlugin extends AutoPlugin { ) }.toSeq - modulePathOpts ++ addModsOpts ++ patchOpts ++ addExportsOpts ++ addReadsOpts + val addOpensOpts = addOpens.flatMap { case (modPkgName, targetModules) => + if (!modPkgName.contains("/")) { + log.error( + s"[JPMSPlugin/$curProjName] Invalid module/package name: $modPkgName " + + "in `addOpens` task." + ) + } + Seq( + "--add-opens", + modPkgName + "=" + targetModules.mkString(",") + ) + }.toSeq + + modulePathOpts ++ addModsOpts ++ patchOpts ++ addExportsOpts ++ addReadsOpts ++ addOpensOpts } /** From 3261d99fd6f0b6f401972d62d4ec25771f2061a6 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 29 Aug 2024 19:51:22 +0200 Subject: [PATCH 129/268] RuntimeServerTest ensures instruments are initialized --- .../test/instrument/RuntimeServerTest.scala | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala index ba035d973aac..fe2ebb1de249 100644 --- a/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala @@ -9,6 +9,7 @@ import org.enso.common.MethodNames import org.enso.polyglot.data.TypeGraph import org.enso.common.RuntimeOptions import org.enso.polyglot.RuntimeServerInfo +import org.enso.polyglot.debugger.IdExecutionService import org.enso.polyglot.runtime.Runtime.Api import org.enso.text.editing.model import org.enso.text.editing.model.TextEdit @@ -75,6 +76,23 @@ class RuntimeServerTest .invokeMember(MethodNames.TopScope.LEAK_CONTEXT) .asHostObject[EnsoContext] + + private def ensureInstrumentsAvailable() = { + val instruments = context.getEngine.getInstruments + if (instruments.get(IdExecutionService.INSTRUMENT_ID) == null) { + throw new IllegalStateException( + "RuntimeServerTest cannot be initialized: IdExecutionService instrument must be available on module-path" + ) + } + if (instruments.get(RuntimeServerInfo.INSTRUMENT_NAME) == null) { + throw new IllegalStateException( + "RuntimeServerTest cannot be initialized: RuntimeServer instrument must be available on module-path" + ) + } + } + + ensureInstrumentsAvailable() + def writeMain(contents: String): File = Files.write(pkg.mainFile.toPath, contents.getBytes).toFile From b9f100ecf0317bd023c78a50e0ae66c7f7a406af Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 29 Aug 2024 19:51:50 +0200 Subject: [PATCH 130/268] Add some exports to org.enso.runtime.compiler --- engine/runtime-compiler/src/main/java/module-info.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/runtime-compiler/src/main/java/module-info.java b/engine/runtime-compiler/src/main/java/module-info.java index 955d89da6415..17cd6c98e308 100644 --- a/engine/runtime-compiler/src/main/java/module-info.java +++ b/engine/runtime-compiler/src/main/java/module-info.java @@ -17,11 +17,16 @@ exports org.enso.compiler.data; exports org.enso.compiler.dump; exports org.enso.compiler.exception; - exports org.enso.compiler.phase; exports org.enso.compiler.pass; exports org.enso.compiler.pass.analyse; exports org.enso.compiler.pass.analyse.alias; exports org.enso.compiler.pass.analyse.alias.graph; exports org.enso.compiler.pass.analyse.types; + exports org.enso.compiler.pass.desugar; + exports org.enso.compiler.pass.lint; + exports org.enso.compiler.pass.optimise; exports org.enso.compiler.pass.resolve; + exports org.enso.compiler.phase; + exports org.enso.compiler.phase.exports; + exports org.enso.compiler.refactoring; } From 16124d96df3f5970a85bc3a8fc2cdaa3ad100138 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 29 Aug 2024 19:52:08 +0200 Subject: [PATCH 131/268] Add instruments on module-path to runtime-integration-tests --- build.sbt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.sbt b/build.sbt index d4701e45fac3..06bf5dd75a63 100644 --- a/build.sbt +++ b/build.sbt @@ -2520,6 +2520,9 @@ lazy val `runtime-integration-tests` = (`runtime-test-instruments` / Compile / exportedModule).value, (`runtime-instrument-common` / Compile / exportedModule).value, (`runtime-instrument-runtime-server` / Compile / exportedModule).value, + (`runtime-instrument-repl-debugger` / Compile / exportedModule).value, + (`runtime-instrument-id-execution` / Compile / exportedModule).value, + (`runtime-language-epb` / Compile / exportedModule).value, (`ydoc-server` / Compile / exportedModule).value, (`syntax-rust-definition` / Compile / exportedModule).value, (`profiling-utils` / Compile / exportedModule).value, @@ -2586,6 +2589,7 @@ lazy val `runtime-integration-tests` = testInstrumentsModName, (`runtime-instrument-common` / javaModuleName).value, (`text-buffer` / javaModuleName).value, + (`semver` / javaModuleName).value, "truffle.tck.tests", "org.openide.util.lookup.RELEASE180" ), @@ -3503,6 +3507,7 @@ lazy val semver = project frgaalJavaCompilerSetting, // Note [JPMS Compile order] compileOrder := CompileOrder.JavaThenScala, + javaModuleName := "org.enso.semver", libraryDependencies ++= Seq( "io.circe" %% "circe-core" % circeVersion % "provided", "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", From c55cd50e7646bc5ec5d66ae74bcd818e83790bdd Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 29 Aug 2024 19:57:58 +0200 Subject: [PATCH 132/268] Replace TestLogProviderOnClassPath with TestLogProviderOnModulePath --- .../test/TestLogProviderOnClasspath.java | 40 ------------------- .../test/TestLogProviderOnModulePath.java | 20 ++++++++++ 2 files changed, 20 insertions(+), 40 deletions(-) delete mode 100644 engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnClasspath.java create mode 100644 engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnClasspath.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnClasspath.java deleted file mode 100644 index 5dd8a87d6bb7..000000000000 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnClasspath.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.enso.interpreter.test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; - -import java.util.ArrayList; -import java.util.List; -import java.util.ServiceLoader; -import java.util.stream.Collectors; -import org.enso.logging.service.logback.test.provider.TestLogProvider; -import org.junit.Test; -import org.slf4j.spi.SLF4JServiceProvider; - -/** - * In the `runtime/Test` testing suite, {@link TestLogProvider} should be among the - * logging providers, because it is explicitly chosen as the logging provider for the tests. - */ -public class TestLogProviderOnClasspath { - @Test - public void testLogProviderOnClasspath() { - var sl = ServiceLoader.load(SLF4JServiceProvider.class); - var serviceIterator = sl.iterator(); - List providers = new ArrayList<>(); - while (serviceIterator.hasNext()) { - providers.add(serviceIterator.next()); - } - List providerNames = - providers.stream().map(elem -> elem.getClass().getName()).collect(Collectors.toList()); - assertThat(providerNames, hasItem("org.enso.logging.service.logback.test.provider.TestLogProvider")); - } - - @Test - public void testLogProviderIsInUnnamedModule() throws Exception { - var testLogProviderClass = Class.forName( - "org.enso.logging.service.logback.test.provider.TestLogProvider"); - var mod = testLogProviderClass.getModule(); - assertThat(mod, notNullValue()); - assertThat("Should be an unnamed module - with null name", mod.getName(), nullValue()); - } -} diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java new file mode 100644 index 000000000000..41e3999364e6 --- /dev/null +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java @@ -0,0 +1,20 @@ +package org.enso.interpreter.test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; + +import org.enso.logging.service.logback.test.provider.TestLogProvider; +import org.junit.Test; + +/** + * In the `runtime/Test` testing suite, {@link TestLogProvider} should be among the + * logging providers, because it is explicitly chosen as the logging provider for the tests. + */ +public class TestLogProviderOnModulePath { + @Test + public void testLogProviderOnClasspath() { + var modName = "org.enso.logging.service.logback.test.provider"; + var logProviderMod = ModuleLayer.boot().findModule(modName); + assertThat(logProviderMod.isPresent(), is(true)); + } +} From 4fe2997ec3a4d3b139393d02c8daba421c9b84b1 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 29 Aug 2024 20:05:07 +0200 Subject: [PATCH 133/268] Replace buildInfo with BuildVersion --- .../websocket/json/LibrariesTest.scala | 25 +++++++------------ .../json/ProjectSettingsManagerTest.scala | 3 ++- .../json/WorkspaceOperationsTest.scala | 6 ++--- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala index 0145fa025a5d..ab7c50636d81 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala @@ -7,21 +7,14 @@ import org.enso.semver.SemVer import org.enso.distribution.FileSystem import org.enso.editions.{Editions, LibraryName} import org.enso.languageserver.libraries.LibraryEntry.PublishedLibraryVersion -import org.enso.languageserver.libraries.{ - LibraryComponentGroup, - LibraryComponentGroups, - LibraryEntry -} +import org.enso.languageserver.libraries.{LibraryComponentGroup, LibraryComponentGroups, LibraryEntry} import org.enso.languageserver.runtime.TestComponentGroups import org.enso.librarymanager.published.bundles.LocalReadOnlyRepository -import org.enso.librarymanager.published.repository.{ - EmptyRepository, - ExampleRepository, - LibraryManifest -} +import org.enso.librarymanager.published.repository.{EmptyRepository, ExampleRepository, LibraryManifest} import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.{Config, Contact, Package, PackageManager} import org.enso.testkit.FlakySpec +import org.enso.version.BuildVersion import org.enso.yaml.YamlHelper import java.nio.file.Files @@ -698,7 +691,7 @@ class LibrariesTest "id": 0, "result": { "editionNames": [ - ${buildinfo.Info.currentEdition} + ${BuildVersion.currentEdition} ] } } @@ -729,7 +722,7 @@ class LibrariesTest "id": 0, "result": { "editionNames": [ - ${buildinfo.Info.currentEdition}, + ${BuildVersion.currentEdition}, "testlocal" ] } @@ -789,7 +782,7 @@ class LibrariesTest PublishedLibrary("Foo", "Bar", isCached = false) ) - val currentEditionName = buildinfo.Info.currentEdition + val currentEditionName = BuildVersion.currentEdition client.send(json""" { "jsonrpc": "2.0", "method": "editions/listDefinedLibraries", @@ -837,7 +830,7 @@ class LibrariesTest LibraryName("Standard", "Base") ) - val currentEditionName = buildinfo.Info.currentEdition + val currentEditionName = BuildVersion.currentEdition client.send(json""" { "jsonrpc": "2.0", "method": "editions/listDefinedComponents", @@ -868,7 +861,7 @@ class LibrariesTest "editions/resolve" should { "resolve the engine version associated with an edition" in { - val currentVersion = buildinfo.Info.ensoVersion + val currentVersion = BuildVersion.ensoVersion val client = getInitialisedWsClient() client.send(json""" @@ -901,7 +894,7 @@ class LibrariesTest "params": { "edition": { "type": "NamedEdition", - "editionName": ${buildinfo.Info.currentEdition} + "editionName": ${BuildVersion.currentEdition} } } } diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala index 69bca1fdc007..86ba66b41c20 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala @@ -3,6 +3,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import org.enso.distribution.FileSystem import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure +import org.enso.version.BuildVersion import java.nio.file.Files @@ -40,7 +41,7 @@ class ProjectSettingsManagerTest { "jsonrpc": "2.0", "id": 0, "result": { - "parentEdition": ${buildinfo.Info.currentEdition}, + "parentEdition": ${BuildVersion.currentEdition}, "preferLocalLibraries": true } } diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala index f21f31b4cc17..31a5dfc765c2 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala @@ -1,10 +1,10 @@ package org.enso.languageserver.websocket.json -import buildinfo.Info import io.circe.literal.JsonStringContext import org.enso.languageserver.data.Config import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.testkit.FlakySpec +import org.enso.version.BuildVersion import java.io.{File, FileOutputStream} @@ -42,8 +42,8 @@ class WorkspaceOperationsTest "id": 1, "result": { "projectName" : "Standard", - "engineVersion" : ${Info.ensoVersion}, - "graalVersion" : ${Info.graalVersion} + "engineVersion" : ${BuildVersion.ensoVersion}, + "graalVersion" : ${BuildVersion.graalVersion} } } """) From 732b3427a2c4a7051c831f3439b4fc04ba126ae1 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 11:27:34 +0200 Subject: [PATCH 134/268] Add jpms-wrapper-scalatest --- build.sbt | 80 +++++++++++++++++++ .../src/main/java/module-info.java | 28 +++++++ 2 files changed, 108 insertions(+) create mode 100644 lib/java/jpms-wrapper-scalatest/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 06bf5dd75a63..a9279c7c5e61 100644 --- a/build.sbt +++ b/build.sbt @@ -1237,6 +1237,86 @@ lazy val `language-server-deps-wrapper` = project } ) +lazy val `jpms-wrapper-scalatest` = project + .in(file("lib/java/jpms-wrapper-scalatest")) + .enablePlugins(JPMSPlugin) + .settings( + modularFatJarWrapperSettings, + libraryDependencies ++= scalaCompiler ++ Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang.modules" %% "scala-xml" % "2.1.0", + "org.scalatest" %% "scalatest" % scalatestVersion, + "org.scalatest" %% "scalatest-core" % scalatestVersion, + "org.scalatest" % "scalatest-compatible" % scalatestVersion, + "org.scalatest" %% "scalatest-diagrams" % scalatestVersion, + "org.scalatest" %% "scalatest-featurespec" % scalatestVersion, + "org.scalatest" %% "scalatest-flatspec" % scalatestVersion, + "org.scalatest" %% "scalatest-freespec" % scalatestVersion, + "org.scalatest" %% "scalatest-funspec" % scalatestVersion, + "org.scalatest" %% "scalatest-funsuite" % scalatestVersion, + "org.scalatest" %% "scalatest-matchers-core" % scalatestVersion, + "org.scalatest" %% "scalatest-propspec" % scalatestVersion, + "org.scalatest" %% "scalatest-refspec" % scalatestVersion, + "org.scalatest" %% "scalatest-wordspec" % scalatestVersion, + "org.scalactic" %% "scalactic" % scalacticVersion, + "org.jline" % "jline" % jlineVersion, + ), + javaModuleName := "org.enso.jpms.wrapper.scalatest", + Compile / moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + ), + assembly / assemblyExcludedJars := { + val scalaVer = scalaBinaryVersion.value + JPMSUtils.filterModulesFromClasspath( + (Compile / dependencyClasspath).value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.scala-lang.modules" % ("scala-xml_" + scalaVer) % "2.1.0", + "org.scalactic" % ("scalactic_" + scalaVer) % scalacticVersion, + "org.jline" % "jline" % jlineVersion, + "io.github.java-diff-utils" % "java-diff-utils" % "4.12", + "net.java.dev.jna" % "jna" % "5.13.0" + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + }, + Compile / patchModules := { + val scalaVer = scalaBinaryVersion.value + val scalaLibs = JPMSUtils.filterModulesFromUpdate( + update.value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.scalactic" % ("scalactic_" + scalaVer) % scalacticVersion, + "org.scala-lang.modules" % ("scala-xml_" + scalaVer) % "2.1.0", + "org.scalatest" % ("scalatest-core_" + scalaVer) % scalatestVersion, + "org.scalatest" % "scalatest-compatible" % scalatestVersion, + "org.scalatest" % ("scalatest-diagrams_" + scalaVer) % scalatestVersion, + "org.scalatest" % ("scalatest-featurespec_" + scalaVer) % scalatestVersion, + "org.scalatest" % ("scalatest-flatspec_" + scalaVer) % scalatestVersion, + "org.scalatest" % ("scalatest-freespec_" + scalaVer) % scalatestVersion, + "org.scalatest" % ("scalatest-funspec_" + scalaVer) % scalatestVersion, + "org.scalatest" % ("scalatest-funsuite_" + scalaVer) % scalatestVersion, + "org.scalatest" % ("scalatest-matchers-core_" + scalaVer) % scalatestVersion, + "org.scalatest" % ("scalatest-propspec_" + scalaVer) % scalatestVersion, + "org.scalatest" % ("scalatest-refspec_" + scalaVer) % scalatestVersion, + "org.scalatest" % ("scalatest-wordspec_" + scalaVer) % scalatestVersion, + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + Map( + javaModuleName.value -> scalaLibs + ) + } + ) + /** JPMS module wrapper for Akka. */ lazy val `akka-wrapper` = project diff --git a/lib/java/jpms-wrapper-scalatest/src/main/java/module-info.java b/lib/java/jpms-wrapper-scalatest/src/main/java/module-info.java new file mode 100644 index 000000000000..c5b892bc2d03 --- /dev/null +++ b/lib/java/jpms-wrapper-scalatest/src/main/java/module-info.java @@ -0,0 +1,28 @@ +module org.enso.jpms.wrapper.scalatest { + requires scala.library; + + exports org.scalatest; + exports org.scalatest.compatible; + exports org.scalatest.concurrent; + exports org.scalatest.diagrams; + exports org.scalatest.enablers; + exports org.scalatest.events; + exports org.scalatest.exceptions; + exports org.scalatest.expectations; + exports org.scalatest.featurespec; + exports org.scalatest.fixture; + exports org.scalatest.flatspec; + exports org.scalatest.freespec; + exports org.scalatest.funspec; + exports org.scalatest.funsuite; + exports org.scalatest.matchers; + exports org.scalatest.prop; + exports org.scalatest.propspec; + exports org.scalatest.refspec; + exports org.scalatest.tagobjects; + exports org.scalatest.tags; + exports org.scalatest.time; + exports org.scalatest.tools; + exports org.scalatest.verbs; + exports org.scalatest.wordspec; +} From 5572b608c50cdba170c3093a97a80ea53f0aac7c Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 12:04:59 +0200 Subject: [PATCH 135/268] ReportLogsOnFailure is in non-modular testkit project --- .../boot/resource/RepoInitializationSpec.scala | 3 +-- .../filemanager/ContentRootManagerSpec.scala | 3 +-- .../filemanager/ContentRootSerializationSpec.scala | 2 +- .../enso/languageserver/filemanager/FileSystemSpec.scala | 2 +- .../libraries/ComponentGroupsResolverSpec.scala | 2 +- .../libraries/ComponentGroupsValidatorSpec.scala | 2 +- .../libraries/EditionNameSerializationSpec.scala | 2 +- .../libraries/LibraryEntrySerializationSpec.scala | 2 +- .../libraries/LocalLibraryManagerSpec.scala | 3 +-- .../monitoring/HealthCheckEndpointSpec.scala | 3 +-- .../languageserver/monitoring/IdlenessEndpointSpec.scala | 3 +-- .../requesthandler/monitoring/PingHandlerSpec.scala | 3 +-- .../runtime/ContextEventsListenerSpec.scala | 3 +-- .../languageserver/search/SuggestionsHandlerSpec.scala | 3 +-- .../org/enso/languageserver/vcsmanager/GitSpec.scala | 3 +-- .../websocket/binary/BinaryFileManipulationTest.scala | 3 +-- .../websocket/binary/BinarySessionManagementTest.scala | 3 +-- .../websocket/binary/VisualizationProtocolTest.scala | 3 +-- .../languageserver/websocket/json/CapabilitiesTest.scala | 2 +- .../websocket/json/ContextRegistryTest.scala | 2 +- .../languageserver/websocket/json/FileManagerTest.scala | 3 +-- .../websocket/json/FileNotificationsTest.scala | 3 +-- .../websocket/json/InputOutputRedirectionTest.scala | 3 +-- .../languageserver/websocket/json/LibrariesTest.scala | 3 +-- .../languageserver/websocket/json/MonitoringTest.scala | 3 +-- .../websocket/json/ProfilingManagerTest.scala | 2 +- .../websocket/json/ProjectSettingsManagerTest.scala | 2 +- .../websocket/json/ReceivesTreeUpdatesHandlerTest.scala | 3 +-- .../languageserver/websocket/json/RefactoringTest.scala | 2 +- .../enso/languageserver/websocket/json/RuntimeTest.scala | 2 +- .../websocket/json/SessionManagementTest.scala | 2 +- .../websocket/json/SuggestionsHandlerEventsTest.scala | 3 +-- .../websocket/json/SuggestionsHandlerTest.scala | 3 +-- .../websocket/json/TextOperationsTest.scala | 3 +-- .../languageserver/websocket/json/VcsManagerTest.scala | 3 +-- .../websocket/json/VisualizationOperationsTest.scala | 2 +- .../websocket/json/WorkspaceOperationsTest.scala | 3 +-- .../languageserver/LanguageServerGatewaySpec.scala | 2 +- .../languageserver/LanguageServerSupervisorSpec.scala | 3 +-- .../languageserver/ProjectRenameActionSpec.scala | 3 +-- .../projectmanager/protocol/EngineManagementApiSpec.scala | 3 +-- .../protocol/LoggingServiceEndpointSpec.scala | 3 +-- .../protocol/ProjectCreateDefaultToLatestSpec.scala | 2 +- .../protocol/ProjectCreateHandleMissingRuntimeSpec.scala | 2 +- .../protocol/ProjectCreateMissingComponentsSpec.scala | 2 +- .../protocol/ProjectManagementApiSpec.scala | 3 +-- .../protocol/ProjectOpenMissingComponentsSpec.scala | 2 +- .../projectmanager/protocol/ProjectShutdownSpec.scala | 3 +-- .../service/validation/ProjectNameValidatorSpec.scala | 2 +- .../scala/org/enso/testkit}/ReportLogsOnFailure.scala | 8 ++------ 50 files changed, 51 insertions(+), 84 deletions(-) rename lib/scala/{logging-service-logback/src/test/scala/org/enso/logging/service/logback/test/provider => testkit/src/main/scala/org/enso/testkit}/ReportLogsOnFailure.scala (78%) diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala index 66ed7712c52a..986de0f7b336 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala @@ -8,9 +8,8 @@ import org.enso.languageserver.boot.StartupConfig import org.enso.languageserver.data._ import org.enso.languageserver.event.InitializedEvent import org.enso.languageserver.filemanager.{ContentRoot, ContentRootWithFile} -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.searcher.memory.InMemorySuggestionsRepo -import org.enso.testkit.{FlakySpec, ToScalaFutureConversions} +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure, ToScalaFutureConversions} import org.scalatest.BeforeAndAfterAll import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala index 2ead95d1cd10..1e94c1c534b7 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala @@ -10,9 +10,8 @@ import org.enso.languageserver.filemanager.ContentRootManagerProtocol.{ ContentRootsAddedNotification, SubscribeToNotifications } -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api -import org.enso.testkit.{EitherValue, WithTemporaryDirectory} +import org.enso.testkit.{EitherValue, ReportLogsOnFailure, WithTemporaryDirectory} import org.scalatest.concurrent.Futures import org.scalatest.concurrent.ScalaFutures.convertScalaFuture import org.scalatest.matchers.should.Matchers diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootSerializationSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootSerializationSpec.scala index a00dd38807c0..e77ecb7dbee1 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootSerializationSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootSerializationSpec.scala @@ -3,7 +3,7 @@ package org.enso.languageserver.filemanager import io.circe.Json import io.circe.syntax._ import io.circe.literal._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure +import org.enso.testkit.ReportLogsOnFailure import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/FileSystemSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/FileSystemSpec.scala index 51431859edc5..ce62a66a51ed 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/FileSystemSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/FileSystemSpec.scala @@ -2,7 +2,7 @@ package org.enso.languageserver.filemanager import org.apache.commons.io.FileUtils import org.enso.languageserver.effect.Effects -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure +import org.enso.testkit.ReportLogsOnFailure import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsResolverSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsResolverSpec.scala index d5461f6665d0..8466dd4d6184 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsResolverSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsResolverSpec.scala @@ -1,7 +1,6 @@ package org.enso.languageserver.libraries import org.enso.editions.LibraryName -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.{ Component, ComponentGroup, @@ -11,6 +10,7 @@ import org.enso.pkg.{ GroupName, GroupReference } +import org.enso.testkit.ReportLogsOnFailure import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsValidatorSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsValidatorSpec.scala index 62c340ac9f13..1c3fc19e06e0 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsValidatorSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/ComponentGroupsValidatorSpec.scala @@ -1,7 +1,6 @@ package org.enso.languageserver.libraries import org.enso.editions.LibraryName -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.{ ComponentGroup, ComponentGroups, @@ -9,6 +8,7 @@ import org.enso.pkg.{ GroupName, GroupReference } +import org.enso.testkit.ReportLogsOnFailure import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/EditionNameSerializationSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/EditionNameSerializationSpec.scala index 9e8da4a8b526..e34c17e7a97a 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/EditionNameSerializationSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/EditionNameSerializationSpec.scala @@ -5,7 +5,7 @@ import org.enso.languageserver.libraries.EditionReference.{ CurrentProjectEdition, NamedEdition } -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure +import org.enso.testkit.ReportLogsOnFailure import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LibraryEntrySerializationSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LibraryEntrySerializationSpec.scala index f37bbfb475aa..8d942c9a20e3 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LibraryEntrySerializationSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LibraryEntrySerializationSpec.scala @@ -1,7 +1,7 @@ package org.enso.languageserver.libraries import io.circe.syntax._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure +import org.enso.testkit.ReportLogsOnFailure import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LocalLibraryManagerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LocalLibraryManagerSpec.scala index edb759118dbd..126832e1258c 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LocalLibraryManagerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/libraries/LocalLibraryManagerSpec.scala @@ -5,9 +5,8 @@ import akka.testkit._ import org.enso.distribution.FileSystem.PathSyntax import org.enso.editions.LibraryName import org.enso.librarymanager.LibraryLocations -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.PackageManager -import org.enso.testkit.WithTemporaryDirectory +import org.enso.testkit.{ReportLogsOnFailure, WithTemporaryDirectory} import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike import org.scalatest.BeforeAndAfterAll diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/HealthCheckEndpointSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/HealthCheckEndpointSpec.scala index 55b67514ea04..0b2b384b5049 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/HealthCheckEndpointSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/HealthCheckEndpointSpec.scala @@ -11,8 +11,7 @@ import org.enso.languageserver.monitoring.HealthCheckEndpointSpec.{ } import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong} import org.enso.languageserver.requesthandler.monitoring.PingHandler -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.scalatest.flatspec.AnyFlatSpecLike import org.scalatest.matchers.must.Matchers diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/IdlenessEndpointSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/IdlenessEndpointSpec.scala index 8286ea52004c..dcd95435c114 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/IdlenessEndpointSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/monitoring/IdlenessEndpointSpec.scala @@ -5,8 +5,7 @@ import akka.http.scaladsl.model.StatusCodes import akka.http.scaladsl.server.Directives import akka.http.scaladsl.testkit.{RouteTestTimeout, ScalatestRouteTest} import org.enso.languageserver.TestClock -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.scalatest.flatspec.AnyFlatSpecLike import org.scalatest.matchers.should.Matchers diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/requesthandler/monitoring/PingHandlerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/requesthandler/monitoring/PingHandlerSpec.scala index a3045160abec..f451e023977b 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/requesthandler/monitoring/PingHandlerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/requesthandler/monitoring/PingHandlerSpec.scala @@ -6,8 +6,7 @@ import org.enso.jsonrpc.Id.Number import org.enso.jsonrpc.{Request, ResponseResult, Unused} import org.enso.languageserver.monitoring.MonitoringApi import org.enso.languageserver.monitoring.MonitoringProtocol.{Ping, Pong} -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.scalatest.BeforeAndAfterAll import org.scalatest.flatspec.AnyFlatSpecLike import org.scalatest.matchers.must.Matchers diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala index ba8e7d4bb3d3..308424fece6e 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/runtime/ContextEventsListenerSpec.scala @@ -20,9 +20,8 @@ import org.enso.languageserver.session.SessionRouter.{ DeliverToBinaryController, DeliverToJsonController } -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api -import org.enso.testkit.RetrySpec +import org.enso.testkit.{ReportLogsOnFailure, RetrySpec} import org.scalatest.BeforeAndAfterAll import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/search/SuggestionsHandlerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/search/SuggestionsHandlerSpec.scala index f23e5867cba3..b76ed913f4a3 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/search/SuggestionsHandlerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/search/SuggestionsHandlerSpec.scala @@ -14,13 +14,12 @@ import org.enso.languageserver.event.InitializedEvent import org.enso.languageserver.filemanager._ import org.enso.languageserver.session.JsonSession import org.enso.languageserver.session.SessionRouter.DeliverToJsonController -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.data.{Tree, TypeGraph} import org.enso.polyglot.runtime.Runtime.Api import org.enso.polyglot.{ExportedSymbol, ModuleExports, Suggestion} import org.enso.searcher.SuggestionsRepo import org.enso.searcher.memory.InMemorySuggestionsRepo -import org.enso.testkit.RetrySpec +import org.enso.testkit.{ReportLogsOnFailure, RetrySpec} import org.scalatest.BeforeAndAfterAll import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/vcsmanager/GitSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/vcsmanager/GitSpec.scala index 4cee6f0f439a..3d3ef0e6a1a2 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/vcsmanager/GitSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/vcsmanager/GitSpec.scala @@ -10,8 +10,7 @@ import org.eclipse.jgit.api.{Git => JGit} import org.eclipse.jgit.lib.Repository import org.eclipse.jgit.storage.file.FileRepositoryBuilder import org.eclipse.jgit.revwalk.RevCommit -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import scala.concurrent.duration._ import scala.jdk.CollectionConverters._ diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinaryFileManipulationTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinaryFileManipulationTest.scala index 758113d830f1..5257c44dabd2 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinaryFileManipulationTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinaryFileManipulationTest.scala @@ -5,8 +5,7 @@ import org.apache.commons.io.FileUtils import org.enso.languageserver.protocol.binary._ import org.enso.languageserver.util.binary.BinaryDecoder import org.enso.languageserver.websocket.binary.factory._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import java.io.File import java.nio.ByteBuffer diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinarySessionManagementTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinarySessionManagementTest.scala index 73753ad321f6..39dfbef57ad9 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinarySessionManagementTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/BinarySessionManagementTest.scala @@ -12,8 +12,7 @@ import org.enso.languageserver.websocket.binary.factory.{ InboundMessageFactory, SessionInitFactory } -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} class BinarySessionManagementTest extends BaseBinaryServerTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/VisualizationProtocolTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/VisualizationProtocolTest.scala index 158e267e5616..24b566e44445 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/VisualizationProtocolTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/binary/VisualizationProtocolTest.scala @@ -12,8 +12,7 @@ import org.enso.languageserver.runtime.ContextRegistryProtocol.{ VisualizationUpdate } import org.enso.languageserver.util.binary.BinaryDecoder -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.scalatest.concurrent.Eventually class VisualizationProtocolTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/CapabilitiesTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/CapabilitiesTest.scala index b16c95fbc6ad..fb6b80f69c1f 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/CapabilitiesTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/CapabilitiesTest.scala @@ -3,8 +3,8 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import io.circe.parser.parse import io.circe.syntax.EncoderOps -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api +import org.enso.testkit.ReportLogsOnFailure import java.util.UUID diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ContextRegistryTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ContextRegistryTest.scala index d3a4edc236e2..f4c44567feac 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ContextRegistryTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ContextRegistryTest.scala @@ -11,8 +11,8 @@ import org.enso.languageserver.session.JsonSession import org.enso.languageserver.websocket.json.{ ExecutionContextJsonMessages => json } -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api +import org.enso.testkit.ReportLogsOnFailure import java.util.UUID diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileManagerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileManagerTest.scala index c2a5c6ff564e..810d910acff9 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileManagerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileManagerTest.scala @@ -7,9 +7,8 @@ import org.bouncycastle.util.encoders.Hex import org.enso.runner.common.ProfilingConfig import org.enso.languageserver.boot.StartupConfig import org.enso.languageserver.data._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api -import org.enso.testkit.RetrySpec +import org.enso.testkit.{ReportLogsOnFailure, RetrySpec} import java.io.File import java.nio.file.attribute.BasicFileAttributes diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileNotificationsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileNotificationsTest.scala index 5a4d762eb39e..dc4285b4aeaf 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileNotificationsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/FileNotificationsTest.scala @@ -2,9 +2,8 @@ package org.enso.languageserver.websocket.json import java.io.File import io.circe.literal._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.enso.text.editing.model.{Position, Range, TextEdit} class FileNotificationsTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/InputOutputRedirectionTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/InputOutputRedirectionTest.scala index 47a6d0503a2c..7eb0c855a956 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/InputOutputRedirectionTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/InputOutputRedirectionTest.scala @@ -1,8 +1,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api -import org.enso.testkit.RetrySpec +import org.enso.testkit.{ReportLogsOnFailure, RetrySpec} class InputOutputRedirectionTest extends BaseServerTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala index ab7c50636d81..1eb71a00587f 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala @@ -11,9 +11,8 @@ import org.enso.languageserver.libraries.{LibraryComponentGroup, LibraryComponen import org.enso.languageserver.runtime.TestComponentGroups import org.enso.librarymanager.published.bundles.LocalReadOnlyRepository import org.enso.librarymanager.published.repository.{EmptyRepository, ExampleRepository, LibraryManifest} -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.{Config, Contact, Package, PackageManager} -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.enso.version.BuildVersion import org.enso.yaml.YamlHelper diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/MonitoringTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/MonitoringTest.scala index a4ef4d8baae6..65850885337f 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/MonitoringTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/MonitoringTest.scala @@ -1,8 +1,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} class MonitoringTest extends BaseServerTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProfilingManagerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProfilingManagerTest.scala index a25a93c3a71f..300ce7d25026 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProfilingManagerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProfilingManagerTest.scala @@ -2,7 +2,7 @@ package org.enso.languageserver.websocket.json import org.enso.distribution.DistributionManager import org.enso.languageserver.profiling.ProfilingManager -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure +import org.enso.testkit.ReportLogsOnFailure import java.nio.file.Files diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala index 86ba66b41c20..9f2329579be5 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ProjectSettingsManagerTest.scala @@ -2,7 +2,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import org.enso.distribution.FileSystem -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure +import org.enso.testkit.ReportLogsOnFailure import org.enso.version.BuildVersion import java.nio.file.Files diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ReceivesTreeUpdatesHandlerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ReceivesTreeUpdatesHandlerTest.scala index b7d41cda1701..60fdf0b504eb 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ReceivesTreeUpdatesHandlerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/ReceivesTreeUpdatesHandlerTest.scala @@ -2,8 +2,7 @@ package org.enso.languageserver.websocket.json import java.nio.file.{Files, Paths} import io.circe.literal._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} class ReceivesTreeUpdatesHandlerTest extends BaseServerTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RefactoringTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RefactoringTest.scala index 2f572c5caf37..a7608778c3a4 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RefactoringTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RefactoringTest.scala @@ -1,8 +1,8 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api +import org.enso.testkit.ReportLogsOnFailure import java.util.UUID diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RuntimeTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RuntimeTest.scala index de39cefce43f..2718601e5aea 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RuntimeTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/RuntimeTest.scala @@ -2,8 +2,8 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import org.enso.languageserver.runtime.TestComponentGroups -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api +import org.enso.testkit.ReportLogsOnFailure class RuntimeTest extends BaseServerTest with ReportLogsOnFailure { diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SessionManagementTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SessionManagementTest.scala index d9088894ec49..9ca80d072389 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SessionManagementTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SessionManagementTest.scala @@ -3,7 +3,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import io.circe.parser.parse import io.circe.syntax.EncoderOps -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure +import org.enso.testkit.ReportLogsOnFailure class SessionManagementTest extends BaseServerTest with ReportLogsOnFailure { diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerEventsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerEventsTest.scala index 60a4e263f644..7fd4241ee110 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerEventsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerEventsTest.scala @@ -3,11 +3,10 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import org.enso.languageserver.search.Suggestions import org.enso.languageserver.websocket.json.{SearchJsonMessages => json} -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.{ExportedSymbol, ModuleExports} import org.enso.polyglot.data.Tree import org.enso.polyglot.runtime.Runtime.Api -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import scala.collection.immutable.ListSet diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerTest.scala index ac09be380822..6a795defcf2f 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/SuggestionsHandlerTest.scala @@ -1,8 +1,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal._ import org.enso.languageserver.websocket.json.{SearchJsonMessages => json} -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.{FlakySpec, RetrySpec} +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure, RetrySpec} class SuggestionsHandlerTest extends BaseServerTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/TextOperationsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/TextOperationsTest.scala index 2bf45524136a..d0f667682e83 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/TextOperationsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/TextOperationsTest.scala @@ -5,9 +5,8 @@ import io.circe.literal._ import org.enso.languageserver.event.{BufferClosed, JsonSessionTerminated} import org.enso.languageserver.filemanager.Path import org.enso.languageserver.session.JsonSession -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.enso.text.editing.model import java.io.File diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VcsManagerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VcsManagerTest.scala index 0f74412a2357..3c1359a5e026 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VcsManagerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VcsManagerTest.scala @@ -11,8 +11,7 @@ import org.enso.runner.common.ProfilingConfig import org.enso.languageserver.boot.StartupConfig import org.enso.languageserver.data._ import org.enso.languageserver.vcsmanager.VcsApi -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import java.io.File import java.nio.charset.StandardCharsets diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VisualizationOperationsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VisualizationOperationsTest.scala index fa6e81e0e132..b6ea8f71502e 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VisualizationOperationsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/VisualizationOperationsTest.scala @@ -5,8 +5,8 @@ import org.enso.languageserver.runtime.{ MethodPointer, VisualizationConfiguration } -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.polyglot.runtime.Runtime.Api +import org.enso.testkit.ReportLogsOnFailure import org.enso.text.editing.model class VisualizationOperationsTest diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala index 31a5dfc765c2..388066ef12bc 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/WorkspaceOperationsTest.scala @@ -2,8 +2,7 @@ package org.enso.languageserver.websocket.json import io.circe.literal.JsonStringContext import org.enso.languageserver.data.Config -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.enso.version.BuildVersion import java.io.{File, FileOutputStream} diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerGatewaySpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerGatewaySpec.scala index ee22873a411d..53998de9f37d 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerGatewaySpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerGatewaySpec.scala @@ -2,11 +2,11 @@ package org.enso.projectmanager.infrastructure.languageserver import akka.testkit.TestDuration import io.circe.literal._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.semver.SemVer import org.enso.projectmanager.test.Net._ import org.enso.projectmanager.{BaseServerSpec, ProjectManagementOps} import org.enso.runtimeversionmanager.test.OverrideTestVersionSuite +import org.enso.testkit.ReportLogsOnFailure import scala.concurrent.Await import scala.concurrent.duration._ diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisorSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisorSpec.scala index 9162b9d5f505..7d2b3f206423 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisorSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/LanguageServerSupervisorSpec.scala @@ -3,7 +3,6 @@ package org.enso.projectmanager.infrastructure.languageserver import akka.actor.{ActorRef, ActorSystem, Props} import akka.testkit.{ImplicitSender, TestActor, TestKit, TestProbe} import com.miguno.akka.testing.VirtualTime -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.boot.configuration.SupervisionConfig import org.enso.projectmanager.infrastructure.http.AkkaBasedWebSocketConnectionFactory import org.enso.projectmanager.infrastructure.languageserver.LanguageServerBootLoader.ServerBooted @@ -13,7 +12,7 @@ import org.enso.projectmanager.infrastructure.languageserver.ProgrammableWebSock } import org.enso.projectmanager.infrastructure.languageserver.StepParent.ChildTerminated import org.enso.projectmanager.infrastructure.net.Tcp -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.mockito.MockitoSugar import org.scalatest.BeforeAndAfterAll import org.scalatest.flatspec.AnyFlatSpecLike diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameActionSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameActionSpec.scala index a90b232f16b6..3ab7b4283d5d 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameActionSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/infrastructure/languageserver/ProjectRenameActionSpec.scala @@ -3,7 +3,6 @@ package org.enso.projectmanager.infrastructure.languageserver import akka.actor.ActorSystem import akka.testkit._ import com.miguno.akka.testing.VirtualTime -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.data.Socket import org.enso.projectmanager.infrastructure.languageserver.LanguageServerProtocol.{ ProjectRenamed, @@ -12,7 +11,7 @@ import org.enso.projectmanager.infrastructure.languageserver.LanguageServerProto } import org.enso.projectmanager.infrastructure.languageserver.ProgrammableWebSocketServer.ReplyWith import org.enso.projectmanager.infrastructure.net.Tcp -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.mockito.MockitoSugar import org.scalatest.BeforeAndAfterAll import org.scalatest.flatspec.AnyFlatSpecLike diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/EngineManagementApiSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/EngineManagementApiSpec.scala index 58ef5ce82b94..a90b22575e63 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/EngineManagementApiSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/EngineManagementApiSpec.scala @@ -2,9 +2,8 @@ package org.enso.projectmanager.protocol import akka.testkit.TestDuration import io.circe.literal._ -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.BaseServerSpec -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import scala.concurrent.duration.DurationInt diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/LoggingServiceEndpointSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/LoggingServiceEndpointSpec.scala index 96561936dc8e..8d92a98cf8e3 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/LoggingServiceEndpointSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/LoggingServiceEndpointSpec.scala @@ -1,9 +1,8 @@ package org.enso.projectmanager.protocol import io.circe.literal.JsonStringContext -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.BaseServerSpec -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import scala.concurrent.Future import java.net.URI diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateDefaultToLatestSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateDefaultToLatestSpec.scala index c24c6e621483..04f1a71bd8b1 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateDefaultToLatestSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateDefaultToLatestSpec.scala @@ -1,10 +1,10 @@ package org.enso.projectmanager.protocol import io.circe.literal.JsonStringContext -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.semver.SemVer import org.enso.projectmanager.BaseServerSpec import org.enso.runtimeversionmanager.test.OverrideTestVersionSuite +import org.enso.testkit.ReportLogsOnFailure class ProjectCreateDefaultToLatestSpec extends BaseServerSpec diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala index 19abf96026ff..0fd90870bf43 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateHandleMissingRuntimeSpec.scala @@ -1,9 +1,9 @@ package org.enso.projectmanager.protocol -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.TestDistributionConfiguration import org.enso.runtimeversionmanager.runner.JVMSettings import org.enso.runtimeversionmanager.test.FakeReleases +import org.enso.testkit.ReportLogsOnFailure class ProjectCreateHandleMissingRuntimeSpec extends ProjectCreateSpecBase diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateMissingComponentsSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateMissingComponentsSpec.scala index f3d7ae1c2177..c73e2fb9edb8 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateMissingComponentsSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectCreateMissingComponentsSpec.scala @@ -1,6 +1,6 @@ package org.enso.projectmanager.protocol -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure +import org.enso.testkit.ReportLogsOnFailure class ProjectCreateMissingComponentsSpec extends ProjectCreateSpecBase diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectManagementApiSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectManagementApiSpec.scala index d1552ab089ba..1bb6316286a5 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectManagementApiSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectManagementApiSpec.scala @@ -4,13 +4,12 @@ import akka.testkit.TestDuration import io.circe.literal._ import org.enso.semver.SemVer import org.apache.commons.io.FileUtils -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.pkg.validation.NameValidation import org.enso.projectmanager.boot.configuration.TimeoutConfig import org.enso.projectmanager.{BaseServerSpec, ProjectManagementOps} import org.enso.runtimeversionmanager.CurrentVersion import org.enso.runtimeversionmanager.test.OverrideTestVersionSuite -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.scalactic.source.Position import java.io.File diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectOpenMissingComponentsSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectOpenMissingComponentsSpec.scala index 9a60feaaebbb..a59b50452506 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectOpenMissingComponentsSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectOpenMissingComponentsSpec.scala @@ -1,8 +1,8 @@ package org.enso.projectmanager.protocol -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.semver.SemVer import org.enso.runtimeversionmanager.test.OverrideTestVersionSuite +import org.enso.testkit.ReportLogsOnFailure class ProjectOpenMissingComponentsSpec extends ProjectOpenSpecBase diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectShutdownSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectShutdownSpec.scala index 6e18c39f2fe6..fa7c8e35d6f6 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectShutdownSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/protocol/ProjectShutdownSpec.scala @@ -4,7 +4,6 @@ import akka.actor.ActorRef import io.circe.literal._ import org.enso.semver.SemVer import org.enso.jsonrpc.ClientControllerFactory -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.boot.configuration.TimeoutConfig import org.enso.projectmanager.event.ClientEvent.ClientDisconnected import zio.{ZAny, ZIO} @@ -12,7 +11,7 @@ import zio.{ZAny, ZIO} import java.util.UUID import org.enso.projectmanager.{BaseServerSpec, ProjectManagementOps} import org.enso.runtimeversionmanager.test.OverrideTestVersionSuite -import org.enso.testkit.FlakySpec +import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.scalactic.source.Position import scala.concurrent.duration._ diff --git a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/service/validation/ProjectNameValidatorSpec.scala b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/service/validation/ProjectNameValidatorSpec.scala index c9893e241504..122d8c785183 100644 --- a/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/service/validation/ProjectNameValidatorSpec.scala +++ b/lib/scala/project-manager/src/test/scala/org/enso/projectmanager/service/validation/ProjectNameValidatorSpec.scala @@ -1,7 +1,7 @@ package org.enso.projectmanager.service.validation -import org.enso.logging.service.logback.test.provider.ReportLogsOnFailure import org.enso.projectmanager.control.effect.Effects +import org.enso.testkit.ReportLogsOnFailure import org.scalatest.EitherValues import org.scalatest.matchers.must.Matchers import org.scalatest.wordspec.AnyWordSpec diff --git a/lib/scala/logging-service-logback/src/test/scala/org/enso/logging/service/logback/test/provider/ReportLogsOnFailure.scala b/lib/scala/testkit/src/main/scala/org/enso/testkit/ReportLogsOnFailure.scala similarity index 78% rename from lib/scala/logging-service-logback/src/test/scala/org/enso/logging/service/logback/test/provider/ReportLogsOnFailure.scala rename to lib/scala/testkit/src/main/scala/org/enso/testkit/ReportLogsOnFailure.scala index 603dda6bae20..015ee66899a3 100644 --- a/lib/scala/logging-service-logback/src/test/scala/org/enso/logging/service/logback/test/provider/ReportLogsOnFailure.scala +++ b/lib/scala/testkit/src/main/scala/org/enso/testkit/ReportLogsOnFailure.scala @@ -1,10 +1,6 @@ -package org.enso.logging.service.logback.test.provider +package org.enso.testkit -import ch.qos.logback.classic.spi.ILoggingEvent -import ch.qos.logback.core.Appender -import org.enso.logging.service.logback.MemoryAppender -import org.scalatest.{Args, Failed, Outcome, Status, TestSuite} -import org.slf4j.{Logger, LoggerFactory} +import org.scalatest._ trait ReportLogsOnFailure extends TestSuite { From ee61079e2fade3fae69818672f51344a8f0df20a Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 12:09:06 +0200 Subject: [PATCH 136/268] Add necessary dependencies to testkit project --- build.sbt | 6 ++++-- .../main/scala/org/enso/testkit/ReportLogsOnFailure.scala | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index a9279c7c5e61..0d530ff19d2d 100644 --- a/build.sbt +++ b/build.sbt @@ -1732,14 +1732,16 @@ lazy val testkit = project .in(file("lib/scala/testkit")) .settings( frgaalJavaCompilerSetting, - libraryDependencies ++= Seq( + libraryDependencies ++= logbackPkg ++ Seq( "org.apache.commons" % "commons-lang3" % commonsLangVersion, "commons-io" % "commons-io" % commonsIoVersion, "org.scalatest" %% "scalatest" % scalatestVersion, "junit" % "junit" % junitVersion, - "com.github.sbt" % "junit-interface" % junitIfVersion + "com.github.sbt" % "junit-interface" % junitIfVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, ) ) + .dependsOn(`logging-service-logback`) lazy val searcher = project .in(file("lib/scala/searcher")) diff --git a/lib/scala/testkit/src/main/scala/org/enso/testkit/ReportLogsOnFailure.scala b/lib/scala/testkit/src/main/scala/org/enso/testkit/ReportLogsOnFailure.scala index 015ee66899a3..c658775820e8 100644 --- a/lib/scala/testkit/src/main/scala/org/enso/testkit/ReportLogsOnFailure.scala +++ b/lib/scala/testkit/src/main/scala/org/enso/testkit/ReportLogsOnFailure.scala @@ -1,6 +1,10 @@ package org.enso.testkit -import org.scalatest._ +import ch.qos.logback.classic.spi.ILoggingEvent +import ch.qos.logback.core.Appender +import org.enso.logging.service.logback.MemoryAppender +import org.scalatest.{Args, Failed, Outcome, Status, TestSuite} +import org.slf4j.{Logger, LoggerFactory} trait ReportLogsOnFailure extends TestSuite { From 99dfd970646ae84ef3c1a5520753f8b60298c0cd Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 12:10:26 +0200 Subject: [PATCH 137/268] Revert "Add jpms-wrapper-scalatest" This reverts commit 732b3427a2c4a7051c831f3439b4fc04ba126ae1. --- build.sbt | 80 ------------------- .../src/main/java/module-info.java | 28 ------- 2 files changed, 108 deletions(-) delete mode 100644 lib/java/jpms-wrapper-scalatest/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 0d530ff19d2d..42d6c0806f65 100644 --- a/build.sbt +++ b/build.sbt @@ -1237,86 +1237,6 @@ lazy val `language-server-deps-wrapper` = project } ) -lazy val `jpms-wrapper-scalatest` = project - .in(file("lib/java/jpms-wrapper-scalatest")) - .enablePlugins(JPMSPlugin) - .settings( - modularFatJarWrapperSettings, - libraryDependencies ++= scalaCompiler ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang.modules" %% "scala-xml" % "2.1.0", - "org.scalatest" %% "scalatest" % scalatestVersion, - "org.scalatest" %% "scalatest-core" % scalatestVersion, - "org.scalatest" % "scalatest-compatible" % scalatestVersion, - "org.scalatest" %% "scalatest-diagrams" % scalatestVersion, - "org.scalatest" %% "scalatest-featurespec" % scalatestVersion, - "org.scalatest" %% "scalatest-flatspec" % scalatestVersion, - "org.scalatest" %% "scalatest-freespec" % scalatestVersion, - "org.scalatest" %% "scalatest-funspec" % scalatestVersion, - "org.scalatest" %% "scalatest-funsuite" % scalatestVersion, - "org.scalatest" %% "scalatest-matchers-core" % scalatestVersion, - "org.scalatest" %% "scalatest-propspec" % scalatestVersion, - "org.scalatest" %% "scalatest-refspec" % scalatestVersion, - "org.scalatest" %% "scalatest-wordspec" % scalatestVersion, - "org.scalactic" %% "scalactic" % scalacticVersion, - "org.jline" % "jline" % jlineVersion, - ), - javaModuleName := "org.enso.jpms.wrapper.scalatest", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - ), - assembly / assemblyExcludedJars := { - val scalaVer = scalaBinaryVersion.value - JPMSUtils.filterModulesFromClasspath( - (Compile / dependencyClasspath).value, - Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.scala-lang.modules" % ("scala-xml_" + scalaVer) % "2.1.0", - "org.scalactic" % ("scalactic_" + scalaVer) % scalacticVersion, - "org.jline" % "jline" % jlineVersion, - "io.github.java-diff-utils" % "java-diff-utils" % "4.12", - "net.java.dev.jna" % "jna" % "5.13.0" - ), - streams.value.log, - moduleName.value, - shouldContainAll = true - ) - }, - Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value - val scalaLibs = JPMSUtils.filterModulesFromUpdate( - update.value, - Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.scalactic" % ("scalactic_" + scalaVer) % scalacticVersion, - "org.scala-lang.modules" % ("scala-xml_" + scalaVer) % "2.1.0", - "org.scalatest" % ("scalatest-core_" + scalaVer) % scalatestVersion, - "org.scalatest" % "scalatest-compatible" % scalatestVersion, - "org.scalatest" % ("scalatest-diagrams_" + scalaVer) % scalatestVersion, - "org.scalatest" % ("scalatest-featurespec_" + scalaVer) % scalatestVersion, - "org.scalatest" % ("scalatest-flatspec_" + scalaVer) % scalatestVersion, - "org.scalatest" % ("scalatest-freespec_" + scalaVer) % scalatestVersion, - "org.scalatest" % ("scalatest-funspec_" + scalaVer) % scalatestVersion, - "org.scalatest" % ("scalatest-funsuite_" + scalaVer) % scalatestVersion, - "org.scalatest" % ("scalatest-matchers-core_" + scalaVer) % scalatestVersion, - "org.scalatest" % ("scalatest-propspec_" + scalaVer) % scalatestVersion, - "org.scalatest" % ("scalatest-refspec_" + scalaVer) % scalatestVersion, - "org.scalatest" % ("scalatest-wordspec_" + scalaVer) % scalatestVersion, - ), - streams.value.log, - moduleName.value, - shouldContainAll = true - ) - Map( - javaModuleName.value -> scalaLibs - ) - } - ) - /** JPMS module wrapper for Akka. */ lazy val `akka-wrapper` = project diff --git a/lib/java/jpms-wrapper-scalatest/src/main/java/module-info.java b/lib/java/jpms-wrapper-scalatest/src/main/java/module-info.java deleted file mode 100644 index c5b892bc2d03..000000000000 --- a/lib/java/jpms-wrapper-scalatest/src/main/java/module-info.java +++ /dev/null @@ -1,28 +0,0 @@ -module org.enso.jpms.wrapper.scalatest { - requires scala.library; - - exports org.scalatest; - exports org.scalatest.compatible; - exports org.scalatest.concurrent; - exports org.scalatest.diagrams; - exports org.scalatest.enablers; - exports org.scalatest.events; - exports org.scalatest.exceptions; - exports org.scalatest.expectations; - exports org.scalatest.featurespec; - exports org.scalatest.fixture; - exports org.scalatest.flatspec; - exports org.scalatest.freespec; - exports org.scalatest.funspec; - exports org.scalatest.funsuite; - exports org.scalatest.matchers; - exports org.scalatest.prop; - exports org.scalatest.propspec; - exports org.scalatest.refspec; - exports org.scalatest.tagobjects; - exports org.scalatest.tags; - exports org.scalatest.time; - exports org.scalatest.tools; - exports org.scalatest.verbs; - exports org.scalatest.wordspec; -} From 9d8b5643ddfbbd40ae362162516b44fb2fad7327 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 13:47:53 +0200 Subject: [PATCH 138/268] modularize filewatcher and wrap its dependencies --- build.sbt | 54 +++++++++++++++++++ .../src/main/java/module-info.java | 6 +++ .../src/main/java/module-info.java | 6 +++ .../org/enso/filewatcher/package-info.java | 1 - 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java create mode 100644 lib/scala/filewatcher/src/main/java/module-info.java delete mode 100644 lib/scala/filewatcher/src/main/java/org/enso/filewatcher/package-info.java diff --git a/build.sbt b/build.sbt index 42d6c0806f65..84add4d4a97f 100644 --- a/build.sbt +++ b/build.sbt @@ -1083,6 +1083,7 @@ lazy val `logging-utils-akka` = project lazy val filewatcher = project .in(file("lib/scala/filewatcher")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, @@ -1092,11 +1093,19 @@ lazy val filewatcher = project "commons-io" % "commons-io" % commonsIoVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), + compileOrder := CompileOrder.ScalaThenJava, + Compile / moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + ), + Compile / internalModuleDependencies := Seq( + (`jpms-wrapper-methvin-directory-watcher` / Compile / exportedModule).value + ), Test / fork := true, Test / javaOptions ++= testLogProviderOptions ) .dependsOn(testkit % Test) .dependsOn(`logging-service-logback` % "test->test") + .dependsOn(`jpms-wrapper-methvin-directory-watcher`) lazy val `logging-truffle-connector` = project .in(file("lib/scala/logging-truffle-connector")) @@ -1237,6 +1246,51 @@ lazy val `language-server-deps-wrapper` = project } ) +lazy val `jpms-wrapper-methvin-directory-watcher` = project + .in(file("lib/java/jpms-wrapper-methvin-directory-watcher")) + .enablePlugins(JPMSPlugin) + .settings( + modularFatJarWrapperSettings, + libraryDependencies ++= Seq( + "io.methvin" % "directory-watcher" % directoryWatcherVersion, + "org.slf4j" % "slf4j-api" % "1.7.36", + ), + javaModuleName := "org.enso.jpms.wrapper.methvin.directory.watcher", + assembly / assemblyExcludedJars := { + val scalaVer = scalaBinaryVersion.value + JPMSUtils.filterModulesFromClasspath( + (Compile / dependencyClasspath).value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % "1.7.36", + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + }, + Compile / moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + Compile / patchModules := { + val scalaVer = scalaBinaryVersion.value + val scalaLibs = JPMSUtils.filterModulesFromUpdate( + update.value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "io.methvin" % "directory-watcher" % directoryWatcherVersion, + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + Map( + javaModuleName.value -> scalaLibs + ) + } + + ) + /** JPMS module wrapper for Akka. */ lazy val `akka-wrapper` = project diff --git a/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java b/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java new file mode 100644 index 000000000000..2610be1debe7 --- /dev/null +++ b/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module org.enso.jpms.wrapper.methvin.directory.watcher { + requires scala.library; + + exports io.methvin.watcher; + exports io.methvin.watchservice; +} diff --git a/lib/scala/filewatcher/src/main/java/module-info.java b/lib/scala/filewatcher/src/main/java/module-info.java new file mode 100644 index 000000000000..af338b638130 --- /dev/null +++ b/lib/scala/filewatcher/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module org.enso.filewatcher { + requires scala.library; + requires org.enso.jpms.wrapper.methvin.directory.watcher; + + exports org.enso.filewatcher; +} diff --git a/lib/scala/filewatcher/src/main/java/org/enso/filewatcher/package-info.java b/lib/scala/filewatcher/src/main/java/org/enso/filewatcher/package-info.java deleted file mode 100644 index 481c5f6de447..000000000000 --- a/lib/scala/filewatcher/src/main/java/org/enso/filewatcher/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.filewatcher; From 8da4a4209f18bf294dbf1dcd7e55e371bc3841a2 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 14:10:36 +0200 Subject: [PATCH 139/268] Initial fix for language-server/test --- build.sbt | 126 ++++++++++++++++-- .../src/main/java/module-info.java | 1 + 2 files changed, 118 insertions(+), 9 deletions(-) diff --git a/build.sbt b/build.sbt index 84add4d4a97f..2a78fe14959c 100644 --- a/build.sbt +++ b/build.sbt @@ -1087,6 +1087,7 @@ lazy val filewatcher = project .configs(Test) .settings( frgaalJavaCompilerSetting, + javaModuleName := "org.enso.filewatcher", version := "0.1", libraryDependencies ++= Seq( "io.methvin" % "directory-watcher" % directoryWatcherVersion, @@ -2057,6 +2058,7 @@ lazy val `polyglot-api-macros` = project lazy val `language-server` = (project in file("engine/language-server")) .enablePlugins(JPMSPlugin) + .enablePlugins(PackageListPlugin) .settings( commands += WithDebugCommand.withDebug, frgaalJavaCompilerSetting, @@ -2080,9 +2082,10 @@ lazy val `language-server` = (project in file("engine/language-server")) "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 + "org.apache.tika" % "tika-core" % tikaVersion % Test, ), excludeFilter := excludeFilter.value || "module-info.java", + javaModuleName := "org.enso.language.server", Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( @@ -2112,6 +2115,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`profiling-utils` / Compile / exportedModule).value, (`searcher` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, + (`filewatcher` / Compile / exportedModule).value, (`version-output` / Compile / exportedModule).value ), Test / testOptions += Tests @@ -2139,26 +2143,130 @@ lazy val `language-server` = (project in file("engine/language-server")) GraalVM.langsPkgs.map(_.withConfigurations(Some(Test.name))) necessaryModules }, - Test / addModules := Seq( - (`syntax-rust-definition` / javaModuleName).value, - (`profiling-utils` / javaModuleName).value, - (`ydoc-server` / javaModuleName).value + // More dependencies needed for modules for testing + libraryDependencies ++= Seq( + "com.google.protobuf" % "protobuf-java" % "3.25.1" % Test, + "org.reactivestreams" % "reactive-streams" % "1.0.3" % Test, + "org.jline" % "jline" % jlineVersion % Test, + "io.sentry" % "sentry-logback" % "6.28.0" % Test, + "io.sentry" % "sentry" % "6.28.0" % Test, + "ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test, + "ch.qos.logback" % "logback-core" % logbackClassicVersion % Test, + "org.apache.tika" % "tika-core" % tikaVersion % Test, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion % Test, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion % Test, + "org.apache.commons" % "commons-lang3" % commonsLangVersion % Test, + "org.apache.commons" % "commons-compress" % commonsCompressVersion % Test, + "org.yaml" % "snakeyaml" % snakeyamlVersion % Test, + "com.ibm.icu" % "icu4j" % icuVersion % Test, ), Test / moduleDependencies := { GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, - (`syntax-rust-definition` / projectID).value, - (`ydoc-server` / projectID).value, - (`profiling-utils` / projectID).value + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "com.google.protobuf" % "protobuf-java" % "3.25.1", + "org.reactivestreams" % "reactive-streams" % "1.0.3", + "org.jline" % "jline" % jlineVersion, + "org.apache.tika" % "tika-core" % tikaVersion, + "com.ibm.icu" % "icu4j" % icuVersion, + "io.sentry" % "sentry-logback" % "6.28.0", + "io.sentry" % "sentry" % "6.28.0", + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion ) }, + Test / internalModuleDependencies := Seq( + (Compile / exportedModule).value, + (`runtime` / Compile / exportedModule).value, + (`runtime-instrument-common` / Compile / exportedModule).value, + (`runtime-instrument-runtime-server` / Compile / exportedModule).value, + (`runtime-instrument-repl-debugger` / Compile / exportedModule).value, + (`runtime-instrument-id-execution` / Compile / exportedModule).value, + (`runtime-language-epb` / Compile / exportedModule).value, + (`ydoc-server` / Compile / exportedModule).value, + (`syntax-rust-definition` / Compile / exportedModule).value, + (`profiling-utils` / Compile / exportedModule).value, + (`logging-service-logback` / Compile / exportedModule).value, + (`logging-service-logback` / Test / exportedModule).value, + (`version-output` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`akka-wrapper` / Compile / exportedModule).value, + (`language-server-deps-wrapper` / Compile / exportedModule).value, + (`jpms-wrapper-methvin-directory-watcher` / Compile / exportedModule).value, + (`text-buffer` / Compile / exportedModule).value, + (`runtime-suggestions` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value, + (`runtime-compiler` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`polyglot-api-macros` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value, + (`connected-lock-manager` / Compile / exportedModule).value, + (`library-manager` / Compile / exportedModule).value, + (`persistance` / Compile / exportedModule).value, + (`interpreter-dsl` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, + (`edition-updater` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, + (`distribution-manager` / Compile / exportedModule).value, + (`common-polyglot-core-utils` / Compile / exportedModule).value, + (`cli` / Compile / exportedModule).value, + (`refactoring-utils` / Compile / exportedModule).value, + (`scala-yaml` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value, + (`downloader` / Compile / exportedModule).value, + (`logging-config` / Compile / exportedModule).value, + (`logging-service` / Compile / exportedModule).value, + ), Test / javaOptions ++= testLogProviderOptions, + Test / patchModules := { + // 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 + // Patching with sources is useful for compilation, patching with compiled classes for runtime. + val javaSrcDir = (Test / javaSource).value + Map( + javaModuleName.value -> Seq(javaSrcDir, testClassesDir) + ) + }, + Test / addModules := Seq( + javaModuleName.value, + (`syntax-rust-definition` / javaModuleName).value, + (`profiling-utils` / javaModuleName).value, + (`ydoc-server` / javaModuleName).value, + ), + Test / addReads := { + // We patched the test-classes into the runtime module. These classes access some stuff from + // unnamed module. Thus, let's add ALL-UNNAMED. + Map( + javaModuleName.value -> Seq( + "ALL-UNNAMED", + ) + ) + }, Test / addExports := { val profModName = (`profiling-utils` / javaModuleName).value - Map( + val exports = Map( profModName + "/org.enso.profiling.snapshot" -> Seq("ALL-UNNAMED") ) + + // Make sure that all the packages in test source directory are exported + // to all unnamed modules + val testPkgs = (Test / packages).value + val testPkgsExports = testPkgs.map { pkg => + javaModuleName.value + "/" + pkg -> Seq("ALL-UNNAMED") + } + .toMap + exports ++ testPkgsExports } ) .settings( diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index 046612d12091..a3f7926d7ffc 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -14,6 +14,7 @@ requires org.enso.zio.wrapper; requires org.enso.runner.common; requires org.enso.engine.common; + requires org.enso.filewatcher; requires org.enso.json.rpc.server; requires org.enso.logging.utils; requires org.enso.logging.utils.akka; From 7934e39f1b4eef929c1512b700d6acd1bb894a48 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 14:16:06 +0200 Subject: [PATCH 140/268] frgaal compiler setting are scoped for Compile and Test --- build.sbt | 57 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/build.sbt b/build.sbt index 2a78fe14959c..48928feafab6 100644 --- a/build.sbt +++ b/build.sbt @@ -2369,33 +2369,40 @@ lazy val javadocSettings = Seq( lazy val frgaalJavaCompilerSetting = customFrgaalJavaCompilerSettings(targetJavaVersion) -def customFrgaalJavaCompilerSettings(targetJdk: String) = Seq( - Compile / compile / compilers := { - // True if there is module-info.java in the sources, and this is a mixed - // project, and module-info.java is excluded from the compilation. - // shouldCompileModuleInfoManually is a settingKey defined only in projects - // with JPMSPlugin. That's why we have to check first for its existance. - val settingOpt = (Compile / shouldCompileModuleInfoManually).?.value - val shouldCompileModInfo = settingOpt.isDefined && settingOpt.get - FrgaalJavaCompiler.compilers( - (Compile / dependencyClasspath).value, - compilers.value, - targetJdk, - shouldCompileModInfo, - (Compile / javaSource).value +def customFrgaalJavaCompilerSettings(targetJdk: String) = { + // There might be slightly different Frgaal compiler configuration for + // both Compile and Test configurations + Seq(Compile, Test).flatMap { config => + Seq( + config / compile / compilers := { + // True if there is module-info.java in the sources, and this is a mixed + // project, and module-info.java is excluded from the compilation. + // shouldCompileModuleInfoManually is a settingKey defined only in projects + // with JPMSPlugin. That's why we have to check first for its existance. + val settingOpt = (config / shouldCompileModuleInfoManually).?.value + val shouldCompileModInfo = settingOpt.isDefined && settingOpt.get + FrgaalJavaCompiler.compilers( + (config / dependencyClasspath).value, + compilers.value, + targetJdk, + shouldCompileModInfo, + (config / javaSource).value + ) + } + ) + } ++ Seq( + // 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. + libraryDependencies += FrgaalJavaCompiler.frgaal, + // Ensure that our tooling uses the right Java version for checking the code. + Compile / javacOptions ++= Seq( + "-source", + frgaalSourceLevel, + "--enable-preview" ) - }, - // 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. - libraryDependencies += FrgaalJavaCompiler.frgaal, - // Ensure that our tooling uses the right Java version for checking the code. - Compile / javacOptions ++= Seq( - "-source", - frgaalSourceLevel, - "--enable-preview" ) -) +} lazy val instrumentationSettings = frgaalJavaCompilerSetting ++ annotationProcSetting ++ Seq( From 09cd2f4ee3b293b35b6c09954bf9bc9eccb2c5bf Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 14:20:33 +0200 Subject: [PATCH 141/268] Rename package in language-server/test --- .../scala/org/enso/filewatcher/{ => test}/NoopWatcher.scala | 4 +++- .../org/enso/filewatcher/{ => test}/NoopWatcherFactory.scala | 5 ++++- .../enso/languageserver/websocket/json/BaseServerTest.scala | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) rename engine/language-server/src/test/scala/org/enso/filewatcher/{ => test}/NoopWatcher.scala (77%) rename engine/language-server/src/test/scala/org/enso/filewatcher/{ => test}/NoopWatcherFactory.scala (73%) diff --git a/engine/language-server/src/test/scala/org/enso/filewatcher/NoopWatcher.scala b/engine/language-server/src/test/scala/org/enso/filewatcher/test/NoopWatcher.scala similarity index 77% rename from engine/language-server/src/test/scala/org/enso/filewatcher/NoopWatcher.scala rename to engine/language-server/src/test/scala/org/enso/filewatcher/test/NoopWatcher.scala index 87484682cae1..9c9d582e0273 100644 --- a/engine/language-server/src/test/scala/org/enso/filewatcher/NoopWatcher.scala +++ b/engine/language-server/src/test/scala/org/enso/filewatcher/test/NoopWatcher.scala @@ -1,4 +1,6 @@ -package org.enso.filewatcher +package org.enso.filewatcher.test + +import org.enso.filewatcher.Watcher import java.util.concurrent.Executor diff --git a/engine/language-server/src/test/scala/org/enso/filewatcher/NoopWatcherFactory.scala b/engine/language-server/src/test/scala/org/enso/filewatcher/test/NoopWatcherFactory.scala similarity index 73% rename from engine/language-server/src/test/scala/org/enso/filewatcher/NoopWatcherFactory.scala rename to engine/language-server/src/test/scala/org/enso/filewatcher/test/NoopWatcherFactory.scala index 3f169d0063bb..7794942dd58c 100644 --- a/engine/language-server/src/test/scala/org/enso/filewatcher/NoopWatcherFactory.scala +++ b/engine/language-server/src/test/scala/org/enso/filewatcher/test/NoopWatcherFactory.scala @@ -1,4 +1,7 @@ -package org.enso.filewatcher +package org.enso.filewatcher.test + +import org.enso.filewatcher.{Watcher, WatcherFactory} + import java.nio.file.Path class NoopWatcherFactory extends WatcherFactory { diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/BaseServerTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/BaseServerTest.scala index bb874d78fcba..19cec97064bf 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/BaseServerTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/BaseServerTest.scala @@ -10,7 +10,8 @@ import org.enso.distribution.locking.ResourceManager import org.enso.distribution.{DistributionManager, LanguageHome} import org.enso.editions.updater.EditionManager import org.enso.editions.{EditionResolver, Editions} -import org.enso.filewatcher.{NoopWatcherFactory, WatcherAdapterFactory} +import org.enso.filewatcher.WatcherAdapterFactory +import org.enso.filewatcher.test.NoopWatcherFactory import org.enso.jsonrpc.test.JsonRpcServerTestKit import org.enso.jsonrpc.{ClientControllerFactory, ProtocolFactory} import org.enso.languageserver.TestClock From 6de5bb69fabf20fadfd5df429e081be907eda5ff Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 14:31:23 +0200 Subject: [PATCH 142/268] Exclude com.sun.jna from wrapper jars --- build.sbt | 16 +++++++++++----- .../src/main/java/module-info.java | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 48928feafab6..411f95d0ce09 100644 --- a/build.sbt +++ b/build.sbt @@ -1144,14 +1144,16 @@ lazy val `scala-libs-wrapper` = project "org.typelevel" %% "cats-core" % "2.10.0", "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion, - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, + "net.java.dev.jna" % "jna" % "5.13.0" ), Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion + "org.slf4j" % "slf4j-api" % slf4jVersion, + "net.java.dev.jna" % "jna" % "5.13.0" ), assembly / assemblyExcludedJars := { JPMSUtils.filterModulesFromClasspath( @@ -1162,7 +1164,8 @@ lazy val `scala-libs-wrapper` = project "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "io.github.java-diff-utils" % "java-diff-utils" % "4.12", - "org.jline" % "jline" % jlineVersion + "org.jline" % "jline" % jlineVersion, + "net.java.dev.jna" % "jna" % "5.13.0" ), streams.value.log, moduleName.value, @@ -1255,6 +1258,7 @@ lazy val `jpms-wrapper-methvin-directory-watcher` = project libraryDependencies ++= Seq( "io.methvin" % "directory-watcher" % directoryWatcherVersion, "org.slf4j" % "slf4j-api" % "1.7.36", + "net.java.dev.jna" % "jna" % "5.13.0" ), javaModuleName := "org.enso.jpms.wrapper.methvin.directory.watcher", assembly / assemblyExcludedJars := { @@ -1264,6 +1268,7 @@ lazy val `jpms-wrapper-methvin-directory-watcher` = project Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % "1.7.36", + "net.java.dev.jna" % "jna" % "5.13.0" ), streams.value.log, moduleName.value, @@ -1271,7 +1276,8 @@ lazy val `jpms-wrapper-methvin-directory-watcher` = project ) }, Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "net.java.dev.jna" % "jna" % "5.13.0" ), Compile / patchModules := { val scalaVer = scalaBinaryVersion.value @@ -2104,6 +2110,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`zio-wrapper` / Compile / exportedModule).value, (`scala-libs-wrapper` / Compile / exportedModule).value, (`language-server-deps-wrapper` / Compile / exportedModule).value, + (`jpms-wrapper-methvin-directory-watcher` / Compile / exportedModule).value, (`engine-runner-common` / Compile / exportedModule).value, (`ydoc-server` / Compile / exportedModule).value, (`logging-utils` / Compile / exportedModule).value, @@ -2201,7 +2208,6 @@ lazy val `language-server` = (project in file("engine/language-server")) (`scala-libs-wrapper` / Compile / exportedModule).value, (`akka-wrapper` / Compile / exportedModule).value, (`language-server-deps-wrapper` / Compile / exportedModule).value, - (`jpms-wrapper-methvin-directory-watcher` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, (`runtime-suggestions` / Compile / exportedModule).value, (`runtime-parser` / Compile / exportedModule).value, diff --git a/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java b/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java index 2610be1debe7..b6d4ff925d67 100644 --- a/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java +++ b/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java @@ -1,5 +1,6 @@ module org.enso.jpms.wrapper.methvin.directory.watcher { requires scala.library; + requires com.sun.jna; exports io.methvin.watcher; exports io.methvin.watchservice; From 4fe7e7eced3efa4c1ddf26f33e72caae8a307fd4 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 14:59:25 +0200 Subject: [PATCH 143/268] Rename package in library-manager-test --- .../enso/languageserver/websocket/json/LibrariesTest.scala | 3 ++- .../enso/editions/updater/UpdatingEditionProviderTest.scala | 2 +- .../{ => test}/published/repository/DownloaderTest.scala | 2 +- .../{ => test}/published/repository/DummyRepository.scala | 4 ++-- .../{ => test}/published/repository/EmptyRepository.scala | 3 ++- .../{ => test}/published/repository/ExampleRepository.scala | 4 ++-- .../published/repository/LibraryDownloadTest.scala | 1 + .../scala/org/enso/libraryupload/LibraryUploadTest.scala | 5 +---- 8 files changed, 12 insertions(+), 12 deletions(-) rename lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/{ => test}/published/repository/DownloaderTest.scala (96%) rename lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/{ => test}/published/repository/DummyRepository.scala (99%) rename lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/{ => test}/published/repository/EmptyRepository.scala (83%) rename lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/{ => test}/published/repository/ExampleRepository.scala (93%) diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala index 1eb71a00587f..4776bece9ff9 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala @@ -10,7 +10,8 @@ import org.enso.languageserver.libraries.LibraryEntry.PublishedLibraryVersion import org.enso.languageserver.libraries.{LibraryComponentGroup, LibraryComponentGroups, LibraryEntry} import org.enso.languageserver.runtime.TestComponentGroups import org.enso.librarymanager.published.bundles.LocalReadOnlyRepository -import org.enso.librarymanager.published.repository.{EmptyRepository, ExampleRepository, LibraryManifest} +import org.enso.librarymanager.published.repository.LibraryManifest +import org.enso.librarymanager.test.published.repository.{EmptyRepository, ExampleRepository} import org.enso.pkg.{Config, Contact, Package, PackageManager} import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.enso.version.BuildVersion diff --git a/lib/scala/edition-updater/src/test/scala/org/enso/editions/updater/UpdatingEditionProviderTest.scala b/lib/scala/edition-updater/src/test/scala/org/enso/editions/updater/UpdatingEditionProviderTest.scala index 57d30fcb7fb8..5dc67a0ecb5e 100644 --- a/lib/scala/edition-updater/src/test/scala/org/enso/editions/updater/UpdatingEditionProviderTest.scala +++ b/lib/scala/edition-updater/src/test/scala/org/enso/editions/updater/UpdatingEditionProviderTest.scala @@ -1,7 +1,7 @@ package org.enso.editions.updater +import org.enso.librarymanager.test.published.repository.ExampleRepository import org.enso.semver.SemVer -import org.enso.librarymanager.published.repository.ExampleRepository import org.enso.testkit.WithTemporaryDirectory import org.scalatest.Inside import org.scalatest.matchers.should.Matchers diff --git a/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/DownloaderTest.scala b/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/DownloaderTest.scala similarity index 96% rename from lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/DownloaderTest.scala rename to lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/DownloaderTest.scala index 18994b618648..304d356802a0 100644 --- a/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/DownloaderTest.scala +++ b/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/DownloaderTest.scala @@ -1,4 +1,4 @@ -package org.enso.librarymanager.published.repository +package org.enso.librarymanager.test.published.repository import org.enso.cli.task.{ProgressReporter, TaskProgress} import org.enso.distribution.TemporaryDirectoryManager diff --git a/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/DummyRepository.scala b/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/DummyRepository.scala similarity index 99% rename from lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/DummyRepository.scala rename to lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/DummyRepository.scala index 7c99813c91c3..6ce729c40b1e 100644 --- a/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/DummyRepository.scala +++ b/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/DummyRepository.scala @@ -1,6 +1,5 @@ -package org.enso.librarymanager.published.repository +package org.enso.librarymanager.test.published.repository -import org.enso.semver.SemVer import org.enso.cli.OS import org.enso.distribution.FileSystem import org.enso.downloader.archive.TarGzWriter @@ -8,6 +7,7 @@ import org.enso.editions.Editions.RawEdition import org.enso.editions.{Editions, LibraryName} import org.enso.pkg.{Package, PackageManager} import org.enso.process.WrappedProcess +import org.enso.semver.SemVer import org.enso.version.BuildVersion import org.enso.yaml.YamlHelper diff --git a/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/EmptyRepository.scala b/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/EmptyRepository.scala similarity index 83% rename from lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/EmptyRepository.scala rename to lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/EmptyRepository.scala index c3b721c7eca2..50094d795f10 100644 --- a/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/EmptyRepository.scala +++ b/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/EmptyRepository.scala @@ -1,4 +1,5 @@ -package org.enso.librarymanager.published.repository +package org.enso.librarymanager.test.published.repository + import org.enso.editions.Editions.RawEdition import java.nio.file.Path diff --git a/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/ExampleRepository.scala b/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/ExampleRepository.scala similarity index 93% rename from lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/ExampleRepository.scala rename to lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/ExampleRepository.scala index a50cad039ec4..d60b4900c23c 100644 --- a/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/published/repository/ExampleRepository.scala +++ b/lib/scala/library-manager-test/src/main/scala/org/enso/librarymanager/test/published/repository/ExampleRepository.scala @@ -1,8 +1,8 @@ -package org.enso.librarymanager.published.repository +package org.enso.librarymanager.test.published.repository -import org.enso.semver.SemVer import org.enso.editions.Editions.RawEdition import org.enso.editions.{Editions, LibraryName} +import org.enso.semver.SemVer import java.nio.file.Path diff --git a/lib/scala/library-manager-test/src/test/scala/org/enso/librarymanager/published/repository/LibraryDownloadTest.scala b/lib/scala/library-manager-test/src/test/scala/org/enso/librarymanager/published/repository/LibraryDownloadTest.scala index f1c8d66d002f..e9bf0d9b5e66 100644 --- a/lib/scala/library-manager-test/src/test/scala/org/enso/librarymanager/published/repository/LibraryDownloadTest.scala +++ b/lib/scala/library-manager-test/src/test/scala/org/enso/librarymanager/published/repository/LibraryDownloadTest.scala @@ -2,6 +2,7 @@ package org.enso.librarymanager.published.repository import org.enso.editions.Editions import org.enso.librarymanager.published.cache.DownloadingLibraryCache +import org.enso.librarymanager.test.published.repository.{DownloaderTest, ExampleRepository} import org.enso.logger.TestLogMessage import org.enso.pkg.PackageManager import org.enso.testkit.{RetrySpec, WithTemporaryDirectory} diff --git a/lib/scala/library-manager-test/src/test/scala/org/enso/libraryupload/LibraryUploadTest.scala b/lib/scala/library-manager-test/src/test/scala/org/enso/libraryupload/LibraryUploadTest.scala index 1597e413eb94..b6f79c12d3ad 100644 --- a/lib/scala/library-manager-test/src/test/scala/org/enso/libraryupload/LibraryUploadTest.scala +++ b/lib/scala/library-manager-test/src/test/scala/org/enso/libraryupload/LibraryUploadTest.scala @@ -3,10 +3,7 @@ package org.enso.libraryupload import org.enso.semver.SemVer import org.enso.cli.task.{ProgressReporter, TaskProgress} import org.enso.editions.{Editions, LibraryName} -import org.enso.librarymanager.published.repository.{ - DownloaderTest, - EmptyRepository -} +import org.enso.librarymanager.test.published.repository.{DownloaderTest, EmptyRepository} import org.enso.libraryupload.auth.SimpleHeaderToken import org.enso.pkg.{Package, PackageManager} import org.enso.testkit.WithTemporaryDirectory From f235b1aceb9859e000b0a6bb2105dfc236393387 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 16:25:43 +0200 Subject: [PATCH 144/268] testkit is an automatic module --- build.sbt | 33 ++++++++++++++++++- .../src/main/java/module-info.java | 17 ++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 lib/scala/library-manager-test/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 411f95d0ce09..b1f5ec1369b3 100644 --- a/build.sbt +++ b/build.sbt @@ -1709,10 +1709,13 @@ lazy val `json-rpc-server-test` = project ) .dependsOn(`json-rpc-server`) +// An automatic JPMS module lazy val testkit = project .in(file("lib/scala/testkit")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + javaModuleName := "org.enso.testkit", libraryDependencies ++= logbackPkg ++ Seq( "org.apache.commons" % "commons-lang3" % commonsLangVersion, "commons-io" % "commons-io" % commonsIoVersion, @@ -1720,7 +1723,17 @@ lazy val testkit = project "junit" % "junit" % junitVersion, "com.github.sbt" % "junit-interface" % junitIfVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, - ) + ), + compileOrder := CompileOrder.ScalaThenJava, + packageOptions := Seq( + Package.ManifestAttributes( + ( + "Automatic-Module-Name", javaModuleName.value + ) + ) + ), + Compile / exportedModule := (Compile / exportedModuleBin).value, + Compile / exportedModuleBin := (Compile / packageBin).value, ) .dependsOn(`logging-service-logback`) @@ -3828,16 +3841,34 @@ lazy val `library-manager` = project lazy val `library-manager-test` = project .in(file("lib/scala/library-manager-test")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, Test / fork := true, commands += WithDebugCommand.withDebug, + compileOrder := CompileOrder.ScalaThenJava, Test / javaOptions ++= testLogProviderOptions, Test / test := (Test / test).tag(simpleLibraryServerTag).value, libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test + ), + Compile / moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + Compile / internalModuleDependencies := Seq( + (`library-manager` / Compile / exportedModule).value, + (`cli` / Compile / exportedModule).value, + (`distribution-manager` / Compile / exportedModule).value, + (`library-manager` / Compile / exportedModule).value, + (`process-utils` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value, + (`downloader` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, + (`version-output` / Compile / exportedModule).value, + (`testkit` / Compile / exportedModule).value, ) ) .dependsOn(`library-manager`) diff --git a/lib/scala/library-manager-test/src/main/java/module-info.java b/lib/scala/library-manager-test/src/main/java/module-info.java new file mode 100644 index 000000000000..5d2456a75442 --- /dev/null +++ b/lib/scala/library-manager-test/src/main/java/module-info.java @@ -0,0 +1,17 @@ +module org.enso.librarymanager.test { + requires scala.library; + + requires org.enso.cli; + requires org.enso.distribution; + requires org.enso.downloader; + requires org.enso.librarymanager; + requires org.enso.pkg; + requires org.enso.semver; + requires org.enso.editions; + requires org.enso.process.utils; + requires org.enso.version.output; + // Automatic module + requires org.enso.testkit; + + exports org.enso.librarymanager.test.published.repository; +} From 96d6fb8f38e648f9f0799cc0846b19396dc7a410 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 16:26:02 +0200 Subject: [PATCH 145/268] process-utils is module --- build.sbt | 7 ++++++- lib/scala/process-utils/src/main/java/module-info.java | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 lib/scala/process-utils/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index b1f5ec1369b3..5163bb4d086f 100644 --- a/build.sbt +++ b/build.sbt @@ -3945,8 +3945,13 @@ lazy val `runtime-version-manager` = project */ lazy val `process-utils` = project .in(file("lib/scala/process-utils")) + .enablePlugins(JPMSPlugin) .settings( - frgaalJavaCompilerSetting + frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, + Compile / moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), ) lazy val `runtime-version-manager-test` = project diff --git a/lib/scala/process-utils/src/main/java/module-info.java b/lib/scala/process-utils/src/main/java/module-info.java new file mode 100644 index 000000000000..abb22d40b2ed --- /dev/null +++ b/lib/scala/process-utils/src/main/java/module-info.java @@ -0,0 +1,5 @@ +module org.enso.process.utils { + requires scala.library; + + exports org.enso.process; +} From ab062a0723eab354832eafbbc6847d28ae00d4fd Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 16:42:37 +0200 Subject: [PATCH 146/268] akka-wrapper contains akka-http --- build.sbt | 2 ++ .../src/main/java/module-info.java | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/build.sbt b/build.sbt index 5163bb4d086f..5545f27826f6 100644 --- a/build.sbt +++ b/build.sbt @@ -1311,6 +1311,7 @@ lazy val `akka-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2", "org.scala-lang.modules" %% "scala-java8-compat" % "1.0.0", + akkaURL %% "akka-http" % akkaHTTPVersion, akkaURL %% "akka-http-core" % akkaHTTPVersion, akkaURL %% "akka-slf4j" % akkaVersion, akkaURL %% "akka-parsing" % "10.2.10", @@ -1370,6 +1371,7 @@ lazy val `akka-wrapper` = project akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, akkaURL % ("akka-actor-typed_" + scalaVer) % akkaVersion, akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, + akkaURL % ("akka-http_" + scalaVer) % akkaHTTPVersion, akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, akkaURL % ("akka-http-spray-json_" + scalaVer) % "10.2.10", akkaURL % ("akka-slf4j_" + scalaVer) % akkaVersion, diff --git a/lib/java/akka-wrapper/src/main/java/module-info.java b/lib/java/akka-wrapper/src/main/java/module-info.java index 3277057e1136..ede10869a481 100644 --- a/lib/java/akka-wrapper/src/main/java/module-info.java +++ b/lib/java/akka-wrapper/src/main/java/module-info.java @@ -84,6 +84,26 @@ exports akka.http.scaladsl.util; exports akka.http.shaded.com.twitter.hpack; + // akka-http + exports akka.http.javadsl.coding; + exports akka.http.javadsl.common; + exports akka.http.javadsl.marshalling; + exports akka.http.javadsl.marshalling.sse; + exports akka.http.javadsl.server; + exports akka.http.javadsl.server.directives; + exports akka.http.javadsl.unmarshalling; + exports akka.http.javadsl.unmarshalling.sse; + exports akka.http.scaladsl.client; + exports akka.http.scaladsl.coding; + exports akka.http.scaladsl.common; + exports akka.http.scaladsl.marshalling; + exports akka.http.scaladsl.marshalling.sse; + exports akka.http.scaladsl.server; + exports akka.http.scaladsl.server.directives; + exports akka.http.scaladsl.server.util; + exports akka.http.scaladsl.unmarshalling; + exports akka.http.scaladsl.unmarshalling.sse; + // akka-http-spray-json_2.13:10.2.10 exports akka.http.scaladsl.marshallers.sprayjson; From ec6bb6a723eadb610a35994571f5af0ede70fce0 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 16:44:48 +0200 Subject: [PATCH 147/268] Some fixes for library-manager-test --- build.sbt | 5 ++++- .../librarymanager/published/repository/package-info.java | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 lib/scala/library-manager-test/src/main/java/org/enso/librarymanager/published/repository/package-info.java diff --git a/build.sbt b/build.sbt index 5545f27826f6..4974b583ccd6 100644 --- a/build.sbt +++ b/build.sbt @@ -2203,7 +2203,8 @@ lazy val `language-server` = (project in file("engine/language-server")) "io.sentry" % "sentry-logback" % "6.28.0", "io.sentry" % "sentry" % "6.28.0", "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion + "ch.qos.logback" % "logback-core" % logbackClassicVersion, + "net.java.dev.jna" % "jna" % "5.13.0" ) }, Test / internalModuleDependencies := Seq( @@ -2264,6 +2265,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`syntax-rust-definition` / javaModuleName).value, (`profiling-utils` / javaModuleName).value, (`ydoc-server` / javaModuleName).value, + (`library-manager` / javaModuleName).value, ), Test / addReads := { // We patched the test-classes into the runtime module. These classes access some stuff from @@ -3817,6 +3819,7 @@ lazy val `library-manager` = project "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), + javaModuleName := "org.enso.librarymanager", Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion, diff --git a/lib/scala/library-manager-test/src/main/java/org/enso/librarymanager/published/repository/package-info.java b/lib/scala/library-manager-test/src/main/java/org/enso/librarymanager/published/repository/package-info.java deleted file mode 100644 index 3672a3c8babc..000000000000 --- a/lib/scala/library-manager-test/src/main/java/org/enso/librarymanager/published/repository/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package org.enso.librarymanager.published.repository; From 562542842385697e38b65e392d3f6fffb50aba97 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 17:03:50 +0200 Subject: [PATCH 148/268] Fix dependencies for akka-wrapper --- build.sbt | 4 ++-- lib/java/akka-wrapper/src/main/java/module-info.java | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 4974b583ccd6..e2e549e8e8a6 100644 --- a/build.sbt +++ b/build.sbt @@ -1330,7 +1330,8 @@ lazy val `akka-wrapper` = project Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "com.google.protobuf" % "protobuf-java" % "3.25.1", - "org.reactivestreams" % "reactive-streams" % "1.0.3" + "org.reactivestreams" % "reactive-streams" % "1.0.3", + "org.slf4j" % "slf4j-api" % slf4jVersion, ), assembly / assemblyExcludedJars := { val scalaVer = scalaBinaryVersion.value @@ -1366,7 +1367,6 @@ lazy val `akka-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % "1.1.2", "com.typesafe" % "config" % typesafeConfigVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, "io.spray" % ("spray-json_" + scalaVer) % "1.3.6", akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, akkaURL % ("akka-actor-typed_" + scalaVer) % akkaVersion, diff --git a/lib/java/akka-wrapper/src/main/java/module-info.java b/lib/java/akka-wrapper/src/main/java/module-info.java index ede10869a481..14d88e944966 100644 --- a/lib/java/akka-wrapper/src/main/java/module-info.java +++ b/lib/java/akka-wrapper/src/main/java/module-info.java @@ -2,6 +2,9 @@ requires protobuf.java; requires scala.library; requires org.reactivestreams; + // For sun.misc.Unsafe - from akka.util.Unsafe + requires jdk.unsupported; + requires org.slf4j; // akka-actor exports akka; From 4d4ced486a37b814a7565c7047479b3f369f072f Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 17:04:10 +0200 Subject: [PATCH 149/268] scala-libs-wrapper exports shapeless --- lib/java/scala-libs-wrapper/src/main/java/module-info.java | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/java/scala-libs-wrapper/src/main/java/module-info.java b/lib/java/scala-libs-wrapper/src/main/java/module-info.java index 4bbe9c7468a7..9a4678553946 100644 --- a/lib/java/scala-libs-wrapper/src/main/java/module-info.java +++ b/lib/java/scala-libs-wrapper/src/main/java/module-info.java @@ -81,6 +81,7 @@ exports org.typelevel.jawn; // "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", + exports shapeless; exports shapeless.ops; exports shapeless.ops.record; exports shapeless.test; From 155eb40ad5fcc0214026ae1dc3619bcf73f14572 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 17:22:30 +0200 Subject: [PATCH 150/268] lang server deps wrapper exports pureconfig --- build.sbt | 2 +- .../language-server-deps-wrapper/src/main/java/module-info.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index e2e549e8e8a6..e14a63cdb8b7 100644 --- a/build.sbt +++ b/build.sbt @@ -1238,7 +1238,7 @@ lazy val `language-server-deps-wrapper` = project val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.github.pureconfig" % ("pureconfig_" + scalaVer) % pureconfigVersion + "com.github.pureconfig" % ("pureconfig-core_" + scalaVer) % pureconfigVersion ), streams.value.log, moduleName.value, diff --git a/lib/java/language-server-deps-wrapper/src/main/java/module-info.java b/lib/java/language-server-deps-wrapper/src/main/java/module-info.java index bdfc2c79e4b6..6ab05645836f 100644 --- a/lib/java/language-server-deps-wrapper/src/main/java/module-info.java +++ b/lib/java/language-server-deps-wrapper/src/main/java/module-info.java @@ -2,5 +2,5 @@ requires scala.library; // pureconfig-core_2.13-0.17.4.jar - //exports pureconfig; + exports pureconfig; } From 5bb3130d794270dc70b60863b37cdc2b849fd369 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 17:22:54 +0200 Subject: [PATCH 151/268] json-rpc-server requires org.slf4j --- build.sbt | 2 ++ lib/scala/json-rpc-server/src/main/java/module-info.java | 1 + 2 files changed, 3 insertions(+) diff --git a/build.sbt b/build.sbt index e14a63cdb8b7..30accfeaf42a 100644 --- a/build.sbt +++ b/build.sbt @@ -1675,6 +1675,7 @@ lazy val `json-rpc-server` = project libraryDependencies ++= Seq( "io.circe" %% "circe-literal" % circeVersion, "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, akkaTestkit % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test, "junit" % "junit" % junitVersion % Test, @@ -1688,6 +1689,7 @@ lazy val `json-rpc-server` = project val scalaVer = scalaBinaryVersion.value Seq( "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, ) }, Compile / internalModuleDependencies := Seq( diff --git a/lib/scala/json-rpc-server/src/main/java/module-info.java b/lib/scala/json-rpc-server/src/main/java/module-info.java index afb020119d56..6c39ae9969f0 100644 --- a/lib/scala/json-rpc-server/src/main/java/module-info.java +++ b/lib/scala/json-rpc-server/src/main/java/module-info.java @@ -2,6 +2,7 @@ requires scala.library; requires org.enso.scala.wrapper; requires org.enso.akka.wrapper; + requires org.slf4j; exports org.enso.jsonrpc; } From 607a9eee61ba20c14e716d6e74bf650d46680e5c Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 17:28:11 +0200 Subject: [PATCH 152/268] Add some dependencies --- build.sbt | 7 ++++++- engine/language-server/src/main/java/module-info.java | 5 +++++ lib/scala/pkg/src/main/java/module-info.java | 1 + lib/scala/searcher/src/main/java/module-info.java | 2 ++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 30accfeaf42a..ff94f92eb3aa 100644 --- a/build.sbt +++ b/build.sbt @@ -2138,9 +2138,14 @@ lazy val `language-server` = (project in file("engine/language-server")) (`json-rpc-server` / Compile / exportedModule).value, (`profiling-utils` / Compile / exportedModule).value, (`searcher` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, + (`distribution-manager` / Compile / exportedModule).value, + (`edition-updater` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, (`filewatcher` / Compile / exportedModule).value, - (`version-output` / Compile / exportedModule).value + (`version-output` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value, ), Test / testOptions += Tests .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index a3f7926d7ffc..a458128b856f 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -12,18 +12,23 @@ requires org.enso.akka.wrapper; requires org.enso.zio.wrapper; + requires org.enso.distribution; requires org.enso.runner.common; requires org.enso.engine.common; + requires org.enso.editions; + requires org.enso.editions.updater; requires org.enso.filewatcher; requires org.enso.json.rpc.server; requires org.enso.logging.utils; requires org.enso.logging.utils.akka; requires org.enso.librarymanager; requires org.enso.polyglot.api; + requires org.enso.pkg; requires org.enso.profiling; requires org.enso.scala.wrapper; requires org.enso.language.server.deps.wrapper; requires org.enso.searcher; + requires org.enso.semver; requires org.enso.version.output; requires org.enso.text.buffer; requires org.enso.ydoc; diff --git a/lib/scala/pkg/src/main/java/module-info.java b/lib/scala/pkg/src/main/java/module-info.java index d1753358feac..4a9ef4ce6d96 100644 --- a/lib/scala/pkg/src/main/java/module-info.java +++ b/lib/scala/pkg/src/main/java/module-info.java @@ -9,5 +9,6 @@ requires org.yaml.snakeyaml; exports org.enso.pkg; + exports org.enso.pkg.validation; exports org.enso.filesystem; } diff --git a/lib/scala/searcher/src/main/java/module-info.java b/lib/scala/searcher/src/main/java/module-info.java index 8a8400488ca4..ceb056471490 100644 --- a/lib/scala/searcher/src/main/java/module-info.java +++ b/lib/scala/searcher/src/main/java/module-info.java @@ -2,5 +2,7 @@ requires scala.library; requires org.enso.polyglot.api; + exports org.enso.searcher; + exports org.enso.searcher.data; exports org.enso.searcher.memory; } From 5a70148817e58862db810b1e5e88184e641e0458 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 17:28:31 +0200 Subject: [PATCH 153/268] lang server deps wrapper exports pureconfig.generic --- build.sbt | 3 ++- .../src/main/java/module-info.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ff94f92eb3aa..4bb48b9af1ef 100644 --- a/build.sbt +++ b/build.sbt @@ -1238,7 +1238,8 @@ lazy val `language-server-deps-wrapper` = project val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.github.pureconfig" % ("pureconfig-core_" + scalaVer) % pureconfigVersion + "com.github.pureconfig" % ("pureconfig-core_" + scalaVer) % pureconfigVersion, + "com.github.pureconfig" % ("pureconfig-generic_" + scalaVer) % pureconfigVersion, ), streams.value.log, moduleName.value, diff --git a/lib/java/language-server-deps-wrapper/src/main/java/module-info.java b/lib/java/language-server-deps-wrapper/src/main/java/module-info.java index 6ab05645836f..65334f05e6cc 100644 --- a/lib/java/language-server-deps-wrapper/src/main/java/module-info.java +++ b/lib/java/language-server-deps-wrapper/src/main/java/module-info.java @@ -3,4 +3,5 @@ // pureconfig-core_2.13-0.17.4.jar exports pureconfig; + exports pureconfig.generic; } From 0f3ee8b92c07a931b55399f0f570c7dd25d009a8 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 17:32:44 +0200 Subject: [PATCH 154/268] language server test requires bouncycastle provider --- build.sbt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 4bb48b9af1ef..5eef20fb4a66 100644 --- a/build.sbt +++ b/build.sbt @@ -2212,7 +2212,10 @@ lazy val `language-server` = (project in file("engine/language-server")) "io.sentry" % "sentry" % "6.28.0", "ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-core" % logbackClassicVersion, - "net.java.dev.jna" % "jna" % "5.13.0" + "net.java.dev.jna" % "jna" % "5.13.0", + "org.bouncycastle" % "bcutil-jdk18on" % "1.76", + "org.bouncycastle" % "bcpkix-jdk18on" % "1.76", + "org.bouncycastle" % "bcprov-jdk18on" % "1.76", ) }, Test / internalModuleDependencies := Seq( @@ -2281,6 +2284,7 @@ lazy val `language-server` = (project in file("engine/language-server")) Map( javaModuleName.value -> Seq( "ALL-UNNAMED", + "org.bouncycastle.provider" ) ) }, From a11691abd6bb8f8542197c6b4206653690fc9bf3 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 30 Aug 2024 17:32:55 +0200 Subject: [PATCH 155/268] language server depends on cli --- build.sbt | 1 + engine/language-server/src/main/java/module-info.java | 1 + 2 files changed, 2 insertions(+) diff --git a/build.sbt b/build.sbt index 5eef20fb4a66..0ce96545883b 100644 --- a/build.sbt +++ b/build.sbt @@ -2147,6 +2147,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`filewatcher` / Compile / exportedModule).value, (`version-output` / Compile / exportedModule).value, (`semver` / Compile / exportedModule).value, + (`cli` / Compile / exportedModule).value, ), Test / testOptions += Tests .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index a458128b856f..fddd01150bdf 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -10,6 +10,7 @@ requires org.openide.util.lookup.RELEASE180; requires org.slf4j; + requires org.enso.cli; requires org.enso.akka.wrapper; requires org.enso.zio.wrapper; requires org.enso.distribution; From 39b3a2404cdd5207ee8d4776755b4c3435ecc2b2 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 2 Sep 2024 17:37:46 +0200 Subject: [PATCH 156/268] directory-watcher wrapper requires org.slf4j --- build.sbt | 3 ++- .../src/main/java/module-info.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 0ce96545883b..8db29e4e8f60 100644 --- a/build.sbt +++ b/build.sbt @@ -1278,7 +1278,8 @@ lazy val `jpms-wrapper-methvin-directory-watcher` = project }, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, - "net.java.dev.jna" % "jna" % "5.13.0" + "net.java.dev.jna" % "jna" % "5.13.0", + "org.slf4j" % "slf4j-api" % "1.7.36", ), Compile / patchModules := { val scalaVer = scalaBinaryVersion.value diff --git a/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java b/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java index b6d4ff925d67..cab07f81cd73 100644 --- a/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java +++ b/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java @@ -1,6 +1,7 @@ module org.enso.jpms.wrapper.methvin.directory.watcher { requires scala.library; requires com.sun.jna; + requires org.slf4j; exports io.methvin.watcher; exports io.methvin.watchservice; From 716ccc79b561dcb978bac688381d8672babde718 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 2 Sep 2024 17:45:26 +0200 Subject: [PATCH 157/268] WatcherAdapter logs unsuccessful initialization errors --- build.sbt | 2 ++ .../src/main/java/module-info.java | 1 + .../org/enso/filewatcher/WatcherAdapter.scala | 28 ++++++++++++------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/build.sbt b/build.sbt index 8db29e4e8f60..fd4bcdaecb58 100644 --- a/build.sbt +++ b/build.sbt @@ -1092,11 +1092,13 @@ lazy val filewatcher = project libraryDependencies ++= Seq( "io.methvin" % "directory-watcher" % directoryWatcherVersion, "commons-io" % "commons-io" % commonsIoVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), compileOrder := CompileOrder.ScalaThenJava, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( (`jpms-wrapper-methvin-directory-watcher` / Compile / exportedModule).value diff --git a/lib/scala/filewatcher/src/main/java/module-info.java b/lib/scala/filewatcher/src/main/java/module-info.java index af338b638130..5ca34038c15b 100644 --- a/lib/scala/filewatcher/src/main/java/module-info.java +++ b/lib/scala/filewatcher/src/main/java/module-info.java @@ -1,5 +1,6 @@ module org.enso.filewatcher { requires scala.library; + requires org.slf4j; requires org.enso.jpms.wrapper.methvin.directory.watcher; exports org.enso.filewatcher; diff --git a/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala b/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala index 6063ae5e762e..25023cd08d9c 100644 --- a/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala +++ b/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala @@ -1,10 +1,7 @@ package org.enso.filewatcher -import io.methvin.watcher.{ - DirectoryChangeEvent, - DirectoryChangeListener, - DirectoryWatcher -} +import io.methvin.watcher.{DirectoryChangeEvent, DirectoryChangeListener, DirectoryWatcher} +import org.slf4j.LoggerFactory import java.util.concurrent.Executor import java.nio.file.Path @@ -22,11 +19,22 @@ final class WatcherAdapter( ) extends Watcher with DirectoryChangeListener { - private val watcher: DirectoryWatcher = DirectoryWatcher - .builder() - .path(root) - .listener(this) - .build() + private val logger = + LoggerFactory.getLogger(classOf[WatcherAdapter]) + + + private val watcher: DirectoryWatcher = + try { + DirectoryWatcher + .builder() + .path(root) + .listener(this) + .build() + } catch { + case t: Throwable => + logger.error("Failed to create DirectoryWatcher", t) + throw t + } /** @inheritdoc */ override def start(executor: Executor): Unit = { From d05af75825972c5bc32b388e9ba8151458ab71ac Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 2 Sep 2024 18:12:01 +0200 Subject: [PATCH 158/268] Fix error reporting in WatcherAdapter --- .../src/main/scala/org/enso/filewatcher/Watcher.scala | 4 ++-- .../main/scala/org/enso/filewatcher/WatcherAdapter.scala | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/Watcher.scala b/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/Watcher.scala index a0b7d892a16a..5dd049ba3240 100644 --- a/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/Watcher.scala +++ b/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/Watcher.scala @@ -40,7 +40,7 @@ object Watcher { /** Object representing en error. * - * @param exception an error + * @param throwable an error */ - case class WatcherError(exception: Exception) + case class WatcherError(throwable: Throwable) } diff --git a/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala b/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala index 25023cd08d9c..b724a61b74ea 100644 --- a/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala +++ b/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala @@ -38,7 +38,12 @@ final class WatcherAdapter( /** @inheritdoc */ override def start(executor: Executor): Unit = { - watcher.watchAsync(executor) + val fut = watcher.watchAsync(executor) + fut.exceptionally(e => { + val error = Watcher.WatcherError(e) + errorCallback(error) + null + }) } /** @inheritdoc */ From 3f1ac6499f59f131965fe9b1943302cec8383ba6 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 2 Sep 2024 18:59:27 +0200 Subject: [PATCH 159/268] Fix rest of the language-server tests --- build.sbt | 6 +++++- engine/language-server/src/main/java/module-info.java | 3 +++ .../src/main/java/module-info.java | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index fd4bcdaecb58..ecc1f5d91a0d 100644 --- a/build.sbt +++ b/build.sbt @@ -2136,6 +2136,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`ydoc-server` / Compile / exportedModule).value, (`logging-utils` / Compile / exportedModule).value, (`logging-utils-akka` / Compile / exportedModule).value, + (`logging-service` / Compile / exportedModule).value, (`engine-common` / Compile / exportedModule).value, (`library-manager` / Compile / exportedModule).value, (`polyglot-api` / Compile / exportedModule).value, @@ -2294,8 +2295,10 @@ lazy val `language-server` = (project in file("engine/language-server")) }, Test / addExports := { val profModName = (`profiling-utils` / javaModuleName).value + val downloaderModName = (`downloader` / javaModuleName).value val exports = Map( - profModName + "/org.enso.profiling.snapshot" -> Seq("ALL-UNNAMED") + profModName + "/org.enso.profiling.snapshot" -> Seq("ALL-UNNAMED"), + downloaderModName + "/org.enso.downloader.archive" -> Seq("ALL-UNNAMED") ) // Make sure that all the packages in test source directory are exported @@ -3772,6 +3775,7 @@ lazy val downloader = (project in file("lib/scala/downloader")) "com.github.sbt" % "junit-interface" % junitIfVersion % Test, "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test ), + javaModuleName := "org.enso.downloader", Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "commons-io" % "commons-io" % commonsIoVersion, diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index fddd01150bdf..f9edd114a695 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -22,6 +22,7 @@ requires org.enso.json.rpc.server; requires org.enso.logging.utils; requires org.enso.logging.utils.akka; + requires org.enso.logging.service; requires org.enso.librarymanager; requires org.enso.polyglot.api; requires org.enso.pkg; @@ -33,4 +34,6 @@ requires org.enso.version.output; requires org.enso.text.buffer; requires org.enso.ydoc; + + exports org.enso.languageserver.filemanager to scala.library; } diff --git a/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java b/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java index cab07f81cd73..119b47ff4996 100644 --- a/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java +++ b/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java @@ -1,6 +1,7 @@ module org.enso.jpms.wrapper.methvin.directory.watcher { requires scala.library; requires com.sun.jna; + requires jdk.unsupported; requires org.slf4j; exports io.methvin.watcher; From 0e8ce68cc7ffa483e71472b2830d4dc6e2a24043 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 2 Sep 2024 19:38:46 +0200 Subject: [PATCH 160/268] language-server-deps-wrapper depends on scala-libs-wrapper --- build.sbt | 3 +++ .../src/main/java/module-info.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/build.sbt b/build.sbt index ecc1f5d91a0d..45ae62ca2c59 100644 --- a/build.sbt +++ b/build.sbt @@ -1221,6 +1221,9 @@ lazy val `language-server-deps-wrapper` = project Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), + Compile / internalModuleDependencies := Seq( + (`scala-libs-wrapper` / Compile / exportedModule).value + ), assembly / assemblyExcludedJars := { val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( diff --git a/lib/java/language-server-deps-wrapper/src/main/java/module-info.java b/lib/java/language-server-deps-wrapper/src/main/java/module-info.java index 65334f05e6cc..e8dcc195d366 100644 --- a/lib/java/language-server-deps-wrapper/src/main/java/module-info.java +++ b/lib/java/language-server-deps-wrapper/src/main/java/module-info.java @@ -1,5 +1,7 @@ module org.enso.language.server.deps.wrapper { requires scala.library; + // For shapeless + requires org.enso.scala.wrapper; // pureconfig-core_2.13-0.17.4.jar exports pureconfig; From 354fe1cf271d5f99b04e1776b5362fb3ee3256c4 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 10:01:26 +0200 Subject: [PATCH 161/268] Fix rest of the language-server tests --- engine/language-server/src/main/java/module-info.java | 2 ++ lib/scala/downloader/src/main/java/module-info.java | 3 +++ lib/scala/library-manager/src/main/java/module-info.java | 1 + 3 files changed, 6 insertions(+) diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index f9edd114a695..f974e359ab03 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -36,4 +36,6 @@ requires org.enso.ydoc; exports org.enso.languageserver.filemanager to scala.library; + exports org.enso.languageserver.runtime to scala.library; + exports org.enso.languageserver.search to scala.library; } diff --git a/lib/scala/downloader/src/main/java/module-info.java b/lib/scala/downloader/src/main/java/module-info.java index afe275974923..c9cad21e2e53 100644 --- a/lib/scala/downloader/src/main/java/module-info.java +++ b/lib/scala/downloader/src/main/java/module-info.java @@ -11,4 +11,7 @@ requires org.slf4j; + exports org.enso.downloader.http; + exports org.enso.downloader.archive; + } diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java index a03867876a0c..ee3580606eb5 100644 --- a/lib/scala/library-manager/src/main/java/module-info.java +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -18,6 +18,7 @@ exports org.enso.librarymanager.dependencies; exports org.enso.librarymanager.local; exports org.enso.librarymanager.published; + exports org.enso.librarymanager.published.bundles; exports org.enso.librarymanager.published.repository; exports org.enso.librarymanager.resolved; exports org.enso.libraryupload; From 43c15a42356b6f6cdf0e0b326445bda3f1a266f1 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 10:03:14 +0200 Subject: [PATCH 162/268] Missing module-info.class in an internal project is a warning, not an error --- project/JPMSPlugin.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 55af0866df18..7d8e449b4be8 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -272,18 +272,18 @@ object JPMSPlugin extends AutoPlugin { val modInfo = internalModuleDep.toPath.resolve("module-info.class").toFile if (!modInfo.exists()) { - logger.error( + logger.warn( s"[JPMSPlugin/$currProjName] Internal module dependency $internalModuleDep does not contain " + - "module-info.class file. This is required for JPMS modules." + "module-info.class file. Ensure it is an automatic module." ) } } else if (internalModuleDep.getName.endsWith(".jar")) { val jarFile = new JarFile(internalModuleDep) val modInfoEntry = jarFile.getJarEntry("module-info.class") if (modInfoEntry == null) { - logger.error( + logger.warn( s"[JPMSPlugin/$currProjName] Internal module dependency (JAR) $internalModuleDep does not contain " + - "module-info.class file. This is required for JPMS modules." + "module-info.class file. Ensure it is an automatic module." ) } } else { From 7b6cf311a2e19d7cb0dd61166b259ae25c6972c8 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 10:13:25 +0200 Subject: [PATCH 163/268] Rename jpms-methvin-directory-watcher-wrapper to a simpler name --- build.sbt | 12 ++++++------ .../src/main/java/module-info.java | 2 +- lib/scala/filewatcher/src/main/java/module-info.java | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) rename lib/java/{jpms-wrapper-methvin-directory-watcher => directory-watcher-wrapper}/src/main/java/module-info.java (74%) diff --git a/build.sbt b/build.sbt index 45ae62ca2c59..690bc4b4c7be 100644 --- a/build.sbt +++ b/build.sbt @@ -1101,14 +1101,14 @@ lazy val filewatcher = project "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( - (`jpms-wrapper-methvin-directory-watcher` / Compile / exportedModule).value + (`directory-watcher-wrapper` / Compile / exportedModule).value ), Test / fork := true, Test / javaOptions ++= testLogProviderOptions ) .dependsOn(testkit % Test) .dependsOn(`logging-service-logback` % "test->test") - .dependsOn(`jpms-wrapper-methvin-directory-watcher`) + .dependsOn(`directory-watcher-wrapper`) lazy val `logging-truffle-connector` = project .in(file("lib/scala/logging-truffle-connector")) @@ -1256,8 +1256,8 @@ lazy val `language-server-deps-wrapper` = project } ) -lazy val `jpms-wrapper-methvin-directory-watcher` = project - .in(file("lib/java/jpms-wrapper-methvin-directory-watcher")) +lazy val `directory-watcher-wrapper` = project + .in(file("lib/java/directory-watcher-wrapper")) .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, @@ -1266,7 +1266,7 @@ lazy val `jpms-wrapper-methvin-directory-watcher` = project "org.slf4j" % "slf4j-api" % "1.7.36", "net.java.dev.jna" % "jna" % "5.13.0" ), - javaModuleName := "org.enso.jpms.wrapper.methvin.directory.watcher", + javaModuleName := "org.enso.directory.watcher.wrapper", assembly / assemblyExcludedJars := { val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( @@ -2134,7 +2134,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`zio-wrapper` / Compile / exportedModule).value, (`scala-libs-wrapper` / Compile / exportedModule).value, (`language-server-deps-wrapper` / Compile / exportedModule).value, - (`jpms-wrapper-methvin-directory-watcher` / Compile / exportedModule).value, + (`directory-watcher-wrapper` / Compile / exportedModule).value, (`engine-runner-common` / Compile / exportedModule).value, (`ydoc-server` / Compile / exportedModule).value, (`logging-utils` / Compile / exportedModule).value, diff --git a/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java b/lib/java/directory-watcher-wrapper/src/main/java/module-info.java similarity index 74% rename from lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java rename to lib/java/directory-watcher-wrapper/src/main/java/module-info.java index 119b47ff4996..6313a49838b5 100644 --- a/lib/java/jpms-wrapper-methvin-directory-watcher/src/main/java/module-info.java +++ b/lib/java/directory-watcher-wrapper/src/main/java/module-info.java @@ -1,4 +1,4 @@ -module org.enso.jpms.wrapper.methvin.directory.watcher { +module org.enso.directory.watcher.wrapper { requires scala.library; requires com.sun.jna; requires jdk.unsupported; diff --git a/lib/scala/filewatcher/src/main/java/module-info.java b/lib/scala/filewatcher/src/main/java/module-info.java index 5ca34038c15b..190726eccb69 100644 --- a/lib/scala/filewatcher/src/main/java/module-info.java +++ b/lib/scala/filewatcher/src/main/java/module-info.java @@ -1,7 +1,7 @@ module org.enso.filewatcher { requires scala.library; requires org.slf4j; - requires org.enso.jpms.wrapper.methvin.directory.watcher; + requires org.enso.directory.watcher.wrapper; exports org.enso.filewatcher; } From 6484050e2c973f6acf54b89a4d1aad56a3a9baea Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 11:10:43 +0200 Subject: [PATCH 164/268] compileOrder has to be specified before libraryDependencies --- build.sbt | 22 ++++++++++++---------- project/JPMSPlugin.scala | 2 ++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/build.sbt b/build.sbt index 690bc4b4c7be..9a1700253330 100644 --- a/build.sbt +++ b/build.sbt @@ -884,10 +884,10 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) lazy val pkg = (project in file("lib/scala/pkg")) .enablePlugins(JPMSPlugin) .settings( - Compile / run / mainClass := Some("org.enso.pkg.Main"), frgaalJavaCompilerSetting, compileOrder := CompileOrder.ScalaThenJava, version := "0.1", + Compile / run / mainClass := Some("org.enso.pkg.Main"), libraryDependencies ++= Seq( "io.circe" %% "circe-core" % circeVersion % "provided", "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", @@ -965,12 +965,12 @@ lazy val `logging-utils` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] version := "0.1", libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.slf4j" % "slf4j-api" % slf4jVersion ) ++ logbackTest, - compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] Compile / moduleDependencies := { Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -1026,6 +1026,7 @@ lazy val `logging-service-logback` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -1042,7 +1043,6 @@ lazy val `logging-service-logback` = project "ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-core" % logbackClassicVersion ), - compileOrder := CompileOrder.ScalaThenJava, Compile / internalModuleDependencies := Seq( (`logging-service` / Compile / exportedModule).value, (`logging-config` / Compile / exportedModule).value @@ -1087,6 +1087,7 @@ lazy val filewatcher = project .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, javaModuleName := "org.enso.filewatcher", version := "0.1", libraryDependencies ++= Seq( @@ -1095,7 +1096,6 @@ lazy val filewatcher = project "org.slf4j" % "slf4j-api" % slf4jVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - compileOrder := CompileOrder.ScalaThenJava, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion @@ -1677,6 +1677,7 @@ lazy val `json-rpc-server` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= akka ++ logbackTest, libraryDependencies ++= circe, libraryDependencies ++= Seq( @@ -1691,7 +1692,6 @@ lazy val `json-rpc-server` = project "org.apache.httpcomponents" % "httpcore" % httpComponentsVersion % Test, "commons-io" % "commons-io" % commonsIoVersion % Test ), - compileOrder := CompileOrder.ScalaThenJava, Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( @@ -1726,6 +1726,7 @@ lazy val testkit = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, javaModuleName := "org.enso.testkit", libraryDependencies ++= logbackPkg ++ Seq( "org.apache.commons" % "commons-lang3" % commonsLangVersion, @@ -1735,7 +1736,6 @@ lazy val testkit = project "com.github.sbt" % "junit-interface" % junitIfVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, ), - compileOrder := CompileOrder.ScalaThenJava, packageOptions := Seq( Package.ManifestAttributes( ( @@ -1754,11 +1754,11 @@ lazy val searcher = project .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, annotationProcSetting, libraryDependencies ++= jmh ++ Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test ) ++ logbackTest, - compileOrder := CompileOrder.ScalaThenJava, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), @@ -2073,11 +2073,11 @@ lazy val `polyglot-api-macros` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= Seq( "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion % "provided", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion % "provided" ), - compileOrder := CompileOrder.ScalaThenJava, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion ), @@ -2426,6 +2426,8 @@ def customFrgaalJavaCompilerSettings(targetJdk: String) = { // with JPMSPlugin. That's why we have to check first for its existance. val settingOpt = (config / shouldCompileModuleInfoManually).?.value val shouldCompileModInfo = settingOpt.isDefined && settingOpt.get + val projName = projectID.value.name + println(s"[customFrgaalOpts/$projName] shouldCompileModInfo=$shouldCompileModInfo") FrgaalJavaCompiler.compilers( (config / dependencyClasspath).value, compilers.value, @@ -3209,6 +3211,7 @@ lazy val `engine-runner` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.JavaThenScala, truffleDslSuppressWarnsSetting, packageOptions := Seq( // The `Multi-Release: true` comes from the `org.xerial/sqlite-jdbc` dependency. @@ -3217,7 +3220,6 @@ lazy val `engine-runner` = project Package.ManifestAttributes(("Multi-Release", "true")) ), Compile / run / mainClass := Some("org.enso.runner.Main"), - compileOrder := CompileOrder.JavaThenScala, commands += WithDebugCommand.withDebug, inConfig(Compile)(truffleRunOptionsSettings), libraryDependencies ++= Seq( @@ -3873,9 +3875,9 @@ lazy val `library-manager-test` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, Test / fork := true, commands += WithDebugCommand.withDebug, - compileOrder := CompileOrder.ScalaThenJava, Test / javaOptions ++= testLogProviderOptions, Test / test := (Test / test).tag(simpleLibraryServerTag).value, libraryDependencies ++= Seq( diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 7d8e449b4be8..a2832e2c52f8 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -16,6 +16,8 @@ import scala.collection.mutable * * If this plugin is enabled, and no settings/tasks from this plugin are used, then the plugin will * not inject anything into `javaOptions` or `javacOptions`. + * + * - `compileOrder` has to be specified before `libraryDependencies` */ object JPMSPlugin extends AutoPlugin { object autoImport { From c1119c1f6c800f4418a62d74af079b4a769d4ed1 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 11:25:14 +0200 Subject: [PATCH 165/268] exclude module-info.java from polyglot-api-macros --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 9a1700253330..8e44eaf55568 100644 --- a/build.sbt +++ b/build.sbt @@ -2073,7 +2073,8 @@ lazy val `polyglot-api-macros` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - compileOrder := CompileOrder.ScalaThenJava, + // Note [Compile module-info] + excludeFilter := excludeFilter.value || "module-info.java", libraryDependencies ++= Seq( "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion % "provided", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion % "provided" From aebb1b9b6effc3313214100a32e154ac7ed0d028 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 11:25:37 +0200 Subject: [PATCH 166/268] Remove temporary logging in customFrgaalCompilerSettings --- build.sbt | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.sbt b/build.sbt index 8e44eaf55568..a17bd299ddae 100644 --- a/build.sbt +++ b/build.sbt @@ -2427,8 +2427,6 @@ def customFrgaalJavaCompilerSettings(targetJdk: String) = { // with JPMSPlugin. That's why we have to check first for its existance. val settingOpt = (config / shouldCompileModuleInfoManually).?.value val shouldCompileModInfo = settingOpt.isDefined && settingOpt.get - val projName = projectID.value.name - println(s"[customFrgaalOpts/$projName] shouldCompileModInfo=$shouldCompileModInfo") FrgaalJavaCompiler.compilers( (config / dependencyClasspath).value, compilers.value, From 9e716d580e07306f4a1e2f25f1a5e52f951b3d04 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 11:34:26 +0200 Subject: [PATCH 167/268] Fix compilation of logging-service-logback --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a17bd299ddae..42a5d73dacc5 100644 --- a/build.sbt +++ b/build.sbt @@ -1026,7 +1026,7 @@ lazy val `logging-service-logback` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - compileOrder := CompileOrder.ScalaThenJava, + excludeFilter := excludeFilter.value || "module-info.java", version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -1043,6 +1043,7 @@ lazy val `logging-service-logback` = project "ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-core" % logbackClassicVersion ), + Compile / shouldCompileModuleInfoManually := true, Compile / internalModuleDependencies := Seq( (`logging-service` / Compile / exportedModule).value, (`logging-config` / Compile / exportedModule).value From 5b68a64ea567b605a0043c5858a89c05d261cc25 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 12:11:20 +0200 Subject: [PATCH 168/268] Fix compilation of runtime-benchmarks --- build.sbt | 110 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 100 insertions(+), 10 deletions(-) diff --git a/build.sbt b/build.sbt index 42a5d73dacc5..df5690b9358b 100644 --- a/build.sbt +++ b/build.sbt @@ -2846,6 +2846,7 @@ lazy val `runtime-integration-tests` = lazy val `runtime-benchmarks` = (project in file("engine/runtime-benchmarks")) .enablePlugins(JPMSPlugin) + .enablePlugins(PackageListPlugin) .settings( frgaalJavaCompilerSetting, annotationProcSetting, @@ -2859,7 +2860,12 @@ lazy val `runtime-benchmarks` = "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided", "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.slf4j" % "slf4j-nop" % slf4jVersion + "org.slf4j" % "slf4j-nop" % slf4jVersion, + "io.sentry" % "sentry" % "6.28.0", + "io.sentry" % "sentry-logback" % "6.28.0", + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, ), mainClass := Some("org.enso.interpreter.bench.benchmarks.RuntimeBenchmarksRunner"), @@ -2870,17 +2876,100 @@ lazy val `runtime-benchmarks` = ), parallelExecution := false, Compile / 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, - (`ydoc-server` / projectID).value, - (`syntax-rust-definition` / projectID).value, - (`profiling-utils` / projectID).value + GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "org.apache.tika" % "tika-core" % tikaVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, + "com.ibm.icu" % "icu4j" % icuVersion, + "org.jline" % "jline" % jlineVersion, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.sentry" % "sentry-logback" % "6.28.0", + "io.sentry" % "sentry" % "6.28.0", + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion ) }, - addExports := { - Map("org.slf4j.nop/org.slf4j.nop" -> Seq("org.slf4j")) + Compile / internalModuleDependencies := Seq( + (`runtime` / Compile / exportedModule).value, + (`runtime-instrument-common` / Compile / exportedModule).value, + (`runtime-instrument-runtime-server` / Compile / exportedModule).value, + (`runtime-instrument-repl-debugger` / Compile / exportedModule).value, + (`runtime-instrument-id-execution` / Compile / exportedModule).value, + (`runtime-language-epb` / Compile / exportedModule).value, + (`ydoc-server` / Compile / exportedModule).value, + (`syntax-rust-definition` / Compile / exportedModule).value, + (`profiling-utils` / Compile / exportedModule).value, + (`logging-service-logback` / Compile / exportedModule).value, + (`logging-service-logback` / Test / exportedModule).value, + (`version-output` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`text-buffer` / Compile / exportedModule).value, + (`runtime-suggestions` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value, + (`runtime-compiler` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`polyglot-api-macros` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value, + (`connected-lock-manager` / Compile / exportedModule).value, + (`library-manager` / Compile / exportedModule).value, + (`persistance` / Compile / exportedModule).value, + (`interpreter-dsl` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, + (`edition-updater` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, + (`distribution-manager` / Compile / exportedModule).value, + (`common-polyglot-core-utils` / Compile / exportedModule).value, + (`cli` / Compile / exportedModule).value, + (`refactoring-utils` / Compile / exportedModule).value, + (`scala-yaml` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value, + (`downloader` / Compile / exportedModule).value, + (`logging-config` / Compile / exportedModule).value, + (`logging-service` / Compile / exportedModule).value, + ), + // Benchmark sources are patched into the `org.enso.runtime` module + Compile / patchModules := { + val runtimeModName = (`runtime` / javaModuleName).value + val javaSrcDir = (Compile / javaSource).value + val classesDir = (Compile / productDirectories).value.head + val testUtilsClasses = (`test-utils` / Compile / productDirectories).value.head + val benchCommonClasses = (`benchmarks-common` / Compile / productDirectories).value.head + Map ( + runtimeModName -> Seq( + javaSrcDir, + classesDir, + testUtilsClasses, + benchCommonClasses + ) + ) + }, + // jmh is in unnamed modules + Compile / addReads := { + val runtimeModName = (`runtime` / javaModuleName).value + Map( + runtimeModName -> Seq("ALL-UNNAMED") + ) + }, + Compile / addExports := { + val runtimeModName = (`runtime` / javaModuleName).value + val pkgs = (Compile / packages).value + val pkgsExports = pkgs.map { pkg => + runtimeModName + "/" + pkg -> Seq("ALL-UNNAMED") + }.toMap + + pkgsExports ++ Map( + "org.slf4j.nop/org.slf4j.nop" -> Seq("org.slf4j") + ) }, javaOptions ++= { Seq( @@ -2913,6 +3002,7 @@ lazy val `runtime-benchmarks` = ) .dependsOn(`benchmarks-common`) .dependsOn(`test-utils`) + .dependsOn(`runtime`) lazy val `runtime-parser` = (project in file("engine/runtime-parser")) From d5f84446a033427dbecf6e6f72844b9f044ecf82 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 12:26:23 +0200 Subject: [PATCH 169/268] Fix runtime-benchmarks/run --- build.sbt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.sbt b/build.sbt index df5690b9358b..147ef8cb8836 100644 --- a/build.sbt +++ b/build.sbt @@ -2885,6 +2885,7 @@ lazy val `runtime-benchmarks` = "commons-io" % "commons-io" % commonsIoVersion, "org.apache.tika" % "tika-core" % tikaVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.slf4j" % "slf4j-nop" % slf4jVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, "com.ibm.icu" % "icu4j" % icuVersion, @@ -2937,6 +2938,10 @@ lazy val `runtime-benchmarks` = (`logging-config` / Compile / exportedModule).value, (`logging-service` / Compile / exportedModule).value, ), + Compile / addModules := Seq( + (`runtime` / javaModuleName).value, + "org.slf4j.nop" + ), // Benchmark sources are patched into the `org.enso.runtime` module Compile / patchModules := { val runtimeModName = (`runtime` / javaModuleName).value From 426c2123dd4d61628efbfdb8347d0a741206a241 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 16:23:14 +0200 Subject: [PATCH 170/268] HostClassLoader delegates to org.graalvm.polyglot class loader if org.enso.runtime is not on boot layer --- .../interpreter/runtime/HostClassLoader.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java index 4f8f957c2924..144bca6dfb35 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java @@ -4,6 +4,7 @@ import java.net.URLClassLoader; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.graalvm.polyglot.Context; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,11 +18,29 @@ final class HostClassLoader extends URLClassLoader implements AutoCloseable { private final Map> loadedClasses = new ConcurrentHashMap<>(); private static final Logger logger = LoggerFactory.getLogger(HostClassLoader.class); + // Classes from "org.graalvm" packages are loaded either by a class loader for the boot + // module layer, or by a specific class loader, depending on how enso is run. For example, + // if enso is run via `org.graalvm.polyglot.Context.eval` from `javac`, then the graalvm + // classes are loaded via a class loader somehow created by `javac` and not by the boot + // module layer's class loader. + private static final ClassLoader polyglotClassLoader = Context.class.getClassLoader(); + + // polyglotClassLoader will be used only iff `org.enso.runtime` module is not in the + // boot module layer. + private static final boolean isRuntimeModInBootLayer; public HostClassLoader() { super(new URL[0]); } + static { + var bootModules = ModuleLayer.boot().modules(); + var hasRuntimeMod = bootModules + .stream() + .anyMatch(module -> module.getName().equals("org.enso.runtime")); + isRuntimeModInBootLayer = hasRuntimeMod; + } + void add(URL u) { logger.debug("Adding URL '{}' to class path", u); addURL(u); @@ -40,6 +59,9 @@ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundE logger.trace("Class {} found in cache", name); return l; } + if (!isRuntimeModInBootLayer && name.startsWith("org.graalvm")) { + return polyglotClassLoader.loadClass(name); + } try { l = findClass(name); if (resolve) { From 3e62dda17b6f48f33d8ad6ce34371bf682431647 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 3 Sep 2024 17:20:40 +0200 Subject: [PATCH 171/268] org.enso.runtime.lnaguage.epb module must be opened to allow it to be used by annnotation processor --- engine/runtime-language-epb/src/main/java/module-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/runtime-language-epb/src/main/java/module-info.java b/engine/runtime-language-epb/src/main/java/module-info.java index 700bb1d7b119..bfced702a4ab 100644 --- a/engine/runtime-language-epb/src/main/java/module-info.java +++ b/engine/runtime-language-epb/src/main/java/module-info.java @@ -1,4 +1,4 @@ -module org.enso.runtime.language.epb { +open module org.enso.runtime.language.epb { requires java.logging; requires org.graalvm.truffle; From 0b746cf2cea39a622cf30745c74bbed98c0ec70b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 4 Sep 2024 08:10:36 +0200 Subject: [PATCH 172/268] fmt --- build.sbt | 464 +++++++++--------- .../resource/RepoInitializationSpec.scala | 6 +- .../filemanager/ContentRootManagerSpec.scala | 6 +- .../websocket/json/LibrariesTest.scala | 11 +- .../test/TestJPMSModuleConfiguration.java | 17 +- .../test/TestLogProviderOnModulePath.java | 4 +- .../test/pass/analyse/AliasAnalysisTest.scala | 11 +- .../test/instrument/RuntimeServerTest.scala | 1 - .../interpreter/runtime/HostClassLoader.java | 5 +- .../src/main/java/module-info.java | 1 - .../editions/src/main/java/module-info.java | 2 - .../org/enso/filewatcher/WatcherAdapter.scala | 7 +- .../src/main/java/module-info.java | 1 - .../repository/LibraryDownloadTest.scala | 5 +- .../libraryupload/LibraryUploadTest.scala | 5 +- .../src/main/java/module-info.java | 1 - .../TestLogProviderOnClasspath.java | 12 +- project/FrgaalJavaCompiler.scala | 4 +- project/JPMSPlugin.scala | 61 +-- project/PackageListPlugin.scala | 34 +- 20 files changed, 339 insertions(+), 319 deletions(-) diff --git a/build.sbt b/build.sbt index 147ef8cb8836..a337f9aaf68f 100644 --- a/build.sbt +++ b/build.sbt @@ -688,28 +688,27 @@ lazy val componentModulesPaths = ourMods ++ thirdPartyModFiles } -/** - * Common settings for our wrappers of some *problematic* dependencies that are not - * compatible with the JPMS system, i.e., these dependencies cannot be put on module-path. - * These projects contain only single `module-info.java` source. - * Before this source is compiled, all the dependencies are gathered via the `assembly` - * task into a Jar. - * The `module-info.java` exports all the packages from these dependencies. - * Note that this is the recommended way how to handle dependencies that are not - * JPMS-friendly. - * - * `exportedModule` of these projects return path to the assembled modular Jar. - * The projects should define: - * - `moduleDependencies` - * - `patchModules` - * - `assembly / assemblyExcludedJars` - */ +/** Common settings for our wrappers of some *problematic* dependencies that are not + * compatible with the JPMS system, i.e., these dependencies cannot be put on module-path. + * These projects contain only single `module-info.java` source. + * Before this source is compiled, all the dependencies are gathered via the `assembly` + * task into a Jar. + * The `module-info.java` exports all the packages from these dependencies. + * Note that this is the recommended way how to handle dependencies that are not + * JPMS-friendly. + * + * `exportedModule` of these projects return path to the assembled modular Jar. + * The projects should define: + * - `moduleDependencies` + * - `patchModules` + * - `assembly / assemblyExcludedJars` + */ lazy val modularFatJarWrapperSettings = frgaalJavaCompilerSetting ++ Seq( Compile / forceModuleInfoCompilation := true, Compile / exportedModuleBin := assembly .dependsOn(Compile / compileModuleInfo) .value, - Compile / exportedModule := (Compile / exportedModuleBin).value, + Compile / exportedModule := (Compile / exportedModuleBin).value ) // ============================================================================ @@ -1073,8 +1072,8 @@ lazy val `logging-utils-akka` = project Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ) }, Compile / internalModuleDependencies := Seq( @@ -1148,15 +1147,15 @@ lazy val `scala-libs-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion, "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, - "net.java.dev.jna" % "jna" % "5.13.0" + "net.java.dev.jna" % "jna" % "5.13.0" ), Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.jline" % "jline" % jlineVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "net.java.dev.jna" % "jna" % "5.13.0" + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.jline" % "jline" % jlineVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "net.java.dev.jna" % "jna" % "5.13.0" ), assembly / assemblyExcludedJars := { JPMSUtils.filterModulesFromClasspath( @@ -1168,7 +1167,7 @@ lazy val `scala-libs-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "io.github.java-diff-utils" % "java-diff-utils" % "4.12", "org.jline" % "jline" % jlineVersion, - "net.java.dev.jna" % "jna" % "5.13.0" + "net.java.dev.jna" % "jna" % "5.13.0" ), streams.value.log, moduleName.value, @@ -1244,8 +1243,8 @@ lazy val `language-server-deps-wrapper` = project val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.github.pureconfig" % ("pureconfig-core_" + scalaVer) % pureconfigVersion, - "com.github.pureconfig" % ("pureconfig-generic_" + scalaVer) % pureconfigVersion, + "com.github.pureconfig" % ("pureconfig-core_" + scalaVer) % pureconfigVersion, + "com.github.pureconfig" % ("pureconfig-generic_" + scalaVer) % pureconfigVersion ), streams.value.log, moduleName.value, @@ -1263,9 +1262,9 @@ lazy val `directory-watcher-wrapper` = project .settings( modularFatJarWrapperSettings, libraryDependencies ++= Seq( - "io.methvin" % "directory-watcher" % directoryWatcherVersion, - "org.slf4j" % "slf4j-api" % "1.7.36", - "net.java.dev.jna" % "jna" % "5.13.0" + "io.methvin" % "directory-watcher" % directoryWatcherVersion, + "org.slf4j" % "slf4j-api" % "1.7.36", + "net.java.dev.jna" % "jna" % "5.13.0" ), javaModuleName := "org.enso.directory.watcher.wrapper", assembly / assemblyExcludedJars := { @@ -1273,9 +1272,9 @@ lazy val `directory-watcher-wrapper` = project JPMSUtils.filterModulesFromClasspath( (Compile / dependencyClasspath).value, Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.slf4j" % "slf4j-api" % "1.7.36", - "net.java.dev.jna" % "jna" % "5.13.0" + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % "1.7.36", + "net.java.dev.jna" % "jna" % "5.13.0" ), streams.value.log, moduleName.value, @@ -1283,9 +1282,9 @@ lazy val `directory-watcher-wrapper` = project ) }, Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "net.java.dev.jna" % "jna" % "5.13.0", - "org.slf4j" % "slf4j-api" % "1.7.36", + "org.scala-lang" % "scala-library" % scalacVersion, + "net.java.dev.jna" % "jna" % "5.13.0", + "org.slf4j" % "slf4j-api" % "1.7.36" ), Compile / patchModules := { val scalaVer = scalaBinaryVersion.value @@ -1293,7 +1292,7 @@ lazy val `directory-watcher-wrapper` = project update.value, Seq( "org.scala-lang" % "scala-library" % scalacVersion, - "io.methvin" % "directory-watcher" % directoryWatcherVersion, + "io.methvin" % "directory-watcher" % directoryWatcherVersion ), streams.value.log, moduleName.value, @@ -1303,7 +1302,6 @@ lazy val `directory-watcher-wrapper` = project javaModuleName.value -> scalaLibs ) } - ) /** JPMS module wrapper for Akka. @@ -1319,7 +1317,7 @@ lazy val `akka-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2", "org.scala-lang.modules" %% "scala-java8-compat" % "1.0.0", - akkaURL %% "akka-http" % akkaHTTPVersion, + akkaURL %% "akka-http" % akkaHTTPVersion, akkaURL %% "akka-http-core" % akkaHTTPVersion, akkaURL %% "akka-slf4j" % akkaVersion, akkaURL %% "akka-parsing" % "10.2.10", @@ -1339,24 +1337,24 @@ lazy val `akka-wrapper` = project "org.scala-lang" % "scala-library" % scalacVersion, "com.google.protobuf" % "protobuf-java" % "3.25.1", "org.reactivestreams" % "reactive-streams" % "1.0.3", - "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ), assembly / assemblyExcludedJars := { val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % "1.0.0", - "org.slf4j" % "slf4j-api" % slf4jVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "io.github.java-diff-utils" % "java-diff-utils" % "4.12", - "org.jline" % "jline" % jlineVersion, - "com.google.protobuf" % "protobuf-java" % "3.25.1", - "org.reactivestreams" % "reactive-streams" % "1.0.3", - "net.java.dev.jna" % "jna" % "5.13.0" + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % "1.0.0", + "org.slf4j" % "slf4j-api" % slf4jVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.github.java-diff-utils" % "java-diff-utils" % "4.12", + "org.jline" % "jline" % jlineVersion, + "com.google.protobuf" % "protobuf-java" % "3.25.1", + "org.reactivestreams" % "reactive-streams" % "1.0.3", + "net.java.dev.jna" % "jna" % "5.13.0" ), streams.value.log, moduleName.value, @@ -1370,21 +1368,21 @@ lazy val `akka-wrapper` = project val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % "1.1.2", - "com.typesafe" % "config" % typesafeConfigVersion, - "io.spray" % ("spray-json_" + scalaVer) % "1.3.6", - akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, - akkaURL % ("akka-actor-typed_" + scalaVer) % akkaVersion, - akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, - akkaURL % ("akka-http_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-http-spray-json_" + scalaVer) % "10.2.10", - akkaURL % ("akka-slf4j_" + scalaVer) % akkaVersion, - akkaURL % ("akka-parsing_" + scalaVer) % "10.2.10", - akkaURL % ("akka-protobuf-v3_" + scalaVer) % akkaVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % "1.1.2", + "com.typesafe" % "config" % typesafeConfigVersion, + "io.spray" % ("spray-json_" + scalaVer) % "1.3.6", + akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, + akkaURL % ("akka-actor-typed_" + scalaVer) % akkaVersion, + akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, + akkaURL % ("akka-http_" + scalaVer) % akkaHTTPVersion, + akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, + akkaURL % ("akka-http-spray-json_" + scalaVer) % "10.2.10", + akkaURL % ("akka-slf4j_" + scalaVer) % akkaVersion, + akkaURL % ("akka-parsing_" + scalaVer) % "10.2.10", + akkaURL % ("akka-protobuf-v3_" + scalaVer) % akkaVersion ), streams.value.log, moduleName.value, @@ -1403,23 +1401,23 @@ lazy val `zio-wrapper` = project modularFatJarWrapperSettings, javaModuleName := "org.enso.zio.wrapper", libraryDependencies ++= zio ++ Seq( - "dev.zio" %% "zio-internal-macros" % zioVersion, - "dev.zio" %% "zio-stacktracer" % zioVersion, - "dev.zio" %% "izumi-reflect" % "2.3.8", - "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % "2.3.8", + "dev.zio" %% "zio-internal-macros" % zioVersion, + "dev.zio" %% "zio-stacktracer" % zioVersion, + "dev.zio" %% "izumi-reflect" % "2.3.8", + "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % "2.3.8" ), Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-library" % scalacVersion ), assembly / assemblyExcludedJars := { val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, - "dev.zio" % ("zio-interop-cats_" + scalaVer) % zioInteropCatsVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "dev.zio" % ("zio-interop-cats_" + scalaVer) % zioInteropCatsVersion ), streams.value.log, moduleName.value, @@ -1433,12 +1431,12 @@ lazy val `zio-wrapper` = project val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "dev.zio" % ("zio_" + scalaVer) % zioVersion, - "dev.zio" % ("zio-internal-macros_" + scalaVer) % zioVersion, - "dev.zio" % ("zio-stacktracer_" + scalaVer) % zioVersion, - "dev.zio" % ("izumi-reflect_" + scalaVer) % "2.3.8", - "dev.zio" % ("izumi-reflect-thirdparty-boopickle-shaded_" + scalaVer) % "2.3.8", + "org.scala-lang" % "scala-library" % scalacVersion, + "dev.zio" % ("zio_" + scalaVer) % zioVersion, + "dev.zio" % ("zio-internal-macros_" + scalaVer) % zioVersion, + "dev.zio" % ("zio-stacktracer_" + scalaVer) % zioVersion, + "dev.zio" % ("izumi-reflect_" + scalaVer) % "2.3.8", + "dev.zio" % ("izumi-reflect-thirdparty-boopickle-shaded_" + scalaVer) % "2.3.8" ), streams.value.log, moduleName.value, @@ -1684,7 +1682,7 @@ lazy val `json-rpc-server` = project libraryDependencies ++= Seq( "io.circe" %% "circe-literal" % circeVersion, "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, akkaTestkit % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test, "junit" % "junit" % junitVersion % Test, @@ -1696,13 +1694,13 @@ lazy val `json-rpc-server` = project Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ) }, Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value, - (`akka-wrapper` / Compile / exportedModule).value, + (`akka-wrapper` / Compile / exportedModule).value ) ) @@ -1735,17 +1733,18 @@ lazy val testkit = project "org.scalatest" %% "scalatest" % scalatestVersion, "junit" % "junit" % junitVersion, "com.github.sbt" % "junit-interface" % junitIfVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ), packageOptions := Seq( Package.ManifestAttributes( ( - "Automatic-Module-Name", javaModuleName.value + "Automatic-Module-Name", + javaModuleName.value ) ) ), Compile / exportedModule := (Compile / exportedModuleBin).value, - Compile / exportedModuleBin := (Compile / packageBin).value, + Compile / exportedModuleBin := (Compile / packageBin).value ) .dependsOn(`logging-service-logback`) @@ -1827,7 +1826,8 @@ lazy val `ydoc-server` = project // would result in an sbt caught in an infinite recursion. // Compile / run / javaOptions ++= { - val mp = (Compile / modulePath).value ++ (`profiling-utils` / Compile / modulePath).value + val mp = + (Compile / modulePath).value ++ (`profiling-utils` / Compile / modulePath).value val jar = (Compile / exportedProductJars).value.head val modName = javaModuleName.value val allMp = mp ++ Seq(jar.data.absolutePath) @@ -2057,7 +2057,7 @@ lazy val `polyglot-api` = project (`engine-common` / Compile / exportedModule).value, (`logging-utils` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, - (`polyglot-api-macros` / Compile / exportedModule).value, + (`polyglot-api-macros` / Compile / exportedModule).value ), GenerateFlatbuffers.flatcVersion := flatbuffersVersion, Compile / sourceGenerators += GenerateFlatbuffers.task @@ -2114,21 +2114,21 @@ lazy val `language-server` = (project in file("engine/language-server")) "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, + "org.apache.tika" % "tika-core" % tikaVersion % Test ), excludeFilter := excludeFilter.value || "module-info.java", javaModuleName := "org.enso.language.server", Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, - "commons-cli" % "commons-cli" % commonsCliVersion, - "commons-io" % "commons-io" % commonsIoVersion, - "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion ) }, Compile / internalModuleDependencies := Seq( @@ -2156,7 +2156,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`filewatcher` / Compile / exportedModule).value, (`version-output` / Compile / exportedModule).value, (`semver` / Compile / exportedModule).value, - (`cli` / Compile / exportedModule).value, + (`cli` / Compile / exportedModule).value ), Test / testOptions += Tests .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), @@ -2185,47 +2185,47 @@ lazy val `language-server` = (project in file("engine/language-server")) }, // More dependencies needed for modules for testing libraryDependencies ++= Seq( - "com.google.protobuf" % "protobuf-java" % "3.25.1" % Test, - "org.reactivestreams" % "reactive-streams" % "1.0.3" % Test, - "org.jline" % "jline" % jlineVersion % Test, - "io.sentry" % "sentry-logback" % "6.28.0" % Test, - "io.sentry" % "sentry" % "6.28.0" % Test, - "ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test, - "ch.qos.logback" % "logback-core" % logbackClassicVersion % Test, - "org.apache.tika" % "tika-core" % tikaVersion % Test, - "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion % Test, - "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion % Test, - "org.apache.commons" % "commons-lang3" % commonsLangVersion % Test, - "org.apache.commons" % "commons-compress" % commonsCompressVersion % Test, - "org.yaml" % "snakeyaml" % snakeyamlVersion % Test, - "com.ibm.icu" % "icu4j" % icuVersion % Test, + "com.google.protobuf" % "protobuf-java" % "3.25.1" % Test, + "org.reactivestreams" % "reactive-streams" % "1.0.3" % Test, + "org.jline" % "jline" % jlineVersion % Test, + "io.sentry" % "sentry-logback" % "6.28.0" % Test, + "io.sentry" % "sentry" % "6.28.0" % Test, + "ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test, + "ch.qos.logback" % "logback-core" % logbackClassicVersion % Test, + "org.apache.tika" % "tika-core" % tikaVersion % Test, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion % Test, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion % Test, + "org.apache.commons" % "commons-lang3" % commonsLangVersion % Test, + "org.apache.commons" % "commons-compress" % commonsCompressVersion % Test, + "org.yaml" % "snakeyaml" % snakeyamlVersion % Test, + "com.ibm.icu" % "icu4j" % icuVersion % Test ), Test / moduleDependencies := { GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, - "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "org.apache.commons" % "commons-lang3" % commonsLangVersion, - "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "commons-io" % "commons-io" % commonsIoVersion, - "com.google.protobuf" % "protobuf-java" % "3.25.1", - "org.reactivestreams" % "reactive-streams" % "1.0.3", - "org.jline" % "jline" % jlineVersion, - "org.apache.tika" % "tika-core" % tikaVersion, - "com.ibm.icu" % "icu4j" % icuVersion, - "io.sentry" % "sentry-logback" % "6.28.0", - "io.sentry" % "sentry" % "6.28.0", - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion, - "net.java.dev.jna" % "jna" % "5.13.0", - "org.bouncycastle" % "bcutil-jdk18on" % "1.76", - "org.bouncycastle" % "bcpkix-jdk18on" % "1.76", - "org.bouncycastle" % "bcprov-jdk18on" % "1.76", + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "com.google.protobuf" % "protobuf-java" % "3.25.1", + "org.reactivestreams" % "reactive-streams" % "1.0.3", + "org.jline" % "jline" % jlineVersion, + "org.apache.tika" % "tika-core" % tikaVersion, + "com.ibm.icu" % "icu4j" % icuVersion, + "io.sentry" % "sentry-logback" % "6.28.0", + "io.sentry" % "sentry" % "6.28.0", + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion, + "net.java.dev.jna" % "jna" % "5.13.0", + "org.bouncycastle" % "bcutil-jdk18on" % "1.76", + "org.bouncycastle" % "bcpkix-jdk18on" % "1.76", + "org.bouncycastle" % "bcprov-jdk18on" % "1.76" ) }, Test / internalModuleDependencies := Seq( @@ -2268,7 +2268,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`semver` / Compile / exportedModule).value, (`downloader` / Compile / exportedModule).value, (`logging-config` / Compile / exportedModule).value, - (`logging-service` / Compile / exportedModule).value, + (`logging-service` / Compile / exportedModule).value ), Test / javaOptions ++= testLogProviderOptions, Test / patchModules := { @@ -2286,7 +2286,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`syntax-rust-definition` / javaModuleName).value, (`profiling-utils` / javaModuleName).value, (`ydoc-server` / javaModuleName).value, - (`library-manager` / javaModuleName).value, + (`library-manager` / javaModuleName).value ), Test / addReads := { // We patched the test-classes into the runtime module. These classes access some stuff from @@ -2299,10 +2299,10 @@ lazy val `language-server` = (project in file("engine/language-server")) ) }, Test / addExports := { - val profModName = (`profiling-utils` / javaModuleName).value + val profModName = (`profiling-utils` / javaModuleName).value val downloaderModName = (`downloader` / javaModuleName).value val exports = Map( - profModName + "/org.enso.profiling.snapshot" -> Seq("ALL-UNNAMED"), + profModName + "/org.enso.profiling.snapshot" -> Seq("ALL-UNNAMED"), downloaderModName + "/org.enso.downloader.archive" -> Seq("ALL-UNNAMED") ) @@ -2310,9 +2310,8 @@ lazy val `language-server` = (project in file("engine/language-server")) // to all unnamed modules val testPkgs = (Test / packages).value val testPkgsExports = testPkgs.map { pkg => - javaModuleName.value + "/" + pkg -> Seq("ALL-UNNAMED") - } - .toMap + javaModuleName.value + "/" + pkg -> Seq("ALL-UNNAMED") + }.toMap exports ++ testPkgsExports } ) @@ -2426,7 +2425,7 @@ def customFrgaalJavaCompilerSettings(targetJdk: String) = { // project, and module-info.java is excluded from the compilation. // shouldCompileModuleInfoManually is a settingKey defined only in projects // with JPMSPlugin. That's why we have to check first for its existance. - val settingOpt = (config / shouldCompileModuleInfoManually).?.value + val settingOpt = (config / shouldCompileModuleInfoManually).?.value val shouldCompileModInfo = settingOpt.isDefined && settingOpt.get FrgaalJavaCompiler.compilers( (config / dependencyClasspath).value, @@ -2629,7 +2628,7 @@ lazy val runtime = (project in file("engine/runtime")) (`interpreter-dsl` / Compile / exportedModule).value, (`persistance` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, - (`scala-libs-wrapper` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value ) ) .settings( @@ -2674,22 +2673,22 @@ lazy val `runtime-integration-tests` = annotationProcSetting, commands += WithDebugCommand.withDebug, libraryDependencies ++= GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq( - "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, - "org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion, - "org.graalvm.truffle" % "truffle-tck-tests" % graalMavenPackagesVersion, - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, - "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, - "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 + "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, + "org.graalvm.truffle" % "truffle-tck-common" % graalMavenPackagesVersion, + "org.graalvm.truffle" % "truffle-tck-tests" % graalMavenPackagesVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, + "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 / fork := true, Test / parallelExecution := false, @@ -2708,29 +2707,29 @@ lazy val `runtime-integration-tests` = Test / javaOptions ++= testLogProviderOptions, Test / moduleDependencies := { GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.apache.commons" % "commons-lang3" % commonsLangVersion, - "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "commons-io" % "commons-io" % commonsIoVersion, - "org.apache.tika" % "tika-core" % tikaVersion, - "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, - "com.ibm.icu" % "icu4j" % icuVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "org.apache.tika" % "tika-core" % tikaVersion, + "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, + "com.ibm.icu" % "icu4j" % icuVersion, "org.jline" % "jline" % jlineVersion, - "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "io.sentry" % "sentry-logback" % "6.28.0", - "io.sentry" % "sentry" % "6.28.0", - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.sentry" % "sentry-logback" % "6.28.0", + "io.sentry" % "sentry" % "6.28.0", + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion ) }, Test / internalModuleDependencies := Seq( @@ -2771,7 +2770,7 @@ lazy val `runtime-integration-tests` = (`semver` / Compile / exportedModule).value, (`downloader` / Compile / exportedModule).value, (`logging-config` / Compile / exportedModule).value, - (`logging-service` / Compile / exportedModule).value, + (`logging-service` / Compile / exportedModule).value ), Test / patchModules := { // Patch test-classes into the runtime module. This is standard way to deal with the @@ -2829,8 +2828,7 @@ lazy val `runtime-integration-tests` = val testPkgs = (Test / packages).value val testPkgsExports = testPkgs.map { pkg => runtimeModName + "/" + pkg -> Seq("ALL-UNNAMED") - } - .toMap + }.toMap exports ++ testPkgsExports } ) @@ -2853,19 +2851,19 @@ lazy val `runtime-benchmarks` = // Note that withDebug command only makes sense if you use `@Fork(0)` in your benchmarks. commands += WithDebugCommand.withDebug, libraryDependencies ++= GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.toolsPkgs ++ helidon ++ 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, - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, - "org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided", - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.slf4j" % "slf4j-nop" % slf4jVersion, - "io.sentry" % "sentry" % "6.28.0", - "io.sentry" % "sentry-logback" % "6.28.0", - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion, - "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, + "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, + "org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided", + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.slf4j" % "slf4j-nop" % slf4jVersion, + "io.sentry" % "sentry" % "6.28.0", + "io.sentry" % "sentry-logback" % "6.28.0", + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion ), mainClass := Some("org.enso.interpreter.bench.benchmarks.RuntimeBenchmarksRunner"), @@ -2877,26 +2875,26 @@ lazy val `runtime-benchmarks` = parallelExecution := false, Compile / moduleDependencies := { GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, - "org.apache.commons" % "commons-lang3" % commonsLangVersion, - "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "commons-io" % "commons-io" % commonsIoVersion, - "org.apache.tika" % "tika-core" % tikaVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.slf4j" % "slf4j-nop" % slf4jVersion, - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, - "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, - "com.ibm.icu" % "icu4j" % icuVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "org.apache.tika" % "tika-core" % tikaVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.slf4j" % "slf4j-nop" % slf4jVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, + "com.ibm.icu" % "icu4j" % icuVersion, "org.jline" % "jline" % jlineVersion, - "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "io.sentry" % "sentry-logback" % "6.28.0", - "io.sentry" % "sentry" % "6.28.0", - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.sentry" % "sentry-logback" % "6.28.0", + "io.sentry" % "sentry" % "6.28.0", + "ch.qos.logback" % "logback-classic" % logbackClassicVersion, + "ch.qos.logback" % "logback-core" % logbackClassicVersion ) }, Compile / internalModuleDependencies := Seq( @@ -2936,7 +2934,7 @@ lazy val `runtime-benchmarks` = (`semver` / Compile / exportedModule).value, (`downloader` / Compile / exportedModule).value, (`logging-config` / Compile / exportedModule).value, - (`logging-service` / Compile / exportedModule).value, + (`logging-service` / Compile / exportedModule).value ), Compile / addModules := Seq( (`runtime` / javaModuleName).value, @@ -2945,11 +2943,13 @@ lazy val `runtime-benchmarks` = // Benchmark sources are patched into the `org.enso.runtime` module Compile / patchModules := { val runtimeModName = (`runtime` / javaModuleName).value - val javaSrcDir = (Compile / javaSource).value - val classesDir = (Compile / productDirectories).value.head - val testUtilsClasses = (`test-utils` / Compile / productDirectories).value.head - val benchCommonClasses = (`benchmarks-common` / Compile / productDirectories).value.head - Map ( + val javaSrcDir = (Compile / javaSource).value + val classesDir = (Compile / productDirectories).value.head + val testUtilsClasses = + (`test-utils` / Compile / productDirectories).value.head + val benchCommonClasses = + (`benchmarks-common` / Compile / productDirectories).value.head + Map( runtimeModName -> Seq( javaSrcDir, classesDir, @@ -2967,7 +2967,7 @@ lazy val `runtime-benchmarks` = }, Compile / addExports := { val runtimeModName = (`runtime` / javaModuleName).value - val pkgs = (Compile / packages).value + val pkgs = (Compile / packages).value val pkgsExports = pkgs.map { pkg => runtimeModName + "/" + pkg -> Seq("ALL-UNNAMED") }.toMap @@ -3789,7 +3789,7 @@ lazy val editions = project (`scala-yaml` / Compile / exportedModule).value, (`version-output` / Compile / exportedModule).value, (`semver` / Compile / exportedModule).value, - (`scala-libs-wrapper` / Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value ) ) .settings( @@ -3993,7 +3993,7 @@ lazy val `library-manager-test` = project (`downloader` / Compile / exportedModule).value, (`editions` / Compile / exportedModule).value, (`version-output` / Compile / exportedModule).value, - (`testkit` / Compile / exportedModule).value, + (`testkit` / Compile / exportedModule).value ) ) .dependsOn(`library-manager`) @@ -4076,7 +4076,7 @@ lazy val `process-utils` = project compileOrder := CompileOrder.ScalaThenJava, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion - ), + ) ) lazy val `runtime-version-manager-test` = project diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala index 986de0f7b336..4cf21cce269b 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/boot/resource/RepoInitializationSpec.scala @@ -9,7 +9,11 @@ import org.enso.languageserver.data._ import org.enso.languageserver.event.InitializedEvent import org.enso.languageserver.filemanager.{ContentRoot, ContentRootWithFile} import org.enso.searcher.memory.InMemorySuggestionsRepo -import org.enso.testkit.{FlakySpec, ReportLogsOnFailure, ToScalaFutureConversions} +import org.enso.testkit.{ + FlakySpec, + ReportLogsOnFailure, + ToScalaFutureConversions +} import org.scalatest.BeforeAndAfterAll import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpecLike diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala index 1e94c1c534b7..3021ff9b31b8 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/filemanager/ContentRootManagerSpec.scala @@ -11,7 +11,11 @@ import org.enso.languageserver.filemanager.ContentRootManagerProtocol.{ SubscribeToNotifications } import org.enso.polyglot.runtime.Runtime.Api -import org.enso.testkit.{EitherValue, ReportLogsOnFailure, WithTemporaryDirectory} +import org.enso.testkit.{ + EitherValue, + ReportLogsOnFailure, + WithTemporaryDirectory +} import org.scalatest.concurrent.Futures import org.scalatest.concurrent.ScalaFutures.convertScalaFuture import org.scalatest.matchers.should.Matchers diff --git a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala index 4776bece9ff9..84d5e24ba8cb 100644 --- a/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala +++ b/engine/language-server/src/test/scala/org/enso/languageserver/websocket/json/LibrariesTest.scala @@ -7,11 +7,18 @@ import org.enso.semver.SemVer import org.enso.distribution.FileSystem import org.enso.editions.{Editions, LibraryName} import org.enso.languageserver.libraries.LibraryEntry.PublishedLibraryVersion -import org.enso.languageserver.libraries.{LibraryComponentGroup, LibraryComponentGroups, LibraryEntry} +import org.enso.languageserver.libraries.{ + LibraryComponentGroup, + LibraryComponentGroups, + LibraryEntry +} import org.enso.languageserver.runtime.TestComponentGroups import org.enso.librarymanager.published.bundles.LocalReadOnlyRepository import org.enso.librarymanager.published.repository.LibraryManifest -import org.enso.librarymanager.test.published.repository.{EmptyRepository, ExampleRepository} +import org.enso.librarymanager.test.published.repository.{ + EmptyRepository, + ExampleRepository +} import org.enso.pkg.{Config, Contact, Package, PackageManager} import org.enso.testkit.{FlakySpec, ReportLogsOnFailure} import org.enso.version.BuildVersion diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java index 697396c1bf30..5b57fb4af057 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java @@ -1,21 +1,18 @@ package org.enso.interpreter.test; - -import java.lang.invoke.MethodHandles; -import org.junit.Test; - import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; +import java.lang.invoke.MethodHandles; +import org.junit.Test; /** * Test source in `runtime-integration-tests` sbt project should be patched to the * `org.enso.runtime` module. This is necessary to allow calling Java methods from Enso code. - * Moreover, there are other testing facilities that require reflective access to the classes - * inside `org.enso.runtime` module. - * One of the facilities is - * {@link com.oracle.truffle.host.HostClassDesc#getLookup(Class, HostClassCache) truffle host lookup}. + * Moreover, there are other testing facilities that require reflective access to the classes inside + * `org.enso.runtime` module. One of the facilities is {@link + * com.oracle.truffle.host.HostClassDesc#getLookup(Class, HostClassCache) truffle host lookup}. */ public class TestJPMSModuleConfiguration { @@ -24,9 +21,7 @@ public void testPackagesArePatchedToRuntimeModule() { var clazz = VectorTest.class; var modName = clazz.getModule().getName(); assertThat( - "Test packages are patched to org.enso.runtime module", - modName, - is("org.enso.runtime")); + "Test packages are patched to org.enso.runtime module", modName, is("org.enso.runtime")); } @Test diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java index 41e3999364e6..f06dfec025c1 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java @@ -7,8 +7,8 @@ import org.junit.Test; /** - * In the `runtime/Test` testing suite, {@link TestLogProvider} should be among the - * logging providers, because it is explicitly chosen as the logging provider for the tests. + * In the `runtime/Test` testing suite, {@link TestLogProvider} should be among the logging + * providers, because it is explicitly chosen as the logging provider for the tests. */ public class TestLogProviderOnModulePath { @Test diff --git a/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala index 843a6aa910df..da8d9d197f9b 100644 --- a/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/compiler/test/pass/analyse/AliasAnalysisTest.scala @@ -3,8 +3,15 @@ package org.enso.compiler.test.pass.analyse import org.enso.compiler.Passes import org.enso.compiler.context.{FreshNameSupply, InlineContext, ModuleContext} import org.enso.compiler.core.Implicits.AsMetadata -import org.enso.compiler.core.ir.{CallArgument, Expression, Function, Module, Name, Pattern} -import org.enso.compiler.core.ir.expression.{Application, Case, errors} +import org.enso.compiler.core.ir.{ + CallArgument, + Expression, + Function, + Module, + Name, + Pattern +} +import org.enso.compiler.core.ir.expression.{errors, Application, Case} import org.enso.compiler.core.ir.module.scope.Definition import org.enso.compiler.core.ir.module.scope.definition import org.enso.compiler.pass.PassConfiguration._ diff --git a/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala index fe2ebb1de249..587863670cfc 100644 --- a/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/interpreter/test/instrument/RuntimeServerTest.scala @@ -76,7 +76,6 @@ class RuntimeServerTest .invokeMember(MethodNames.TopScope.LEAK_CONTEXT) .asHostObject[EnsoContext] - private def ensureInstrumentsAvailable() = { val instruments = context.getEngine.getInstruments if (instruments.get(IdExecutionService.INSTRUMENT_ID) == null) { diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java index 144bca6dfb35..b1d46a6509e9 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/HostClassLoader.java @@ -35,9 +35,8 @@ public HostClassLoader() { static { var bootModules = ModuleLayer.boot().modules(); - var hasRuntimeMod = bootModules - .stream() - .anyMatch(module -> module.getName().equals("org.enso.runtime")); + var hasRuntimeMod = + bootModules.stream().anyMatch(module -> module.getName().equals("org.enso.runtime")); isRuntimeModInBootLayer = hasRuntimeMod; } diff --git a/lib/scala/distribution-manager/src/main/java/module-info.java b/lib/scala/distribution-manager/src/main/java/module-info.java index 736bcd1e9d0b..ba7b64cb3cce 100644 --- a/lib/scala/distribution-manager/src/main/java/module-info.java +++ b/lib/scala/distribution-manager/src/main/java/module-info.java @@ -5,7 +5,6 @@ requires org.enso.scala.wrapper; requires org.enso.scala.yaml; requires org.enso.semver; - requires org.yaml.snakeyaml; requires org.slf4j; diff --git a/lib/scala/editions/src/main/java/module-info.java b/lib/scala/editions/src/main/java/module-info.java index 31d4777692a4..cc49f8f59040 100644 --- a/lib/scala/editions/src/main/java/module-info.java +++ b/lib/scala/editions/src/main/java/module-info.java @@ -1,11 +1,9 @@ module org.enso.editions { requires scala.library; - requires org.enso.semver; requires org.enso.scala.yaml; requires org.enso.scala.wrapper; requires org.enso.version.output; - requires org.yaml.snakeyaml; exports org.enso.editions; diff --git a/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala b/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala index b724a61b74ea..e3ab95452902 100644 --- a/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala +++ b/lib/scala/filewatcher/src/main/scala/org/enso/filewatcher/WatcherAdapter.scala @@ -1,6 +1,10 @@ package org.enso.filewatcher -import io.methvin.watcher.{DirectoryChangeEvent, DirectoryChangeListener, DirectoryWatcher} +import io.methvin.watcher.{ + DirectoryChangeEvent, + DirectoryChangeListener, + DirectoryWatcher +} import org.slf4j.LoggerFactory import java.util.concurrent.Executor @@ -22,7 +26,6 @@ final class WatcherAdapter( private val logger = LoggerFactory.getLogger(classOf[WatcherAdapter]) - private val watcher: DirectoryWatcher = try { DirectoryWatcher diff --git a/lib/scala/library-manager-test/src/main/java/module-info.java b/lib/scala/library-manager-test/src/main/java/module-info.java index 5d2456a75442..69df2897b17a 100644 --- a/lib/scala/library-manager-test/src/main/java/module-info.java +++ b/lib/scala/library-manager-test/src/main/java/module-info.java @@ -1,6 +1,5 @@ module org.enso.librarymanager.test { requires scala.library; - requires org.enso.cli; requires org.enso.distribution; requires org.enso.downloader; diff --git a/lib/scala/library-manager-test/src/test/scala/org/enso/librarymanager/published/repository/LibraryDownloadTest.scala b/lib/scala/library-manager-test/src/test/scala/org/enso/librarymanager/published/repository/LibraryDownloadTest.scala index e9bf0d9b5e66..f6de0a82c434 100644 --- a/lib/scala/library-manager-test/src/test/scala/org/enso/librarymanager/published/repository/LibraryDownloadTest.scala +++ b/lib/scala/library-manager-test/src/test/scala/org/enso/librarymanager/published/repository/LibraryDownloadTest.scala @@ -2,7 +2,10 @@ package org.enso.librarymanager.published.repository import org.enso.editions.Editions import org.enso.librarymanager.published.cache.DownloadingLibraryCache -import org.enso.librarymanager.test.published.repository.{DownloaderTest, ExampleRepository} +import org.enso.librarymanager.test.published.repository.{ + DownloaderTest, + ExampleRepository +} import org.enso.logger.TestLogMessage import org.enso.pkg.PackageManager import org.enso.testkit.{RetrySpec, WithTemporaryDirectory} diff --git a/lib/scala/library-manager-test/src/test/scala/org/enso/libraryupload/LibraryUploadTest.scala b/lib/scala/library-manager-test/src/test/scala/org/enso/libraryupload/LibraryUploadTest.scala index b6f79c12d3ad..1febfa760bbc 100644 --- a/lib/scala/library-manager-test/src/test/scala/org/enso/libraryupload/LibraryUploadTest.scala +++ b/lib/scala/library-manager-test/src/test/scala/org/enso/libraryupload/LibraryUploadTest.scala @@ -3,7 +3,10 @@ package org.enso.libraryupload import org.enso.semver.SemVer import org.enso.cli.task.{ProgressReporter, TaskProgress} import org.enso.editions.{Editions, LibraryName} -import org.enso.librarymanager.test.published.repository.{DownloaderTest, EmptyRepository} +import org.enso.librarymanager.test.published.repository.{ + DownloaderTest, + EmptyRepository +} import org.enso.libraryupload.auth.SimpleHeaderToken import org.enso.pkg.{Package, PackageManager} import org.enso.testkit.WithTemporaryDirectory diff --git a/lib/scala/library-manager/src/main/java/module-info.java b/lib/scala/library-manager/src/main/java/module-info.java index ee3580606eb5..76eddc06aa16 100644 --- a/lib/scala/library-manager/src/main/java/module-info.java +++ b/lib/scala/library-manager/src/main/java/module-info.java @@ -10,7 +10,6 @@ // For com.typesafe.scalalogging.Logger requires org.enso.scala.wrapper; requires org.enso.scala.yaml; - requires org.yaml.snakeyaml; requires org.slf4j; diff --git a/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java b/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java index 1a2e00b4b985..7f78742c4911 100644 --- a/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java +++ b/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java @@ -12,8 +12,9 @@ import org.slf4j.spi.SLF4JServiceProvider; /** - * In the `runtime/Test` testing suite, {@link }org.enso.logging.service.logback.test.provider.TestLogProvider} should be among the - * logging providers, because it is explicitly chosen as the logging provider for the tests. + * In the `runtime/Test` testing suite, {@link + * }org.enso.logging.service.logback.test.provider.TestLogProvider} should be among the logging + * providers, because it is explicitly chosen as the logging provider for the tests. * *

Note that the same test is in the `runtime/Test` project. */ @@ -28,15 +29,16 @@ public void testLogProviderIsOnClasspath() { } List providerNames = providers.stream().map(elem -> elem.getClass().getName()).collect(Collectors.toList()); - assertThat(providerNames, hasItem("org.enso.logging.service.logback.test.provider.TestLogProvider")); + assertThat( + providerNames, hasItem("org.enso.logging.service.logback.test.provider.TestLogProvider")); } @Test public void testLogProviderIsInUnnamedModule() { Class testLogProviderClass = null; try { - testLogProviderClass = Class.forName( - "org.enso.logging.service.logback.test.provider.TestLogProvider"); + testLogProviderClass = + Class.forName("org.enso.logging.service.logback.test.provider.TestLogProvider"); } catch (ClassNotFoundException e) { fail("TestLogProvider class not found"); } diff --git a/project/FrgaalJavaCompiler.scala b/project/FrgaalJavaCompiler.scala index 7b32ebb9d26d..6b9787be7723 100644 --- a/project/FrgaalJavaCompiler.scala +++ b/project/FrgaalJavaCompiler.scala @@ -141,8 +141,8 @@ object FrgaalJavaCompiler { if (!moduleInfo.exists()) { log.warn( s"[FrgaalJavaCompiler] module-info.java not found in $javaSourceDir, but " + - "settings of the project require to compile it. Ensure that the setting of " + - "`shouldCompileModuleInfoManually` is correctly set." + "settings of the project require to compile it. Ensure that the setting of " + + "`shouldCompileModuleInfoManually` is correctly set." ) log.info( s"[FrgaalJavaCompiler] compiling ${sources.size} Java sources to $out ..." diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index a2832e2c52f8..421d99026ee3 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -16,8 +16,8 @@ import scala.collection.mutable * * If this plugin is enabled, and no settings/tasks from this plugin are used, then the plugin will * not inject anything into `javaOptions` or `javacOptions`. - * - * - `compileOrder` has to be specified before `libraryDependencies` + * + * - `compileOrder` has to be specified before `libraryDependencies` */ object JPMSPlugin extends AutoPlugin { object autoImport { @@ -65,7 +65,7 @@ object JPMSPlugin extends AutoPlugin { |""".stripMargin ) - val addOpens = taskKey[Map[String, Seq[String]]] ( + val addOpens = taskKey[Map[String, Seq[String]]]( """ |A map of module names with packages to modules that will be put into --add-opens option to java. |Note that this option is not added to `javac`, only to `java`. @@ -122,28 +122,28 @@ object JPMSPlugin extends AutoPlugin { val javaSrcDir = (config / javaSource).value val modInfo = javaSrcDir.toPath.resolve("module-info.java").toFile - val hasModInfo = modInfo.exists - val projName = moduleName.value - val logger = streams.value.log + val hasModInfo = modInfo.exists + val projName = moduleName.value + val logger = streams.value.log val hasScalaSources = (config / scalaSource).value.exists() - val _compileOrder = (config / compileOrder).value + val _compileOrder = (config / compileOrder).value val res = _compileOrder == CompileOrder.Mixed && - hasModInfo && - hasScalaSources + hasModInfo && + hasScalaSources if (res) { logger.debug( s"[JPMSPlugin] Project '$projName' will have `module-info.java` compiled " + - "manually. If this is not the intended behavior, consult the documentation " + - "of JPMSPlugin." + "manually. If this is not the intended behavior, consult the documentation " + + "of JPMSPlugin." ) } // Check excludeFilter - there should be module-info.java specified if (res && !excludeFilter.value.accept(modInfo)) { logger.error( s"[JPMSPlugin/$projName] `module-info.java` is not in `excludeFilter`. " + - "You should add module-info.java to " + - "`excludedFilter` so that sbt does not handle the compilation. Check docs of JPMSPlugin." + "You should add module-info.java to " + + "`excludedFilter` so that sbt does not handle the compilation. Check docs of JPMSPlugin." ) } res @@ -188,13 +188,13 @@ object JPMSPlugin extends AutoPlugin { val targetClassDir = (config / exportedProducts).value .map(_.data) .head - val logger = streams.value.log + val logger = streams.value.log val projName = moduleName.value if (!isModule(targetClassDir)) { logger.error( s"[JPMSPlugin/$projName] The target classes directory ${targetClassDir.getAbsolutePath} is not " + - "a module - it does not contain module-info.class. Make sure the `compileModuleInfo` task " + - "is set correctly." + "a module - it does not contain module-info.class. Make sure the `compileModuleInfo` task " + + "is set correctly." ) } targetClassDir @@ -236,8 +236,12 @@ object JPMSPlugin extends AutoPlugin { ) }, // Sanitize cmd line arguments - config / javacOptions := joinModulePathOption((config / javacOptions).value), - config / javaOptions := joinModulePathOption((config / javaOptions).value) + config / javacOptions := joinModulePathOption( + (config / javacOptions).value + ), + config / javaOptions := joinModulePathOption( + (config / javaOptions).value + ) ) } } @@ -396,20 +400,19 @@ object JPMSPlugin extends AutoPlugin { modulePathOpts ++ addModsOpts ++ patchOpts ++ addExportsOpts ++ addReadsOpts ++ addOpensOpts } - /** - * Searches for multiple `--module-path` cmd line options and joins them into a single - * option. - * If there are multiple `--module-path` options passed to `java` or `javac`, only the - * last one specified is considered. - * Note that this is not an issue for other JPMS-related cmd line options, like - * `--add-modules` - * @param opts Current value of cmd line options - * @return - */ + /** Searches for multiple `--module-path` cmd line options and joins them into a single + * option. + * If there are multiple `--module-path` options passed to `java` or `javac`, only the + * last one specified is considered. + * Note that this is not an issue for other JPMS-related cmd line options, like + * `--add-modules` + * @param opts Current value of cmd line options + * @return + */ private def joinModulePathOption( opts: Seq[String] ): Seq[String] = { - val modulePathOpt = new StringBuilder() + val modulePathOpt = new StringBuilder() val optIdxToRemove = mutable.HashSet[Int]() // Find all `--module-path` options and join them into a single option for ((opt, idx) <- opts.zipWithIndex) { diff --git a/project/PackageListPlugin.scala b/project/PackageListPlugin.scala index a601343253ac..308e16d17547 100644 --- a/project/PackageListPlugin.scala +++ b/project/PackageListPlugin.scala @@ -6,13 +6,12 @@ import java.io.File import java.nio.file.Path import scala.collection.mutable -/** - * sbt plugin for gathering set of packages contained in the current project. - * The packages are gathered via recursive directory listing. - */ +/** sbt plugin for gathering set of packages contained in the current project. + * The packages are gathered via recursive directory listing. + */ object PackageListPlugin extends AutoPlugin { object autoImport { - val packages = taskKey[Set[String]] ( + val packages = taskKey[Set[String]]( "Set of packages in the source directory" ) } @@ -25,24 +24,22 @@ object PackageListPlugin extends AutoPlugin { ).value, Test / packages := listOfPackages( ScopeFilter(configurations = inConfigurations(Test)) - ).value, + ).value ) private def listOfPackages( scopeFilter: ScopeFilter ): Def.Initialize[Task[Set[String]]] = Def.task { - val javaSrcDir = javaSource.all(scopeFilter).value.head + val javaSrcDir = javaSource.all(scopeFilter).value.head val scalaSrcDir = scalaSource.all(scopeFilter).value.head listOfPackages(List(javaSrcDir, scalaSrcDir)) } - - /** - * From the given source directory, iterates all files and gathers the list of packages. - * Implemented with recursive listing of directories. - * @param srcDir The source directory, either Java or Scala. - * @return Set of packages found in the source directory. - */ + /** From the given source directory, iterates all files and gathers the list of packages. + * Implemented with recursive listing of directories. + * @param srcDir The source directory, either Java or Scala. + * @return Set of packages found in the source directory. + */ private def listOfPackages(srcDirs: List[File]): Set[String] = { val pkgs = mutable.HashSet.empty[String] srcDirs.foreach { srcDir => @@ -62,13 +59,12 @@ object PackageListPlugin extends AutoPlugin { val files = curDir.listFiles for (file <- files) { if (file.isFile) { - val fPath = file.toPath + val fPath = file.toPath val relativePath = rootDir.relativize(fPath) - val pkgPart = relativePath.subpath(0, relativePath.getNameCount - 1) - val pkg = pkgPart.toString.replace(File.separator, ".") + val pkgPart = relativePath.subpath(0, relativePath.getNameCount - 1) + val pkg = pkgPart.toString.replace(File.separator, ".") pkgs.add(pkg) - } - else if (file.isDirectory) { + } else if (file.isDirectory) { listOfPackages(rootDir, file, pkgs) } } From 4dacbaac3ea7ee2d46f239fc818e2b3518c337da Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 4 Sep 2024 14:00:13 +0200 Subject: [PATCH 173/268] Fix afetr merge --- build.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sbt b/build.sbt index 4f89a262405d..52e415c9adaa 100644 --- a/build.sbt +++ b/build.sbt @@ -2333,7 +2333,6 @@ 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`) From 754c712f44c4787771a8e10a1faf57cb21e498fe Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 4 Sep 2024 14:22:13 +0200 Subject: [PATCH 174/268] Add module deps after merge --- build.sbt | 2 ++ .../src/main/java/module-info.java | 1 + engine/runtime/src/main/java/module-info.java | 16 ++++++++++------ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/build.sbt b/build.sbt index 52e415c9adaa..0bf5b0763a82 100644 --- a/build.sbt +++ b/build.sbt @@ -3200,6 +3200,7 @@ lazy val `runtime-instrument-repl-debugger` = ), Compile / internalModuleDependencies := Seq( (`runtime-instrument-common` / Compile / exportedModule).value, + (`engine-common` / Compile / exportedModule).value, (`runtime` / Compile / exportedModule).value, (`polyglot-api` / Compile / exportedModule).value, (`runtime-compiler` / Compile / exportedModule).value @@ -3700,6 +3701,7 @@ lazy val `bench-processor` = (project in file("lib/scala/bench-processor")) lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) .enablePlugins(JPMSPlugin) + .enablePlugins(PackageListPlugin) .settings( frgaalJavaCompilerSetting, annotationProcSetting, diff --git a/engine/runtime-instrument-repl-debugger/src/main/java/module-info.java b/engine/runtime-instrument-repl-debugger/src/main/java/module-info.java index 8ee409ceb919..c9a7e1105afa 100644 --- a/engine/runtime-instrument-repl-debugger/src/main/java/module-info.java +++ b/engine/runtime-instrument-repl-debugger/src/main/java/module-info.java @@ -1,5 +1,6 @@ module org.enso.runtime.instrument.repl.debugger { requires scala.library; + requires org.enso.engine.common; requires org.enso.runtime.instrument.common; requires org.enso.runtime; requires org.enso.polyglot.api; diff --git a/engine/runtime/src/main/java/module-info.java b/engine/runtime/src/main/java/module-info.java index 5145f3a59fe4..e16c4dd440ca 100644 --- a/engine/runtime/src/main/java/module-info.java +++ b/engine/runtime/src/main/java/module-info.java @@ -32,22 +32,26 @@ exports org.enso.interpreter.caches; exports org.enso.interpreter.node; - exports org.enso.interpreter.runtime.callable; - exports org.enso.interpreter.runtime.state; exports org.enso.interpreter.runtime; + exports org.enso.interpreter.runtime.builtin; + exports org.enso.interpreter.runtime.callable; + exports org.enso.interpreter.runtime.callable.argument; + exports org.enso.interpreter.runtime.callable.function; + exports org.enso.interpreter.runtime.control; exports org.enso.interpreter.runtime.data; exports org.enso.interpreter.runtime.data.atom; + exports org.enso.interpreter.runtime.data.hash; exports org.enso.interpreter.runtime.data.text; - exports org.enso.interpreter.node.callable; - exports org.enso.interpreter.runtime.control; - exports org.enso.interpreter.runtime.callable.function; - exports org.enso.interpreter.runtime.library.dispatch; + exports org.enso.interpreter.runtime.data.vector; exports org.enso.interpreter.runtime.error; exports org.enso.interpreter.runtime.instrument; + exports org.enso.interpreter.runtime.library.dispatch; exports org.enso.interpreter.runtime.tag; exports org.enso.interpreter.runtime.scope; + exports org.enso.interpreter.runtime.state; exports org.enso.interpreter.runtime.type; exports org.enso.interpreter.runtime.warning; + exports org.enso.interpreter.node.callable; exports org.enso.interpreter.node.expression.builtin; exports org.enso.interpreter.node.expression.builtin.debug; exports org.enso.interpreter.node.expression.builtin.text.util; From e52724d117f9c2f7eac648757fafab29bb492372 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 4 Sep 2024 17:38:36 +0200 Subject: [PATCH 175/268] Print stack trace of the uncaught exception from the annotation processor --- .../main/java/org/enso/benchmarks/processor/BenchProcessor.java | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java index 74b065c240b3..3737ec01f761 100644 --- a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java +++ b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java @@ -124,6 +124,7 @@ public boolean process(Set annotations, RoundEnvironment return true; } catch (Exception e) { failWithMessage("Uncaught exception in " + getClass().getName() + ": " + e.getMessage()); + e.printStackTrace(System.out); return false; } } From 1927048ab01f840bf89dd610efbe598fb5f67c8f Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 6 Sep 2024 12:15:18 +0200 Subject: [PATCH 176/268] Remove akka-actor-typed from akka-wrapper --- build.sbt | 1 - .../akka-wrapper/src/main/java/module-info.java | 17 ----------------- 2 files changed, 18 deletions(-) diff --git a/build.sbt b/build.sbt index 72ce8c5b6345..ba578a2cb64c 100644 --- a/build.sbt +++ b/build.sbt @@ -1370,7 +1370,6 @@ lazy val `akka-wrapper` = project "com.typesafe" % "config" % typesafeConfigVersion, "io.spray" % ("spray-json_" + scalaVer) % "1.3.6", akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, - akkaURL % ("akka-actor-typed_" + scalaVer) % akkaVersion, akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, akkaURL % ("akka-http_" + scalaVer) % akkaHTTPVersion, akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, diff --git a/lib/java/akka-wrapper/src/main/java/module-info.java b/lib/java/akka-wrapper/src/main/java/module-info.java index 14d88e944966..e137feeadcde 100644 --- a/lib/java/akka-wrapper/src/main/java/module-info.java +++ b/lib/java/akka-wrapper/src/main/java/module-info.java @@ -35,23 +35,6 @@ exports akka.util; exports akka.util.ccompat; - // akka-actor-typed - exports akka.actor.typed; - exports akka.actor.typed.delivery; - exports akka.actor.typed.delivery.internal; - exports akka.actor.typed.eventstream; - exports akka.actor.typed.internal; - exports akka.actor.typed.internal.adapter; - exports akka.actor.typed.internal.jfr; - exports akka.actor.typed.internal.pubsub; - exports akka.actor.typed.internal.receptionist; - exports akka.actor.typed.internal.routing; - exports akka.actor.typed.javadsl; - exports akka.actor.typed.pubsub; - exports akka.actor.typed.receptionist; - exports akka.actor.typed.scaladsl; - exports akka.actor.typed.scaladsl.adapter; - // akka-http-core exports akka.http; exports akka.http.ccompat.imm; From acc41b793d816e195c3583778b407ace556e021c Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 6 Sep 2024 12:15:34 +0200 Subject: [PATCH 177/268] runtime-instrument-common depends on slf4j --- build.sbt | 3 ++- .../runtime-instrument-common/src/main/java/module-info.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ba578a2cb64c..2eae5a0ef0fb 100644 --- a/build.sbt +++ b/build.sbt @@ -3134,7 +3134,8 @@ lazy val `runtime-instrument-common` = "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.scala-lang" % "scala-library" % scalacVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( (`cli` / Compile / exportedModule).value, diff --git a/engine/runtime-instrument-common/src/main/java/module-info.java b/engine/runtime-instrument-common/src/main/java/module-info.java index cbc368636342..aa4df1340861 100644 --- a/engine/runtime-instrument-common/src/main/java/module-info.java +++ b/engine/runtime-instrument-common/src/main/java/module-info.java @@ -1,6 +1,7 @@ module org.enso.runtime.instrument.common { requires java.logging; requires scala.library; + requires org.slf4j; requires org.enso.cli; requires org.enso.distribution; From c43797b4f9d845aea9b2138590989b821b699173 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 6 Sep 2024 12:19:31 +0200 Subject: [PATCH 178/268] Fix module-path for runtime-instrument-repl-debugger --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2eae5a0ef0fb..8f8bc61459bb 100644 --- a/build.sbt +++ b/build.sbt @@ -3204,7 +3204,8 @@ lazy val `runtime-instrument-repl-debugger` = (`engine-common` / Compile / exportedModule).value, (`runtime` / Compile / exportedModule).value, (`polyglot-api` / Compile / exportedModule).value, - (`runtime-compiler` / Compile / exportedModule).value + (`runtime-compiler` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value, ) ) .dependsOn(LocalProject("runtime")) From e1875383a78fa95ab9ccb40728d6034cc9e2827c Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 9 Sep 2024 09:55:09 +0200 Subject: [PATCH 179/268] runtime-benchmarks depends on runtime-language-arrow --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index 8f8bc61459bb..2053e4d90dca 100644 --- a/build.sbt +++ b/build.sbt @@ -2899,6 +2899,7 @@ lazy val `runtime-benchmarks` = (`runtime-instrument-repl-debugger` / Compile / exportedModule).value, (`runtime-instrument-id-execution` / Compile / exportedModule).value, (`runtime-language-epb` / Compile / exportedModule).value, + (`runtime-language-arrow` / Compile / exportedModule).value, (`ydoc-server` / Compile / exportedModule).value, (`syntax-rust-definition` / Compile / exportedModule).value, (`profiling-utils` / Compile / exportedModule).value, From da63f66a0ed2377f78d90d13bdd955f903f0ff19 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 9 Sep 2024 10:09:44 +0200 Subject: [PATCH 180/268] --module-path is passed directly to frgaal --- project/FrgaalJavaCompiler.scala | 67 +++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 18 deletions(-) diff --git a/project/FrgaalJavaCompiler.scala b/project/FrgaalJavaCompiler.scala index 6b9787be7723..19c6d7cf5d13 100644 --- a/project/FrgaalJavaCompiler.scala +++ b/project/FrgaalJavaCompiler.scala @@ -109,6 +109,23 @@ object FrgaalJavaCompiler { x.toPath.toAbsolutePath.toString } + // Ensure that the --module-path option is passed to the frgaal compiler + // directly. This ensures that all + // the modules specified in the --module-path will be part of the boot + // module layer, and thus, ensure proper initialization of all the Truffle + // services. This is necessary if we try to initialize Truffle (execute Enso + // code) from an annotation processor. + // Note that the option is duplicated - passed directly to + // `java -jar frgaal-compiler.jar --module-path` and also inside the argfile + val strippedModulePath = findOptionValue( + nonJArgs, + optName => optName == "-p" || optName == "--module-path" + ) + val strippedAddModules = findOptionValue( + nonJArgs, + _ == "--add-modules" + ) + def asPath(a: Any): Path = a match { case p: PathBasedFile => p.toPath case p: Path => p @@ -262,25 +279,23 @@ object FrgaalJavaCompiler { val allArguments = outputOption ++ frgaalOptions ++ nonJArgs ++ allSources withArgumentFile(allArguments) { argsFile => - // List of modules that Frgaal can use for compilation - val limitModules = Seq( - "java.base", - "jdk.zipfs", - "jdk.internal.vm.compiler.management", - "java.desktop", - "java.net.http", - "java.sql", - "jdk.jfr" - ) - val limitModulesArgs = Seq( - "--limit-modules", - limitModules.mkString(",") - ) + val modulePathOpt = strippedModulePath match { + case Some(mp) => Seq("--module-path", mp) + case None => Seq() + } + val addModulesOpt = strippedAddModules match { + case Some(am) => Seq("--add-modules", am) + case None => Seq() + } // strippedJArgs needs to be passed via cmd line, and not via the argument file - val forkArgs = (strippedJArgs ++ limitModulesArgs ++ Seq( - "-jar", - compilerJar.toString - )) :+ + val forkArgs = ( + strippedJArgs ++ + modulePathOpt ++ + addModulesOpt ++ + Seq( + "-jar", + compilerJar.toString + )) :+ s"@${normalizeSlash(argsFile.getAbsolutePath)}" val exe = getJavaExecutable(javaHome, "java") val cwd = new File(new File(".").getAbsolutePath).getCanonicalFile @@ -294,6 +309,7 @@ object FrgaalJavaCompiler { " You should attach the debugger now." ) } + log.debug("Running " + exe + " " + forkArgs.mkString(" ")) try { exitCode = Process(exe +: forkArgs, cwd) ! javacLogger } finally { @@ -353,6 +369,21 @@ object FrgaalJavaCompiler { case Some(jh) => jh.resolve("bin").resolve(name).toAbsolutePath.toString } + + + private def findOptionValue( + options: Seq[String], + optNameMatcher: String => Boolean + ): Option[String] = { + options + .zipWithIndex + .collectFirst { + case (arg, idx) if optNameMatcher(arg) => + val optValue = options(idx + 1) + Some(optValue) + } + .flatten + } } /** An implementation of compiling java which forks Frgaal instance. */ From f64cc2e87ee4f150930896efba03caa8368b917e Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 9 Sep 2024 10:10:20 +0200 Subject: [PATCH 181/268] Fix some module-related cmd line options for std-benchmarks --- build.sbt | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index 2053e4d90dca..d2fac8a0bf57 100644 --- a/build.sbt +++ b/build.sbt @@ -3725,21 +3725,48 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) (LocalProject("bench-processor") / mainClass).value, Compile / javacOptions ++= Seq( "-Xlint:unchecked", - "-J-Dpolyglotimpl.DisableClassPathIsolation=true", - "-J-Dpolyglot.engine.WarnInterpreterOnly=false" ), Compile / moduleDependencies := { - componentModulesIds.value ++ Seq( - "org.slf4j" % "slf4j-nop" % slf4jVersion + (`runtime-benchmarks` / Compile / moduleDependencies).value + }, + (Compile / internalModuleDependencies) := { + (`runtime-benchmarks` / Compile / internalModuleDependencies).value + }, + Compile / addModules := Seq( + (`runtime` / javaModuleName).value + ), + // std benchmark sources are patch into the `org.enso.runtime` module + Compile / patchModules := { + val runtimeModName = (`runtime` / javaModuleName).value + val javaSrcDir = (Compile / javaSource).value + val classesDir = (Compile / productDirectories).value.head + Map( + runtimeModName -> Seq( + javaSrcDir, + classesDir + ) ) }, - addExports := { - Map("org.slf4j.nop/org.slf4j.nop" -> Seq("org.slf4j")) + Compile / addReads := { + (`runtime-benchmarks` / Compile / addReads).value + }, + // export all the packages to ALL-UNNAMED + Compile / addExports := { + val runtimeModName = (`runtime` / javaModuleName).value + val pkgs = (Compile / packages).value + val pkgsExports = pkgs.map { pkg => + runtimeModName + "/" + pkg -> Seq("ALL-UNNAMED") + }.toMap + + pkgsExports ++ 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" + //"-Dslf4j.provider=org.slf4j.nop.NOPServiceProvider" + "-Dslf4j.provider=ch.qos.logback.classic.spi.LogbackServiceProvider" ) }, javaOptions ++= benchOnlyOptions From 1fc692412dfa508c348c8da499085423e6fee99d Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 9 Sep 2024 10:22:45 +0200 Subject: [PATCH 182/268] Revert "--module-path is passed directly to frgaal" This reverts commit da63f66a0ed2377f78d90d13bdd955f903f0ff19. --- project/FrgaalJavaCompiler.scala | 67 +++++++++----------------------- 1 file changed, 18 insertions(+), 49 deletions(-) diff --git a/project/FrgaalJavaCompiler.scala b/project/FrgaalJavaCompiler.scala index 19c6d7cf5d13..6b9787be7723 100644 --- a/project/FrgaalJavaCompiler.scala +++ b/project/FrgaalJavaCompiler.scala @@ -109,23 +109,6 @@ object FrgaalJavaCompiler { x.toPath.toAbsolutePath.toString } - // Ensure that the --module-path option is passed to the frgaal compiler - // directly. This ensures that all - // the modules specified in the --module-path will be part of the boot - // module layer, and thus, ensure proper initialization of all the Truffle - // services. This is necessary if we try to initialize Truffle (execute Enso - // code) from an annotation processor. - // Note that the option is duplicated - passed directly to - // `java -jar frgaal-compiler.jar --module-path` and also inside the argfile - val strippedModulePath = findOptionValue( - nonJArgs, - optName => optName == "-p" || optName == "--module-path" - ) - val strippedAddModules = findOptionValue( - nonJArgs, - _ == "--add-modules" - ) - def asPath(a: Any): Path = a match { case p: PathBasedFile => p.toPath case p: Path => p @@ -279,23 +262,25 @@ object FrgaalJavaCompiler { val allArguments = outputOption ++ frgaalOptions ++ nonJArgs ++ allSources withArgumentFile(allArguments) { argsFile => - val modulePathOpt = strippedModulePath match { - case Some(mp) => Seq("--module-path", mp) - case None => Seq() - } - val addModulesOpt = strippedAddModules match { - case Some(am) => Seq("--add-modules", am) - case None => Seq() - } + // List of modules that Frgaal can use for compilation + val limitModules = Seq( + "java.base", + "jdk.zipfs", + "jdk.internal.vm.compiler.management", + "java.desktop", + "java.net.http", + "java.sql", + "jdk.jfr" + ) + val limitModulesArgs = Seq( + "--limit-modules", + limitModules.mkString(",") + ) // strippedJArgs needs to be passed via cmd line, and not via the argument file - val forkArgs = ( - strippedJArgs ++ - modulePathOpt ++ - addModulesOpt ++ - Seq( - "-jar", - compilerJar.toString - )) :+ + val forkArgs = (strippedJArgs ++ limitModulesArgs ++ Seq( + "-jar", + compilerJar.toString + )) :+ s"@${normalizeSlash(argsFile.getAbsolutePath)}" val exe = getJavaExecutable(javaHome, "java") val cwd = new File(new File(".").getAbsolutePath).getCanonicalFile @@ -309,7 +294,6 @@ object FrgaalJavaCompiler { " You should attach the debugger now." ) } - log.debug("Running " + exe + " " + forkArgs.mkString(" ")) try { exitCode = Process(exe +: forkArgs, cwd) ! javacLogger } finally { @@ -369,21 +353,6 @@ object FrgaalJavaCompiler { case Some(jh) => jh.resolve("bin").resolve(name).toAbsolutePath.toString } - - - private def findOptionValue( - options: Seq[String], - optNameMatcher: String => Boolean - ): Option[String] = { - options - .zipWithIndex - .collectFirst { - case (arg, idx) if optNameMatcher(arg) => - val optValue = options(idx + 1) - Some(optValue) - } - .flatten - } } /** An implementation of compiling java which forks Frgaal instance. */ From 33032cc12413dbf713d9bb83dfcf212a4de9a191 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Tue, 10 Sep 2024 06:59:12 +0200 Subject: [PATCH 183/268] Avoid closing of System.err when closing Context --- .../main/java/org/enso/benchmarks/processor/BenchProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java index 3737ec01f761..028b70aa2a38 100644 --- a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java +++ b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java @@ -103,7 +103,7 @@ public boolean process(Set annotations, RoundEnvironment .allowIO(IOAccess.ALL) .allowAllAccess(true) .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) - .logHandler(System.err) + .logHandler(new java.util.logging.ConsoleHandler()) .option(RuntimeOptions.PROJECT_ROOT, projectRootDir.getAbsolutePath()) .option(RuntimeOptions.LANGUAGE_HOME_OVERRIDE, ensoHomeOverride.getAbsolutePath()) .build()) { From acb330852f2cee34eabb110933adfb56261bfb06 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Tue, 10 Sep 2024 07:26:59 +0200 Subject: [PATCH 184/268] Avoid processing altogether when requested annotations are empty --- .../java/org/enso/benchmarks/processor/BenchProcessor.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java index 028b70aa2a38..2a3dbbf296db 100644 --- a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java +++ b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java @@ -87,6 +87,9 @@ public SourceVersion getSupportedSourceVersion() { @Override public boolean process(Set annotations, RoundEnvironment roundEnv) { + if (annotations.isEmpty()) { + return true; + } var elements = roundEnv.getElementsAnnotatedWith(GenerateBenchSources.class); for (var element : elements) { GenerateBenchSources annotation = element.getAnnotation(GenerateBenchSources.class); From 71563e458b50b2663062dbc6ac9630aa674844ea Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 10 Sep 2024 11:52:57 +0200 Subject: [PATCH 185/268] Pass shouldNotLimitModules opt to frgaal --- build.sbt | 12 +++++++++++- project/FrgaalJavaCompiler.scala | 20 ++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index d2fac8a0bf57..c20eb5d08d0d 100644 --- a/build.sbt +++ b/build.sbt @@ -269,6 +269,11 @@ ThisBuild / Test / testOptions ++= Compile / console / scalacOptions ~= (_ filterNot (_ == "-Xfatal-warnings")) +lazy val frgaalShouldNotLimitModules = Def.settingKey[Boolean]( + "Whether --limit-modules cmd line option should be passed to the java process that runs " + + "the frgaal compiler" +) + // ============================================================================ // === Benchmark Configuration ================================================ // ============================================================================ @@ -2422,12 +2427,16 @@ def customFrgaalJavaCompilerSettings(targetJdk: String) = { // with JPMSPlugin. That's why we have to check first for its existance. val settingOpt = (config / shouldCompileModuleInfoManually).?.value val shouldCompileModInfo = settingOpt.isDefined && settingOpt.get + val shouldNotLimitModulesOpt = frgaalShouldNotLimitModules.?.value + val _shouldNotLimitModules = shouldNotLimitModulesOpt.getOrElse(false) + val projName = projectID.value.name FrgaalJavaCompiler.compilers( (config / dependencyClasspath).value, compilers.value, targetJdk, shouldCompileModInfo, - (config / javaSource).value + (config / javaSource).value, + _shouldNotLimitModules ) } ) @@ -3706,6 +3715,7 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) .enablePlugins(JPMSPlugin) .enablePlugins(PackageListPlugin) .settings( + frgaalShouldNotLimitModules := true, frgaalJavaCompilerSetting, annotationProcSetting, libraryDependencies ++= GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.toolsPkgs ++ Seq( diff --git a/project/FrgaalJavaCompiler.scala b/project/FrgaalJavaCompiler.scala index 6b9787be7723..62d29e1bbdcd 100644 --- a/project/FrgaalJavaCompiler.scala +++ b/project/FrgaalJavaCompiler.scala @@ -43,6 +43,8 @@ object FrgaalJavaCompiler { * of `shouldCompileModuleInfo` task in `build.sbt` and * the docs of [[JPMSPlugin]]. * @param javaSourceDir The directory where Java sources are located + * @param shouldNotLimitModules Should `--limit-modules` cmdline option be passed to java process + * to limit set of modules frgaal is able to see? * @return */ def compilers( @@ -50,7 +52,8 @@ object FrgaalJavaCompiler { sbtCompilers: xsbti.compile.Compilers, javaVersion: String, shouldCompileModuleInfo: Boolean, - javaSourceDir: File + javaSourceDir: File, + shouldNotLimitModules: Boolean ) = { // Enable Java 11+ features by invoking Frgaal instead of regular javac val javaHome = Option(System.getProperty("java.home")).map(Paths.get(_)) @@ -78,7 +81,8 @@ object FrgaalJavaCompiler { frgaalOnClasspath.get, javaSourceDir = javaSourceDir, target = javaVersion, - shouldCompileModuleInfo = shouldCompileModuleInfo + shouldCompileModuleInfo = shouldCompileModuleInfo, + shouldNotLimitModules = shouldNotLimitModules ) val javaTools = sbt.internal.inc.javac .JavaTools(frgaalJavac, sbtCompilers.javaTools.javadoc()) @@ -98,7 +102,8 @@ object FrgaalJavaCompiler { source: Option[String], target: String, shouldCompileModuleInfo: Boolean, - javaSourceDir: File + javaSourceDir: File, + shouldNotLimitModules: Boolean ): Boolean = { val (jArgs, nonJArgs) = options.partition(_.startsWith("-J")) val debugAnotProcessorOpt = jArgs.contains(debugArg) @@ -272,7 +277,7 @@ object FrgaalJavaCompiler { "java.sql", "jdk.jfr" ) - val limitModulesArgs = Seq( + val limitModulesArgs = if (shouldNotLimitModules) Seq() else Seq( "--limit-modules", limitModules.mkString(",") ) @@ -294,6 +299,7 @@ object FrgaalJavaCompiler { " You should attach the debugger now." ) } + log.debug("[frgaal] Running " + (exe +: forkArgs).mkString(" ")) try { exitCode = Process(exe +: forkArgs, cwd) ! javacLogger } finally { @@ -362,7 +368,8 @@ final class FrgaalJavaCompiler( target: String, javaSourceDir: File, source: Option[String] = None, - shouldCompileModuleInfo: Boolean = false + shouldCompileModuleInfo: Boolean = false, + shouldNotLimitModules: Boolean = false ) extends XJavaCompiler { def run( sources: Array[VirtualFile], @@ -383,6 +390,7 @@ final class FrgaalJavaCompiler( source, target, shouldCompileModuleInfo, - javaSourceDir + javaSourceDir, + shouldNotLimitModules ) } From 0871cab81ce6835fae4ff5b4b425429ceacdb90f Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 10 Sep 2024 11:55:53 +0200 Subject: [PATCH 186/268] Pass module-path and add-modules options with -J prefix to frgaal --- build.sbt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/build.sbt b/build.sbt index c20eb5d08d0d..e91e894dc0b0 100644 --- a/build.sbt +++ b/build.sbt @@ -3736,6 +3736,21 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) Compile / javacOptions ++= Seq( "-Xlint:unchecked", ), + Compile / javacOptions ++= { + val mp = (Compile / modulePath).value + val mpStr = mp.map(_.getAbsolutePath).mkString(File.pathSeparator) + val addModsStr = (Compile / addModules).value.mkString(",") + // Passing these arguments with -J prefix will force frgaal to put the + // arguments directly to java, rather than passing them via an argfile. + // This means that this will correctly form the module boot layer and + // we will have truffle modules on module-path + Seq( + "-J--module-path", + "-J" + mpStr, + "-J--add-modules", + "-J" + addModsStr + ) + }, Compile / moduleDependencies := { (`runtime-benchmarks` / Compile / moduleDependencies).value }, From ddb46f60fa88eee270e10a7bf0d4334b77f26072 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 11 Sep 2024 12:34:38 +0200 Subject: [PATCH 187/268] BenchProcessor annotation processor creates its own truffle module layer --- build.sbt | 43 +- .../benchmarks/processor/BenchProcessor.java | 552 +++++------------- .../processor/SpecCollectionException.java | 12 + .../benchmarks/processor/SpecCollector.java | 424 +++++++++++++- 4 files changed, 614 insertions(+), 417 deletions(-) create mode 100644 lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollectionException.java diff --git a/build.sbt b/build.sbt index e91e894dc0b0..b6a62c2d0f9e 100644 --- a/build.sbt +++ b/build.sbt @@ -2425,11 +2425,11 @@ def customFrgaalJavaCompilerSettings(targetJdk: String) = { // project, and module-info.java is excluded from the compilation. // shouldCompileModuleInfoManually is a settingKey defined only in projects // with JPMSPlugin. That's why we have to check first for its existance. - val settingOpt = (config / shouldCompileModuleInfoManually).?.value - val shouldCompileModInfo = settingOpt.isDefined && settingOpt.get + val settingOpt = (config / shouldCompileModuleInfoManually).?.value + val shouldCompileModInfo = settingOpt.isDefined && settingOpt.get val shouldNotLimitModulesOpt = frgaalShouldNotLimitModules.?.value - val _shouldNotLimitModules = shouldNotLimitModulesOpt.getOrElse(false) - val projName = projectID.value.name + val _shouldNotLimitModules = shouldNotLimitModulesOpt.getOrElse(false) + val projName = projectID.value.name FrgaalJavaCompiler.compilers( (config / dependencyClasspath).value, compilers.value, @@ -3715,6 +3715,9 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) .enablePlugins(JPMSPlugin) .enablePlugins(PackageListPlugin) .settings( + // Do not pass --limit-modules to frgaal. We need to ensure that the boot module layer + // (for the annotation processor) contains all the truffle modules, including our + // `org.enso.runtime` module. frgaalShouldNotLimitModules := true, frgaalJavaCompilerSetting, annotationProcSetting, @@ -3734,31 +3737,37 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) mainClass := (LocalProject("bench-processor") / mainClass).value, Compile / javacOptions ++= Seq( - "-Xlint:unchecked", + "-Xlint:unchecked" ), + // Passing these arguments with -J prefix will force frgaal to put the + // arguments directly to java, rather than passing them via an argfile. + // This means that this will correctly form the module boot layer and + // we will have truffle modules on module-path Compile / javacOptions ++= { - val mp = (Compile / modulePath).value + val mp = (Compile / modulePath).value val mpStr = mp.map(_.getAbsolutePath).mkString(File.pathSeparator) - val addModsStr = (Compile / addModules).value.mkString(",") - // Passing these arguments with -J prefix will force frgaal to put the - // arguments directly to java, rather than passing them via an argfile. - // This means that this will correctly form the module boot layer and - // we will have truffle modules on module-path Seq( - "-J--module-path", - "-J" + mpStr, - "-J--add-modules", - "-J" + addModsStr + "-J-Dorg.enso.benchmarks.processor.BenchProcessor.modulePath=" + mpStr ) }, + Compile / javacOptions ++= Seq( + "-processor", + "org.enso.benchmarks.processor.BenchProcessor" + ), Compile / moduleDependencies := { (`runtime-benchmarks` / Compile / moduleDependencies).value }, (Compile / internalModuleDependencies) := { - (`runtime-benchmarks` / Compile / internalModuleDependencies).value + val runtimeBenchsDeps = + (`runtime-benchmarks` / Compile / internalModuleDependencies).value + runtimeBenchsDeps ++ Seq( + (`bench-processor` / Compile / exportedModule).value, + (`benchmarks-common` / Compile / exportedModule).value + ) }, Compile / addModules := Seq( - (`runtime` / javaModuleName).value + (`runtime` / javaModuleName).value, + (`bench-processor` / javaModuleName).value ), // std benchmark sources are patch into the `org.enso.runtime` module Compile / patchModules := { diff --git a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java index 2a3dbbf296db..f2720e704896 100644 --- a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java +++ b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java @@ -2,448 +2,206 @@ import java.io.File; import java.io.IOException; -import java.io.PrintWriter; +import java.lang.module.ModuleFinder; +import java.lang.reflect.InvocationTargetException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.logging.Level; -import java.util.stream.Collectors; +import java.util.function.BiConsumer; import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.FilerException; +import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.Processor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.SourceVersion; import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic.Kind; -import org.enso.benchmarks.BenchGroup; -import org.enso.benchmarks.BenchSpec; -import org.enso.benchmarks.ModuleBenchSuite; import org.enso.benchmarks.Utils; -import org.enso.common.LanguageInfo; -import org.enso.common.MethodNames.TopScope; -import org.enso.common.RuntimeOptions; -import org.graalvm.polyglot.Context; -import org.graalvm.polyglot.PolyglotException; -import org.graalvm.polyglot.Value; -import org.graalvm.polyglot.io.IOAccess; import org.openide.util.lookup.ServiceProvider; @SupportedAnnotationTypes("org.enso.benchmarks.processor.GenerateBenchSources") @ServiceProvider(service = Processor.class) public class BenchProcessor extends AbstractProcessor { - private final File ensoHomeOverride; - private final File ensoDir; - private File projectRootDir; - private static final String generatedSourcesPackagePrefix = "org.enso.benchmarks.generated"; - private static final List imports = - List.of( - "import java.nio.file.Paths;", - "import java.io.ByteArrayOutputStream;", - "import java.io.File;", - "import java.util.List;", - "import java.util.Objects;", - "import java.util.concurrent.TimeUnit;", - "import java.util.logging.Level;", - "import java.util.logging.LogRecord;", - "import java.util.logging.Handler;", - "import org.openjdk.jmh.annotations.Benchmark;", - "import org.openjdk.jmh.annotations.BenchmarkMode;", - "import org.openjdk.jmh.annotations.Mode;", - "import org.openjdk.jmh.annotations.Fork;", - "import org.openjdk.jmh.annotations.Measurement;", - "import org.openjdk.jmh.annotations.OutputTimeUnit;", - "import org.openjdk.jmh.annotations.Setup;", - "import org.openjdk.jmh.annotations.TearDown;", - "import org.openjdk.jmh.annotations.State;", - "import org.openjdk.jmh.annotations.Scope;", - "import org.openjdk.jmh.annotations.Warmup;", - "import org.openjdk.jmh.infra.BenchmarkParams;", - "import org.openjdk.jmh.infra.IterationParams;", - "import org.openjdk.jmh.infra.Blackhole;", - "import org.graalvm.polyglot.Context;", - "import org.graalvm.polyglot.Value;", - "import org.graalvm.polyglot.io.IOAccess;", - "import org.enso.common.LanguageInfo;", - "import org.enso.common.MethodNames;", - "import org.enso.common.RuntimeOptions;", - "import org.enso.benchmarks.processor.SpecCollector;", - "import org.enso.benchmarks.ModuleBenchSuite;", - "import org.enso.benchmarks.BenchSpec;", - "import org.enso.benchmarks.BenchGroup;", - "import org.enso.benchmarks.Utils;"); - - public BenchProcessor() { - ensoDir = Utils.findRepoRootDir(); - - // Note that ensoHomeOverride does not have to exist, only its parent directory - ensoHomeOverride = ensoDir.toPath().resolve("distribution").resolve("component").toFile(); - } + private static final String MODULE_PATH_PROP_NAME = + BenchProcessor.class.getName() + ".modulePath"; @Override public SourceVersion getSupportedSourceVersion() { return SourceVersion.latest(); } - @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { - if (annotations.isEmpty()) { - return true; - } - var elements = roundEnv.getElementsAnnotatedWith(GenerateBenchSources.class); - for (var element : elements) { - GenerateBenchSources annotation = element.getAnnotation(GenerateBenchSources.class); - projectRootDir = new File(annotation.projectRootPath()); - if (!projectRootDir.exists() || !projectRootDir.isDirectory() || !projectRootDir.canRead()) { - failWithMessage( - "Project root dir '" - + projectRootDir.getAbsolutePath() - + "' specified in the annotation does not exist or is not readable"); - } - try (var ctx = - Context.newBuilder() - .allowExperimentalOptions(true) - .allowIO(IOAccess.ALL) - .allowAllAccess(true) - .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) - .logHandler(new java.util.logging.ConsoleHandler()) - .option(RuntimeOptions.PROJECT_ROOT, projectRootDir.getAbsolutePath()) - .option(RuntimeOptions.LANGUAGE_HOME_OVERRIDE, ensoHomeOverride.getAbsolutePath()) - .build()) { - Value module = getModule(ctx, annotation.moduleName()); - assert module != null; - List benchSuites = - SpecCollector.collectBenchSpecsFromModule(module, annotation.variableName()); - for (ModuleBenchSuite benchSuite : benchSuites) { - for (BenchGroup group : benchSuite.getGroups()) { - if (!validateGroup(group)) { - return false; - } else { - generateClassForGroup( - group, benchSuite.getModuleQualifiedName(), annotation.variableName()); - } - } - } - return true; - } catch (Exception e) { - failWithMessage("Uncaught exception in " + getClass().getName() + ": " + e.getMessage()); - e.printStackTrace(System.out); - return false; - } - } - return true; + private static boolean shouldCreateModuleLayer() { + return System.getProperty(MODULE_PATH_PROP_NAME) != null; } - private Value getModule(Context ctx, String moduleName) { - try { - return ctx.getBindings(LanguageInfo.ID).invokeMember(TopScope.GET_MODULE, moduleName); - } catch (PolyglotException e) { - failWithMessage("Cannot get module '" + moduleName + "': " + e.getMessage()); - return null; + /** + * This annotation processor is invoked from frgaal compiler. Which means that all the + * truffle-related modules are not on boot module layer. To avoid problems with double class + * loading with different class loaders, we explicitly create our own module layer for truffle and + * execute all the polyglot code in this layer, with the associated class loader. Note that + * usually, this is done by Truffle itself during initialization. We must ensure that the {@code + * SpecCollector} is loaded via the class loader used for loading the {@code org.graalvm.truffle} + * (or {@code org.enso.runtime}) module. + */ + private static ModuleLayer createTruffleModuleLayer() { + // Note that we cannot use java.class.path here as for frgaal compiler, there is just + // one jar on the classpath, and it is the frgaal compiler jar. + var mp = System.getProperty(MODULE_PATH_PROP_NAME); + if (mp == null) { + throw new IllegalStateException( + MODULE_PATH_PROP_NAME + + " system property must be set so that the annotation processor " + + "is able to create the truffle module layer"); } - } - - private void generateClassForGroup(BenchGroup group, String moduleQualifiedName, String varName) { - String fullClassName = createGroupClassName(group); - try (PrintWriter srcFileWriter = - new PrintWriter(processingEnv.getFiler().createSourceFile(fullClassName).openWriter())) { - generateClassForGroup(srcFileWriter, moduleQualifiedName, varName, group); - } catch (IOException e) { - if (!isResourceAlreadyExistsException(e)) { - failWithMessage( - "Failed to generate source file for group '" + group.name() + "': " + e.getMessage()); - } + System.out.println( + "BenchProcessor: " + + MODULE_PATH_PROP_NAME + + " system property set. " + + "Creating truffle module layer for benchmark collection."); + var paths = Arrays.stream(mp.split(File.pathSeparator)).map(Path::of).toArray(Path[]::new); + var bootLayer = ModuleLayer.boot(); + var bootConf = bootLayer.configuration(); + var modFinder = ModuleFinder.of(paths); + if (modFinder.find("org.graalvm.truffle").isEmpty()) { + throw new IllegalStateException("org.graalvm.truffle module not found in the classpath"); } - } - - private boolean validateGroup(BenchGroup group) { - List specNames = - group.specs().stream().map(BenchSpec::name).collect(Collectors.toList()); - long distinctNamesCount = specNames.stream().distinct().count(); - List sortedSpecNames = specNames.stream().sorted().collect(Collectors.toList()); - if (specNames.size() != distinctNamesCount) { - failWithMessage( - "All benchmark suite names in group '" - + group.name() - + "' must be unique." - + " Found names of the bench suites: " - + sortedSpecNames); - return false; - } else { - return true; + // We are creating new module layer, with the boot module layer as the parent. In the boot + // module layer, there are base JDK modules that are required, but there are also some modules + // that + // may be duplicated on the system property. For example, it is likely that there is + // `org.graalvm.word` module which is also in the boot module layer (as it is part of the JDK). + // We have to filter these modules out of the new configuration. + Set duplicatedModPaths = new HashSet<>(); + for (var bootMod : bootConf.modules()) { + var modRefOpt = modFinder.find(bootMod.name()); + modRefOpt.ifPresent( + modRef -> { + var uri = + modRef + .location() + .orElseThrow( + () -> + new AssertionError( + "Module " + modRef.descriptor().name() + " has no location")); + duplicatedModPaths.add(uri.getPath()); + }); + } + // Path to modules without duplicated ones. + List pathsToUse = new ArrayList<>(); + for (var path : paths) { + var pathStr = path.toAbsolutePath().toString(); + if (!duplicatedModPaths.contains(pathStr)) { + pathsToUse.add(path); + } } + var rootModules = + Set.of( + "org.graalvm.truffle", + "com.oracle.truffle.regex", + "org.enso.runtime", + "org.enso.runtime.language.epb", + "org.enso.interpreter.arrow", + "org.enso.bench.processor"); + var truffleLayer = createLayerFromPaths(pathsToUse, rootModules, bootLayer); + return truffleLayer; } /** - * Returns true iff the given exception is thrown because a file already exists exception. There - * is no better way to check this. + * A callback called from {@code SpecCollector} so that we don't have to pass the {@link + * ProcessingEnvironment} directly to it. * - * @param e Exception to check. - * @return true iff the given exception is thrown because a file already exists exception. + * @param className Name of the class to create. + * @param content Source code for the class. */ - private static boolean isResourceAlreadyExistsException(IOException e) { - List messages = - List.of( - "Source file already created", - "Resource already created", - "Attempt to recreate a file"); - return e instanceof FilerException - && messages.stream().anyMatch(msg -> e.getMessage().contains(msg)); - } - - private void generateClassForGroup( - PrintWriter out, String moduleQualifiedName, String varName, BenchGroup group) - throws IOException { - String groupFullClassName = createGroupClassName(group); - String className = groupFullClassName.substring(groupFullClassName.lastIndexOf('.') + 1); - List specs = group.specs(); - List specJavaNames = - specs.stream().map(spec -> normalize(spec.name())).collect(Collectors.toUnmodifiableList()); - out.println("package " + generatedSourcesPackagePrefix + ";"); - out.println(); - out.println(String.join("\n", imports)); - out.println(); - out.println("/**"); - out.println(" * Generated from:"); - out.println(" * - Module: " + moduleQualifiedName); - out.println(" * - Group: \"" + group.name() + "\""); - out.println(" * Generated by {@link " + getClass().getName() + "}."); - out.println(" */"); - out.println("@BenchmarkMode(Mode.AverageTime)"); - out.println("@OutputTimeUnit(TimeUnit.MILLISECONDS)"); - out.println("@Fork(1)"); - out.println(getWarmupAnnotationForGroup(group)); - out.println(getMeasureAnnotationForGroup(group)); - out.println("@State(Scope.Benchmark)"); - out.println("public class " + className + " {"); - - // Field definitions - out.println(" private int warmupCounter = 0;"); - out.println(" private int measurementCounter = 0;"); - out.println(" private boolean compilationMessagesFound;"); - out.println(" private final StringBuilder compilationLog = new StringBuilder();"); - out.println( - " private final List messages = new" - + " java.util.concurrent.CopyOnWriteArrayList<>();"); - out.println(" private Value groupInputArg;"); - for (var specJavaName : specJavaNames) { - out.println(" private Value benchFunc_" + specJavaName + ";"); - } - out.println(" "); - out.println(" @Setup"); - out.println(" public void setup(BenchmarkParams params) throws Exception {"); - // Workaround for compilation failures on Windows. - String projectRootDirPath = - projectRootDir.getPath().contains("\\") - ? projectRootDir.getPath().replace("\\", "\\\\") - : projectRootDir.getPath(); - out.append(" File projectRootDir = Utils.findRepoRootDir().toPath().resolve(\"") - .append(projectRootDirPath) - .append("\").toFile();\n"); - out.println( - " if (projectRootDir == null || !projectRootDir.exists() || !projectRootDir.canRead())" - + " {"); - out.println( - " throw new IllegalStateException(\"Project root directory does not exist or cannot be" - + " read: \" + Objects.toString(projectRootDir));"); - out.println(" }"); - out.println(" File languageHomeOverride = Utils.findLanguageHomeOverride();"); - out.println(" var ctx = Context.newBuilder()"); - out.println(" .allowExperimentalOptions(true)"); - out.println(" .allowIO(IOAccess.ALL)"); - out.println(" .allowAllAccess(true)"); - out.println(" .option(RuntimeOptions.LOG_LEVEL, Level.FINE.getName())"); - out.println(" .logHandler(System.err)"); - out.println(" .option("); - out.println(" RuntimeOptions.LANGUAGE_HOME_OVERRIDE,"); - out.println(" languageHomeOverride.getAbsolutePath()"); - out.println(" )"); - out.println(" .option("); - out.println(" RuntimeOptions.PROJECT_ROOT,"); - out.println(" projectRootDir.getAbsolutePath()"); - out.println(" )"); - out.println( - """ - .option("engine.TraceCompilation", "true") - .logHandler(new java.util.logging.Handler() { - @Override - public void publish(LogRecord lr) { - if ("engine".equals(lr.getLoggerName())) { - messages.add(lr); - } - } - @Override public void flush() {} - @Override public void close() {} - }) - """); - out.println(" .build();"); - out.println(" "); - out.println(" Value bindings = ctx.getBindings(LanguageInfo.ID);"); - out.println( - " Value module = bindings.invokeMember(MethodNames.TopScope.GET_MODULE, \"" - + moduleQualifiedName - + "\");"); - out.println( - " BenchGroup group = SpecCollector.collectBenchGroupFromModule(module, \"" - + group.name() - + "\", \"" - + varName - + "\");"); - out.println(" "); - for (int i = 0; i < specs.size(); i++) { - var specJavaName = specJavaNames.get(i); - var specName = specs.get(i).name(); - out.println( - " BenchSpec benchSpec_" - + specJavaName - + " = Utils.findSpecByName(group, \"" - + specName - + "\");"); - out.println( - " this.benchFunc_" + specJavaName + " = benchSpec_" + specJavaName + ".code();"); - } - out.println(" "); - out.println(" this.groupInputArg = Value.asValue(null);"); - out.println(" } "); // end of setup method - out.println(" "); - - out.println( - """ - @Setup(org.openjdk.jmh.annotations.Level.Iteration) - public void clearCompilationMessages(IterationParams it) { - var round = round(it); - if (!messages.isEmpty()) { - compilationLog.append("Before " + it.getType() + "#" + round + ". "); - compilationLog.append("Cleaning " + messages.size() + " compilation messages\\n"); - messages.clear(); - } - } - - private int round(IterationParams it) { - return switch (it.getType()) { - case WARMUP -> ++warmupCounter; - case MEASUREMENT -> ++measurementCounter; - }; - } - - private void dumpMessages() { - for (var lr : messages) { - compilationLog.append(lr.getMessage() + "\\n"); - compilationMessagesFound = true; - } - } - - @TearDown(org.openjdk.jmh.annotations.Level.Iteration) - public void dumpCompilationMessages(IterationParams it) { - switch (it.getType()) { - case MEASUREMENT -> { - compilationLog.append("After " + it.getType() + "#" + measurementCounter + ". "); - if (!messages.isEmpty()) { - compilationLog.append("Dumping " + messages.size() + " compilation messages:\\n"); - dumpMessages(); - } else { - compilationLog.append("No compilation messages.\\n"); - } - } - } - } - - @TearDown - public void checkNoTruffleCompilation(BenchmarkParams params) { - if (compilationMessagesFound) { - System.err.println(compilationLog.toString()); - } - } - - """); - // Benchmark methods - for (var specJavaName : specJavaNames) { - out.println(); - out.println(" @Benchmark"); - out.println(" public void " + specJavaName + "(Blackhole blackhole) {"); - out.println( - " Value result = this.benchFunc_" + specJavaName + ".execute(this.groupInputArg);"); - out.println(" blackhole.consume(result);"); - out.println(" }"); // end of benchmark method + void createSourceFile(String className, String content) { + try (var os = processingEnv.getFiler().createSourceFile(className).openOutputStream()) { + os.write(content.getBytes(StandardCharsets.UTF_8)); + } catch (IOException e) { + throw new IllegalStateException( + "Unexpected excpetion when creating source file for class " + className, e); } - - out.println("}"); // end of class className - } - - private String getWarmupAnnotationForGroup(BenchGroup group) { - var warmupConf = group.configuration().warmup(); - return """ - @Warmup( - iterations = $1, - time = $2, - timeUnit = TimeUnit.SECONDS - ) - """ - .strip() - .replace("$1", Long.toString(warmupConf.iterations())) - .replace("$2", Long.toString(warmupConf.seconds())); - } - - private String getMeasureAnnotationForGroup(BenchGroup group) { - var measureConf = group.configuration().measure(); - return """ - @Measurement( - iterations = $1, - time = $2, - timeUnit = TimeUnit.SECONDS - ) - """ - .strip() - .replace("$1", Long.toString(measureConf.iterations())) - .replace("$2", Long.toString(measureConf.seconds())); } /** - * Returns Java FQN for a benchmark spec. + * Creates a new module layer from paths with the given root modules with boot module layer as + * parent. * - * @param group Group name will be converted to Java package name. - * @return + * @param paths Paths to modules. + * @param rootModules Set of root modules to resolve. + * @return New module layer. */ - private static String createGroupClassName(BenchGroup group) { - var groupPkgName = normalize(group.name()); - return generatedSourcesPackagePrefix + "." + groupPkgName; - } - - private static boolean isValidChar(char c) { - return Character.isAlphabetic(c) || Character.isDigit(c) || c == '_'; + private static ModuleLayer createLayerFromPaths( + List paths, Set rootModules, ModuleLayer parentLayer) { + var modFinder = ModuleFinder.of(paths.toArray(Path[]::new)); + var modConf = parentLayer.configuration().resolve(modFinder, ModuleFinder.of(), rootModules); + return parentLayer.defineModulesWithOneLoader(modConf, ClassLoader.getSystemClassLoader()); } /** - * Converts Text to valid Java identifier. - * - * @param name Text to convert. - * @return Valid Java identifier, non null. + * @param runtimeLoader Class loader for the {@code org.enso.runtime} module. */ - private static String normalize(String name) { - var normalizedNameSb = new StringBuilder(); - for (char c : name.toCharArray()) { - if (isValidChar(c)) { - normalizedNameSb.append(c); - } else if (c == '-') { - normalizedNameSb.append("minus"); - } else if (Character.isWhitespace(c) && (peekLastChar(normalizedNameSb) != '_')) { - normalizedNameSb.append('_'); - } + private void generateBenchSpecs( + ClassLoader runtimeLoader, + String moduleName, + String varName, + File projectRootDir, + File ensoHomeOverride) { + try { + var specCollectorClazz = + runtimeLoader.loadClass("org.enso.benchmarks.processor.SpecCollector"); + var createMethod = + specCollectorClazz.getDeclaredMethod( + "create", String.class, String.class, File.class, File.class, BiConsumer.class); + BiConsumer createSrcFileFn = this::createSourceFile; + var specCollector = + createMethod.invoke( + null, moduleName, varName, projectRootDir, ensoHomeOverride, createSrcFileFn); + var genSpecsMethod = specCollectorClazz.getMethod("generateBenchSpecs"); + genSpecsMethod.invoke(specCollector); + } catch (ClassNotFoundException + | NoSuchMethodException + | InvocationTargetException + | IllegalAccessException e) { + throw new IllegalStateException(e); + } catch (Exception ex) { + processingEnv.getMessager().printMessage(Kind.ERROR, ex.getMessage()); + // Better have duplicated error message than none at all + System.out.println( + "[org.enso.benchmarks.processor.BenchProcessor]: ERROR: " + ex.getMessage()); + ex.printStackTrace(System.out); } - return normalizedNameSb.toString(); } - private static char peekLastChar(StringBuilder sb) { - if (!sb.isEmpty()) { - return sb.charAt(sb.length() - 1); - } else { - return 0; + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + if (annotations.isEmpty()) { + return true; } - } - - private void failWithMessage(String msg) { - // Better have duplicated error message than none at all - System.out.println("[org.enso.benchmarks.processor.BenchProcessor]: ERROR: " + msg); - processingEnv.getMessager().printMessage(Kind.ERROR, msg); + var elements = roundEnv.getElementsAnnotatedWith(GenerateBenchSources.class); + if (!elements.isEmpty()) { + File ensoDir = Utils.findRepoRootDir(); + // Note that ensoHomeOverride does not have to exist, only its parent directory + var ensoHomeOverride = ensoDir.toPath().resolve("distribution").resolve("component").toFile(); + ClassLoader runtimeLoader; + if (shouldCreateModuleLayer()) { + var truffleModLayer = createTruffleModuleLayer(); + runtimeLoader = truffleModLayer.findLoader("org.enso.runtime"); + } else { + runtimeLoader = BenchProcessor.class.getClassLoader(); + } + for (var element : elements) { + GenerateBenchSources annotation = element.getAnnotation(GenerateBenchSources.class); + var projectRootDir = new File(annotation.projectRootPath()); + var moduleName = annotation.moduleName(); + var varName = annotation.variableName(); + generateBenchSpecs(runtimeLoader, moduleName, varName, projectRootDir, ensoHomeOverride); + } + } + return true; } } diff --git a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollectionException.java b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollectionException.java new file mode 100644 index 000000000000..e0bf26ca4cdf --- /dev/null +++ b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollectionException.java @@ -0,0 +1,12 @@ +package org.enso.benchmarks.processor; + +/** An exception thrown when there is an issue collecting benchmark specifications. */ +public final class SpecCollectionException extends RuntimeException { + SpecCollectionException(String message) { + super(message); + } + + SpecCollectionException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollector.java b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollector.java index 4c9040e5cd09..51dbf8a8130a 100644 --- a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollector.java +++ b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollector.java @@ -1,16 +1,152 @@ package org.enso.benchmarks.processor; +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; import java.util.ArrayList; import java.util.List; +import java.util.function.BiConsumer; +import java.util.logging.ConsoleHandler; +import java.util.logging.Level; +import java.util.stream.Collectors; import org.enso.benchmarks.BenchGroup; +import org.enso.benchmarks.BenchSpec; import org.enso.benchmarks.BenchSuite; import org.enso.benchmarks.ModuleBenchSuite; +import org.enso.common.LanguageInfo; import org.enso.common.MethodNames.Module; +import org.enso.common.MethodNames.TopScope; +import org.enso.common.RuntimeOptions; +import org.graalvm.polyglot.Context; +import org.graalvm.polyglot.PolyglotException; import org.graalvm.polyglot.Value; +import org.graalvm.polyglot.io.IOAccess; -/** Collect benchmark specifications from Enso source files. */ -public class SpecCollector { - private SpecCollector() {} +/** + * Collect benchmark specifications from Enso source files. Ensure that this class is loaded by the + * same class loader used for loading the {@code org.graalvm.truffle} module. Otherwise, you might + * encounter issues with double class loading when Enso code is executed when collecting specs. + */ +public final class SpecCollector { + private final File projectRootDir; + private final File ensoHomeOverride; + private final String moduleName; + private final String varName; + private final BiConsumer createSourceFileFn; + private static final String generatedSourcesPackagePrefix = "org.enso.benchmarks.generated"; + + private static final List imports = + List.of( + "import java.nio.file.Paths;", + "import java.io.ByteArrayOutputStream;", + "import java.io.File;", + "import java.util.List;", + "import java.util.Objects;", + "import java.util.concurrent.TimeUnit;", + "import java.util.logging.Level;", + "import java.util.logging.LogRecord;", + "import java.util.logging.Handler;", + "import org.openjdk.jmh.annotations.Benchmark;", + "import org.openjdk.jmh.annotations.BenchmarkMode;", + "import org.openjdk.jmh.annotations.Mode;", + "import org.openjdk.jmh.annotations.Fork;", + "import org.openjdk.jmh.annotations.Measurement;", + "import org.openjdk.jmh.annotations.OutputTimeUnit;", + "import org.openjdk.jmh.annotations.Setup;", + "import org.openjdk.jmh.annotations.TearDown;", + "import org.openjdk.jmh.annotations.State;", + "import org.openjdk.jmh.annotations.Scope;", + "import org.openjdk.jmh.annotations.Warmup;", + "import org.openjdk.jmh.infra.BenchmarkParams;", + "import org.openjdk.jmh.infra.IterationParams;", + "import org.openjdk.jmh.infra.Blackhole;", + "import org.graalvm.polyglot.Context;", + "import org.graalvm.polyglot.Value;", + "import org.graalvm.polyglot.io.IOAccess;", + "import org.enso.common.LanguageInfo;", + "import org.enso.common.MethodNames;", + "import org.enso.common.RuntimeOptions;", + "import org.enso.benchmarks.processor.SpecCollector;", + "import org.enso.benchmarks.ModuleBenchSuite;", + "import org.enso.benchmarks.BenchSpec;", + "import org.enso.benchmarks.BenchGroup;", + "import org.enso.benchmarks.Utils;"); + + private SpecCollector( + String moduleName, + String varName, + File projectRootDir, + File ensoHomeOverride, + BiConsumer createSourceFileFn) { + this.projectRootDir = projectRootDir; + this.ensoHomeOverride = ensoHomeOverride; + this.moduleName = moduleName; + this.varName = varName; + this.createSourceFileFn = createSourceFileFn; + } + + /** + * Invoked via reflection from {@code BenchProcessor}. Ensure that the class loader used for + * loading this class, and this method, is the same as the one used for loading the {@code + * org.graalvm.truffle} module. + * + * @param moduleName Fully qualified name of the module that contains the bench specs + * @param varName Name of the variable that holds all the collected bench suites + * @param projectRootDir Root directory of the project. Must be a directory and exist. + * @param ensoHomeOverride Path to the Enso home directory. Will be used for polyglot context. + */ + public static SpecCollector create( + String moduleName, + String varName, + File projectRootDir, + File ensoHomeOverride, + BiConsumer createSourceFileFn) { + if (!projectRootDir.exists() || !projectRootDir.isDirectory() || !projectRootDir.canRead()) { + throw new IllegalArgumentException( + "Project root directory " + projectRootDir + "does not exist or is not readable."); + } + return new SpecCollector( + moduleName, varName, projectRootDir, ensoHomeOverride, createSourceFileFn); + } + + /** + * Invoked via reflection from {@code BenchProcessor}. Ensure that the class loader used for + * loading this class, and this method, is the same as the one used for loading the {@code + * org.graalvm.truffle} module. + * + * @throws SpecCollectionException + */ + public void generateBenchSpecs() throws SpecCollectionException { + if (!projectRootDir.exists() || !projectRootDir.isDirectory() || !projectRootDir.canRead()) { + throw new IllegalArgumentException( + "Project root directory " + projectRootDir + "does not exist or is not readable."); + } + try (var ctx = + Context.newBuilder() + .allowExperimentalOptions(true) + .allowIO(IOAccess.ALL) + .allowAllAccess(true) + .option(RuntimeOptions.LOG_LEVEL, Level.WARNING.getName()) + .logHandler(new ConsoleHandler()) + .option(RuntimeOptions.PROJECT_ROOT, projectRootDir.getAbsolutePath()) + .option(RuntimeOptions.LANGUAGE_HOME_OVERRIDE, ensoHomeOverride.getAbsolutePath()) + .build()) { + var langs = ctx.getEngine().getLanguages().keySet(); + Value module = getModule(ctx, moduleName); + assert module != null; + List benchSuites = + SpecCollector.collectBenchSpecsFromModule(module, varName); + for (ModuleBenchSuite benchSuite : benchSuites) { + for (BenchGroup group : benchSuite.getGroups()) { + validateGroup(group); + generateClassForGroup(group, benchSuite.getModuleQualifiedName(), varName); + } + } + } catch (Exception e) { + throw new SpecCollectionException( + "Uncaught exception in " + getClass().getName() + ": " + e.getMessage(), e); + } + } /** * Collects all the bench specifications from the given module in a variable with the given name. @@ -56,4 +192,286 @@ public static BenchGroup collectBenchGroupFromModule( } return null; } + + private Value getModule(Context ctx, String moduleName) { + try { + return ctx.getBindings(LanguageInfo.ID).invokeMember(TopScope.GET_MODULE, moduleName); + } catch (PolyglotException e) { + throw new SpecCollectionException( + "Cannot get module '" + moduleName + "': " + e.getMessage(), e); + } + } + + private void generateClassForGroup(BenchGroup group, String moduleQualifiedName, String varName) { + String fullClassName = createGroupClassName(group); + var sw = new StringWriter(); + try (PrintWriter srcFileWriter = new PrintWriter(sw)) { + generateClassForGroup(srcFileWriter, moduleQualifiedName, varName, group); + } + createSourceFileFn.accept(fullClassName, sw.toString()); + } + + private void validateGroup(BenchGroup group) { + List specNames = + group.specs().stream().map(BenchSpec::name).collect(Collectors.toList()); + long distinctNamesCount = specNames.stream().distinct().count(); + List sortedSpecNames = specNames.stream().sorted().collect(Collectors.toList()); + if (specNames.size() != distinctNamesCount) { + throw new SpecCollectionException( + "All benchmark suite names in group '" + + group.name() + + "' must be unique." + + " Found names of the bench suites: " + + sortedSpecNames); + } + } + + private void generateClassForGroup( + PrintWriter out, String moduleQualifiedName, String varName, BenchGroup group) { + String groupFullClassName = createGroupClassName(group); + String className = groupFullClassName.substring(groupFullClassName.lastIndexOf('.') + 1); + List specs = group.specs(); + List specJavaNames = + specs.stream().map(spec -> normalize(spec.name())).collect(Collectors.toUnmodifiableList()); + out.println("package " + generatedSourcesPackagePrefix + ";"); + out.println(); + out.println(String.join("\n", imports)); + out.println(); + out.println("/**"); + out.println(" * Generated from:"); + out.println(" * - Module: " + moduleQualifiedName); + out.println(" * - Group: \"" + group.name() + "\""); + out.println(" * Generated by {@link " + getClass().getName() + "}."); + out.println(" */"); + out.println("@BenchmarkMode(Mode.AverageTime)"); + out.println("@OutputTimeUnit(TimeUnit.MILLISECONDS)"); + out.println("@Fork(1)"); + out.println(getWarmupAnnotationForGroup(group)); + out.println(getMeasureAnnotationForGroup(group)); + out.println("@State(Scope.Benchmark)"); + out.println("public class " + className + " {"); + + // Field definitions + out.println(" private int warmupCounter = 0;"); + out.println(" private int measurementCounter = 0;"); + out.println(" private boolean compilationMessagesFound;"); + out.println(" private final StringBuilder compilationLog = new StringBuilder();"); + out.println( + " private final List messages = new" + + " java.util.concurrent.CopyOnWriteArrayList<>();"); + out.println(" private Value groupInputArg;"); + for (var specJavaName : specJavaNames) { + out.println(" private Value benchFunc_" + specJavaName + ";"); + } + out.println(" "); + out.println(" @Setup"); + out.println(" public void setup(BenchmarkParams params) throws Exception {"); + // Workaround for compilation failures on Windows. + String projectRootDirPath = + projectRootDir.getPath().contains("\\") + ? projectRootDir.getPath().replace("\\", "\\\\") + : projectRootDir.getPath(); + out.append(" File projectRootDir = Utils.findRepoRootDir().toPath().resolve(\"") + .append(projectRootDirPath) + .append("\").toFile();\n"); + out.println( + " if (projectRootDir == null || !projectRootDir.exists() || !projectRootDir.canRead())" + + " {"); + out.println( + " throw new IllegalStateException(\"Project root directory does not exist or cannot be" + + " read: \" + Objects.toString(projectRootDir));"); + out.println(" }"); + out.println(" File languageHomeOverride = Utils.findLanguageHomeOverride();"); + out.println(" var ctx = Context.newBuilder()"); + out.println(" .allowExperimentalOptions(true)"); + out.println(" .allowIO(IOAccess.ALL)"); + out.println(" .allowAllAccess(true)"); + out.println(" .option(RuntimeOptions.LOG_LEVEL, Level.FINE.getName())"); + out.println(" .logHandler(System.err)"); + out.println(" .option("); + out.println(" RuntimeOptions.LANGUAGE_HOME_OVERRIDE,"); + out.println(" languageHomeOverride.getAbsolutePath()"); + out.println(" )"); + out.println(" .option("); + out.println(" RuntimeOptions.PROJECT_ROOT,"); + out.println(" projectRootDir.getAbsolutePath()"); + out.println(" )"); + out.println( + """ + .option("engine.TraceCompilation", "true") + .logHandler(new java.util.logging.Handler() { + @Override + public void publish(LogRecord lr) { + if ("engine".equals(lr.getLoggerName())) { + messages.add(lr); + } + } + @Override public void flush() {} + @Override public void close() {} + }) + """); + out.println(" .build();"); + out.println(" "); + out.println(" Value bindings = ctx.getBindings(LanguageInfo.ID);"); + out.println( + " Value module = bindings.invokeMember(MethodNames.TopScope.GET_MODULE, \"" + + moduleQualifiedName + + "\");"); + out.println( + " BenchGroup group = SpecCollector.collectBenchGroupFromModule(module, \"" + + group.name() + + "\", \"" + + varName + + "\");"); + out.println(" "); + for (int i = 0; i < specs.size(); i++) { + var specJavaName = specJavaNames.get(i); + var specName = specs.get(i).name(); + out.println( + " BenchSpec benchSpec_" + + specJavaName + + " = Utils.findSpecByName(group, \"" + + specName + + "\");"); + out.println( + " this.benchFunc_" + specJavaName + " = benchSpec_" + specJavaName + ".code();"); + } + out.println(" "); + out.println(" this.groupInputArg = Value.asValue(null);"); + out.println(" } "); // end of setup method + out.println(" "); + + out.println( + """ + @Setup(org.openjdk.jmh.annotations.Level.Iteration) + public void clearCompilationMessages(IterationParams it) { + var round = round(it); + if (!messages.isEmpty()) { + compilationLog.append("Before " + it.getType() + "#" + round + ". "); + compilationLog.append("Cleaning " + messages.size() + " compilation messages\\n"); + messages.clear(); + } + } + + private int round(IterationParams it) { + return switch (it.getType()) { + case WARMUP -> ++warmupCounter; + case MEASUREMENT -> ++measurementCounter; + }; + } + + private void dumpMessages() { + for (var lr : messages) { + compilationLog.append(lr.getMessage() + "\\n"); + compilationMessagesFound = true; + } + } + + @TearDown(org.openjdk.jmh.annotations.Level.Iteration) + public void dumpCompilationMessages(IterationParams it) { + switch (it.getType()) { + case MEASUREMENT -> { + compilationLog.append("After " + it.getType() + "#" + measurementCounter + ". "); + if (!messages.isEmpty()) { + compilationLog.append("Dumping " + messages.size() + " compilation messages:\\n"); + dumpMessages(); + } else { + compilationLog.append("No compilation messages.\\n"); + } + } + } + } + + @TearDown + public void checkNoTruffleCompilation(BenchmarkParams params) { + if (compilationMessagesFound) { + System.err.println(compilationLog.toString()); + } + } + + """); + // Benchmark methods + for (var specJavaName : specJavaNames) { + out.println(); + out.println(" @Benchmark"); + out.println(" public void " + specJavaName + "(Blackhole blackhole) {"); + out.println( + " Value result = this.benchFunc_" + specJavaName + ".execute(this.groupInputArg);"); + out.println(" blackhole.consume(result);"); + out.println(" }"); // end of benchmark method + } + + out.println("}"); // end of class className + } + + private String getWarmupAnnotationForGroup(BenchGroup group) { + var warmupConf = group.configuration().warmup(); + return """ + @Warmup( + iterations = $1, + time = $2, + timeUnit = TimeUnit.SECONDS + ) + """ + .strip() + .replace("$1", Long.toString(warmupConf.iterations())) + .replace("$2", Long.toString(warmupConf.seconds())); + } + + private String getMeasureAnnotationForGroup(BenchGroup group) { + var measureConf = group.configuration().measure(); + return """ + @Measurement( + iterations = $1, + time = $2, + timeUnit = TimeUnit.SECONDS + ) + """ + .strip() + .replace("$1", Long.toString(measureConf.iterations())) + .replace("$2", Long.toString(measureConf.seconds())); + } + + /** + * Returns Java FQN for a benchmark spec. + * + * @param group Group name will be converted to Java package name. + * @return + */ + private static String createGroupClassName(BenchGroup group) { + var groupPkgName = normalize(group.name()); + return generatedSourcesPackagePrefix + "." + groupPkgName; + } + + private static boolean isValidChar(char c) { + return Character.isAlphabetic(c) || Character.isDigit(c) || c == '_'; + } + + /** + * Converts Text to valid Java identifier. + * + * @param name Text to convert. + * @return Valid Java identifier, non null. + */ + private static String normalize(String name) { + var normalizedNameSb = new StringBuilder(); + for (char c : name.toCharArray()) { + if (isValidChar(c)) { + normalizedNameSb.append(c); + } else if (c == '-') { + normalizedNameSb.append("minus"); + } else if (Character.isWhitespace(c) && (peekLastChar(normalizedNameSb) != '_')) { + normalizedNameSb.append('_'); + } + } + return normalizedNameSb.toString(); + } + + private static char peekLastChar(StringBuilder sb) { + if (!sb.isEmpty()) { + return sb.charAt(sb.length() - 1); + } else { + return 0; + } + } } From bca316f3f72831fdc7c9892b5e7e5d25c3473d8e Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 11 Sep 2024 12:35:12 +0200 Subject: [PATCH 188/268] bench-processor and benchmarks-common are modules --- build.sbt | 24 ++++++++++++++++++- .../src/main/java/module-info.java | 8 +++++++ .../src/main/java/module-info.java | 15 ++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 lib/java/benchmarks-common/src/main/java/module-info.java create mode 100644 lib/scala/bench-processor/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index b6a62c2d0f9e..835f5224d273 100644 --- a/build.sbt +++ b/build.sbt @@ -3215,7 +3215,7 @@ lazy val `runtime-instrument-repl-debugger` = (`runtime` / Compile / exportedModule).value, (`polyglot-api` / Compile / exportedModule).value, (`runtime-compiler` / Compile / exportedModule).value, - (`runtime-parser` / Compile / exportedModule).value, + (`runtime-parser` / Compile / exportedModule).value ) ) .dependsOn(LocalProject("runtime")) @@ -3651,6 +3651,7 @@ lazy val `test-utils` = lazy val `benchmarks-common` = (project in file("lib/java/benchmarks-common")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, libraryDependencies ++= GraalVM.modules ++ Seq( @@ -3658,6 +3659,15 @@ lazy val `benchmarks-common` = "org.openjdk.jmh" % "jmh-generator-annprocess" % jmhVersion, "jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion, "com.sun.xml.bind" % "jaxb-impl" % jaxbVersion + ), + Compile / moduleDependencies := Seq( + "org.openjdk.jmh" % "jmh-core" % jmhVersion, // Automatic module + "jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion, + "jakarta.activation" % "jakarta.activation-api" % "2.1.0", + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion + ), + Compile / internalModuleDependencies := Seq( + (`engine-common` / Compile / exportedModule).value ) ) .dependsOn(`polyglot-api`) @@ -3677,8 +3687,10 @@ lazy val `desktop-environment` = ) lazy val `bench-processor` = (project in file("lib/scala/bench-processor")) + .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + javaModuleName := "org.enso.bench.processor", libraryDependencies ++= Seq( "jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion, "com.sun.xml.bind" % "jaxb-impl" % jaxbVersion, @@ -3697,6 +3709,16 @@ lazy val `bench-processor` = (project in file("lib/scala/bench-processor")) "-processor", "org.netbeans.modules.openide.util.ServiceProviderProcessor" )), + Compile / moduleDependencies := Seq( + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion + ), + Compile / internalModuleDependencies := Seq( + (`engine-common` / Compile / exportedModule).value, + (`runtime` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, + (`benchmarks-common` / Compile / exportedModule).value + ), mainClass := Some("org.enso.benchmarks.libs.LibBenchRunner"), commands += WithDebugCommand.withDebug, (Test / fork) := true, diff --git a/lib/java/benchmarks-common/src/main/java/module-info.java b/lib/java/benchmarks-common/src/main/java/module-info.java new file mode 100644 index 000000000000..2ae6dc7ac68d --- /dev/null +++ b/lib/java/benchmarks-common/src/main/java/module-info.java @@ -0,0 +1,8 @@ +module org.enso.benchmarks.common { + requires jakarta.xml.bind; + requires jmh.core; + requires org.enso.engine.common; + requires org.graalvm.polyglot; + + exports org.enso.interpreter.bench; +} diff --git a/lib/scala/bench-processor/src/main/java/module-info.java b/lib/scala/bench-processor/src/main/java/module-info.java new file mode 100644 index 000000000000..853fec063934 --- /dev/null +++ b/lib/scala/bench-processor/src/main/java/module-info.java @@ -0,0 +1,15 @@ +module org.enso.bench.processor { + requires java.compiler; + requires java.logging; + requires org.enso.engine.common; + requires org.enso.polyglot.api; + requires org.enso.runtime; + requires org.graalvm.polyglot; + requires org.openide.util.lookup.RELEASE180; + + exports org.enso.benchmarks; + exports org.enso.benchmarks.processor; + + provides javax.annotation.processing.Processor with + org.enso.benchmarks.processor.BenchProcessor; +} From 2c65cb889d3be1260dd1d9278ee2ebe1a8378708 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 11 Sep 2024 12:35:18 +0200 Subject: [PATCH 189/268] fmt --- .../repl/debugger/ReplDebuggerInstrument.java | 2 -- project/FrgaalJavaCompiler.scala | 17 ++++++++++------- project/JPMSUtils.scala | 7 +------ 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/repl/debugger/ReplDebuggerInstrument.java b/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/repl/debugger/ReplDebuggerInstrument.java index f37d78c5614c..87012f057480 100644 --- a/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/repl/debugger/ReplDebuggerInstrument.java +++ b/engine/runtime-instrument-repl-debugger/src/main/java/org/enso/interpreter/instrument/repl/debugger/ReplDebuggerInstrument.java @@ -34,8 +34,6 @@ import org.enso.interpreter.instrument.DebuggerMessageHandler; import org.enso.interpreter.instrument.ReplExecutionEventNode; import org.enso.interpreter.node.EnsoRootNode; -import org.enso.interpreter.instrument.DebuggerMessageHandler; -import org.enso.interpreter.instrument.ReplExecutionEventNode; import org.enso.interpreter.node.expression.builtin.debug.DebugBreakpointNode; import org.enso.interpreter.node.expression.builtin.text.util.ToJavaStringNode; import org.enso.interpreter.node.expression.debug.CaptureResultScopeNode; diff --git a/project/FrgaalJavaCompiler.scala b/project/FrgaalJavaCompiler.scala index 62d29e1bbdcd..e0bbc181d8af 100644 --- a/project/FrgaalJavaCompiler.scala +++ b/project/FrgaalJavaCompiler.scala @@ -43,8 +43,8 @@ object FrgaalJavaCompiler { * of `shouldCompileModuleInfo` task in `build.sbt` and * the docs of [[JPMSPlugin]]. * @param javaSourceDir The directory where Java sources are located - * @param shouldNotLimitModules Should `--limit-modules` cmdline option be passed to java process - * to limit set of modules frgaal is able to see? + * @param shouldNotLimitModules Should `--limit-modules` cmdline option be passed to java process + * to limit set of modules frgaal is able to see? * @return */ def compilers( @@ -277,10 +277,13 @@ object FrgaalJavaCompiler { "java.sql", "jdk.jfr" ) - val limitModulesArgs = if (shouldNotLimitModules) Seq() else Seq( - "--limit-modules", - limitModules.mkString(",") - ) + val limitModulesArgs = + if (shouldNotLimitModules) Seq() + else + Seq( + "--limit-modules", + limitModules.mkString(",") + ) // strippedJArgs needs to be passed via cmd line, and not via the argument file val forkArgs = (strippedJArgs ++ limitModulesArgs ++ Seq( "-jar", @@ -369,7 +372,7 @@ final class FrgaalJavaCompiler( javaSourceDir: File, source: Option[String] = None, shouldCompileModuleInfo: Boolean = false, - shouldNotLimitModules: Boolean = false + shouldNotLimitModules: Boolean = false ) extends XJavaCompiler { def run( sources: Array[VirtualFile], diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index 37f32fd19d25..1e8c29b10c76 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -7,12 +7,7 @@ import xsbti.compile.IncToolOptionsUtil import java.io.File import java.nio.file.attribute.BasicFileAttributes -import java.nio.file.{ - FileVisitResult, - Files, - Path, - SimpleFileVisitor -} +import java.nio.file.{FileVisitResult, Files, Path, SimpleFileVisitor} import scala.collection.mutable /** Collection of utility methods dealing with JPMS modules. From f3347ca88b45431c4e9c39e56f109523148d8704 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 11 Sep 2024 12:39:32 +0200 Subject: [PATCH 190/268] Fix after mege --- .../enso/benchmarks/processor/SpecCollector.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollector.java b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollector.java index 51dbf8a8130a..0fd82ed4daac 100644 --- a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollector.java +++ b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/SpecCollector.java @@ -385,7 +385,19 @@ public void dumpCompilationMessages(IterationParams it) { @TearDown public void checkNoTruffleCompilation(BenchmarkParams params) { if (compilationMessagesFound) { - System.err.println(compilationLog.toString()); + var limit = Boolean.getBoolean("bench.all") ? 10 : Integer.MAX_VALUE; + for (var l : compilationLog.toString().split("\\n")) { + var pipe = l.indexOf('|'); + if (pipe > 0) { + l = l.substring(0, pipe); + } + System.out.println(l); + if (limit-- <= 0) { + System.out.println("... to see more use:"); + System.out.println("benchOnly " + params.getBenchmark()); + break; + } + } } } From 70c1d43c9d525b8f6b5c387de901c59a8e2a2e01 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 11 Sep 2024 12:57:30 +0200 Subject: [PATCH 191/268] Enable JMH annotation processor --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 19804fed7a45..6efa2694ad36 100644 --- a/build.sbt +++ b/build.sbt @@ -3774,7 +3774,7 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) }, Compile / javacOptions ++= Seq( "-processor", - "org.enso.benchmarks.processor.BenchProcessor" + "org.enso.benchmarks.processor.BenchProcessor,org.openjdk.jmh.generators.BenchmarkProcessor" ), Compile / moduleDependencies := { (`runtime-benchmarks` / Compile / moduleDependencies).value From 259cc9c2011acabb653109c6f4f0d273f7260d4a Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 17 Sep 2024 14:34:59 +0200 Subject: [PATCH 192/268] Fix compileOrder in some projects --- build.sbt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.sbt b/build.sbt index 6efa2694ad36..bef010818a77 100644 --- a/build.sbt +++ b/build.sbt @@ -2474,6 +2474,7 @@ lazy val `runtime-language-epb` = .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + javaModuleName := "org.enso.runtime.language.epb", inConfig(Compile)(truffleRunOptionsSettings), truffleDslSuppressWarnsSetting, commands += WithDebugCommand.withDebug, @@ -2501,6 +2502,7 @@ lazy val `runtime-language-arrow` = .settings( crossPaths := false, autoScalaLibrary := false, + javaModuleName := "org.enso.interpreter.arrow", inConfig(Compile)(truffleRunOptionsSettings), instrumentationSettings, libraryDependencies ++= GraalVM.modules ++ Seq( @@ -3177,6 +3179,7 @@ lazy val `runtime-instrument-id-execution` = .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.JavaThenScala, inConfig(Compile)(truffleRunOptionsSettings), instrumentationSettings, Compile / moduleDependencies := Seq( @@ -3200,6 +3203,7 @@ lazy val `runtime-instrument-repl-debugger` = .enablePlugins(JPMSPlugin) .settings( inConfig(Compile)(truffleRunOptionsSettings), + compileOrder := CompileOrder.JavaThenScala, instrumentationSettings, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -3226,6 +3230,7 @@ lazy val `runtime-instrument-runtime-server` = .enablePlugins(JPMSPlugin) .settings( inConfig(Compile)(truffleRunOptionsSettings), + compileOrder := CompileOrder.JavaThenScala, instrumentationSettings, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, From 5be420cd0ddba2c72d7d761adc0c21b9460a19ef Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 17 Sep 2024 14:51:52 +0200 Subject: [PATCH 193/268] Insert TruffleBoundary to QualifiedName. This is a revert --- build.sbt | 12 +++++++++--- lib/scala/pkg/src/main/java/module-info.java | 1 + .../src/main/scala/org/enso/pkg/QualifiedName.scala | 4 ++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index bef010818a77..e876f956de60 100644 --- a/build.sbt +++ b/build.sbt @@ -888,6 +888,7 @@ lazy val pkg = (project in file("lib/scala/pkg")) version := "0.1", Compile / run / mainClass := Some("org.enso.pkg.Main"), libraryDependencies ++= Seq( + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "io.circe" %% "circe-core" % circeVersion % "provided", "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test, @@ -895,9 +896,14 @@ lazy val pkg = (project in file("lib/scala/pkg")) ), Compile / moduleDependencies := { Seq( - "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "org.scala-lang" % "scala-library" % scalacVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion ) }, Compile / internalModuleDependencies := Seq( diff --git a/lib/scala/pkg/src/main/java/module-info.java b/lib/scala/pkg/src/main/java/module-info.java index 4a9ef4ce6d96..7b0e270402bb 100644 --- a/lib/scala/pkg/src/main/java/module-info.java +++ b/lib/scala/pkg/src/main/java/module-info.java @@ -1,5 +1,6 @@ module org.enso.pkg { requires scala.library; + requires org.graalvm.truffle; requires org.apache.commons.compress; requires org.enso.editions; requires org.enso.semver; diff --git a/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala b/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala index c3581dbcecfc..45025b81d140 100644 --- a/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala +++ b/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala @@ -1,5 +1,7 @@ package org.enso.pkg +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary + import scala.jdk.CollectionConverters._ /** Represents a qualified name of a source item. @@ -13,6 +15,7 @@ case class QualifiedName(path: List[String], item: String) { private lazy val qualifiedNameString: String = (path :+ item).mkString(QualifiedName.separator) + @TruffleBoundary override def toString: String = qualifiedNameString @@ -28,6 +31,7 @@ case class QualifiedName(path: List[String], item: String) { * @param name the name of a child node. * @return a new qualified name based on this name. */ + @TruffleBoundary def createChild(name: String): QualifiedName = QualifiedName(path :+ item, name) From f63b0e7f542205e04115c81ea27c9965cc1c8be2 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 17 Sep 2024 15:37:36 +0200 Subject: [PATCH 194/268] Fix building of engine-runner native image --- build.sbt | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/build.sbt b/build.sbt index e876f956de60..ea598c9fe2f1 100644 --- a/build.sbt +++ b/build.sbt @@ -3380,18 +3380,12 @@ lazy val `engine-runner` = project .settings( NativeImage.smallJdk := Some(buildSmallJdk.value), NativeImage.additionalCp := { - val core = Seq( - "runtime.jar", - "runner.jar" - ) + val runnerDeps = (Compile / fullClasspath).value.map(_.data.getAbsolutePath) + val runtimeDeps = (`runtime` / Compile / fullClasspath).value.map(_.data.getAbsolutePath) + val core = (runnerDeps ++ runtimeDeps).distinct 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 + core ++ stdLibsJars }, buildSmallJdk := { val smallJdkDirectory = (target.value / "jdk").getAbsoluteFile() From dcef5e5b68f544f8fff0dde6316a54f4ef24b013 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 17 Sep 2024 16:32:39 +0200 Subject: [PATCH 195/268] Add more deps to the native image --- build.sbt | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ea598c9fe2f1..834e2a5d74a8 100644 --- a/build.sbt +++ b/build.sbt @@ -3382,7 +3382,27 @@ lazy val `engine-runner` = project NativeImage.additionalCp := { val runnerDeps = (Compile / fullClasspath).value.map(_.data.getAbsolutePath) val runtimeDeps = (`runtime` / Compile / fullClasspath).value.map(_.data.getAbsolutePath) - val core = (runnerDeps ++ runtimeDeps).distinct + val loggingDeps = (`logging-service-logback` / Compile / fullClasspath).value.map(_.data.getAbsolutePath) + val replDebugInstr = + (`runtime-instrument-repl-debugger` / Compile / fullClasspath) + .value + .map(_.data.getAbsolutePath) + val runtimeServerInstr = + (`runtime-instrument-runtime-server` / Compile / fullClasspath) + .value + .map(_.data.getAbsolutePath) + val epbLang = + (`runtime-language-epb` / Compile / fullClasspath) + .value + .map(_.data.getAbsolutePath) + val core = ( + runnerDeps ++ + runtimeDeps ++ + loggingDeps ++ + replDebugInstr ++ + runtimeServerInstr ++ + epbLang + ).distinct val stdLibsJars = `base-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath()) core ++ stdLibsJars From 40770f4de54f120de37035f9fec0a72f84b50c1d Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 17 Sep 2024 18:15:54 +0200 Subject: [PATCH 196/268] Force module-info compilation in instruments. This fixes some weird sbt bug --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 834e2a5d74a8..c9217d2467b3 100644 --- a/build.sbt +++ b/build.sbt @@ -3185,8 +3185,8 @@ lazy val `runtime-instrument-id-execution` = .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - compileOrder := CompileOrder.JavaThenScala, inConfig(Compile)(truffleRunOptionsSettings), + Compile / forceModuleInfoCompilation := true, instrumentationSettings, Compile / moduleDependencies := Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, @@ -3209,7 +3209,7 @@ lazy val `runtime-instrument-repl-debugger` = .enablePlugins(JPMSPlugin) .settings( inConfig(Compile)(truffleRunOptionsSettings), - compileOrder := CompileOrder.JavaThenScala, + Compile / forceModuleInfoCompilation := true, instrumentationSettings, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -3236,7 +3236,7 @@ lazy val `runtime-instrument-runtime-server` = .enablePlugins(JPMSPlugin) .settings( inConfig(Compile)(truffleRunOptionsSettings), - compileOrder := CompileOrder.JavaThenScala, + Compile / forceModuleInfoCompilation := true, instrumentationSettings, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, From a7ddd028687ce6b159b878ff99a2fa80cc199e80 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 17 Sep 2024 18:37:11 +0200 Subject: [PATCH 197/268] Don't run engine-runner/assembly from Rust build script --- build/build/src/engine/context.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/build/build/src/engine/context.rs b/build/build/src/engine/context.rs index bc6702bfa784..04870a70efd2 100644 --- a/build/build/src/engine/context.rs +++ b/build/build/src/engine/context.rs @@ -320,7 +320,6 @@ impl RunContext { // === Build project-manager distribution and native image === let mut tasks = vec![]; if self.config.build_engine_package() { - tasks.push("engine-runner/assembly"); tasks.push("buildEngineDistribution"); } if self.config.build_native_runner { From 04495ec03e2b6278029fde9a1e7e9d1306abf3e4 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 10:43:17 +0200 Subject: [PATCH 198/268] Update docs of JPMSPlugin --- build.sbt | 72 +++++++++++++++++++++++----------------- project/JPMSPlugin.scala | 38 ++++++++++++++++++--- 2 files changed, 76 insertions(+), 34 deletions(-) diff --git a/build.sbt b/build.sbt index c9217d2467b3..6e9211e51354 100644 --- a/build.sbt +++ b/build.sbt @@ -727,6 +727,7 @@ lazy val `text-buffer` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test ), + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion @@ -865,6 +866,7 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) .configs(Test) .settings( frgaalJavaCompilerSetting, + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", libraryDependencies ++= Seq( "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", @@ -889,21 +891,21 @@ lazy val pkg = (project in file("lib/scala/pkg")) Compile / run / mainClass := Some("org.enso.pkg.Main"), libraryDependencies ++= Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, - "io.circe" %% "circe-core" % circeVersion % "provided", - "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", - "org.scalatest" %% "scalatest" % scalatestVersion % Test, - "org.apache.commons" % "commons-compress" % commonsCompressVersion + "io.circe" %% "circe-core" % circeVersion % "provided", + "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", + "org.scalatest" %% "scalatest" % scalatestVersion % Test, + "org.apache.commons" % "commons-compress" % commonsCompressVersion ), Compile / moduleDependencies := { Seq( - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "org.scala-lang" % "scala-library" % scalacVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion ) }, Compile / internalModuleDependencies := Seq( @@ -1031,6 +1033,7 @@ lazy val `logging-service-logback` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", version := "0.1", libraryDependencies ++= Seq( @@ -1525,6 +1528,7 @@ lazy val `refactoring-utils` = project "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion @@ -2046,7 +2050,7 @@ lazy val `polyglot-api` = project "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test ), javaModuleName := "org.enso.polyglot.api", - // Note [Compile module-info] + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -2079,7 +2083,7 @@ lazy val `polyglot-api-macros` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - // Note [Compile module-info] + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", libraryDependencies ++= Seq( "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion % "provided", @@ -2122,6 +2126,7 @@ lazy val `language-server` = (project in file("engine/language-server")) "org.bouncycastle" % "bcprov-jdk18on" % "1.76" % Test, "org.apache.tika" % "tika-core" % tikaVersion % Test ), + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", javaModuleName := "org.enso.language.server", Compile / moduleDependencies := { @@ -2606,6 +2611,7 @@ lazy val runtime = (project in file("engine/runtime")) necessaryModules ++ langs ++ tools }, javaModuleName := "org.enso.runtime", + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -3051,7 +3057,7 @@ lazy val `runtime-parser` = (`syntax-rust-definition` / Compile / exportedModule).value, (`persistance` / Compile / exportedModule).value ), - // Note [Compile module-info] + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java" ) .dependsOn(`syntax-rust-definition`) @@ -3076,6 +3082,7 @@ lazy val `runtime-compiler` = "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ), + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", Compile / internalModuleDependencies := Seq( (`engine-common` / Compile / exportedModule).value, @@ -3104,6 +3111,7 @@ lazy val `runtime-suggestions` = "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion @@ -3145,6 +3153,7 @@ lazy val `runtime-instrument-common` = "org.scalatest" %% "scalatest" % scalatestVersion % Test ), javaModuleName := "org.enso.runtime.instrument.common", + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", Compile / moduleDependencies := Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, @@ -3380,29 +3389,31 @@ lazy val `engine-runner` = project .settings( NativeImage.smallJdk := Some(buildSmallJdk.value), NativeImage.additionalCp := { - val runnerDeps = (Compile / fullClasspath).value.map(_.data.getAbsolutePath) - val runtimeDeps = (`runtime` / Compile / fullClasspath).value.map(_.data.getAbsolutePath) - val loggingDeps = (`logging-service-logback` / Compile / fullClasspath).value.map(_.data.getAbsolutePath) + val runnerDeps = + (Compile / fullClasspath).value.map(_.data.getAbsolutePath) + val runtimeDeps = + (`runtime` / Compile / fullClasspath).value.map(_.data.getAbsolutePath) + val loggingDeps = + (`logging-service-logback` / Compile / fullClasspath).value.map( + _.data.getAbsolutePath + ) val replDebugInstr = - (`runtime-instrument-repl-debugger` / Compile / fullClasspath) - .value + (`runtime-instrument-repl-debugger` / Compile / fullClasspath).value .map(_.data.getAbsolutePath) val runtimeServerInstr = - (`runtime-instrument-runtime-server` / Compile / fullClasspath) - .value + (`runtime-instrument-runtime-server` / Compile / fullClasspath).value .map(_.data.getAbsolutePath) val epbLang = - (`runtime-language-epb` / Compile / fullClasspath) - .value + (`runtime-language-epb` / Compile / fullClasspath).value .map(_.data.getAbsolutePath) val core = ( runnerDeps ++ - runtimeDeps ++ - loggingDeps ++ - replDebugInstr ++ - runtimeServerInstr ++ - epbLang - ).distinct + runtimeDeps ++ + loggingDeps ++ + replDebugInstr ++ + runtimeServerInstr ++ + epbLang + ).distinct val stdLibsJars = `base-polyglot-root`.listFiles("*.jar").map(_.getAbsolutePath()) core ++ stdLibsJars @@ -3994,6 +4005,7 @@ lazy val downloader = (project in file("lib/scala/downloader")) "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), + // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", Compile / internalModuleDependencies := Seq( (`cli` / Compile / exportedModule).value, diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 447faf639ae8..79d31900341e 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -13,25 +13,55 @@ import scala.collection.mutable * This plugin injects all the module-specific options to `javaOptions`, based on * the settings of this plugin. * + * Note that the settings of this plugin are *scoped* to `Compile` and `Test` configurations, so + * you need to always specify the configuration, for example, `Compile / moduleDependencies` instead + * of just `moduleDependencies`. + * * If this plugin is enabled, and no settings/tasks from this plugin are used, then the plugin will * not inject anything into `javaOptions` or `javacOptions`. * * == How to work with this plugin == - * - Specify `moduleDependencies` with something like: + * + * - Specify external dependencies in `Compile / moduleDependencies` with something like: * {{{ - * moduleDependencies := Seq( + * Compile / moduleDependencies := Seq( * "org.apache.commons" % "commons-lang3" % "3.11", * ) * }}} + * - Specify internal dependencies in `Compile / internalModuleDependencies` with something like: + * {{{ + * Compile / internalModuleDependencies := Seq( + * (myProject / Compile / exportedModule).value + * ) + * }}} + * - This ensures that `myProject` will be compiled, along with its `module-info.java`, and + * the resulting directory with all the classes, along with `module-info.class` will be put on + * the module path. * - Ensure that all the module dependencies were gathered by the plugin correctly by * `print modulePath`. * - If not, make sure that these dependencies are in `libraryDependencies`. * Debug this with `print dependencyClasspath`. * + * == Mixed projects == + * + * A project with both Java and Scala sources that call into each other is called *mixed*. + * sbt sets `compileOrder := CompileOrder.Mixed` for these projects. + * Having `module-info.java` and trying to compile such project fails, because sbt first + * tries to parse all the Java sources with its own custom parser, that does not recognize + * `module-info.java`. + * One has to **exclude** the `module-info.java` from the compilation with setting + * {{{ + * excludeFilter := excludeFilter.value || "module-info.java" + * }}} + * This plugin tries to determine this case and will force the compilation of `module-info.java`. + * To see if this will be the case, check the value of `shouldCompileModuleInfoManually` task by + * `print shouldCompileModuleInfoManually`. + * In rare case, you have to override either `shouldCompileInfoManually` or `forceModuleInfoCompilation`. + * * == Caveats == + * * - This plugin cannot determine transitive dependencies of modules in `moduleDependencies`. - * As opposed to `libraryDependencies` which automatically gatheres all the transitive dependencies. - * - `compileOrder` has to be specified before `libraryDependencies`. + * As opposed to `libraryDependencies` which automatically gathers all the transitive dependencies. */ object JPMSPlugin extends AutoPlugin { object autoImport { From c897666ad2052eb52f442c14ad6996865d68c98e Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 10:43:23 +0200 Subject: [PATCH 199/268] fmt --- lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala b/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala index 45025b81d140..4e53851a5e8b 100644 --- a/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala +++ b/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala @@ -31,7 +31,7 @@ case class QualifiedName(path: List[String], item: String) { * @param name the name of a child node. * @return a new qualified name based on this name. */ - @TruffleBoundary + @TruffleBoundary def createChild(name: String): QualifiedName = QualifiedName(path :+ item, name) From 432d7082efeb668f0dffc72a51c284a229877457 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 12:24:51 +0200 Subject: [PATCH 200/268] runtime-benchmarks depends on benchmarks-common module --- build.sbt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 6e9211e51354..80685ee8c97b 100644 --- a/build.sbt +++ b/build.sbt @@ -2912,7 +2912,11 @@ lazy val `runtime-benchmarks` = "io.sentry" % "sentry-logback" % "6.28.0", "io.sentry" % "sentry" % "6.28.0", "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion + "ch.qos.logback" % "logback-core" % logbackClassicVersion, + // Dependencies for benchmarks-common + "org.openjdk.jmh" % "jmh-core" % jmhVersion, // Automatic module + "jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion, + "jakarta.activation" % "jakarta.activation-api" % "2.1.0", ) }, Compile / internalModuleDependencies := Seq( @@ -2924,6 +2928,7 @@ lazy val `runtime-benchmarks` = (`runtime-language-epb` / Compile / exportedModule).value, (`runtime-language-arrow` / Compile / exportedModule).value, (`ydoc-server` / Compile / exportedModule).value, + (`benchmarks-common` / Compile / exportedModule).value, (`syntax-rust-definition` / Compile / exportedModule).value, (`profiling-utils` / Compile / exportedModule).value, (`logging-service-logback` / Compile / exportedModule).value, @@ -2957,6 +2962,7 @@ lazy val `runtime-benchmarks` = ), Compile / addModules := Seq( (`runtime` / javaModuleName).value, + (`benchmarks-common` / javaModuleName).value, "org.slf4j.nop" ), // Benchmark sources are patched into the `org.enso.runtime` module @@ -2964,16 +2970,15 @@ lazy val `runtime-benchmarks` = val runtimeModName = (`runtime` / javaModuleName).value val javaSrcDir = (Compile / javaSource).value val classesDir = (Compile / productDirectories).value.head + val generatedClassesDir = (Compile / sourceManaged).value val testUtilsClasses = (`test-utils` / Compile / productDirectories).value.head - val benchCommonClasses = - (`benchmarks-common` / Compile / productDirectories).value.head Map( runtimeModName -> Seq( javaSrcDir, classesDir, testUtilsClasses, - benchCommonClasses + generatedClassesDir ) ) }, @@ -2981,7 +2986,10 @@ lazy val `runtime-benchmarks` = Compile / addReads := { val runtimeModName = (`runtime` / javaModuleName).value Map( - runtimeModName -> Seq("ALL-UNNAMED") + runtimeModName -> Seq( + "ALL-UNNAMED", + (`benchmarks-common` / javaModuleName).value + ) ) }, Compile / addExports := { @@ -3690,6 +3698,7 @@ lazy val `benchmarks-common` = .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + javaModuleName := "org.enso.benchmarks.common", libraryDependencies ++= GraalVM.modules ++ Seq( "org.openjdk.jmh" % "jmh-core" % jmhVersion, "org.openjdk.jmh" % "jmh-generator-annprocess" % jmhVersion, From 5f3fc68daaec8c68cf3d7d7df9f8de9e7c99345a Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 12:30:46 +0200 Subject: [PATCH 201/268] Fix benchmark report writing --- lib/java/benchmarks-common/src/main/java/module-info.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/java/benchmarks-common/src/main/java/module-info.java b/lib/java/benchmarks-common/src/main/java/module-info.java index 2ae6dc7ac68d..2f6b35d3b771 100644 --- a/lib/java/benchmarks-common/src/main/java/module-info.java +++ b/lib/java/benchmarks-common/src/main/java/module-info.java @@ -5,4 +5,6 @@ requires org.graalvm.polyglot; exports org.enso.interpreter.bench; + + opens org.enso.interpreter.bench to jakarta.xml.bind; } From f6aa7ac35223f4610abb92f7e1684af8ebab3600 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 12:38:59 +0200 Subject: [PATCH 202/268] std-benchmarks annot processing does not take settings from runtime-benchmarks --- build.sbt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 80685ee8c97b..a21e4fb22a0f 100644 --- a/build.sbt +++ b/build.sbt @@ -3834,7 +3834,8 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) }, Compile / addModules := Seq( (`runtime` / javaModuleName).value, - (`bench-processor` / javaModuleName).value + (`bench-processor` / javaModuleName).value, + (`benchmarks-common` / javaModuleName).value ), // std benchmark sources are patch into the `org.enso.runtime` module Compile / patchModules := { @@ -3848,8 +3849,15 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) ) ) }, + // jmh is in unnamed modules Compile / addReads := { - (`runtime-benchmarks` / Compile / addReads).value + val runtimeModName = (`runtime` / javaModuleName).value + Map( + runtimeModName -> Seq( + "ALL-UNNAMED", + (`benchmarks-common` / javaModuleName).value + ) + ) }, // export all the packages to ALL-UNNAMED Compile / addExports := { From 9af6e9fd75f09288366ddeed602b6bb2477efd20 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 12:40:11 +0200 Subject: [PATCH 203/268] Suppress interpreter only warning in annotation processor --- build.sbt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index a21e4fb22a0f..aecb4287ebb7 100644 --- a/build.sbt +++ b/build.sbt @@ -3819,7 +3819,9 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) }, Compile / javacOptions ++= Seq( "-processor", - "org.enso.benchmarks.processor.BenchProcessor,org.openjdk.jmh.generators.BenchmarkProcessor" + "org.enso.benchmarks.processor.BenchProcessor,org.openjdk.jmh.generators.BenchmarkProcessor", + // There is no Truffle compiler available for annotation processors. Suppress the warning. + "-J-Dpolyglot.engine.WarnInterpreterOnly=false", ), Compile / moduleDependencies := { (`runtime-benchmarks` / Compile / moduleDependencies).value From 672fbeba4fdfbcbfa63bc311ebe472bc6c21e00f Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 12:59:02 +0200 Subject: [PATCH 204/268] Runtime version manager does not expect runtime.jar fat jar --- .../components/Engine.scala | 30 ++----------------- .../runtimeversionmanager/runner/Runner.scala | 21 ++----------- 2 files changed, 6 insertions(+), 45 deletions(-) diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Engine.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Engine.scala index 24abaaf238bf..8631eaddd6ed 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Engine.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/components/Engine.scala @@ -38,39 +38,15 @@ case class Engine(version: SemVer, path: Path, manifest: Manifest) { */ def componentDirPath: Path = path / "component" - /** Path to the runner JAR. - */ - def runnerPath: Option[Path] = { - if (graalRuntimeVersion.isUnchained) { - None - } else { - Some( - componentDirPath / "runner.jar" - ) - } - } - - /** Path to the runtime JAR. - */ - def runtimePath: Path = componentDirPath / "runtime.jar" - /** Checks if the installation is not corrupted and reports any issues as * failures. */ def ensureValid(): Try[Unit] = { - if (runnerPath.isDefined && !Files.exists(runnerPath.get)) { - return Failure( - CorruptedComponentError( - s"Engine's runner.jar (expected at " + - s"`${MaskedPath(runnerPath.get).applyMasking()}`) is missing." - ) - ) - } - if (!Files.exists(runtimePath)) { + if (!Files.exists(componentDirPath)) { return Failure( CorruptedComponentError( - s"`Engine's runtime.jar (expected at " + - s"${MaskedPath(runtimePath).applyMasking()}`) is missing." + s"`Engine's component directory (expected at " + + s"${MaskedPath(componentDirPath).applyMasking()}`) is missing." ) ) } diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala index ea0affdb71d1..4b81789dd036 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala @@ -197,29 +197,14 @@ class Runner( jvmSettings.extraOptions.map( translateJVMOption(_, standardOption = false) ) - val shouldInvokeViaModulePath = engine.graalRuntimeVersion.isUnchained - val componentPath = engine.componentDirPath.toAbsolutePath.normalize - var jvmArguments = - manifestOptions ++ environmentOptions ++ commandLineOptions - if (shouldInvokeViaModulePath) { - jvmArguments = jvmArguments :++ Seq( + val jvmArguments = + manifestOptions ++ environmentOptions ++ commandLineOptions ++ Seq( "--module-path", componentPath.toString, "-m", - "org.enso.runtime/org.enso.EngineRunnerBootLoader" - ) - } else { - assert( - engine.runnerPath.isDefined, - "Engines path to runner.jar must be defined - it is not an unchained engine" + "org.enso.runner/org.enso.runner.Main" ) - val runnerJar = engine.runnerPath.get.toAbsolutePath.normalize.toString - jvmArguments = jvmArguments :++ Seq( - "-jar", - runnerJar - ) - } val loggingConnectionArguments = if (runSettings.connectLoggerIfAvailable) From 9cb6b7748c3b8d20a79ebe3ea6db154624a1f55d Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 12:59:09 +0200 Subject: [PATCH 205/268] fmt --- build.sbt | 14 +++++++------- .../src/main/java/module-info.java | 3 ++- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index aecb4287ebb7..291b527b80f0 100644 --- a/build.sbt +++ b/build.sbt @@ -2914,9 +2914,9 @@ lazy val `runtime-benchmarks` = "ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-core" % logbackClassicVersion, // Dependencies for benchmarks-common - "org.openjdk.jmh" % "jmh-core" % jmhVersion, // Automatic module - "jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion, - "jakarta.activation" % "jakarta.activation-api" % "2.1.0", + "org.openjdk.jmh" % "jmh-core" % jmhVersion, // Automatic module + "jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion, + "jakarta.activation" % "jakarta.activation-api" % "2.1.0" ) }, Compile / internalModuleDependencies := Seq( @@ -2967,9 +2967,9 @@ lazy val `runtime-benchmarks` = ), // Benchmark sources are patched into the `org.enso.runtime` module Compile / patchModules := { - val runtimeModName = (`runtime` / javaModuleName).value - val javaSrcDir = (Compile / javaSource).value - val classesDir = (Compile / productDirectories).value.head + val runtimeModName = (`runtime` / javaModuleName).value + val javaSrcDir = (Compile / javaSource).value + val classesDir = (Compile / productDirectories).value.head val generatedClassesDir = (Compile / sourceManaged).value val testUtilsClasses = (`test-utils` / Compile / productDirectories).value.head @@ -3821,7 +3821,7 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) "-processor", "org.enso.benchmarks.processor.BenchProcessor,org.openjdk.jmh.generators.BenchmarkProcessor", // There is no Truffle compiler available for annotation processors. Suppress the warning. - "-J-Dpolyglot.engine.WarnInterpreterOnly=false", + "-J-Dpolyglot.engine.WarnInterpreterOnly=false" ), Compile / moduleDependencies := { (`runtime-benchmarks` / Compile / moduleDependencies).value diff --git a/lib/java/benchmarks-common/src/main/java/module-info.java b/lib/java/benchmarks-common/src/main/java/module-info.java index 2f6b35d3b771..eca1109c56fe 100644 --- a/lib/java/benchmarks-common/src/main/java/module-info.java +++ b/lib/java/benchmarks-common/src/main/java/module-info.java @@ -6,5 +6,6 @@ exports org.enso.interpreter.bench; - opens org.enso.interpreter.bench to jakarta.xml.bind; + opens org.enso.interpreter.bench to + jakarta.xml.bind; } From b8e2737a2994f6b483aa94598275951c7f646c76 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 15:51:49 +0200 Subject: [PATCH 206/268] Fix module entry point --- engine/runner/src/main/java/org/enso/runner/Main.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/runner/src/main/java/org/enso/runner/Main.java b/engine/runner/src/main/java/org/enso/runner/Main.java index 6ce937cbb306..7cd7cd4eb383 100644 --- a/engine/runner/src/main/java/org/enso/runner/Main.java +++ b/engine/runner/src/main/java/org/enso/runner/Main.java @@ -1358,7 +1358,7 @@ private void launch(String[] args) throws IOException, InterruptedException, URI } commandAndArgs.add(component.getPath()); commandAndArgs.add("-m"); - commandAndArgs.add("org.enso.runtime/org.enso.EngineRunnerBootLoader"); + commandAndArgs.add("org.enso.runner/org.enso.runner.Main"); var it = line.iterator(); while (it.hasNext()) { var op = it.next(); From 059daecff6cb592d4fa1620b7fd9c2b3359a940e Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 16:04:19 +0200 Subject: [PATCH 207/268] Move some polyglot tests to runtime-integration-tests. Also make their output silent --- .../scala/org/enso/polyglot/test}/ApiTest.scala | 8 +++++++- .../enso/polyglot/test}/ModuleManagementTest.scala | 13 +++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) rename engine/{polyglot-api/src/test/scala/org/enso/polyglot => runtime-integration-tests/src/test/scala/org/enso/polyglot/test}/ApiTest.scala (92%) rename engine/{polyglot-api/src/test/scala/org/enso/polyglot => runtime-integration-tests/src/test/scala/org/enso/polyglot/test}/ModuleManagementTest.scala (96%) diff --git a/engine/polyglot-api/src/test/scala/org/enso/polyglot/ApiTest.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/polyglot/test/ApiTest.scala similarity index 92% rename from engine/polyglot-api/src/test/scala/org/enso/polyglot/ApiTest.scala rename to engine/runtime-integration-tests/src/test/scala/org/enso/polyglot/test/ApiTest.scala index 174526eed722..5a34f7ef3a4f 100644 --- a/engine/polyglot-api/src/test/scala/org/enso/polyglot/ApiTest.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/polyglot/test/ApiTest.scala @@ -1,14 +1,17 @@ -package org.enso.polyglot +package org.enso.polyglot.test import org.enso.common.RuntimeOptions +import org.enso.polyglot.PolyglotContext import org.graalvm.polyglot.Context import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers +import java.io.ByteArrayOutputStream import java.nio.file.Paths class ApiTest extends AnyFlatSpec with Matchers { import org.enso.common.LanguageInfo._ + val out = new ByteArrayOutputStream() val executionContext = new PolyglotContext( Context .newBuilder(ID) @@ -18,6 +21,9 @@ class ApiTest extends AnyFlatSpec with Matchers { RuntimeOptions.LANGUAGE_HOME_OVERRIDE, Paths.get("../../distribution/component").toFile.getAbsolutePath ) + .out(out) + .err(out) + .logHandler(out) .build() ) diff --git a/engine/polyglot-api/src/test/scala/org/enso/polyglot/ModuleManagementTest.scala b/engine/runtime-integration-tests/src/test/scala/org/enso/polyglot/test/ModuleManagementTest.scala similarity index 96% rename from engine/polyglot-api/src/test/scala/org/enso/polyglot/ModuleManagementTest.scala rename to engine/runtime-integration-tests/src/test/scala/org/enso/polyglot/test/ModuleManagementTest.scala index 9be2ea37c33c..6d213dca2d54 100644 --- a/engine/polyglot-api/src/test/scala/org/enso/polyglot/ModuleManagementTest.scala +++ b/engine/runtime-integration-tests/src/test/scala/org/enso/polyglot/test/ModuleManagementTest.scala @@ -1,15 +1,16 @@ -package org.enso.polyglot +package org.enso.polyglot.test import org.enso.common.RuntimeOptions - -import java.io.File -import java.nio.file.{Files, Paths} import org.enso.pkg.{Package, PackageManager} +import org.enso.polyglot.PolyglotContext import org.enso.testkit.WithTemporaryDirectory import org.graalvm.polyglot.{Context, PolyglotException} import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers +import java.io.{ByteArrayOutputStream, File} +import java.nio.file.{Files, Paths} + class ModuleManagementTest extends AnyFlatSpec with Matchers @@ -28,6 +29,7 @@ class ModuleManagementTest packageName, "Enso_Test" ) + val out = new ByteArrayOutputStream() val executionContext = new PolyglotContext( Context .newBuilder(org.enso.common.LanguageInfo.ID) @@ -39,6 +41,9 @@ class ModuleManagementTest Paths.get("../../distribution/component").toFile.getAbsolutePath ) .option(RuntimeOptions.STRICT_ERRORS, "true") + .out(out) + .err(out) + .logHandler(out) .build() ) From 59f3f45c0dcacf47865e6f6f6e8c6571f5af100d Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 17:04:03 +0200 Subject: [PATCH 208/268] pkg has no dependency on org.graalvm.truffle --- build.sbt | 6 ------ lib/scala/pkg/src/main/java/module-info.java | 1 - .../pkg/src/main/scala/org/enso/pkg/QualifiedName.scala | 4 ---- 3 files changed, 11 deletions(-) diff --git a/build.sbt b/build.sbt index 291b527b80f0..01c5b6d13b56 100644 --- a/build.sbt +++ b/build.sbt @@ -890,7 +890,6 @@ lazy val pkg = (project in file("lib/scala/pkg")) version := "0.1", Compile / run / mainClass := Some("org.enso.pkg.Main"), libraryDependencies ++= Seq( - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "io.circe" %% "circe-core" % circeVersion % "provided", "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test, @@ -898,11 +897,6 @@ lazy val pkg = (project in file("lib/scala/pkg")) ), Compile / moduleDependencies := { Seq( - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.scala-lang" % "scala-library" % scalacVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion diff --git a/lib/scala/pkg/src/main/java/module-info.java b/lib/scala/pkg/src/main/java/module-info.java index 7b0e270402bb..4a9ef4ce6d96 100644 --- a/lib/scala/pkg/src/main/java/module-info.java +++ b/lib/scala/pkg/src/main/java/module-info.java @@ -1,6 +1,5 @@ module org.enso.pkg { requires scala.library; - requires org.graalvm.truffle; requires org.apache.commons.compress; requires org.enso.editions; requires org.enso.semver; diff --git a/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala b/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala index 4e53851a5e8b..c3581dbcecfc 100644 --- a/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala +++ b/lib/scala/pkg/src/main/scala/org/enso/pkg/QualifiedName.scala @@ -1,7 +1,5 @@ package org.enso.pkg -import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary - import scala.jdk.CollectionConverters._ /** Represents a qualified name of a source item. @@ -15,7 +13,6 @@ case class QualifiedName(path: List[String], item: String) { private lazy val qualifiedNameString: String = (path :+ item).mkString(QualifiedName.separator) - @TruffleBoundary override def toString: String = qualifiedNameString @@ -31,7 +28,6 @@ case class QualifiedName(path: List[String], item: String) { * @param name the name of a child node. * @return a new qualified name based on this name. */ - @TruffleBoundary def createChild(name: String): QualifiedName = QualifiedName(path :+ item, name) From a37952ce6688c993e0274266ad012fa4896a00db Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 18 Sep 2024 17:07:56 +0200 Subject: [PATCH 209/268] Fix compiler dependencies test --- build.sbt | 78 ++++++++++++++++--- .../compiler/CompilerDependenciesTest.java | 36 --------- .../test/CompilerDependenciesTest.java | 44 +++++++++++ 3 files changed, 110 insertions(+), 48 deletions(-) delete mode 100644 engine/runtime-compiler/src/test/java/org/enso/compiler/CompilerDependenciesTest.java create mode 100644 engine/runtime-compiler/src/test/java/org/enso/compiler/test/CompilerDependenciesTest.java diff --git a/build.sbt b/build.sbt index 01c5b6d13b56..2e6765564ffc 100644 --- a/build.sbt +++ b/build.sbt @@ -890,16 +890,16 @@ lazy val pkg = (project in file("lib/scala/pkg")) version := "0.1", Compile / run / mainClass := Some("org.enso.pkg.Main"), libraryDependencies ++= Seq( - "io.circe" %% "circe-core" % circeVersion % "provided", - "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", - "org.scalatest" %% "scalatest" % scalatestVersion % Test, - "org.apache.commons" % "commons-compress" % commonsCompressVersion + "io.circe" %% "circe-core" % circeVersion % "provided", + "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", + "org.scalatest" %% "scalatest" % scalatestVersion % Test, + "org.apache.commons" % "commons-compress" % commonsCompressVersion ), Compile / moduleDependencies := { Seq( - "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "org.scala-lang" % "scala-library" % scalacVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion ) }, Compile / internalModuleDependencies := Seq( @@ -3069,15 +3069,22 @@ lazy val `runtime-parser` = lazy val `runtime-compiler` = (project in file("engine/runtime-compiler")) .enablePlugins(JPMSPlugin) + .enablePlugins(PackageListPlugin) .settings( frgaalJavaCompilerSetting, annotationProcSetting, + commands += WithDebugCommand.withDebug, + javaModuleName := "org.enso.runtime.compiler", (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" + "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", + "org.yaml" % "snakeyaml" % snakeyamlVersion % Test, + "org.jline" % "jline" % jlineVersion % Test, + "com.typesafe" % "config" % typesafeConfigVersion % Test, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % Test ), Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -3093,7 +3100,54 @@ lazy val `runtime-compiler` = (`syntax-rust-definition` / Compile / exportedModule).value, (`persistance` / Compile / exportedModule).value, (`editions` / Compile / exportedModule).value - ) + ), + Test / moduleDependencies := { + (Compile / moduleDependencies).value ++ Seq( + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "org.jline" % "jline" % jlineVersion, + "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-compiler" % scalacVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion + ) + }, + Test / internalModuleDependencies := { + val compileDeps = (Compile / internalModuleDependencies).value + compileDeps ++ Seq( + (Compile / exportedModule).value, + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`version-output` / Compile / exportedModule).value, + (`scala-yaml` / Compile / exportedModule).value, + (`logging-config` / Compile / exportedModule).value, + (`logging-utils` / Compile / exportedModule).value, + (`semver` / Compile / exportedModule).value + ) + }, + Test / addModules := Seq( + javaModuleName.value + ), + Test / patchModules := { + val testClassDir = (Test / productDirectories).value.head + Map( + javaModuleName.value -> Seq( + testClassDir + ) + ) + }, + Test / addExports := { + val modName = javaModuleName.value + val testPkgs = (Test / packages).value + val testPkgsExports = testPkgs.map { pkg => + modName + "/" + pkg -> Seq("ALL-UNNAMED") + }.toMap + + testPkgsExports + }, + Test / addReads := { + Map(javaModuleName.value -> Seq("ALL-UNNAMED")) + } ) .dependsOn(`runtime-parser`) .dependsOn(pkg) diff --git a/engine/runtime-compiler/src/test/java/org/enso/compiler/CompilerDependenciesTest.java b/engine/runtime-compiler/src/test/java/org/enso/compiler/CompilerDependenciesTest.java deleted file mode 100644 index 4d23eb21a4a5..000000000000 --- a/engine/runtime-compiler/src/test/java/org/enso/compiler/CompilerDependenciesTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.enso.compiler; - -import static org.junit.Assert.fail; - -import org.junit.Test; - -public final class CompilerDependenciesTest { - @Test - public void noTruffleDependency() { - assertNoClass("com.oracle.truffle.api.nodes.Node"); - } - - @Test - public void noCirceDependency() { - assertNoClass("io.circe.Error"); - } - - @Test - public void noJacksonDependency() { - assertNoClass("com.fasterxml.jackson.databind.ObjectMapper"); - } - - private static void assertNoClass(String name) { - try { - var c = Class.forName(name); - var sb = new StringBuilder(); - sb.append("This class shouldn't be loaded: ").append(c.getName()); - sb.append("\nloaded from: ").append(c.getProtectionDomain().getCodeSource().getLocation()); - sb.append("\nclassloader: ").append(c.getClassLoader()); - sb.append("\nclasspath : ").append(System.getProperty("java.class.path")); - fail(sb.toString()); - } catch (ClassNotFoundException ex) { - return; - } - } -} diff --git a/engine/runtime-compiler/src/test/java/org/enso/compiler/test/CompilerDependenciesTest.java b/engine/runtime-compiler/src/test/java/org/enso/compiler/test/CompilerDependenciesTest.java new file mode 100644 index 000000000000..10de4da3b8a6 --- /dev/null +++ b/engine/runtime-compiler/src/test/java/org/enso/compiler/test/CompilerDependenciesTest.java @@ -0,0 +1,44 @@ +package org.enso.compiler.test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import org.enso.compiler.MetadataInteropHelpers; +import org.junit.Test; + +public final class CompilerDependenciesTest { + @Test + public void compilerModuleIsLoaded() { + var compilerModule = MetadataInteropHelpers.class.getModule(); + assertTrue( + "org.enso.runtime.compiler module is loaded and the test classes are " + + "patched into the module", + compilerModule.isNamed()); + } + + @Test + public void noTruffleDependency() { + assertNoClassInCompilerModule("com.oracle.truffle.api.nodes.Node"); + } + + @Test + public void noJacksonDependency() { + assertNoClassInCompilerModule("com.fasterxml.jackson.databind.ObjectMapper"); + } + + private static void assertNoClassInCompilerModule(String name) { + var compilerModule = MetadataInteropHelpers.class.getModule(); + var classLoader = compilerModule.getClassLoader(); + try { + var c = classLoader.loadClass(name); + var sb = new StringBuilder(); + sb.append("This class shouldn't be loaded: ").append(c.getName()); + sb.append("\nloaded from: ").append(c.getProtectionDomain().getCodeSource().getLocation()); + sb.append("\nclassloader: ").append(c.getClassLoader()); + sb.append("\nmoduleLayer : ").append(compilerModule.getLayer()); + fail(sb.toString()); + } catch (ClassNotFoundException ex) { + return; + } + } +} From 1dbe76f6f63dfb5dc38913423547c23b74236d5d Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 16:22:24 +0200 Subject: [PATCH 210/268] Rename all runtime.jar in fake releases --- .../enso-0.0.0-pre/component/runner.jar | 1 - .../component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.0-pre/component/runner.jar | 1 - .../component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.0-pre/component/runner.jar | 1 - .../component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.0-pre/component/runner.jar | 1 - .../component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.0/component/runner.jar | 1 - .../component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.0/component/runner.jar | 1 - .../component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.0/component/runner.jar | 1 - .../component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.0/component/runner.jar | 1 - .../component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} | 0 .../component/{runner.jar => runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.1/component/runner/runner.jar | 1 - .../enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.1/component/runner/runner.jar | 1 - .../enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.1/component/runner/runner.jar | 1 - .../enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.0.1/component/runner/runner.jar | 1 - .../enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.1.0/component/runner/runner.jar | 1 - .../enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.1.0/component/runner/runner.jar | 1 - .../enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.1.0/component/runner/runner.jar | 1 - .../enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.1.0/component/runner/runner.jar | 1 - .../enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.9999.0-broken/component/runner.jar | 1 - .../enso-0.9999.0-broken/component/runtime.jar | 2 -- .../enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.9999.0-broken/component/runner.jar | 1 - .../enso-0.9999.0-broken/component/runtime.jar | 2 -- .../enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.9999.0-broken/component/runner.jar | 1 - .../enso-0.9999.0-broken/component/runtime.jar | 2 -- .../enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar} | 0 .../enso-0.9999.0-broken/component/runner.jar | 1 - .../enso-0.9999.0-broken/component/runtime.jar | 2 -- .../enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar} | 0 48 files changed, 28 deletions(-) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/{runtime.jar => runtime_2.13-0.0.0-dev.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/{runner.jar => runtime_2.13-0.0.0-dev.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/{enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runtime.jar => enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/{enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runner.jar => enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/{enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runtime.jar => enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runner/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runner.jar => enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runner/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runtime.jar => enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runner/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runner.jar => enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runner/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runtime.jar => enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runner/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runtime.jar => enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runner/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runtime.jar => enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runner/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runtime.jar => enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runner/runner.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runtime.jar => enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runner.jar delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runtime.jar => enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runner.jar delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runtime.jar => enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runner.jar delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runtime.jar => enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar} (100%) delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runner.jar delete mode 100644 lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime.jar rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/{enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runtime.jar => enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar} (100%) diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runner.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runner.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runner/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runner/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runner/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runner.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runner/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runner/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runner/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runner/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runner/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runner/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runner.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runner/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runner/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runner/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runner/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runner/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runner/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runner/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runner/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runner/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runner/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runner/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runner/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runner/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runner/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runner/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar deleted file mode 100644 index bb4b9533544b..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar +++ /dev/null @@ -1,2 +0,0 @@ -placeholder - diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime.jar deleted file mode 100644 index bb4b9533544b..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime.jar +++ /dev/null @@ -1,2 +0,0 @@ -placeholder - diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar deleted file mode 100644 index bb4b9533544b..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar +++ /dev/null @@ -1,2 +0,0 @@ -placeholder - diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runner.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runner.jar deleted file mode 100644 index 48cdce852872..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runner.jar +++ /dev/null @@ -1 +0,0 @@ -placeholder diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime.jar deleted file mode 100644 index bb4b9533544b..000000000000 --- a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime.jar +++ /dev/null @@ -1,2 +0,0 @@ -placeholder - diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runtime.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runtime.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar From ff464ed3059452766c0e5173ba91d29a292bd724 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 18:40:46 +0200 Subject: [PATCH 211/268] Add language-server with dependencies to component dir --- build.sbt | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 2e6765564ffc..df2755d034fa 100644 --- a/build.sbt +++ b/build.sbt @@ -609,7 +609,9 @@ lazy val componentModulesPaths = (ThisBuild / componentModulesPaths) := { val runnerCp = (`engine-runner` / Runtime / fullClasspath).value val runtimeCp = (LocalProject("runtime") / Runtime / fullClasspath).value - val fullCp = (runnerCp ++ runtimeCp).distinct + val langServerCp = (`language-server` / Runtime / fullClasspath).value + val akkaWrapperCp = (`akka-wrapper` / Compile / fullClasspath).value + val fullCp = (runnerCp ++ runtimeCp ++ langServerCp ++ akkaWrapperCp).distinct val log = streams.value.log val thirdPartyModIds = GraalVM.modules ++ @@ -623,15 +625,20 @@ lazy val componentModulesPaths = "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "com.google.protobuf" % "protobuf-java" % "3.25.1", + "commons-cli" % "commons-cli" % commonsCliVersion, "commons-io" % "commons-io" % commonsIoVersion, + "net.java.dev.jna" % "jna" % "5.13.0", "org.yaml" % "snakeyaml" % snakeyamlVersion, + "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion, "com.typesafe" % "config" % typesafeConfigVersion, + "org.reactivestreams" % "reactive-streams" % "1.0.3", "org.jline" % "jline" % jlineVersion, - "commons-cli" % "commons-cli" % commonsCliVersion, "org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.apache.tika" % "tika-core" % tikaVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, "ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-core" % logbackClassicVersion, "com.ibm.icu" % "icu4j" % icuVersion, @@ -666,18 +673,29 @@ lazy val componentModulesPaths = (`runtime-language-epb` / Compile / exportedModuleBin).value, (`persistance` / Compile / exportedModuleBin).value, (`cli` / Compile / exportedModuleBin).value, + (`json-rpc-server` / Compile / exportedModuleBin).value, (`connected-lock-manager` / Compile / exportedModuleBin).value, (`distribution-manager` / Compile / exportedModuleBin).value, (`downloader` / Compile / exportedModuleBin).value, + (`filewatcher` / Compile / exportedModuleBin).value, (`editions` / Compile / exportedModuleBin).value, + (`language-server` / Compile / exportedModuleBin).value, + (`library-manager` / Compile / exportedModuleBin).value, + (`akka-wrapper` / Compile / exportedModuleBin).value, + (`zio-wrapper` / Compile / exportedModuleBin).value, + (`language-server-deps-wrapper` / Compile / exportedModuleBin).value, + (`directory-watcher-wrapper` / Compile / exportedModuleBin).value, + (`ydoc-server` / Compile / exportedModuleBin).value, (`library-manager` / Compile / exportedModuleBin).value, (`logging-config` / Compile / exportedModuleBin).value, (`logging-utils` / Compile / exportedModuleBin).value, + (`logging-utils-akka` / Compile / exportedModuleBin).value, (`logging-service` / Compile / exportedModuleBin).value, (`logging-service-logback` / Compile / exportedModuleBin).value, (`pkg` / Compile / exportedModuleBin).value, (`refactoring-utils` / Compile / exportedModuleBin).value, (`semver` / Compile / exportedModuleBin).value, + (`searcher` / Compile / exportedModuleBin).value, (`text-buffer` / Compile / exportedModuleBin).value, (`version-output` / Compile / exportedModuleBin).value, (`scala-yaml` / Compile / exportedModuleBin).value, From 8a4082fad0f6d86f07956408a3b9c114c8da0340 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 18:41:12 +0200 Subject: [PATCH 212/268] No module-info.class in target dir is warning not error --- project/JPMSPlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 79d31900341e..25ec32706ece 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -235,7 +235,7 @@ object JPMSPlugin extends AutoPlugin { val logger = streams.value.log val projName = moduleName.value if (!isModule(targetClassDir)) { - logger.error( + logger.warn( s"[JPMSPlugin/$projName] The target classes directory ${targetClassDir.getAbsolutePath} is not " + "a module - it does not contain module-info.class. Make sure the `compileModuleInfo` task " + "is set correctly." From 12607ca9c89768844ba5c2696c7c17b413ae3b3a Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 18:41:42 +0200 Subject: [PATCH 213/268] language-server does not depend on netbeans lookup uitl --- build.sbt | 1 - engine/language-server/src/main/java/module-info.java | 1 - .../java/org/enso/languageserver/boot/LanguageServerRunner.java | 2 -- 3 files changed, 4 deletions(-) diff --git a/build.sbt b/build.sbt index df2755d034fa..d4b92a14ffdc 100644 --- a/build.sbt +++ b/build.sbt @@ -2147,7 +2147,6 @@ lazy val `language-server` = (project in file("engine/language-server")) "org.scala-lang" % "scala-library" % scalacVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "commons-cli" % "commons-cli" % commonsCliVersion, "commons-io" % "commons-io" % commonsIoVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index f974e359ab03..63b6df1a261c 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -7,7 +7,6 @@ requires org.apache.commons.io; requires org.graalvm.polyglot; requires org.eclipse.jgit; - requires org.openide.util.lookup.RELEASE180; requires org.slf4j; requires org.enso.cli; diff --git a/engine/language-server/src/main/java/org/enso/languageserver/boot/LanguageServerRunner.java b/engine/language-server/src/main/java/org/enso/languageserver/boot/LanguageServerRunner.java index 6f86104b8885..cf3d8964c186 100644 --- a/engine/language-server/src/main/java/org/enso/languageserver/boot/LanguageServerRunner.java +++ b/engine/language-server/src/main/java/org/enso/languageserver/boot/LanguageServerRunner.java @@ -5,11 +5,9 @@ import org.enso.runner.common.LanguageServerApi; import org.enso.runner.common.ProfilingConfig; import org.enso.runner.common.WrongOption; -import org.openide.util.lookup.ServiceProvider; import org.slf4j.event.Level; import scala.concurrent.ExecutionContext; -@ServiceProvider(service = LanguageServerApi.class) public final class LanguageServerRunner extends LanguageServerApi { public LanguageServerRunner() {} From cf3c8108a06e8c66e80c2604d4e31ecb43024d00 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 18:42:14 +0200 Subject: [PATCH 214/268] Declare LanguageServerApi service provider in module-info --- engine/language-server/src/main/java/module-info.java | 5 +++++ engine/runner-common/src/main/java/module-info.java | 2 ++ 2 files changed, 7 insertions(+) diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index 63b6df1a261c..715f73eab12c 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -1,3 +1,5 @@ +import org.enso.runner.common.LanguageServerApi; + module org.enso.language.server { requires java.logging; requires scala.library; @@ -34,7 +36,10 @@ requires org.enso.text.buffer; requires org.enso.ydoc; + exports org.enso.languageserver.boot; exports org.enso.languageserver.filemanager to scala.library; exports org.enso.languageserver.runtime to scala.library; exports org.enso.languageserver.search to scala.library; + + provides LanguageServerApi with org.enso.languageserver.boot.LanguageServerRunner; } diff --git a/engine/runner-common/src/main/java/module-info.java b/engine/runner-common/src/main/java/module-info.java index 7cd5ff083b4c..9c63ce8f2231 100644 --- a/engine/runner-common/src/main/java/module-info.java +++ b/engine/runner-common/src/main/java/module-info.java @@ -10,4 +10,6 @@ requires scala.library; exports org.enso.runner.common; + + uses org.enso.runner.common.LanguageServerApi; } From 67f975ad7c288c7203c021f3bb2bf03304da6fed Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 18:50:17 +0200 Subject: [PATCH 215/268] connected-lock-manager-server is JPMS module --- build.sbt | 13 +++++++++++++ .../language-server/src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 9 +++++++++ 3 files changed, 23 insertions(+) create mode 100644 lib/scala/connected-lock-manager-server/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index d4b92a14ffdc..0f2ba7c5fbe7 100644 --- a/build.sbt +++ b/build.sbt @@ -675,6 +675,7 @@ lazy val componentModulesPaths = (`cli` / Compile / exportedModuleBin).value, (`json-rpc-server` / Compile / exportedModuleBin).value, (`connected-lock-manager` / Compile / exportedModuleBin).value, + (`connected-lock-manager-server` / Compile / exportedModuleBin).value, (`distribution-manager` / Compile / exportedModuleBin).value, (`downloader` / Compile / exportedModuleBin).value, (`filewatcher` / Compile / exportedModuleBin).value, @@ -2157,6 +2158,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`akka-wrapper` / Compile / exportedModule).value, (`zio-wrapper` / Compile / exportedModule).value, (`scala-libs-wrapper` / Compile / exportedModule).value, + (`connected-lock-manager-server` / Compile / exportedModule).value, (`language-server-deps-wrapper` / Compile / exportedModule).value, (`directory-watcher-wrapper` / Compile / exportedModule).value, (`engine-runner-common` / Compile / exportedModule).value, @@ -4238,14 +4240,25 @@ lazy val `connected-lock-manager` = project */ lazy val `connected-lock-manager-server` = project .in(file("lib/scala/connected-lock-manager-server")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( frgaalJavaCompilerSetting, + compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, akkaActor, akkaTestkit % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test + ), + Compile / moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + Compile / internalModuleDependencies := Seq( + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`akka-wrapper` / Compile / exportedModule).value, + (`distribution-manager` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value, ) ) .dependsOn(`distribution-manager`) diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index 715f73eab12c..348b89d6677b 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -24,6 +24,7 @@ requires org.enso.logging.utils; requires org.enso.logging.utils.akka; requires org.enso.logging.service; + requires org.enso.lockmanager.server; requires org.enso.librarymanager; requires org.enso.polyglot.api; requires org.enso.pkg; diff --git a/lib/scala/connected-lock-manager-server/src/main/java/module-info.java b/lib/scala/connected-lock-manager-server/src/main/java/module-info.java new file mode 100644 index 000000000000..cb824b73b552 --- /dev/null +++ b/lib/scala/connected-lock-manager-server/src/main/java/module-info.java @@ -0,0 +1,9 @@ +module org.enso.lockmanager.server { + requires scala.library; + requires org.enso.scala.wrapper; + requires org.enso.akka.wrapper; + requires org.enso.distribution; + requires org.enso.polyglot.api; + + exports org.enso.lockmanager.server; +} From d55f4440fe56118b9b22367e9fe4fdbbc5627e5e Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 18:58:00 +0200 Subject: [PATCH 216/268] task-progress-notifications is module --- build.sbt | 16 ++++++++++++++-- .../src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 7 +++++++ 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 lib/scala/task-progress-notifications/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 0f2ba7c5fbe7..25c141c0980f 100644 --- a/build.sbt +++ b/build.sbt @@ -695,6 +695,7 @@ lazy val componentModulesPaths = (`logging-service-logback` / Compile / exportedModuleBin).value, (`pkg` / Compile / exportedModuleBin).value, (`refactoring-utils` / Compile / exportedModuleBin).value, + (`task-progress-notifications` / Compile / exportedModuleBin).value, (`semver` / Compile / exportedModuleBin).value, (`searcher` / Compile / exportedModuleBin).value, (`text-buffer` / Compile / exportedModuleBin).value, @@ -1495,12 +1496,21 @@ lazy val cli = project lazy val `task-progress-notifications` = project .in(file("lib/scala/task-progress-notifications")) + .enablePlugins(JPMSPlugin) .configs(Test) .settings( version := "0.1", + compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test ), + Compile / moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + Compile / internalModuleDependencies := Seq( + (`cli` / Compile / exportedModule).value, + (`json-rpc-server` / Compile / exportedModule).value, + ), Test / parallelExecution := false ) .dependsOn(cli) @@ -2180,7 +2190,8 @@ lazy val `language-server` = (project in file("engine/language-server")) (`filewatcher` / Compile / exportedModule).value, (`version-output` / Compile / exportedModule).value, (`semver` / Compile / exportedModule).value, - (`cli` / Compile / exportedModule).value + (`cli` / Compile / exportedModule).value, + (`task-progress-notifications` / Compile / exportedModule).value, ), Test / testOptions += Tests .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), @@ -2292,7 +2303,8 @@ lazy val `language-server` = (project in file("engine/language-server")) (`semver` / Compile / exportedModule).value, (`downloader` / Compile / exportedModule).value, (`logging-config` / Compile / exportedModule).value, - (`logging-service` / Compile / exportedModule).value + (`logging-service` / Compile / exportedModule).value, + (`task-progress-notifications` / Compile / exportedModule).value, ), Test / javaOptions ++= testLogProviderOptions, Test / patchModules := { diff --git a/engine/language-server/src/main/java/module-info.java b/engine/language-server/src/main/java/module-info.java index 348b89d6677b..40493d9e5e96 100644 --- a/engine/language-server/src/main/java/module-info.java +++ b/engine/language-server/src/main/java/module-info.java @@ -35,6 +35,7 @@ requires org.enso.semver; requires org.enso.version.output; requires org.enso.text.buffer; + requires org.enso.task.progress.notifications; requires org.enso.ydoc; exports org.enso.languageserver.boot; diff --git a/lib/scala/task-progress-notifications/src/main/java/module-info.java b/lib/scala/task-progress-notifications/src/main/java/module-info.java new file mode 100644 index 000000000000..553e9ef8a51d --- /dev/null +++ b/lib/scala/task-progress-notifications/src/main/java/module-info.java @@ -0,0 +1,7 @@ +module org.enso.task.progress.notifications { + requires scala.library; + requires org.enso.cli; + requires org.enso.json.rpc.server; + + exports org.enso.cli.task.notifications; +} From cdf9b3add992813904b351482ef28d8a0c6704fa Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 19:18:33 +0200 Subject: [PATCH 217/268] Add fansi-wrapper module --- build.sbt | 46 ++++++++++++++++++- engine/runtime/src/main/java/module-info.java | 1 + .../src/main/java/module-info.java | 5 ++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 lib/java/fansi-wrapper/src/main/java/module-info.java diff --git a/build.sbt b/build.sbt index 25c141c0980f..4862ea557ecc 100644 --- a/build.sbt +++ b/build.sbt @@ -702,6 +702,7 @@ lazy val componentModulesPaths = (`version-output` / Compile / exportedModuleBin).value, (`scala-yaml` / Compile / exportedModuleBin).value, (`scala-libs-wrapper` / Compile / exportedModuleBin).value, + (`fansi-wrapper` / Compile / exportedModuleBin).value, (`edition-updater` / Compile / exportedModuleBin).value, (`profiling-utils` / Compile / exportedModuleBin).value ) @@ -1327,6 +1328,48 @@ lazy val `directory-watcher-wrapper` = project } ) +lazy val `fansi-wrapper` = project + .in(file("lib/java/fansi-wrapper")) + .enablePlugins(JPMSPlugin) + .settings( + modularFatJarWrapperSettings, + libraryDependencies ++= Seq( + "com.lihaoyi" %% "fansi" % fansiVersion + ), + javaModuleName := "org.enso.fansi.wrapper", + Compile / moduleDependencies := Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + Compile / patchModules := { + val scalaVer = scalaBinaryVersion.value + val scalaLibs = JPMSUtils.filterModulesFromUpdate( + update.value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion, + "com.lihaoyi" % ("fansi_" + scalaVer) % fansiVersion + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + Map( + javaModuleName.value -> scalaLibs + ) + }, + assembly / assemblyExcludedJars := { + val scalaVer = scalaBinaryVersion.value + JPMSUtils.filterModulesFromClasspath( + (Compile / dependencyClasspath).value, + Seq( + "org.scala-lang" % "scala-library" % scalacVersion + ), + streams.value.log, + moduleName.value, + shouldContainAll = true + ) + } + ) + /** JPMS module wrapper for Akka. */ lazy val `akka-wrapper` = project @@ -2671,7 +2714,8 @@ lazy val runtime = (project in file("engine/runtime")) (`interpreter-dsl` / Compile / exportedModule).value, (`persistance` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, - (`scala-libs-wrapper` / Compile / exportedModule).value + (`scala-libs-wrapper` / Compile / exportedModule).value, + (`fansi-wrapper` / Compile / exportedModule).value, ) ) .settings( diff --git a/engine/runtime/src/main/java/module-info.java b/engine/runtime/src/main/java/module-info.java index e16c4dd440ca..ee6022531ca4 100644 --- a/engine/runtime/src/main/java/module-info.java +++ b/engine/runtime/src/main/java/module-info.java @@ -20,6 +20,7 @@ requires org.enso.runtime.suggestions; requires org.enso.text.buffer; requires org.enso.scala.wrapper; + requires org.enso.fansi.wrapper; requires org.enso.syntax; requires org.enso.version.output; diff --git a/lib/java/fansi-wrapper/src/main/java/module-info.java b/lib/java/fansi-wrapper/src/main/java/module-info.java new file mode 100644 index 000000000000..cbdddcbeef75 --- /dev/null +++ b/lib/java/fansi-wrapper/src/main/java/module-info.java @@ -0,0 +1,5 @@ +module org.enso.fansi.wrapper { + requires scala.library; + + exports fansi; +} From 9e0ea1471d87661987e01d209d5ae4960f77b87f Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 19:30:30 +0200 Subject: [PATCH 218/268] Fix compilation of connected-lock-manager-server --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 4862ea557ecc..a14c3c96b169 100644 --- a/build.sbt +++ b/build.sbt @@ -4300,7 +4300,8 @@ lazy val `connected-lock-manager-server` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - compileOrder := CompileOrder.ScalaThenJava, + // See JPMSPlugin docs (Mixed projects) + excludeFilter := excludeFilter.value || "module-info.java", libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, akkaActor, From cb989406c1307eb5e9ecfa6460aa43173b3a495e Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 19:36:40 +0200 Subject: [PATCH 219/268] Define correct Test/internalModuleDependencies for project-manager --- build.sbt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index a14c3c96b169..a01c5ea9486a 100644 --- a/build.sbt +++ b/build.sbt @@ -1693,11 +1693,13 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, - (`ydoc-server` / projectID).value, - (`syntax-rust-definition` / projectID).value, - (`profiling-utils` / projectID).value ) }, + Test / internalModuleDependencies := Seq( + (`profiling-utils` / Compile / exportedModule).value, + (`syntax-rust-definition` / Compile / exportedModule).value, + (`ydoc-server` / Compile / exportedModule).value, + ), Test / javaOptions ++= testLogProviderOptions ) .settings( From 6c9c9354e830448b3e0f49b020d19b0bb9786003 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Thu, 19 Sep 2024 19:38:37 +0200 Subject: [PATCH 220/268] fmt --- build.sbt | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/build.sbt b/build.sbt index a01c5ea9486a..e3d9f7ceb2e9 100644 --- a/build.sbt +++ b/build.sbt @@ -607,12 +607,12 @@ lazy val componentModulesPaths = " as files" ) (ThisBuild / componentModulesPaths) := { - val runnerCp = (`engine-runner` / Runtime / fullClasspath).value - val runtimeCp = (LocalProject("runtime") / Runtime / fullClasspath).value - val langServerCp = (`language-server` / Runtime / fullClasspath).value + val runnerCp = (`engine-runner` / Runtime / fullClasspath).value + val runtimeCp = (LocalProject("runtime") / Runtime / fullClasspath).value + val langServerCp = (`language-server` / Runtime / fullClasspath).value val akkaWrapperCp = (`akka-wrapper` / Compile / fullClasspath).value - val fullCp = (runnerCp ++ runtimeCp ++ langServerCp ++ akkaWrapperCp).distinct - val log = streams.value.log + val fullCp = (runnerCp ++ runtimeCp ++ langServerCp ++ akkaWrapperCp).distinct + val log = streams.value.log val thirdPartyModIds = GraalVM.modules ++ GraalVM.langsPkgs ++ @@ -1345,8 +1345,8 @@ lazy val `fansi-wrapper` = project val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "com.lihaoyi" % ("fansi_" + scalaVer) % fansiVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "com.lihaoyi" % ("fansi_" + scalaVer) % fansiVersion ), streams.value.log, moduleName.value, @@ -1552,7 +1552,7 @@ lazy val `task-progress-notifications` = project ), Compile / internalModuleDependencies := Seq( (`cli` / Compile / exportedModule).value, - (`json-rpc-server` / Compile / exportedModule).value, + (`json-rpc-server` / Compile / exportedModule).value ), Test / parallelExecution := false ) @@ -1692,13 +1692,13 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) Test / moduleDependencies := { GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion ) }, Test / internalModuleDependencies := Seq( (`profiling-utils` / Compile / exportedModule).value, (`syntax-rust-definition` / Compile / exportedModule).value, - (`ydoc-server` / Compile / exportedModule).value, + (`ydoc-server` / Compile / exportedModule).value ), Test / javaOptions ++= testLogProviderOptions ) @@ -2200,13 +2200,13 @@ lazy val `language-server` = (project in file("engine/language-server")) Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "commons-cli" % "commons-cli" % commonsCliVersion, - "commons-io" % "commons-io" % commonsIoVersion, - "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion + "org.scala-lang" % "scala-library" % scalacVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion ) }, Compile / internalModuleDependencies := Seq( @@ -2236,7 +2236,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`version-output` / Compile / exportedModule).value, (`semver` / Compile / exportedModule).value, (`cli` / Compile / exportedModule).value, - (`task-progress-notifications` / Compile / exportedModule).value, + (`task-progress-notifications` / Compile / exportedModule).value ), Test / testOptions += Tests .Argument(TestFrameworks.ScalaCheck, "-minSuccessfulTests", "1000"), @@ -2349,7 +2349,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`downloader` / Compile / exportedModule).value, (`logging-config` / Compile / exportedModule).value, (`logging-service` / Compile / exportedModule).value, - (`task-progress-notifications` / Compile / exportedModule).value, + (`task-progress-notifications` / Compile / exportedModule).value ), Test / javaOptions ++= testLogProviderOptions, Test / patchModules := { @@ -2717,7 +2717,7 @@ lazy val runtime = (project in file("engine/runtime")) (`persistance` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, (`scala-libs-wrapper` / Compile / exportedModule).value, - (`fansi-wrapper` / Compile / exportedModule).value, + (`fansi-wrapper` / Compile / exportedModule).value ) ) .settings( @@ -4317,7 +4317,7 @@ lazy val `connected-lock-manager-server` = project (`scala-libs-wrapper` / Compile / exportedModule).value, (`akka-wrapper` / Compile / exportedModule).value, (`distribution-manager` / Compile / exportedModule).value, - (`polyglot-api` / Compile / exportedModule).value, + (`polyglot-api` / Compile / exportedModule).value ) ) .dependsOn(`distribution-manager`) From 70ad75339b73df2634bbdeb392ce81ba4af1bf75 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 20 Sep 2024 11:18:42 +0200 Subject: [PATCH 221/268] Fix LauncherRunnerSpec - no runtime.jar --- .../enso/launcher/components/LauncherRunnerSpec.scala | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala b/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala index b8658fbecafb..2e918aaa7899 100644 --- a/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala +++ b/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala @@ -68,16 +68,12 @@ class LauncherRunnerSpec extends RuntimeVersionManagerTest with FlakySpec { connectLoggerIfAvailable = true ) val jvmOptions = Seq(("locally-added-options", "value1")) - - val enginePath = - getTestDirectory / "test_data" / "dist" / "0.0.0" - val runnerPath = - (enginePath / "component" / "runner.jar").toAbsolutePath.normalize + val runnerEntryPoint = "org.enso.runner/org.enso.runner.Main" def checkCommandLine(command: Command): Unit = { val arguments = command.command.tail val javaArguments = arguments.takeWhile(_ != "-jar") - val appArguments = arguments.dropWhile(_ != runnerPath.toString).tail + val appArguments = arguments.dropWhile(_ != runnerEntryPoint).tail javaArguments should contain("-Xfrom-env") javaArguments should contain("-Denv=env") javaArguments should contain("-Dlocally-added-options=value1") @@ -88,7 +84,7 @@ class LauncherRunnerSpec extends RuntimeVersionManagerTest with FlakySpec { val appCommandLine = appArguments.mkString(" ") appCommandLine shouldEqual s"--logger-connect $fakeUri arg1 --flag2" - command.command.mkString(" ") should include(s"-jar $runnerPath") + command.command.mkString(" ") should include(runnerEntryPoint) } runner.withCommand( From 9418a8b584ec4884f2a0e1f91e3f9c26551f3699 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 20 Sep 2024 11:23:47 +0200 Subject: [PATCH 222/268] Add fansi-wrapper to runtime-integration-tests and runtime-benchmarks --- build.sbt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.sbt b/build.sbt index e3d9f7ceb2e9..6deda4aa8ab4 100644 --- a/build.sbt +++ b/build.sbt @@ -2836,6 +2836,7 @@ lazy val `runtime-integration-tests` = (`logging-service-logback` / Test / exportedModule).value, (`version-output` / Compile / exportedModule).value, (`scala-libs-wrapper` / Compile / exportedModule).value, + (`fansi-wrapper` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, (`runtime-suggestions` / Compile / exportedModule).value, (`runtime-parser` / Compile / exportedModule).value, @@ -3006,6 +3007,7 @@ lazy val `runtime-benchmarks` = (`logging-service-logback` / Test / exportedModule).value, (`version-output` / Compile / exportedModule).value, (`scala-libs-wrapper` / Compile / exportedModule).value, + (`fansi-wrapper` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, (`runtime-suggestions` / Compile / exportedModule).value, (`runtime-parser` / Compile / exportedModule).value, From 55ecdf90cf3d414ffaf02abb703ae91f4a260ce3 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 20 Sep 2024 11:53:17 +0200 Subject: [PATCH 223/268] Fix engine-runner native image build --- .../node/expression/builtin/meta/EqualsComplexNode.java | 7 ++++++- .../expression/builtin/meta/GetQualifiedTypeNameNode.java | 8 +++++++- .../node/expression/builtin/meta/HashCodeNode.java | 7 ++++++- .../main/java/org/enso/interpreter/runtime/data/Type.java | 2 ++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsComplexNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsComplexNode.java index 6ce3da80068f..8d52b780bb6f 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsComplexNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/EqualsComplexNode.java @@ -92,7 +92,12 @@ boolean equalsTypes( @Shared("equalsNode") @Cached EqualsNode equalsNode, @Shared("typesLib") @CachedLibrary(limit = "10") TypesLibrary typesLib) { return equalsNode.execute( - frame, selfType.getQualifiedName().toString(), otherType.getQualifiedName().toString()); + frame, getQualifiedTypeName(selfType), getQualifiedTypeName(otherType)); + } + + @TruffleBoundary + private static String getQualifiedTypeName(Type type) { + return type.getQualifiedName().toString(); } /** diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/GetQualifiedTypeNameNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/GetQualifiedTypeNameNode.java index 6ad7fc659436..022ef2abd59d 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/GetQualifiedTypeNameNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/GetQualifiedTypeNameNode.java @@ -1,5 +1,6 @@ package org.enso.interpreter.node.expression.builtin.meta; +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.nodes.Node; import org.enso.interpreter.dsl.AcceptsError; import org.enso.interpreter.dsl.BuiltinMethod; @@ -23,8 +24,13 @@ Object execute(@AcceptsError Object value) { default -> typeOfNode.execute(value); }; if (maybeType instanceof Type type) { - return Text.create(type.getQualifiedName().toString()); + return Text.create(getQualifiedName(type)); } return EnsoContext.get(this).getBuiltins().nothing(); } + + @TruffleBoundary + private static String getQualifiedName(Type type) { + return type.getQualifiedName().toString(); + } } diff --git a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java index 68bd6527e4a1..1127cf61beef 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/meta/HashCodeNode.java @@ -171,10 +171,15 @@ long hashCodeForType(Type type, @Shared("hashCodeNode") @Cached HashCodeNode has // Nothing should be equal to `null` return 0; } else { - return hashCodeNode.execute(type.getQualifiedName().toString()); + return hashCodeNode.execute(getQualifiedTypeName(type)); } } + @TruffleBoundary + private static String getQualifiedTypeName(Type type) { + return type.getQualifiedName().toString(); + } + @NeverDefault static HashCodeNode[] createHashCodeNodes(int size) { HashCodeNode[] nodes = new HashCodeNode[size]; diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java index 5be1062f72fe..53d1cf8a6e31 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/data/Type.java @@ -2,6 +2,7 @@ import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.CompilerDirectives; +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.interop.InteropLibrary; import com.oracle.truffle.api.interop.UnknownIdentifierException; import com.oracle.truffle.api.interop.UnsupportedMessageException; @@ -320,6 +321,7 @@ String getMetaSimpleName(@CachedLibrary("this") InteropLibrary lib) } @ExportMessage + @TruffleBoundary String getMetaQualifiedName(@CachedLibrary("this") InteropLibrary lib) throws UnsupportedMessageException { if (isNothing(lib)) { From fafa7de55beec5d3ea50446184c6d3dd1346f5d5 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Fri, 20 Sep 2024 13:28:46 +0200 Subject: [PATCH 224/268] Use newer JNA version - fixes running of hyperd --- build.sbt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/build.sbt b/build.sbt index 6deda4aa8ab4..50a6567bb4ca 100644 --- a/build.sbt +++ b/build.sbt @@ -628,7 +628,7 @@ lazy val componentModulesPaths = "com.google.protobuf" % "protobuf-java" % "3.25.1", "commons-cli" % "commons-cli" % commonsCliVersion, "commons-io" % "commons-io" % commonsIoVersion, - "net.java.dev.jna" % "jna" % "5.13.0", + "net.java.dev.jna" % "jna" % jnaVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion, "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion, "com.typesafe" % "config" % typesafeConfigVersion, @@ -1171,7 +1171,7 @@ lazy val `scala-libs-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion, "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, - "net.java.dev.jna" % "jna" % "5.13.0" + "net.java.dev.jna" % "jna" % jnaVersion ), Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, @@ -1179,7 +1179,7 @@ lazy val `scala-libs-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, - "net.java.dev.jna" % "jna" % "5.13.0" + "net.java.dev.jna" % "jna" % jnaVersion ), assembly / assemblyExcludedJars := { JPMSUtils.filterModulesFromClasspath( @@ -1191,7 +1191,7 @@ lazy val `scala-libs-wrapper` = project "org.scala-lang" % "scala-compiler" % scalacVersion, "io.github.java-diff-utils" % "java-diff-utils" % "4.12", "org.jline" % "jline" % jlineVersion, - "net.java.dev.jna" % "jna" % "5.13.0" + "net.java.dev.jna" % "jna" % jnaVersion ), streams.value.log, moduleName.value, @@ -1288,7 +1288,7 @@ lazy val `directory-watcher-wrapper` = project libraryDependencies ++= Seq( "io.methvin" % "directory-watcher" % directoryWatcherVersion, "org.slf4j" % "slf4j-api" % "1.7.36", - "net.java.dev.jna" % "jna" % "5.13.0" + "net.java.dev.jna" % "jna" % jnaVersion ), javaModuleName := "org.enso.directory.watcher.wrapper", assembly / assemblyExcludedJars := { @@ -1298,7 +1298,7 @@ lazy val `directory-watcher-wrapper` = project Seq( "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % "1.7.36", - "net.java.dev.jna" % "jna" % "5.13.0" + "net.java.dev.jna" % "jna" % jnaVersion ), streams.value.log, moduleName.value, @@ -1307,7 +1307,7 @@ lazy val `directory-watcher-wrapper` = project }, Compile / moduleDependencies := Seq( "org.scala-lang" % "scala-library" % scalacVersion, - "net.java.dev.jna" % "jna" % "5.13.0", + "net.java.dev.jna" % "jna" % jnaVersion, "org.slf4j" % "slf4j-api" % "1.7.36" ), Compile / patchModules := { @@ -1395,7 +1395,7 @@ lazy val `akka-wrapper` = project "io.github.java-diff-utils" % "java-diff-utils" % "4.12", "org.reactivestreams" % "reactive-streams" % "1.0.3", "org.jline" % "jline" % jlineVersion, - "net.java.dev.jna" % "jna" % "5.13.0", + "net.java.dev.jna" % "jna" % jnaVersion, "io.spray" %% "spray-json" % "1.3.6" ), javaModuleName := "org.enso.akka.wrapper", @@ -1420,7 +1420,7 @@ lazy val `akka-wrapper` = project "org.jline" % "jline" % jlineVersion, "com.google.protobuf" % "protobuf-java" % "3.25.1", "org.reactivestreams" % "reactive-streams" % "1.0.3", - "net.java.dev.jna" % "jna" % "5.13.0" + "net.java.dev.jna" % "jna" % jnaVersion ), streams.value.log, moduleName.value, @@ -2302,7 +2302,7 @@ lazy val `language-server` = (project in file("engine/language-server")) "io.sentry" % "sentry" % "6.28.0", "ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-core" % logbackClassicVersion, - "net.java.dev.jna" % "jna" % "5.13.0", + "net.java.dev.jna" % "jna" % jnaVersion, "org.bouncycastle" % "bcutil-jdk18on" % "1.76", "org.bouncycastle" % "bcpkix-jdk18on" % "1.76", "org.bouncycastle" % "bcprov-jdk18on" % "1.76" From 3ac8b87d3fd4ae334e36438920b04c3c1e81d633 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Fri, 20 Sep 2024 16:01:20 +0200 Subject: [PATCH 225/268] DRY --- build.sbt | 186 ++++++++++++++++++------------------------------------ 1 file changed, 62 insertions(+), 124 deletions(-) diff --git a/build.sbt b/build.sbt index 50a6567bb4ca..8ba83ca24ceb 100644 --- a/build.sbt +++ b/build.sbt @@ -520,6 +520,9 @@ val scalaCompiler = Seq( "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion ) +val scalaLibrary = Seq( + "org.scala-lang" % "scala-library" % scalacVersion, +) val scalaCollectionCompatVersion = "2.8.1" // === std-lib ================================================================ @@ -618,8 +621,8 @@ lazy val componentModulesPaths = GraalVM.langsPkgs ++ GraalVM.toolsPkgs ++ helidon ++ + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, @@ -750,9 +753,7 @@ lazy val `text-buffer` = project ), // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ) + Compile / moduleDependencies := scalaLibrary ) lazy val rustParserTargetDirectory = @@ -893,10 +894,8 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "com.chuusai" %% "shapeless" % "2.3.10" ), - Compile / moduleDependencies ++= Seq( - "org.scala-lang" % "scala-library" % scalacVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion - ), + Compile / moduleDependencies ++= scalaLibrary ++ + Seq("org.yaml" % "snakeyaml" % snakeyamlVersion), Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value ) @@ -916,13 +915,11 @@ lazy val pkg = (project in file("lib/scala/pkg")) "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.apache.commons" % "commons-compress" % commonsCompressVersion ), - Compile / moduleDependencies := { + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "org.scala-lang" % "scala-library" % scalacVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion - ) - }, + ), Compile / internalModuleDependencies := Seq( (`editions` / Compile / exportedModule).value, (`semver` / Compile / exportedModule).value, @@ -993,12 +990,10 @@ lazy val `logging-utils` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.slf4j" % "slf4j-api" % slf4jVersion ) ++ logbackTest, - Compile / moduleDependencies := { + Compile / moduleDependencies := scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ) - } ) lazy val `logging-service` = project @@ -1013,8 +1008,7 @@ lazy val `logging-service` = project "com.typesafe" % "config" % typesafeConfigVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( @@ -1071,9 +1065,7 @@ lazy val `logging-service-logback` = project (`logging-service` / Compile / exportedModule).value, (`logging-config` / Compile / exportedModule).value ), - Test / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Test / moduleDependencies := scalaLibrary, Test / internalModuleDependencies := Seq( (Compile / exportedModule).value ) @@ -1095,8 +1087,8 @@ lazy val `logging-utils-akka` = project ), Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ) }, @@ -1120,8 +1112,7 @@ lazy val filewatcher = project "org.slf4j" % "slf4j-api" % slf4jVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( @@ -1173,8 +1164,7 @@ lazy val `scala-libs-wrapper` = project "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, "net.java.dev.jna" % "jna" % jnaVersion ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion, @@ -1184,9 +1174,9 @@ lazy val `scala-libs-wrapper` = project assembly / assemblyExcludedJars := { JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, + scalaLibrary ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "io.github.java-diff-utils" % "java-diff-utils" % "4.12", @@ -1242,9 +1232,7 @@ lazy val `language-server-deps-wrapper` = project "com.typesafe" % "config" % typesafeConfigVersion ), javaModuleName := "org.enso.language.server.deps.wrapper", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value ), @@ -1252,8 +1240,8 @@ lazy val `language-server-deps-wrapper` = project val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", "com.typesafe" % "config" % typesafeConfigVersion ), @@ -1295,8 +1283,8 @@ lazy val `directory-watcher-wrapper` = project val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( (Compile / dependencyClasspath).value, + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % "1.7.36", "net.java.dev.jna" % "jna" % jnaVersion ), @@ -1305,8 +1293,7 @@ lazy val `directory-watcher-wrapper` = project shouldContainAll = true ) }, - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "net.java.dev.jna" % "jna" % jnaVersion, "org.slf4j" % "slf4j-api" % "1.7.36" ), @@ -1314,8 +1301,8 @@ lazy val `directory-watcher-wrapper` = project val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "io.methvin" % "directory-watcher" % directoryWatcherVersion ), streams.value.log, @@ -1337,15 +1324,13 @@ lazy val `fansi-wrapper` = project "com.lihaoyi" %% "fansi" % fansiVersion ), javaModuleName := "org.enso.fansi.wrapper", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / patchModules := { val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "com.lihaoyi" % ("fansi_" + scalaVer) % fansiVersion ), streams.value.log, @@ -1360,9 +1345,7 @@ lazy val `fansi-wrapper` = project val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( (Compile / dependencyClasspath).value, - Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + scalaLibrary, streams.value.log, moduleName.value, shouldContainAll = true @@ -1377,8 +1360,7 @@ lazy val `akka-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, - libraryDependencies ++= akka ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + libraryDependencies ++= akka ++ scalaLibrary ++ Seq( "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2", @@ -1399,8 +1381,7 @@ lazy val `akka-wrapper` = project "io.spray" %% "spray-json" % "1.3.6" ), javaModuleName := "org.enso.akka.wrapper", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "com.google.protobuf" % "protobuf-java" % "3.25.1", "org.reactivestreams" % "reactive-streams" % "1.0.3", "org.slf4j" % "slf4j-api" % slf4jVersion @@ -1409,8 +1390,7 @@ lazy val `akka-wrapper` = project val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, - Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + scalaLibrary ++ Seq( "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % "1.0.0", @@ -1433,8 +1413,8 @@ lazy val `akka-wrapper` = project val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % "1.1.2", @@ -1471,15 +1451,13 @@ lazy val `zio-wrapper` = project "dev.zio" %% "izumi-reflect" % "2.3.8", "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % "2.3.8" ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, assembly / assemblyExcludedJars := { val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "dev.zio" % ("zio-interop-cats_" + scalaVer) % zioInteropCatsVersion @@ -1495,8 +1473,8 @@ lazy val `zio-wrapper` = project val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "dev.zio" % ("zio_" + scalaVer) % zioVersion, "dev.zio" % ("zio-internal-macros_" + scalaVer) % zioVersion, "dev.zio" % ("zio-stacktracer_" + scalaVer) % zioVersion, @@ -1526,9 +1504,7 @@ lazy val cli = project "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value, (`scala-yaml` / Compile / exportedModule).value @@ -1547,9 +1523,7 @@ lazy val `task-progress-notifications` = project libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`cli` / Compile / exportedModule).value, (`json-rpc-server` / Compile / exportedModule).value @@ -1596,9 +1570,7 @@ lazy val `refactoring-utils` = project ), // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`text-buffer` / Compile / exportedModule).value, (`runtime-parser` / Compile / exportedModule).value @@ -1770,8 +1742,8 @@ lazy val `json-rpc-server` = project ), Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ) }, @@ -1836,9 +1808,7 @@ lazy val searcher = project libraryDependencies ++= jmh ++ Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test ) ++ logbackTest, - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`polyglot-api` / Compile / exportedModule).value ) @@ -2120,8 +2090,7 @@ lazy val `polyglot-api` = project javaModuleName := "org.enso.polyglot.api", // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, @@ -2157,9 +2126,7 @@ lazy val `polyglot-api-macros` = project "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion % "provided", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion % "provided" ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value ) @@ -2199,8 +2166,8 @@ lazy val `language-server` = (project in file("engine/language-server")) javaModuleName := "org.enso.language.server", Compile / moduleDependencies := { val scalaVer = scalaBinaryVersion.value + scalaLibrary ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "commons-cli" % "commons-cli" % commonsCliVersion, @@ -2281,8 +2248,7 @@ lazy val `language-server` = (project in file("engine/language-server")) "com.ibm.icu" % "icu4j" % icuVersion % Test ), Test / moduleDependencies := { - GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ Seq( "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -2683,8 +2649,7 @@ lazy val runtime = (project in file("engine/runtime")) javaModuleName := "org.enso.runtime", // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "org.apache.tika" % "tika-core" % tikaVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -2795,8 +2760,7 @@ lazy val `runtime-integration-tests` = ), Test / javaOptions ++= testLogProviderOptions, Test / moduleDependencies := { - GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ Seq( "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "org.apache.commons" % "commons-lang3" % commonsLangVersion, @@ -2964,8 +2928,7 @@ lazy val `runtime-benchmarks` = ), parallelExecution := false, Compile / moduleDependencies := { - GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ Seq( "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "org.apache.commons" % "commons-lang3" % commonsLangVersion, @@ -3129,8 +3092,7 @@ lazy val `runtime-parser` = ), javaModuleName := "org.enso.runtime.parser", Compile / moduleDependencies := { - Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + scalaLibrary ++ Seq( "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ) }, @@ -3165,8 +3127,7 @@ lazy val `runtime-compiler` = "com.typesafe" % "config" % typesafeConfigVersion % Test, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ), @@ -3181,11 +3142,10 @@ lazy val `runtime-compiler` = (`editions` / Compile / exportedModule).value ), Test / moduleDependencies := { - (Compile / moduleDependencies).value ++ Seq( + (Compile / moduleDependencies).value ++ scalaLibrary ++ Seq( "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion, "org.jline" % "jline" % jlineVersion, - "org.scala-lang" % "scala-library" % scalacVersion, "org.scala-lang" % "scala-reflect" % scalacVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "com.typesafe" % "config" % typesafeConfigVersion, @@ -3248,9 +3208,7 @@ lazy val `runtime-suggestions` = ), // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`pkg` / Compile / exportedModule).value, (`polyglot-api` / Compile / exportedModule).value, @@ -3290,13 +3248,12 @@ lazy val `runtime-instrument-common` = javaModuleName := "org.enso.runtime.instrument.common", // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := Seq( + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.scala-lang" % "scala-library" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( @@ -3355,8 +3312,7 @@ lazy val `runtime-instrument-repl-debugger` = inConfig(Compile)(truffleRunOptionsSettings), Compile / forceModuleInfoCompilation := true, instrumentationSettings, - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, @@ -3382,8 +3338,7 @@ lazy val `runtime-instrument-runtime-server` = inConfig(Compile)(truffleRunOptionsSettings), Compile / forceModuleInfoCompilation := true, instrumentationSettings, - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, @@ -3445,11 +3400,10 @@ lazy val `engine-runner-common` = project "commons-io" % "commons-io" % commonsIoVersion, "commons-cli" % "commons-cli" % commonsCliVersion ), - Compile / moduleDependencies := Seq( + Compile / moduleDependencies := scalaLibrary ++ Seq( "commons-cli" % "commons-cli" % commonsCliVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "commons-io" % "commons-io" % commonsIoVersion, - "org.scala-lang" % "scala-library" % scalacVersion ), Compile / internalModuleDependencies := Seq( (`pkg` / Compile / exportedModule).value, @@ -3492,8 +3446,7 @@ lazy val `engine-runner` = project "org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion ), Compile / moduleDependencies := { - Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + scalaLibrary ++ Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, @@ -3782,8 +3735,7 @@ lazy val `distribution-manager` = project "commons-io" % "commons-io" % commonsIoVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion ), @@ -4050,8 +4002,7 @@ lazy val editions = project "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.yaml" % "snakeyaml" % snakeyamlVersion ), Compile / internalModuleDependencies := Seq( @@ -4098,8 +4049,7 @@ lazy val semver = project "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), Compile / moduleDependencies := { - Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + scalaLibrary ++ Seq( "org.yaml" % "snakeyaml" % snakeyamlVersion ) }, @@ -4145,8 +4095,7 @@ lazy val downloader = (project in file("lib/scala/downloader")) "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test ), javaModuleName := "org.enso.downloader", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "commons-io" % "commons-io" % commonsIoVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.slf4j" % "slf4j-api" % slf4jVersion @@ -4174,9 +4123,7 @@ lazy val `edition-updater` = project "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`distribution-manager` / Compile / exportedModule).value, (`editions` / Compile / exportedModule).value @@ -4210,8 +4157,7 @@ lazy val `library-manager` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test ), javaModuleName := "org.enso.librarymanager", - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ Seq( "org.yaml" % "snakeyaml" % snakeyamlVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), @@ -4249,9 +4195,7 @@ lazy val `library-manager-test` = project "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`library-manager` / Compile / exportedModule).value, (`cli` / Compile / exportedModule).value, @@ -4283,9 +4227,7 @@ lazy val `connected-lock-manager` = project "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`distribution-manager` / Compile / exportedModule).value, (`polyglot-api` / Compile / exportedModule).value, @@ -4312,9 +4254,7 @@ lazy val `connected-lock-manager-server` = project akkaTestkit % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ), + Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value, (`akka-wrapper` / Compile / exportedModule).value, @@ -4356,9 +4296,7 @@ lazy val `process-utils` = project .settings( frgaalJavaCompilerSetting, compileOrder := CompileOrder.ScalaThenJava, - Compile / moduleDependencies := Seq( - "org.scala-lang" % "scala-library" % scalacVersion - ) + Compile / moduleDependencies := scalaLibrary, ) lazy val `runtime-version-manager-test` = project From 9af0a289802e0ae0449f8824f4d387c301f16873 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Fri, 20 Sep 2024 17:05:21 +0200 Subject: [PATCH 226/268] scala-compiler DRY --- build.sbt | 47 +++++++++++------------------------------------ 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/build.sbt b/build.sbt index 8ba83ca24ceb..61b6e26ae8ff 100644 --- a/build.sbt +++ b/build.sbt @@ -622,9 +622,8 @@ lazy val componentModulesPaths = GraalVM.toolsPkgs ++ helidon ++ scalaLibrary ++ + scalaCompiler ++ Seq( - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, @@ -1086,7 +1085,6 @@ lazy val `logging-utils-akka` = project "com.typesafe.akka" %% "akka-actor" % akkaVersion ), Compile / moduleDependencies := { - val scalaVer = scalaBinaryVersion.value scalaLibrary ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion @@ -1164,9 +1162,7 @@ lazy val `scala-libs-wrapper` = project "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, "net.java.dev.jna" % "jna" % jnaVersion ), - Compile / moduleDependencies := scalaLibrary ++ Seq( - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, + Compile / moduleDependencies := scalaLibrary ++ scalaCompiler ++ Seq( "org.jline" % "jline" % jlineVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "net.java.dev.jna" % "jna" % jnaVersion @@ -1175,10 +1171,9 @@ lazy val `scala-libs-wrapper` = project JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, scalaLibrary ++ + scalaCompiler ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, "io.github.java-diff-utils" % "java-diff-utils" % "4.12", "org.jline" % "jline" % jlineVersion, "net.java.dev.jna" % "jna" % jnaVersion @@ -1280,7 +1275,6 @@ lazy val `directory-watcher-wrapper` = project ), javaModuleName := "org.enso.directory.watcher.wrapper", assembly / assemblyExcludedJars := { - val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( (Compile / dependencyClasspath).value, scalaLibrary ++ @@ -1298,7 +1292,6 @@ lazy val `directory-watcher-wrapper` = project "org.slf4j" % "slf4j-api" % "1.7.36" ), Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ @@ -1342,7 +1335,6 @@ lazy val `fansi-wrapper` = project ) }, assembly / assemblyExcludedJars := { - val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( (Compile / dependencyClasspath).value, scalaLibrary, @@ -1360,9 +1352,7 @@ lazy val `akka-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, - libraryDependencies ++= akka ++ scalaLibrary ++ Seq( - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, + libraryDependencies ++= akka ++ scalaLibrary ++ scalaCompiler ++ Seq( "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2", "org.scala-lang.modules" %% "scala-java8-compat" % "1.0.0", akkaURL %% "akka-http" % akkaHTTPVersion, @@ -1390,9 +1380,7 @@ lazy val `akka-wrapper` = project val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, - scalaLibrary ++ Seq( - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, + scalaLibrary ++ scalaCompiler ++ Seq( "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % "1.0.0", "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe" % "config" % typesafeConfigVersion, @@ -1413,10 +1401,8 @@ lazy val `akka-wrapper` = project val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, - scalaLibrary ++ + scalaLibrary ++ scalaCompiler ++ Seq( - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % "1.1.2", "com.typesafe" % "config" % typesafeConfigVersion, "io.spray" % ("spray-json_" + scalaVer) % "1.3.6", @@ -1457,9 +1443,8 @@ lazy val `zio-wrapper` = project val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ + scalaCompiler ++ Seq( - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, "dev.zio" % ("zio-interop-cats_" + scalaVer) % zioInteropCatsVersion ), streams.value.log, @@ -1741,7 +1726,6 @@ lazy val `json-rpc-server` = project "commons-io" % "commons-io" % commonsIoVersion % Test ), Compile / moduleDependencies := { - val scalaVer = scalaBinaryVersion.value scalaLibrary ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion @@ -2165,7 +2149,6 @@ lazy val `language-server` = (project in file("engine/language-server")) excludeFilter := excludeFilter.value || "module-info.java", javaModuleName := "org.enso.language.server", Compile / moduleDependencies := { - val scalaVer = scalaBinaryVersion.value scalaLibrary ++ Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, @@ -2248,9 +2231,7 @@ lazy val `language-server` = (project in file("engine/language-server")) "com.ibm.icu" % "icu4j" % icuVersion % Test ), Test / moduleDependencies := { - GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ Seq( - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, + GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ scalaCompiler ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, @@ -2760,9 +2741,7 @@ lazy val `runtime-integration-tests` = ), Test / javaOptions ++= testLogProviderOptions, Test / moduleDependencies := { - GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ Seq( - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, + GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ scalaCompiler ++ Seq( "org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "commons-io" % "commons-io" % commonsIoVersion, @@ -2928,9 +2907,7 @@ lazy val `runtime-benchmarks` = ), parallelExecution := false, Compile / moduleDependencies := { - GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ Seq( - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, + GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ scalaCompiler ++ Seq( "org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "commons-io" % "commons-io" % commonsIoVersion, @@ -3142,12 +3119,10 @@ lazy val `runtime-compiler` = (`editions` / Compile / exportedModule).value ), Test / moduleDependencies := { - (Compile / moduleDependencies).value ++ scalaLibrary ++ Seq( + (Compile / moduleDependencies).value ++ scalaLibrary ++ scalaCompiler ++ Seq( "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion, "org.jline" % "jline" % jlineVersion, - "org.scala-lang" % "scala-reflect" % scalacVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, "com.typesafe" % "config" % typesafeConfigVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion ) From 927f23610e632636cebb30c5b5b32e8bee115995 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Fri, 20 Sep 2024 17:07:00 +0200 Subject: [PATCH 227/268] fmt --- build.sbt | 114 +++++++++++++++++++++++++++--------------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/build.sbt b/build.sbt index 61b6e26ae8ff..aeab16289cb6 100644 --- a/build.sbt +++ b/build.sbt @@ -521,7 +521,7 @@ val scalaCompiler = Seq( "org.scala-lang" % "scala-compiler" % scalacVersion ) val scalaLibrary = Seq( - "org.scala-lang" % "scala-library" % scalacVersion, + "org.scala-lang" % "scala-library" % scalacVersion ) val scalaCollectionCompatVersion = "2.8.1" @@ -894,7 +894,7 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) "com.chuusai" %% "shapeless" % "2.3.10" ), Compile / moduleDependencies ++= scalaLibrary ++ - Seq("org.yaml" % "snakeyaml" % snakeyamlVersion), + Seq("org.yaml" % "snakeyaml" % snakeyamlVersion), Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value ) @@ -915,10 +915,10 @@ lazy val pkg = (project in file("lib/scala/pkg")) "org.apache.commons" % "commons-compress" % commonsCompressVersion ), Compile / moduleDependencies := scalaLibrary ++ - Seq( - "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion - ), + Seq( + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion + ), Compile / internalModuleDependencies := Seq( (`editions` / Compile / exportedModule).value, (`semver` / Compile / exportedModule).value, @@ -990,9 +990,9 @@ lazy val `logging-utils` = project "org.slf4j" % "slf4j-api" % slf4jVersion ) ++ logbackTest, Compile / moduleDependencies := scalaLibrary ++ - Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion - ) + Seq( + "org.slf4j" % "slf4j-api" % slf4jVersion + ) ) lazy val `logging-service` = project @@ -1008,7 +1008,7 @@ lazy val `logging-service` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test ), Compile / moduleDependencies := scalaLibrary ++ Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion + "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( (`logging-config` / Compile / exportedModule).value, @@ -1087,7 +1087,7 @@ lazy val `logging-utils-akka` = project Compile / moduleDependencies := { scalaLibrary ++ Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion + "org.slf4j" % "slf4j-api" % slf4jVersion ) }, Compile / internalModuleDependencies := Seq( @@ -1111,7 +1111,7 @@ lazy val filewatcher = project "org.scalatest" %% "scalatest" % scalatestVersion % Test ), Compile / moduleDependencies := scalaLibrary ++ Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion + "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( (`directory-watcher-wrapper` / Compile / exportedModule).value @@ -1163,9 +1163,9 @@ lazy val `scala-libs-wrapper` = project "net.java.dev.jna" % "jna" % jnaVersion ), Compile / moduleDependencies := scalaLibrary ++ scalaCompiler ++ Seq( - "org.jline" % "jline" % jlineVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "net.java.dev.jna" % "jna" % jnaVersion + "org.jline" % "jline" % jlineVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "net.java.dev.jna" % "jna" % jnaVersion ), assembly / assemblyExcludedJars := { JPMSUtils.filterModulesFromClasspath( @@ -1237,8 +1237,8 @@ lazy val `language-server-deps-wrapper` = project (Compile / fullClasspath).value, scalaLibrary ++ Seq( - "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", - "com.typesafe" % "config" % typesafeConfigVersion + "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", + "com.typesafe" % "config" % typesafeConfigVersion ), streams.value.log, moduleName.value, @@ -1279,8 +1279,8 @@ lazy val `directory-watcher-wrapper` = project (Compile / dependencyClasspath).value, scalaLibrary ++ Seq( - "org.slf4j" % "slf4j-api" % "1.7.36", - "net.java.dev.jna" % "jna" % jnaVersion + "org.slf4j" % "slf4j-api" % "1.7.36", + "net.java.dev.jna" % "jna" % jnaVersion ), streams.value.log, moduleName.value, @@ -1288,15 +1288,15 @@ lazy val `directory-watcher-wrapper` = project ) }, Compile / moduleDependencies := scalaLibrary ++ Seq( - "net.java.dev.jna" % "jna" % jnaVersion, - "org.slf4j" % "slf4j-api" % "1.7.36" + "net.java.dev.jna" % "jna" % jnaVersion, + "org.slf4j" % "slf4j-api" % "1.7.36" ), Compile / patchModules := { val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ Seq( - "io.methvin" % "directory-watcher" % directoryWatcherVersion + "io.methvin" % "directory-watcher" % directoryWatcherVersion ), streams.value.log, moduleName.value, @@ -1324,7 +1324,7 @@ lazy val `fansi-wrapper` = project update.value, scalaLibrary ++ Seq( - "com.lihaoyi" % ("fansi_" + scalaVer) % fansiVersion + "com.lihaoyi" % ("fansi_" + scalaVer) % fansiVersion ), streams.value.log, moduleName.value, @@ -1445,7 +1445,7 @@ lazy val `zio-wrapper` = project scalaLibrary ++ scalaCompiler ++ Seq( - "dev.zio" % ("zio-interop-cats_" + scalaVer) % zioInteropCatsVersion + "dev.zio" % ("zio-interop-cats_" + scalaVer) % zioInteropCatsVersion ), streams.value.log, moduleName.value, @@ -1460,11 +1460,11 @@ lazy val `zio-wrapper` = project update.value, scalaLibrary ++ Seq( - "dev.zio" % ("zio_" + scalaVer) % zioVersion, - "dev.zio" % ("zio-internal-macros_" + scalaVer) % zioVersion, - "dev.zio" % ("zio-stacktracer_" + scalaVer) % zioVersion, - "dev.zio" % ("izumi-reflect_" + scalaVer) % "2.3.8", - "dev.zio" % ("izumi-reflect-thirdparty-boopickle-shaded_" + scalaVer) % "2.3.8" + "dev.zio" % ("zio_" + scalaVer) % zioVersion, + "dev.zio" % ("zio-internal-macros_" + scalaVer) % zioVersion, + "dev.zio" % ("zio-stacktracer_" + scalaVer) % zioVersion, + "dev.zio" % ("izumi-reflect_" + scalaVer) % "2.3.8", + "dev.zio" % ("izumi-reflect-thirdparty-boopickle-shaded_" + scalaVer) % "2.3.8" ), streams.value.log, moduleName.value, @@ -1728,7 +1728,7 @@ lazy val `json-rpc-server` = project Compile / moduleDependencies := { scalaLibrary ++ Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion + "org.slf4j" % "slf4j-api" % slf4jVersion ) }, Compile / internalModuleDependencies := Seq( @@ -3224,12 +3224,12 @@ lazy val `runtime-instrument-common` = // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", Compile / moduleDependencies := scalaLibrary ++ Seq( - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( (`cli` / Compile / exportedModule).value, @@ -3288,11 +3288,11 @@ lazy val `runtime-instrument-repl-debugger` = Compile / forceModuleInfoCompilation := true, instrumentationSettings, Compile / moduleDependencies := scalaLibrary ++ Seq( - "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion + "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion ), Compile / internalModuleDependencies := Seq( (`runtime-instrument-common` / Compile / exportedModule).value, @@ -3376,9 +3376,9 @@ lazy val `engine-runner-common` = project "commons-cli" % "commons-cli" % commonsCliVersion ), Compile / moduleDependencies := scalaLibrary ++ Seq( - "commons-cli" % "commons-cli" % commonsCliVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "commons-io" % "commons-io" % commonsIoVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "commons-io" % "commons-io" % commonsIoVersion ), Compile / internalModuleDependencies := Seq( (`pkg` / Compile / exportedModule).value, @@ -3422,12 +3422,12 @@ lazy val `engine-runner` = project ), Compile / moduleDependencies := { scalaLibrary ++ Seq( - "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, - "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, - "commons-cli" % "commons-cli" % commonsCliVersion, - "org.jline" % "jline" % jlineVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion + "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, + "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "org.jline" % "jline" % jlineVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ) }, Compile / internalModuleDependencies := Seq( @@ -3711,8 +3711,8 @@ lazy val `distribution-manager` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test ), Compile / moduleDependencies := scalaLibrary ++ Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion ), Compile / internalModuleDependencies := Seq( (`cli` / Compile / exportedModule).value, @@ -3978,7 +3978,7 @@ lazy val editions = project "org.scalatest" %% "scalatest" % scalatestVersion % Test ), Compile / moduleDependencies := scalaLibrary ++ Seq( - "org.yaml" % "snakeyaml" % snakeyamlVersion + "org.yaml" % "snakeyaml" % snakeyamlVersion ), Compile / internalModuleDependencies := Seq( (`scala-yaml` / Compile / exportedModule).value, @@ -4025,7 +4025,7 @@ lazy val semver = project ), Compile / moduleDependencies := { scalaLibrary ++ Seq( - "org.yaml" % "snakeyaml" % snakeyamlVersion + "org.yaml" % "snakeyaml" % snakeyamlVersion ) }, Compile / internalModuleDependencies := Seq( @@ -4133,8 +4133,8 @@ lazy val `library-manager` = project ), javaModuleName := "org.enso.librarymanager", Compile / moduleDependencies := scalaLibrary ++ Seq( - "org.yaml" % "snakeyaml" % snakeyamlVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( (`distribution-manager` / Compile / exportedModule).value, @@ -4271,7 +4271,7 @@ lazy val `process-utils` = project .settings( frgaalJavaCompilerSetting, compileOrder := CompileOrder.ScalaThenJava, - Compile / moduleDependencies := scalaLibrary, + Compile / moduleDependencies := scalaLibrary ) lazy val `runtime-version-manager-test` = project From fba7b6916815fc22894005cfcabccb4feb6bcfe2 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Sat, 21 Sep 2024 00:10:14 +0200 Subject: [PATCH 228/268] More build.sbt refactoring --- build.sbt | 236 +++++++++++++++++++++++++++--------------------------- 1 file changed, 116 insertions(+), 120 deletions(-) diff --git a/build.sbt b/build.sbt index aeab16289cb6..dfb6db2f51e4 100644 --- a/build.sbt +++ b/build.sbt @@ -407,7 +407,10 @@ val akkaURL = "com.typesafe.akka" val akkaVersion = "2.6.20" val akkaHTTPVersion = "10.2.10" val akkaMockSchedulerVersion = "0.5.5" +val reactiveStreamsVersion = "1.0.3" +val sprayJsonVersion = "1.3.6" val logbackClassicVersion = JPMSUtils.logbackClassicVersion +val javaDiffVersion = "4.12" val logbackPkg = Seq( "ch.qos.logback" % "logback-classic" % logbackClassicVersion, "ch.qos.logback" % "logback-core" % logbackClassicVersion @@ -427,7 +430,8 @@ val akka = // === Cats =================================================================== -val catsVersion = "2.9.0" +val catsVersion = "2.10.0" +val jawnParserVersion = "1.5.1" // === Circe ================================================================== @@ -505,6 +509,7 @@ val jaxb = Seq( "jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion % Benchmark, "com.sun.xml.bind" % "jaxb-impl" % jaxbVersion % Benchmark ) +val jaActivationVersion = "2.1.0" // === JMH ==================================================================== @@ -523,7 +528,9 @@ val scalaCompiler = Seq( val scalaLibrary = Seq( "org.scala-lang" % "scala-library" % scalacVersion ) -val scalaCollectionCompatVersion = "2.8.1" +val scalaParserCombinatorsVersion = "1.1.2" +val scalaJavaCompatVersion = "1.0.0" +val scalaCollectionCompatVersion = "2.8.1" // === std-lib ================================================================ @@ -539,13 +546,36 @@ val tableauVersion = "0.0.19691.r2d7e5bc8" // === ZIO ==================================================================== -val zioVersion = "2.0.14" -val zioInteropCatsVersion = "23.0.0.6" +val zioVersion = "2.0.14" +val zioInteropCatsVersion = "23.0.0.6" +val zioIzumiReflectVersion = "2.3.8" val zio = Seq( "dev.zio" %% "zio" % zioVersion, "dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion ) +// === Sentry ================================================================= + +val ioSentryVersion = "6.28.0" +val ioSentry = Seq( + "io.sentry" % "sentry-logback" % ioSentryVersion, + "io.sentry" % "sentry" % ioSentryVersion +) + +// === Bouncy Castle ========================================================== + +val bouncyCastleVersion = "1.76" +val bouncyCastle = Seq( + "org.bouncycastle" % "bcutil-jdk18on" % bouncyCastleVersion, + "org.bouncycastle" % "bcpkix-jdk18on" % bouncyCastleVersion, + "org.bouncycastle" % "bcprov-jdk18on" % bouncyCastleVersion +) + +// === Google ================================================================= +val googleApiClientVersion = "2.2.0" +val googleApiServicesSheetsVersion = "v4-rev612-1.25.0" +val googleAnalyticsDataVersion = "0.44.0" + // === Other ================================================================== val bcpkixJdk15Version = "1.70" @@ -574,6 +604,7 @@ val junitVersion = "4.13.2" val junitIfVersion = "0.13.2" val hamcrestVersion = "1.3" val netbeansApiVersion = "RELEASE180" +val opencvVersion = "4.7.0-0" val fansiVersion = "0.4.0" val httpComponentsVersion = "4.4.1" val apacheArrowVersion = "14.0.1" @@ -581,6 +612,9 @@ val snowflakeJDBCVersion = "3.15.0" val mssqlserverJDBCVersion = "12.6.2.jre11" val jsoniterVersion = "2.28.5" val jnaVersion = "5.14.0" +val googleProtobufVersion = "3.25.1" +val shapelessVersion = "2.3.10" +val postgresVersion = "42.4.0" // ============================================================================ // === Utility methods ===================================================== @@ -592,10 +626,8 @@ lazy val componentModulesIds = "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( + GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.toolsPkgs ++ helidon ++ logbackPkg ++ 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, @@ -623,30 +655,28 @@ lazy val componentModulesPaths = helidon ++ scalaLibrary ++ scalaCompiler ++ - Seq( - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, - "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, - "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - "com.google.protobuf" % "protobuf-java" % "3.25.1", - "commons-cli" % "commons-cli" % commonsCliVersion, - "commons-io" % "commons-io" % commonsIoVersion, - "net.java.dev.jna" % "jna" % jnaVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion, - "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "org.reactivestreams" % "reactive-streams" % "1.0.3", - "org.jline" % "jline" % jlineVersion, - "org.apache.commons" % "commons-lang3" % commonsLangVersion, - "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "org.apache.tika" % "tika-core" % tikaVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion, - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion, - "com.ibm.icu" % "icu4j" % icuVersion, - "io.sentry" % "sentry-logback" % "6.28.0", - "io.sentry" % "sentry" % "6.28.0" - ) + ioSentry ++ + logbackPkg + Seq( + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "net.java.dev.jna" % "jna" % jnaVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, + "org.jline" % "jline" % jlineVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.apache.tika" % "tika-core" % tikaVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "com.ibm.icu" % "icu4j" % icuVersion + ) val thirdPartyMods = JPMSUtils.filterModulesFromClasspath( fullCp, thirdPartyModIds, @@ -891,7 +921,7 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) excludeFilter := excludeFilter.value || "module-info.java", libraryDependencies ++= Seq( "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", - "com.chuusai" %% "shapeless" % "2.3.10" + "com.chuusai" %% "shapeless" % shapelessVersion ), Compile / moduleDependencies ++= scalaLibrary ++ Seq("org.yaml" % "snakeyaml" % snakeyamlVersion), @@ -1046,18 +1076,12 @@ lazy val `logging-service-logback` = project version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, - "io.sentry" % "sentry-logback" % "6.28.0", - "io.sentry" % "sentry" % "6.28.0", "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" - ) ++ logbackPkg, - Compile / moduleDependencies := Seq( + ) ++ logbackPkg ++ ioSentry, + Compile / moduleDependencies := logbackPkg ++ ioSentry ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, - "io.sentry" % "sentry-logback" % "6.28.0", - "io.sentry" % "sentry" % "6.28.0", - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided", - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), Compile / shouldCompileModuleInfoManually := true, Compile / internalModuleDependencies := Seq( @@ -1156,7 +1180,7 @@ lazy val `scala-libs-wrapper` = project libraryDependencies ++= circe ++ Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.typelevel" %% "cats-core" % "2.10.0", + "org.typelevel" %% "cats-core" % catsVersion, "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion, "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, @@ -1174,7 +1198,7 @@ lazy val `scala-libs-wrapper` = project scalaCompiler ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, - "io.github.java-diff-utils" % "java-diff-utils" % "4.12", + "io.github.java-diff-utils" % "java-diff-utils" % javaDiffVersion, "org.jline" % "jline" % jlineVersion, "net.java.dev.jna" % "jna" % jnaVersion ), @@ -1196,10 +1220,10 @@ lazy val `scala-libs-wrapper` = project "io.circe" % ("circe-parser_" + scalaVer) % circeVersion, "io.circe" % ("circe-jawn_" + scalaVer) % circeVersion, "io.circe" % ("circe-numbers_" + scalaVer) % circeVersion, - "org.typelevel" % ("cats-core_" + scalaVer) % "2.10.0", - "org.typelevel" % ("cats-kernel_" + scalaVer) % "2.10.0", - "org.typelevel" % ("jawn-parser_" + scalaVer) % "1.5.1", - "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", + "org.typelevel" % ("cats-core_" + scalaVer) % catsVersion, + "org.typelevel" % ("cats-kernel_" + scalaVer) % catsVersion, + "org.typelevel" % ("jawn-parser_" + scalaVer) % jawnParserVersion, + "com.chuusai" % ("shapeless_" + scalaVer) % shapelessVersion, "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-macros_" + scalaVer) % jsoniterVersion, "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-core_" + scalaVer) % jsoniterVersion ), @@ -1223,7 +1247,7 @@ lazy val `language-server-deps-wrapper` = project modularFatJarWrapperSettings, libraryDependencies ++= Seq( "com.github.pureconfig" %% "pureconfig" % pureconfigVersion, - "com.chuusai" %% "shapeless" % "2.3.10", + "com.chuusai" %% "shapeless" % shapelessVersion, "com.typesafe" % "config" % typesafeConfigVersion ), javaModuleName := "org.enso.language.server.deps.wrapper", @@ -1237,7 +1261,7 @@ lazy val `language-server-deps-wrapper` = project (Compile / fullClasspath).value, scalaLibrary ++ Seq( - "com.chuusai" % ("shapeless_" + scalaVer) % "2.3.10", + "com.chuusai" % ("shapeless_" + scalaVer) % shapelessVersion, "com.typesafe" % "config" % typesafeConfigVersion ), streams.value.log, @@ -1353,27 +1377,27 @@ lazy val `akka-wrapper` = project .settings( modularFatJarWrapperSettings, libraryDependencies ++= akka ++ scalaLibrary ++ scalaCompiler ++ Seq( - "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2", - "org.scala-lang.modules" %% "scala-java8-compat" % "1.0.0", + "org.scala-lang.modules" %% "scala-parser-combinators" % scalaParserCombinatorsVersion, + "org.scala-lang.modules" %% "scala-java8-compat" % scalaJavaCompatVersion, akkaURL %% "akka-http" % akkaHTTPVersion, akkaURL %% "akka-http-core" % akkaHTTPVersion, akkaURL %% "akka-slf4j" % akkaVersion, - akkaURL %% "akka-parsing" % "10.2.10", + akkaURL %% "akka-parsing" % akkaHTTPVersion, akkaURL %% "akka-protobuf-v3" % akkaVersion, - akkaURL %% "akka-http-spray-json" % "10.2.10", + akkaURL %% "akka-http-spray-json" % akkaHTTPVersion, "com.typesafe" % "config" % typesafeConfigVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, - "com.google.protobuf" % "protobuf-java" % "3.25.1", - "io.github.java-diff-utils" % "java-diff-utils" % "4.12", - "org.reactivestreams" % "reactive-streams" % "1.0.3", + "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, + "io.github.java-diff-utils" % "java-diff-utils" % javaDiffVersion, + "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, "org.jline" % "jline" % jlineVersion, "net.java.dev.jna" % "jna" % jnaVersion, - "io.spray" %% "spray-json" % "1.3.6" + "io.spray" %% "spray-json" % sprayJsonVersion ), javaModuleName := "org.enso.akka.wrapper", Compile / moduleDependencies := scalaLibrary ++ Seq( - "com.google.protobuf" % "protobuf-java" % "3.25.1", - "org.reactivestreams" % "reactive-streams" % "1.0.3", + "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, + "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), assembly / assemblyExcludedJars := { @@ -1381,13 +1405,13 @@ lazy val `akka-wrapper` = project val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ scalaCompiler ++ Seq( - "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % "1.0.0", + "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % scalaJavaCompatVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe" % "config" % typesafeConfigVersion, - "io.github.java-diff-utils" % "java-diff-utils" % "4.12", + "io.github.java-diff-utils" % "java-diff-utils" % javaDiffVersion, "org.jline" % "jline" % jlineVersion, - "com.google.protobuf" % "protobuf-java" % "3.25.1", - "org.reactivestreams" % "reactive-streams" % "1.0.3", + "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, + "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, "net.java.dev.jna" % "jna" % jnaVersion ), streams.value.log, @@ -1403,16 +1427,16 @@ lazy val `akka-wrapper` = project update.value, scalaLibrary ++ scalaCompiler ++ Seq( - "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % "1.1.2", + "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % scalaParserCombinatorsVersion, "com.typesafe" % "config" % typesafeConfigVersion, - "io.spray" % ("spray-json_" + scalaVer) % "1.3.6", + "io.spray" % ("spray-json_" + scalaVer) % sprayJsonVersion, akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, akkaURL % ("akka-http_" + scalaVer) % akkaHTTPVersion, akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-http-spray-json_" + scalaVer) % "10.2.10", + akkaURL % ("akka-http-spray-json_" + scalaVer) % akkaHTTPVersion, akkaURL % ("akka-slf4j_" + scalaVer) % akkaVersion, - akkaURL % ("akka-parsing_" + scalaVer) % "10.2.10", + akkaURL % ("akka-parsing_" + scalaVer) % akkaHTTPVersion, akkaURL % ("akka-protobuf-v3_" + scalaVer) % akkaVersion ), streams.value.log, @@ -1434,8 +1458,8 @@ lazy val `zio-wrapper` = project libraryDependencies ++= zio ++ Seq( "dev.zio" %% "zio-internal-macros" % zioVersion, "dev.zio" %% "zio-stacktracer" % zioVersion, - "dev.zio" %% "izumi-reflect" % "2.3.8", - "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % "2.3.8" + "dev.zio" %% "izumi-reflect" % zioIzumiReflectVersion, + "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % zioIzumiReflectVersion ), Compile / moduleDependencies := scalaLibrary, assembly / assemblyExcludedJars := { @@ -1463,8 +1487,8 @@ lazy val `zio-wrapper` = project "dev.zio" % ("zio_" + scalaVer) % zioVersion, "dev.zio" % ("zio-internal-macros_" + scalaVer) % zioVersion, "dev.zio" % ("zio-stacktracer_" + scalaVer) % zioVersion, - "dev.zio" % ("izumi-reflect_" + scalaVer) % "2.3.8", - "dev.zio" % ("izumi-reflect-thirdparty-boopickle-shaded_" + scalaVer) % "2.3.8" + "dev.zio" % ("izumi-reflect_" + scalaVer) % zioIzumiReflectVersion, + "dev.zio" % ("izumi-reflect-thirdparty-boopickle-shaded_" + scalaVer) % zioIzumiReflectVersion ), streams.value.log, moduleName.value, @@ -1818,10 +1842,8 @@ lazy val `ydoc-server` = project Test / fork := true, commands += WithDebugCommand.withDebug, Compile / 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 + GraalVM.modules ++ GraalVM.jsPkgs ++ GraalVM.chromeInspectorPkgs ++ helidon ++ logbackPkg ++ Seq( + "org.slf4j" % "slf4j-api" % slf4jVersion ) }, Compile / internalModuleDependencies := Seq( @@ -2122,7 +2144,7 @@ lazy val `language-server` = (project in file("engine/language-server")) .settings( commands += WithDebugCommand.withDebug, frgaalJavaCompilerSetting, - libraryDependencies ++= akka ++ circe ++ Seq( + libraryDependencies ++= akka ++ circe ++ bouncyCastle.map(_ % Test) ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "io.circe" %% "circe-generic-extras" % circeGenericExtrasVersion, @@ -2140,9 +2162,6 @@ lazy val `language-server` = (project in file("engine/language-server")) "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 ), // See JPMSPlugin docs (Mixed projects) @@ -2214,14 +2233,10 @@ lazy val `language-server` = (project in file("engine/language-server")) necessaryModules }, // More dependencies needed for modules for testing - libraryDependencies ++= Seq( - "com.google.protobuf" % "protobuf-java" % "3.25.1" % Test, - "org.reactivestreams" % "reactive-streams" % "1.0.3" % Test, + libraryDependencies ++= ioSentry.map(_ % Test) ++ logbackTest ++ Seq( + "com.google.protobuf" % "protobuf-java" % googleProtobufVersion % Test, + "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion % Test, "org.jline" % "jline" % jlineVersion % Test, - "io.sentry" % "sentry-logback" % "6.28.0" % Test, - "io.sentry" % "sentry" % "6.28.0" % Test, - "ch.qos.logback" % "logback-classic" % logbackClassicVersion % Test, - "ch.qos.logback" % "logback-core" % logbackClassicVersion % Test, "org.apache.tika" % "tika-core" % tikaVersion % Test, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion % Test, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion % Test, @@ -2231,7 +2246,7 @@ lazy val `language-server` = (project in file("engine/language-server")) "com.ibm.icu" % "icu4j" % icuVersion % Test ), Test / moduleDependencies := { - GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ scalaCompiler ++ Seq( + GraalVM.modules ++ GraalVM.langsPkgs ++ logbackPkg ++ helidon ++ ioSentry ++ bouncyCastle ++ scalaLibrary ++ scalaCompiler ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, @@ -2240,19 +2255,12 @@ lazy val `language-server` = (project in file("engine/language-server")) "org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "commons-io" % "commons-io" % commonsIoVersion, - "com.google.protobuf" % "protobuf-java" % "3.25.1", - "org.reactivestreams" % "reactive-streams" % "1.0.3", + "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, + "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, "org.jline" % "jline" % jlineVersion, "org.apache.tika" % "tika-core" % tikaVersion, "com.ibm.icu" % "icu4j" % icuVersion, - "io.sentry" % "sentry-logback" % "6.28.0", - "io.sentry" % "sentry" % "6.28.0", - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion, - "net.java.dev.jna" % "jna" % jnaVersion, - "org.bouncycastle" % "bcutil-jdk18on" % "1.76", - "org.bouncycastle" % "bcpkix-jdk18on" % "1.76", - "org.bouncycastle" % "bcprov-jdk18on" % "1.76" + "net.java.dev.jna" % "jna" % jnaVersion ) }, Test / internalModuleDependencies := Seq( @@ -2741,7 +2749,7 @@ lazy val `runtime-integration-tests` = ), Test / javaOptions ++= testLogProviderOptions, Test / moduleDependencies := { - GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ scalaCompiler ++ Seq( + GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ ioSentry ++ scalaLibrary ++ scalaCompiler ++ Seq( "org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "commons-io" % "commons-io" % commonsIoVersion, @@ -2757,11 +2765,7 @@ lazy val `runtime-integration-tests` = "org.jline" % "jline" % jlineVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "io.sentry" % "sentry-logback" % "6.28.0", - "io.sentry" % "sentry" % "6.28.0", - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion + "com.typesafe" % "config" % typesafeConfigVersion ) }, Test / internalModuleDependencies := Seq( @@ -2883,7 +2887,7 @@ lazy val `runtime-benchmarks` = annotationProcSetting, // Note that withDebug command only makes sense if you use `@Fork(0)` in your benchmarks. commands += WithDebugCommand.withDebug, - libraryDependencies ++= GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.toolsPkgs ++ helidon ++ Seq( + libraryDependencies ++= GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.toolsPkgs ++ helidon ++ ioSentry ++ logbackPkg ++ Seq( "org.openjdk.jmh" % "jmh-core" % jmhVersion, "org.openjdk.jmh" % "jmh-generator-annprocess" % jmhVersion, "jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion, @@ -2892,10 +2896,6 @@ lazy val `runtime-benchmarks` = "org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided", "org.slf4j" % "slf4j-api" % slf4jVersion, "org.slf4j" % "slf4j-nop" % slf4jVersion, - "io.sentry" % "sentry" % "6.28.0", - "io.sentry" % "sentry-logback" % "6.28.0", - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion ), mainClass := @@ -2907,7 +2907,7 @@ lazy val `runtime-benchmarks` = ), parallelExecution := false, Compile / moduleDependencies := { - GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ scalaLibrary ++ scalaCompiler ++ Seq( + GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ ioSentry ++ scalaLibrary ++ scalaCompiler ++ Seq( "org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "commons-io" % "commons-io" % commonsIoVersion, @@ -2921,14 +2921,10 @@ lazy val `runtime-benchmarks` = "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion, "com.typesafe" % "config" % typesafeConfigVersion, - "io.sentry" % "sentry-logback" % "6.28.0", - "io.sentry" % "sentry" % "6.28.0", - "ch.qos.logback" % "logback-classic" % logbackClassicVersion, - "ch.qos.logback" % "logback-core" % logbackClassicVersion, // Dependencies for benchmarks-common "org.openjdk.jmh" % "jmh-core" % jmhVersion, // Automatic module "jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion, - "jakarta.activation" % "jakarta.activation-api" % "2.1.0" + "jakarta.activation" % "jakarta.activation-api" % jaActivationVersion ) }, Compile / internalModuleDependencies := Seq( @@ -3762,7 +3758,7 @@ lazy val `benchmarks-common` = Compile / moduleDependencies := Seq( "org.openjdk.jmh" % "jmh-core" % jmhVersion, // Automatic module "jakarta.xml.bind" % "jakarta.xml.bind-api" % jaxbVersion, - "jakarta.activation" % "jakarta.activation-api" % "2.1.0", + "jakarta.activation" % "jakarta.activation-api" % jaActivationVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion ), Compile / internalModuleDependencies := Seq( @@ -4490,7 +4486,7 @@ lazy val `std-image` = project libraryDependencies ++= Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided", "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided", - "org.openpnp" % "opencv" % "4.7.0-0" + "org.openpnp" % "opencv" % opencvVersion ), Compile / packageBin := Def.task { val result = (Compile / packageBin).value @@ -4517,9 +4513,9 @@ lazy val `std-google-api` = project Compile / packageBin / artifactPath := `google-api-polyglot-root` / "std-google-api.jar", libraryDependencies ++= Seq( - "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") + "com.google.api-client" % "google-api-client" % googleApiClientVersion exclude ("com.google.code.findbugs", "jsr305"), + "com.google.apis" % "google-api-services-sheets" % googleApiServicesSheetsVersion exclude ("com.google.code.findbugs", "jsr305"), + "com.google.analytics" % "google-analytics-data" % googleAnalyticsDataVersion exclude ("com.google.code.findbugs", "jsr305") ), Compile / packageBin := Def.task { val result = (Compile / packageBin).value @@ -4548,7 +4544,7 @@ lazy val `std-database` = project "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" + "org.postgresql" % "postgresql" % postgresVersion ), Compile / packageBin := Def.task { val result = (Compile / packageBin).value From e774f3acabe22e90ec271763a1e254712fd8b2e5 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 23 Sep 2024 11:55:27 +0200 Subject: [PATCH 229/268] Include runtime-instrument-id-execution in engine-runner native image --- build.sbt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.sbt b/build.sbt index dfb6db2f51e4..63a837ecb31c 100644 --- a/build.sbt +++ b/build.sbt @@ -3462,6 +3462,9 @@ lazy val `engine-runner` = project val runtimeServerInstr = (`runtime-instrument-runtime-server` / Compile / fullClasspath).value .map(_.data.getAbsolutePath) + val idExecInstr = + (`runtime-instrument-id-execution` / Compile / fullClasspath).value + .map(_.data.getAbsolutePath) val epbLang = (`runtime-language-epb` / Compile / fullClasspath).value .map(_.data.getAbsolutePath) @@ -3471,6 +3474,7 @@ lazy val `engine-runner` = project loggingDeps ++ replDebugInstr ++ runtimeServerInstr ++ + idExecInstr ++ epbLang ).distinct val stdLibsJars = From b1d0898ed0c3cabb8eabcafa220e7eb58a531722 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 23 Sep 2024 11:55:43 +0200 Subject: [PATCH 230/268] TruffleBoundary for QualifiedName.toString --- .../org/enso/interpreter/service/ExecutionCallbacks.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionCallbacks.java b/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionCallbacks.java index ff02a02bd319..27972daa52b6 100644 --- a/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionCallbacks.java +++ b/engine/runtime-instrument-common/src/main/java/org/enso/interpreter/service/ExecutionCallbacks.java @@ -209,11 +209,16 @@ private String typeOf(Object value) { var typeOfNode = TypeOfNode.getUncached(); Object typeResult = value == null ? null : typeOfNode.execute(value); if (typeResult instanceof Type t) { - resultType = t.getQualifiedName().toString(); + resultType = getTypeQualifiedName(t); } else { resultType = null; } } return resultType; } + + @CompilerDirectives.TruffleBoundary + private static String getTypeQualifiedName(Type t) { + return t.getQualifiedName().toString(); + } } From 6be2ff4c0e5c949ea73ec1b2e906f0a6ac7d8ccc Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Mon, 23 Sep 2024 14:04:51 +0200 Subject: [PATCH 231/268] Finding a needle in a haystack :facepalm: --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 63a837ecb31c..295a92712c28 100644 --- a/build.sbt +++ b/build.sbt @@ -656,7 +656,7 @@ lazy val componentModulesPaths = scalaLibrary ++ scalaCompiler ++ ioSentry ++ - logbackPkg + logbackPkg ++ Seq( "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, From 9421e29690a0dad650e17c9380c3a6e9c1577562 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Mon, 23 Sep 2024 14:46:28 +0200 Subject: [PATCH 232/268] More scala-library DRY --- build.sbt | 131 +++++++++++++++++++++++++++++------------------------- 1 file changed, 70 insertions(+), 61 deletions(-) diff --git a/build.sbt b/build.sbt index 295a92712c28..7280593d4927 100644 --- a/build.sbt +++ b/build.sbt @@ -657,26 +657,26 @@ lazy val componentModulesPaths = scalaCompiler ++ ioSentry ++ logbackPkg ++ - Seq( - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, - "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, - "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, - "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, - "commons-cli" % "commons-cli" % commonsCliVersion, - "commons-io" % "commons-io" % commonsIoVersion, - "net.java.dev.jna" % "jna" % jnaVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion, - "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, - "org.jline" % "jline" % jlineVersion, - "org.apache.commons" % "commons-lang3" % commonsLangVersion, - "org.apache.commons" % "commons-compress" % commonsCompressVersion, - "org.apache.tika" % "tika-core" % tikaVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "org.yaml" % "snakeyaml" % snakeyamlVersion, - "com.ibm.icu" % "icu4j" % icuVersion - ) + Seq( + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, + "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, + "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, + "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, + "commons-cli" % "commons-cli" % commonsCliVersion, + "commons-io" % "commons-io" % commonsIoVersion, + "net.java.dev.jna" % "jna" % jnaVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, + "org.jline" % "jline" % jlineVersion, + "org.apache.commons" % "commons-lang3" % commonsLangVersion, + "org.apache.commons" % "commons-compress" % commonsCompressVersion, + "org.apache.tika" % "tika-core" % tikaVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "org.yaml" % "snakeyaml" % snakeyamlVersion, + "com.ibm.icu" % "icu4j" % icuVersion + ) val thirdPartyMods = JPMSUtils.filterModulesFromClasspath( fullCp, thirdPartyModIds, @@ -774,15 +774,15 @@ lazy val `text-buffer` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, + // See JPMSPlugin docs (Mixed projects) + excludeFilter := excludeFilter.value || "module-info.java", commands += WithDebugCommand.withDebug, javaModuleName := "org.enso.text.buffer", libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test - ), - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := scalaLibrary + ) ) lazy val rustParserTargetDirectory = @@ -917,14 +917,15 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", libraryDependencies ++= Seq( - "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", - "com.chuusai" %% "shapeless" % shapelessVersion + "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided" + ), + Compile / moduleDependencies ++= Seq( + "org.yaml" % "snakeyaml" % snakeyamlVersion ), - Compile / moduleDependencies ++= scalaLibrary ++ - Seq("org.yaml" % "snakeyaml" % snakeyamlVersion), Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value ) @@ -935,6 +936,7 @@ lazy val pkg = (project in file("lib/scala/pkg")) .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, compileOrder := CompileOrder.ScalaThenJava, version := "0.1", Compile / run / mainClass := Some("org.enso.pkg.Main"), @@ -944,8 +946,7 @@ lazy val pkg = (project in file("lib/scala/pkg")) "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.apache.commons" % "commons-compress" % commonsCompressVersion ), - Compile / moduleDependencies := scalaLibrary ++ - Seq( + Compile / moduleDependencies ++= Seq( "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion ), @@ -1013,16 +1014,17 @@ lazy val `logging-utils` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] version := "0.1", libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.slf4j" % "slf4j-api" % slf4jVersion ) ++ logbackTest, - Compile / moduleDependencies := scalaLibrary ++ - Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion - ) + Compile / moduleDependencies ++= + Seq( + "org.slf4j" % "slf4j-api" % slf4jVersion + ) ) lazy val `logging-service` = project @@ -1031,13 +1033,14 @@ lazy val `logging-service` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe" % "config" % typesafeConfigVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( @@ -1102,18 +1105,17 @@ lazy val `logging-utils-akka` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, version := "0.1", compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe.akka" %% "akka-actor" % akkaVersion ), - Compile / moduleDependencies := { - scalaLibrary ++ + Compile / moduleDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion - ) - }, + ), Compile / internalModuleDependencies := Seq( (`akka-wrapper` / Compile / exportedModule).value ) @@ -1125,6 +1127,7 @@ lazy val filewatcher = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, compileOrder := CompileOrder.ScalaThenJava, javaModuleName := "org.enso.filewatcher", version := "0.1", @@ -1134,7 +1137,7 @@ lazy val filewatcher = project "org.slf4j" % "slf4j-api" % slf4jVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion ), Compile / internalModuleDependencies := Seq( @@ -1176,6 +1179,7 @@ lazy val `scala-libs-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, + scalaProjectSettings, javaModuleName := "org.enso.scala.wrapper", libraryDependencies ++= circe ++ Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, @@ -1186,7 +1190,7 @@ lazy val `scala-libs-wrapper` = project "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, "net.java.dev.jna" % "jna" % jnaVersion ), - Compile / moduleDependencies := scalaLibrary ++ scalaCompiler ++ Seq( + Compile / moduleDependencies ++= scalaCompiler ++ Seq( "org.jline" % "jline" % jlineVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "net.java.dev.jna" % "jna" % jnaVersion @@ -1245,13 +1249,13 @@ lazy val `language-server-deps-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, + scalaProjectSettings, libraryDependencies ++= Seq( "com.github.pureconfig" %% "pureconfig" % pureconfigVersion, "com.chuusai" %% "shapeless" % shapelessVersion, "com.typesafe" % "config" % typesafeConfigVersion ), javaModuleName := "org.enso.language.server.deps.wrapper", - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value ), @@ -1292,6 +1296,7 @@ lazy val `directory-watcher-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, + scalaProjectSettings, libraryDependencies ++= Seq( "io.methvin" % "directory-watcher" % directoryWatcherVersion, "org.slf4j" % "slf4j-api" % "1.7.36", @@ -1311,7 +1316,7 @@ lazy val `directory-watcher-wrapper` = project shouldContainAll = true ) }, - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "net.java.dev.jna" % "jna" % jnaVersion, "org.slf4j" % "slf4j-api" % "1.7.36" ), @@ -1337,11 +1342,11 @@ lazy val `fansi-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, + scalaProjectSettings, libraryDependencies ++= Seq( "com.lihaoyi" %% "fansi" % fansiVersion ), javaModuleName := "org.enso.fansi.wrapper", - Compile / moduleDependencies := scalaLibrary, Compile / patchModules := { val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( @@ -1376,6 +1381,7 @@ lazy val `akka-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, + scalaProjectSettings, libraryDependencies ++= akka ++ scalaLibrary ++ scalaCompiler ++ Seq( "org.scala-lang.modules" %% "scala-parser-combinators" % scalaParserCombinatorsVersion, "org.scala-lang.modules" %% "scala-java8-compat" % scalaJavaCompatVersion, @@ -1395,7 +1401,7 @@ lazy val `akka-wrapper` = project "io.spray" %% "spray-json" % sprayJsonVersion ), javaModuleName := "org.enso.akka.wrapper", - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, "org.slf4j" % "slf4j-api" % slf4jVersion @@ -1454,6 +1460,7 @@ lazy val `zio-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, + scalaProjectSettings, javaModuleName := "org.enso.zio.wrapper", libraryDependencies ++= zio ++ Seq( "dev.zio" %% "zio-internal-macros" % zioVersion, @@ -1461,7 +1468,6 @@ lazy val `zio-wrapper` = project "dev.zio" %% "izumi-reflect" % zioIzumiReflectVersion, "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % zioIzumiReflectVersion ), - Compile / moduleDependencies := scalaLibrary, assembly / assemblyExcludedJars := { val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( @@ -1506,6 +1512,7 @@ lazy val cli = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, compileOrder := CompileOrder.ScalaThenJava, version := "0.1", libraryDependencies ++= circe ++ Seq( @@ -1513,7 +1520,6 @@ lazy val cli = project "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value, (`scala-yaml` / Compile / exportedModule).value @@ -1527,12 +1533,12 @@ lazy val `task-progress-notifications` = project .enablePlugins(JPMSPlugin) .configs(Test) .settings( + scalaProjectSettings, version := "0.1", compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`cli` / Compile / exportedModule).value, (`json-rpc-server` / Compile / exportedModule).value @@ -1571,6 +1577,7 @@ lazy val `refactoring-utils` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, commands += WithDebugCommand.withDebug, version := "0.1", libraryDependencies ++= Seq( @@ -1579,7 +1586,6 @@ lazy val `refactoring-utils` = project ), // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`text-buffer` / Compile / exportedModule).value, (`runtime-parser` / Compile / exportedModule).value @@ -1734,6 +1740,7 @@ lazy val `json-rpc-server` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= akka ++ logbackTest, libraryDependencies ++= circe, @@ -1749,12 +1756,10 @@ lazy val `json-rpc-server` = project "org.apache.httpcomponents" % "httpcore" % httpComponentsVersion % Test, "commons-io" % "commons-io" % commonsIoVersion % Test ), - Compile / moduleDependencies := { - scalaLibrary ++ + Compile / moduleDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion - ) - }, + ), Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value, (`akka-wrapper` / Compile / exportedModule).value @@ -1811,12 +1816,12 @@ lazy val searcher = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, compileOrder := CompileOrder.ScalaThenJava, annotationProcSetting, libraryDependencies ++= jmh ++ Seq( "org.scalatest" %% "scalatest" % scalatestVersion % Test ) ++ logbackTest, - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`polyglot-api` / Compile / exportedModule).value ) @@ -2076,6 +2081,7 @@ lazy val `polyglot-api` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, Test / fork := true, commands += WithDebugCommand.withDebug, Test / envVars ++= distributionEnvironmentOverrides, @@ -2096,7 +2102,7 @@ lazy val `polyglot-api` = project javaModuleName := "org.enso.polyglot.api", // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, @@ -2126,13 +2132,13 @@ lazy val `polyglot-api-macros` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", libraryDependencies ++= Seq( "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion % "provided", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion % "provided" ), - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value ) @@ -2144,6 +2150,7 @@ lazy val `language-server` = (project in file("engine/language-server")) .settings( commands += WithDebugCommand.withDebug, frgaalJavaCompilerSetting, + scalaProjectSettings, libraryDependencies ++= akka ++ circe ++ bouncyCastle.map(_ % Test) ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, @@ -2167,8 +2174,7 @@ lazy val `language-server` = (project in file("engine/language-server")) // See JPMSPlugin docs (Mixed projects) excludeFilter := excludeFilter.value || "module-info.java", javaModuleName := "org.enso.language.server", - Compile / moduleDependencies := { - scalaLibrary ++ + Compile / moduleDependencies ++= Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -2176,8 +2182,7 @@ lazy val `language-server` = (project in file("engine/language-server")) "commons-io" % "commons-io" % commonsIoVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion - ) - }, + ), Compile / internalModuleDependencies := Seq( (`akka-wrapper` / Compile / exportedModule).value, (`zio-wrapper` / Compile / exportedModule).value, @@ -2448,9 +2453,13 @@ lazy val javadocSettings = Seq( /** A setting to replace javac with Frgaal compiler, allowing to use latest Java features in the code * and still compile down to JDK 17 */ -lazy val frgaalJavaCompilerSetting = +lazy val frgaalJavaCompilerSetting: SettingsDefinition = customFrgaalJavaCompilerSettings(targetJavaVersion) +lazy val scalaProjectSettings: SettingsDefinition = Seq( + Compile / moduleDependencies := scalaLibrary +) + def customFrgaalJavaCompilerSettings(targetJdk: String) = { // There might be slightly different Frgaal compiler configuration for // both Compile and Test configurations From 7d349c1d800434bf44f36f8a94408985ad5559c3 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Mon, 23 Sep 2024 15:15:34 +0200 Subject: [PATCH 233/268] more mixed-java/scala goodies --- build.sbt | 73 +++++++++++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 40 deletions(-) diff --git a/build.sbt b/build.sbt index 7280593d4927..8548536b291e 100644 --- a/build.sbt +++ b/build.sbt @@ -775,8 +775,7 @@ lazy val `text-buffer` = project .settings( frgaalJavaCompilerSetting, scalaProjectSettings, - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", + mixedJavaScalaProjectSetting, commands += WithDebugCommand.withDebug, javaModuleName := "org.enso.text.buffer", libraryDependencies ++= Seq( @@ -918,8 +917,7 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) .settings( frgaalJavaCompilerSetting, scalaProjectSettings, - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", + mixedJavaScalaProjectSetting, libraryDependencies ++= Seq( "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided" ), @@ -1074,8 +1072,6 @@ lazy val `logging-service-logback` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -1578,14 +1574,13 @@ lazy val `refactoring-utils` = project .settings( frgaalJavaCompilerSetting, scalaProjectSettings, + mixedJavaScalaProjectSetting, commands += WithDebugCommand.withDebug, version := "0.1", libraryDependencies ++= Seq( "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", Compile / internalModuleDependencies := Seq( (`text-buffer` / Compile / exportedModule).value, (`runtime-parser` / Compile / exportedModule).value @@ -2082,6 +2077,7 @@ lazy val `polyglot-api` = project .settings( frgaalJavaCompilerSetting, scalaProjectSettings, + mixedJavaScalaProjectSetting, Test / fork := true, commands += WithDebugCommand.withDebug, Test / envVars ++= distributionEnvironmentOverrides, @@ -2100,8 +2096,6 @@ lazy val `polyglot-api` = project "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test ), javaModuleName := "org.enso.polyglot.api", - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", Compile / moduleDependencies ++= Seq( "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, @@ -2133,8 +2127,7 @@ lazy val `polyglot-api-macros` = project .settings( frgaalJavaCompilerSetting, scalaProjectSettings, - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", + mixedJavaScalaProjectSetting, libraryDependencies ++= Seq( "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion % "provided", "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion % "provided" @@ -2151,6 +2144,7 @@ lazy val `language-server` = (project in file("engine/language-server")) commands += WithDebugCommand.withDebug, frgaalJavaCompilerSetting, scalaProjectSettings, + mixedJavaScalaProjectSetting, libraryDependencies ++= akka ++ circe ++ bouncyCastle.map(_ % Test) ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, @@ -2171,8 +2165,6 @@ lazy val `language-server` = (project in file("engine/language-server")) "org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion, "org.apache.tika" % "tika-core" % tikaVersion % Test ), - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", javaModuleName := "org.enso.language.server", Compile / moduleDependencies ++= Seq( @@ -2460,6 +2452,11 @@ lazy val scalaProjectSettings: SettingsDefinition = Seq( Compile / moduleDependencies := scalaLibrary ) +lazy val mixedJavaScalaProjectSetting: SettingsDefinition = Seq( + // See JPMSPlugin docs (Mixed projects) + excludeFilter := excludeFilter.value || "module-info.java" +) + def customFrgaalJavaCompilerSettings(targetJdk: String) = { // There might be slightly different Frgaal compiler configuration for // both Compile and Test configurations @@ -2611,6 +2608,8 @@ lazy val runtime = (project in file("engine/runtime")) .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, + mixedJavaScalaProjectSetting, annotationProcSetting, truffleDslSuppressWarnsSetting, version := ensoVersion, @@ -2645,9 +2644,7 @@ lazy val runtime = (project in file("engine/runtime")) necessaryModules ++ langs ++ tools }, javaModuleName := "org.enso.runtime", - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "org.apache.tika" % "tika-core" % tikaVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -3058,6 +3055,8 @@ lazy val `runtime-parser` = (project in file("engine/runtime-parser")) .enablePlugins(JPMSPlugin) .settings( + scalaProjectSettings, + mixedJavaScalaProjectSetting, version := mavenUploadVersion, javadocSettings, publish / skip := false, @@ -3073,17 +3072,13 @@ lazy val `runtime-parser` = "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), javaModuleName := "org.enso.runtime.parser", - Compile / moduleDependencies := { - scalaLibrary ++ Seq( - "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion - ) - }, + Compile / moduleDependencies ++= Seq( + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion + ), Compile / internalModuleDependencies := Seq( (`syntax-rust-definition` / Compile / exportedModule).value, (`persistance` / Compile / exportedModule).value - ), - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java" + ) ) .dependsOn(`syntax-rust-definition`) .dependsOn(`persistance`) @@ -3095,6 +3090,8 @@ lazy val `runtime-compiler` = .enablePlugins(PackageListPlugin) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, + mixedJavaScalaProjectSetting, annotationProcSetting, commands += WithDebugCommand.withDebug, javaModuleName := "org.enso.runtime.compiler", @@ -3109,12 +3106,10 @@ lazy val `runtime-compiler` = "com.typesafe" % "config" % typesafeConfigVersion % Test, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % Test ), - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ), - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", Compile / internalModuleDependencies := Seq( (`engine-common` / Compile / exportedModule).value, (`pkg` / Compile / exportedModule).value, @@ -3179,6 +3174,8 @@ lazy val `runtime-suggestions` = .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, + mixedJavaScalaProjectSetting, (Test / fork) := true, libraryDependencies ++= Seq( "junit" % "junit" % junitVersion % Test, @@ -3186,9 +3183,6 @@ lazy val `runtime-suggestions` = "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`pkg` / Compile / exportedModule).value, (`polyglot-api` / Compile / exportedModule).value, @@ -3206,6 +3200,8 @@ lazy val `runtime-instrument-common` = .configs(Benchmark) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, + mixedJavaScalaProjectSetting, inConfig(Compile)(truffleRunOptionsSettings), inConfig(Benchmark)(Defaults.testSettings), instrumentationSettings, @@ -3226,9 +3222,7 @@ lazy val `runtime-instrument-common` = "org.scalatest" %% "scalatest" % scalatestVersion % Test ), javaModuleName := "org.enso.runtime.instrument.common", - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, @@ -4064,6 +4058,8 @@ lazy val downloader = (project in file("lib/scala/downloader")) .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + scalaProjectSettings, + mixedJavaScalaProjectSetting, // Fork the tests to make sure that the withDebug command works (we can // attach debugger to the subprocess) (Test / fork) := true, @@ -4079,13 +4075,11 @@ lazy val downloader = (project in file("lib/scala/downloader")) "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test ), javaModuleName := "org.enso.downloader", - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "commons-io" % "commons-io" % commonsIoVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", Compile / internalModuleDependencies := Seq( (`cli` / Compile / exportedModule).value, (`scala-libs-wrapper` / Compile / exportedModule).value @@ -4230,15 +4224,14 @@ lazy val `connected-lock-manager-server` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - // See JPMSPlugin docs (Mixed projects) - excludeFilter := excludeFilter.value || "module-info.java", + scalaProjectSettings, + mixedJavaScalaProjectSetting, libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, akkaActor, akkaTestkit % Test, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value, (`akka-wrapper` / Compile / exportedModule).value, From 31290d1ba1e89949bb3a7dbfe158758e3f4ca446 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 23 Sep 2024 15:36:48 +0200 Subject: [PATCH 234/268] Fix compilation of syntax-rust-definition --- build.sbt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/build.sbt b/build.sbt index 223a007411af..eced6412ae81 100644 --- a/build.sbt +++ b/build.sbt @@ -898,11 +898,9 @@ lazy val `syntax-rust-definition` = project libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion ), - moduleDependencies := { - Seq( - "org.slf4j" % "slf4j-api" % slf4jVersion - ) - }, + Compile / moduleDependencies := Seq( + "org.slf4j" % "slf4j-api" % slf4jVersion + ), javaModuleName := "org.enso.syntax", Compile / sourceGenerators += generateParserJavaSources, Compile / resourceGenerators += generateRustParserLib, From 83ef8ae617ccd6adfeb4f923162723f70b54acc1 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 23 Sep 2024 15:45:50 +0200 Subject: [PATCH 235/268] Test that engine-runner does not depend on language-server --- build.sbt | 1 - .../main/java/org/enso/runner/common/LanguageServerApi.java | 3 +++ .../java/org/enso/runner/EngineRunnerDependenciesTest.java | 3 --- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index eced6412ae81..90c7291b923d 100644 --- a/build.sbt +++ b/build.sbt @@ -3621,7 +3621,6 @@ lazy val `engine-runner` = project .dependsOn(`engine-runner-common`) .dependsOn(`polyglot-api`) .dependsOn(`enso-test-java-helpers`) - .dependsOn(`language-server` % Runtime) lazy val buildSmallJdk = taskKey[File]("Build a minimal JDK used for native image generation") diff --git a/engine/runner-common/src/main/java/org/enso/runner/common/LanguageServerApi.java b/engine/runner-common/src/main/java/org/enso/runner/common/LanguageServerApi.java index 4dcfc49ec389..848e59a9622f 100644 --- a/engine/runner-common/src/main/java/org/enso/runner/common/LanguageServerApi.java +++ b/engine/runner-common/src/main/java/org/enso/runner/common/LanguageServerApi.java @@ -20,6 +20,9 @@ public static void launchLanguageServer(CommandLine line, ProfilingConfig config var it = ServiceLoader.load(LanguageServerApi.class, LanguageServerApi.class.getClassLoader()) .iterator(); + if (!it.hasNext()) { + throw new WrongOption("No language server implementation found"); + } var impl = it.next(); impl.runLanguageServer(line, config, logLevel); } diff --git a/engine/runner/src/test/java/org/enso/runner/EngineRunnerDependenciesTest.java b/engine/runner/src/test/java/org/enso/runner/EngineRunnerDependenciesTest.java index 74c8b0f75d1c..e2b944085407 100644 --- a/engine/runner/src/test/java/org/enso/runner/EngineRunnerDependenciesTest.java +++ b/engine/runner/src/test/java/org/enso/runner/EngineRunnerDependenciesTest.java @@ -16,9 +16,6 @@ public class EngineRunnerDependenciesTest { public EngineRunnerDependenciesTest() {} @Test - // ignored for now as engine-runner still has "Runtime" dependency on language-server and that one - // appears in test classpath - remove once language-server is packaged as its own JAR file - @Ignore public void unableToLoadClassFromLanguageServerProject() { try { var b = new CommandLine.Builder(); From 38ad13cc8ef880ec4ab2e27d07c932cb002041b0 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Mon, 23 Sep 2024 17:02:54 +0200 Subject: [PATCH 236/268] Append rather than assign `moduleDependencies` `++=` is less error prone than `:=`. Also discovered some unnecessary dependencies. --- build.sbt | 133 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/build.sbt b/build.sbt index 90c7291b923d..8c5b83f51b3c 100644 --- a/build.sbt +++ b/build.sbt @@ -774,7 +774,7 @@ lazy val `text-buffer` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, commands += WithDebugCommand.withDebug, javaModuleName := "org.enso.text.buffer", @@ -898,7 +898,7 @@ lazy val `syntax-rust-definition` = project libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion ), - Compile / moduleDependencies := Seq( + Compile / moduleDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion ), javaModuleName := "org.enso.syntax", @@ -922,7 +922,7 @@ lazy val `scala-yaml` = (project in file("lib/scala/yaml")) .configs(Test) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, libraryDependencies ++= Seq( "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided" @@ -940,7 +940,7 @@ lazy val pkg = (project in file("lib/scala/pkg")) .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, version := "0.1", Compile / run / mainClass := Some("org.enso.pkg.Main"), @@ -1004,7 +1004,7 @@ lazy val `profiling-utils` = project "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), - Compile / moduleDependencies := { + Compile / moduleDependencies ++= { Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion @@ -1018,7 +1018,7 @@ lazy val `logging-utils` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] version := "0.1", libraryDependencies ++= Seq( @@ -1037,7 +1037,7 @@ lazy val `logging-service` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -1066,7 +1066,7 @@ lazy val `logging-config` = project "com.typesafe" % "config" % typesafeConfigVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), - Compile / moduleDependencies := Seq( + Compile / moduleDependencies ++= Seq( "com.typesafe" % "config" % typesafeConfigVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ) @@ -1084,7 +1084,7 @@ lazy val `logging-service-logback` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ) ++ logbackPkg ++ ioSentry, - Compile / moduleDependencies := logbackPkg ++ ioSentry ++ Seq( + Compile / moduleDependencies ++= logbackPkg ++ ioSentry ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), @@ -1093,7 +1093,7 @@ lazy val `logging-service-logback` = project (`logging-service` / Compile / exportedModule).value, (`logging-config` / Compile / exportedModule).value ), - Test / moduleDependencies := scalaLibrary, + Test / moduleDependencies ++= scalaLibrary, Test / internalModuleDependencies := Seq( (Compile / exportedModule).value ) @@ -1107,7 +1107,7 @@ lazy val `logging-utils-akka` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, version := "0.1", compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= Seq( @@ -1129,7 +1129,7 @@ lazy val filewatcher = project .configs(Test) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, javaModuleName := "org.enso.filewatcher", version := "0.1", @@ -1181,7 +1181,7 @@ lazy val `scala-libs-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, - scalaProjectSettings, + scalaModuleDependencySetting, javaModuleName := "org.enso.scala.wrapper", libraryDependencies ++= circe ++ Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, @@ -1251,7 +1251,7 @@ lazy val `language-server-deps-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, - scalaProjectSettings, + scalaModuleDependencySetting, libraryDependencies ++= Seq( "com.github.pureconfig" %% "pureconfig" % pureconfigVersion, "com.chuusai" %% "shapeless" % shapelessVersion, @@ -1298,7 +1298,7 @@ lazy val `directory-watcher-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, - scalaProjectSettings, + scalaModuleDependencySetting, libraryDependencies ++= Seq( "io.methvin" % "directory-watcher" % directoryWatcherVersion, "org.slf4j" % "slf4j-api" % "1.7.36", @@ -1344,7 +1344,7 @@ lazy val `fansi-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, - scalaProjectSettings, + scalaModuleDependencySetting, libraryDependencies ++= Seq( "com.lihaoyi" %% "fansi" % fansiVersion ), @@ -1383,7 +1383,7 @@ lazy val `akka-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, - scalaProjectSettings, + scalaModuleDependencySetting, libraryDependencies ++= akka ++ scalaLibrary ++ scalaCompiler ++ Seq( "org.scala-lang.modules" %% "scala-parser-combinators" % scalaParserCombinatorsVersion, "org.scala-lang.modules" %% "scala-java8-compat" % scalaJavaCompatVersion, @@ -1462,7 +1462,7 @@ lazy val `zio-wrapper` = project .enablePlugins(JPMSPlugin) .settings( modularFatJarWrapperSettings, - scalaProjectSettings, + scalaModuleDependencySetting, javaModuleName := "org.enso.zio.wrapper", libraryDependencies ++= zio ++ Seq( "dev.zio" %% "zio-internal-macros" % zioVersion, @@ -1514,7 +1514,7 @@ lazy val cli = project .configs(Test) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, version := "0.1", libraryDependencies ++= circe ++ Seq( @@ -1535,7 +1535,7 @@ lazy val `task-progress-notifications` = project .enablePlugins(JPMSPlugin) .configs(Test) .settings( - scalaProjectSettings, + scalaModuleDependencySetting, version := "0.1", compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= Seq( @@ -1579,7 +1579,7 @@ lazy val `refactoring-utils` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, commands += WithDebugCommand.withDebug, version := "0.1", @@ -1741,7 +1741,7 @@ lazy val `json-rpc-server` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= akka ++ logbackTest, libraryDependencies ++= circe, @@ -1817,7 +1817,7 @@ lazy val searcher = project .configs(Test) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, annotationProcSetting, libraryDependencies ++= jmh ++ Seq( @@ -1847,7 +1847,7 @@ lazy val `ydoc-server` = project autoScalaLibrary := false, Test / fork := true, commands += WithDebugCommand.withDebug, - Compile / moduleDependencies := { + Compile / moduleDependencies ++= { GraalVM.modules ++ GraalVM.jsPkgs ++ GraalVM.chromeInspectorPkgs ++ helidon ++ logbackPkg ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion ) @@ -1935,7 +1935,7 @@ lazy val `persistance` = (project in file("lib/java/persistance")) "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), - Compile / moduleDependencies := Seq( + Compile / moduleDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ) @@ -1979,7 +1979,7 @@ lazy val `interpreter-dsl` = (project in file("lib/scala/interpreter-dsl")) "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided", "com.google.guava" % "guava" % guavaVersion exclude ("com.google.code.findbugs", "jsr305") ), - Compile / moduleDependencies := Seq( + Compile / moduleDependencies ++= Seq( "org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "com.google.guava" % "guava" % guavaVersion @@ -2062,7 +2062,7 @@ lazy val `engine-common` = project libraryDependencies ++= Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion % "provided" ), - Compile / moduleDependencies := { + Compile / moduleDependencies ++= { Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.slf4j" % "slf4j-api" % slf4jVersion @@ -2082,7 +2082,7 @@ lazy val `polyglot-api` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, Test / fork := true, commands += WithDebugCommand.withDebug, @@ -2132,7 +2132,7 @@ lazy val `polyglot-api-macros` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, libraryDependencies ++= Seq( "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion % "provided", @@ -2149,7 +2149,7 @@ lazy val `language-server` = (project in file("engine/language-server")) .settings( commands += WithDebugCommand.withDebug, frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, libraryDependencies ++= akka ++ circe ++ bouncyCastle.map(_ % Test) ++ Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -2454,7 +2454,7 @@ lazy val javadocSettings = Seq( lazy val frgaalJavaCompilerSetting: SettingsDefinition = customFrgaalJavaCompilerSettings(targetJavaVersion) -lazy val scalaProjectSettings: SettingsDefinition = Seq( +lazy val scalaModuleDependencySetting: SettingsDefinition = Seq( Compile / moduleDependencies := scalaLibrary ) @@ -2535,7 +2535,7 @@ lazy val `runtime-language-epb` = "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided", "org.graalvm.truffle" % "truffle-dsl-processor" % graalMavenPackagesVersion % "provided" ), - Compile / moduleDependencies := Seq( + Compile / moduleDependencies ++= Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, @@ -2562,7 +2562,7 @@ lazy val `runtime-language-arrow` = "org.apache.arrow" % "arrow-memory-netty" % apacheArrowVersion % Test ), javaModuleName := "org.enso.interpreter.arrow", - Compile / moduleDependencies := GraalVM.modules, + Compile / moduleDependencies ++= GraalVM.modules, Test / moduleDependencies += (LocalProject("runtime-language-arrow") / projectID).value, Test / patchModules := { @@ -2599,7 +2599,7 @@ lazy val `runtime-test-instruments` = "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), javaModuleName := "org.enso.runtime.test", - Compile / moduleDependencies := { + Compile / moduleDependencies ++= { GraalVM.modules ++ Seq( "org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion, "org.graalvm.truffle" % "truffle-tck" % graalMavenPackagesVersion, @@ -2614,7 +2614,7 @@ lazy val runtime = (project in file("engine/runtime")) .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, annotationProcSetting, truffleDslSuppressWarnsSetting, @@ -2896,6 +2896,7 @@ lazy val `runtime-benchmarks` = .enablePlugins(PackageListPlugin) .settings( frgaalJavaCompilerSetting, + scalaModuleDependencySetting, annotationProcSetting, // Note that withDebug command only makes sense if you use `@Fork(0)` in your benchmarks. commands += WithDebugCommand.withDebug, @@ -2918,8 +2919,8 @@ lazy val `runtime-benchmarks` = "--enable-preview" ), parallelExecution := false, - Compile / moduleDependencies := { - GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ ioSentry ++ scalaLibrary ++ scalaCompiler ++ Seq( + Compile / moduleDependencies ++= { + GraalVM.modules ++ GraalVM.langsPkgs ++ GraalVM.insightPkgs ++ logbackPkg ++ helidon ++ ioSentry ++ scalaCompiler ++ Seq( "org.apache.commons" % "commons-lang3" % commonsLangVersion, "org.apache.commons" % "commons-compress" % commonsCompressVersion, "commons-io" % "commons-io" % commonsIoVersion, @@ -3061,7 +3062,7 @@ lazy val `runtime-parser` = (project in file("engine/runtime-parser")) .enablePlugins(JPMSPlugin) .settings( - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, version := mavenUploadVersion, javadocSettings, @@ -3096,7 +3097,7 @@ lazy val `runtime-compiler` = .enablePlugins(PackageListPlugin) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, annotationProcSetting, commands += WithDebugCommand.withDebug, @@ -3180,7 +3181,7 @@ lazy val `runtime-suggestions` = .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, (Test / fork) := true, libraryDependencies ++= Seq( @@ -3206,7 +3207,7 @@ lazy val `runtime-instrument-common` = .configs(Benchmark) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, inConfig(Compile)(truffleRunOptionsSettings), inConfig(Benchmark)(Defaults.testSettings), @@ -3269,7 +3270,7 @@ lazy val `runtime-instrument-id-execution` = inConfig(Compile)(truffleRunOptionsSettings), Compile / forceModuleInfoCompilation := true, instrumentationSettings, - Compile / moduleDependencies := Seq( + Compile / moduleDependencies ++= Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, @@ -3289,10 +3290,11 @@ lazy val `runtime-instrument-repl-debugger` = (project in file("engine/runtime-instrument-repl-debugger")) .enablePlugins(JPMSPlugin) .settings( + scalaModuleDependencySetting, inConfig(Compile)(truffleRunOptionsSettings), Compile / forceModuleInfoCompilation := true, instrumentationSettings, - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, @@ -3318,7 +3320,7 @@ lazy val `runtime-instrument-runtime-server` = inConfig(Compile)(truffleRunOptionsSettings), Compile / forceModuleInfoCompilation := true, instrumentationSettings, - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion, "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "collections" % graalMavenPackagesVersion, @@ -3371,6 +3373,7 @@ lazy val `engine-runner-common` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] Test / fork := true, commands += WithDebugCommand.withDebug, @@ -3380,7 +3383,7 @@ lazy val `engine-runner-common` = project "commons-io" % "commons-io" % commonsIoVersion, "commons-cli" % "commons-cli" % commonsCliVersion ), - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "commons-cli" % "commons-cli" % commonsCliVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "commons-io" % "commons-io" % commonsIoVersion @@ -3403,6 +3406,7 @@ lazy val `engine-runner` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, + scalaModuleDependencySetting, compileOrder := CompileOrder.JavaThenScala, truffleDslSuppressWarnsSetting, packageOptions := Seq( @@ -3425,16 +3429,15 @@ lazy val `engine-runner` = project "org.hamcrest" % "hamcrest-all" % hamcrestVersion % Test, "org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion ), - Compile / moduleDependencies := { - scalaLibrary ++ Seq( + Compile / moduleDependencies ++= + Seq( "org.graalvm.polyglot" % "polyglot" % graalMavenPackagesVersion, "org.graalvm.sdk" % "nativeimage" % graalMavenPackagesVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, "commons-cli" % "commons-cli" % commonsCliVersion, "org.jline" % "jline" % jlineVersion, "org.slf4j" % "slf4j-api" % slf4jVersion - ) - }, + ), Compile / internalModuleDependencies := Seq( (`profiling-utils` / Compile / exportedModule).value, (`semver` / Compile / exportedModule).value, @@ -3709,6 +3712,7 @@ lazy val `distribution-manager` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaModuleDependencySetting, // Note [JPMS Compile order] compileOrder := CompileOrder.ScalaThenJava, resolvers += Resolver.bintrayRepo("gn0s1s", "releases"), @@ -3718,7 +3722,7 @@ lazy val `distribution-manager` = project "commons-io" % "commons-io" % commonsIoVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, "org.yaml" % "snakeyaml" % snakeyamlVersion ), @@ -3979,13 +3983,14 @@ lazy val editions = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] libraryDependencies ++= Seq( "io.circe" %% "circe-core" % circeVersion % "provided", "org.yaml" % "snakeyaml" % snakeyamlVersion % "provided", "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "org.yaml" % "snakeyaml" % snakeyamlVersion ), Compile / internalModuleDependencies := Seq( @@ -4021,6 +4026,7 @@ lazy val semver = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaModuleDependencySetting, // Note [JPMS Compile order] compileOrder := CompileOrder.JavaThenScala, javaModuleName := "org.enso.semver", @@ -4031,11 +4037,9 @@ lazy val semver = project "junit" % "junit" % junitVersion % Test, "com.github.sbt" % "junit-interface" % junitIfVersion % Test ), - Compile / moduleDependencies := { - scalaLibrary ++ Seq( - "org.yaml" % "snakeyaml" % snakeyamlVersion - ) - }, + Compile / moduleDependencies ++= Seq( + "org.yaml" % "snakeyaml" % snakeyamlVersion + ), Compile / internalModuleDependencies := Seq( (`scala-yaml` / Compile / exportedModule).value ) @@ -4063,7 +4067,7 @@ lazy val downloader = (project in file("lib/scala/downloader")) .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, // Fork the tests to make sure that the withDebug command works (we can // attach debugger to the subprocess) @@ -4100,13 +4104,13 @@ lazy val `edition-updater` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] Test / test := (Test / test).tag(simpleLibraryServerTag).value, libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`distribution-manager` / Compile / exportedModule).value, (`editions` / Compile / exportedModule).value @@ -4134,13 +4138,14 @@ lazy val `library-manager` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, // Note [JPMS Compile order] libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), javaModuleName := "org.enso.librarymanager", - Compile / moduleDependencies := scalaLibrary ++ Seq( + Compile / moduleDependencies ++= Seq( "org.yaml" % "snakeyaml" % snakeyamlVersion, "org.slf4j" % "slf4j-api" % slf4jVersion ), @@ -4169,6 +4174,7 @@ lazy val `library-manager-test` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, Test / fork := true, commands += WithDebugCommand.withDebug, @@ -4178,7 +4184,6 @@ lazy val `library-manager-test` = project "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`library-manager` / Compile / exportedModule).value, (`cli` / Compile / exportedModule).value, @@ -4205,12 +4210,12 @@ lazy val `connected-lock-manager` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.scalatest" %% "scalatest" % scalatestVersion % Test ), - Compile / moduleDependencies := scalaLibrary, Compile / internalModuleDependencies := Seq( (`distribution-manager` / Compile / exportedModule).value, (`polyglot-api` / Compile / exportedModule).value, @@ -4229,7 +4234,7 @@ lazy val `connected-lock-manager-server` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - scalaProjectSettings, + scalaModuleDependencySetting, mixedJavaScalaProjectSetting, libraryDependencies ++= Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, @@ -4277,8 +4282,8 @@ lazy val `process-utils` = project .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - compileOrder := CompileOrder.ScalaThenJava, - Compile / moduleDependencies := scalaLibrary + scalaModuleDependencySetting, + compileOrder := CompileOrder.ScalaThenJava ) lazy val `runtime-version-manager-test` = project From cf99104689bf1440c6635e06326c8cd19afdd5c4 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 23 Sep 2024 18:02:25 +0200 Subject: [PATCH 237/268] Replace : with File.pathSeparator --- project/JPMSPlugin.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 25ec32706ece..f6c1cf034860 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -464,7 +464,7 @@ object JPMSPlugin extends AutoPlugin { optIdxToRemove += idx optIdxToRemove += idx + 1 modulePathOpt.append(opts(idx + 1)) - modulePathOpt.append(":") + modulePathOpt.append(File.pathSeparator) } } From 427428e1420984c5faee0ce0981a3b405964df47 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Mon, 23 Sep 2024 18:36:47 +0200 Subject: [PATCH 238/268] [WIP] Make logging in ProjectService more verbose --- .../projectmanager/service/ProjectService.scala | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectService.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectService.scala index b813e6e57f0a..d315047b5ba1 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectService.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectService.scala @@ -89,7 +89,7 @@ class ProjectService[ projectsDirectory: Option[File] ): F[ProjectServiceFailure, Project] = for { projectId <- gen.randomUUID() - _ <- log.debug( + _ <- log.error( "Creating project [{}, {}, {}, {}].", projectName, projectId, @@ -98,7 +98,7 @@ class ProjectService[ ) repo = projectRepositoryFactory.getProjectRepository(projectsDirectory) name <- getNameForNewProject(projectName, repo) - _ <- log.info("Created project with actual name [{}].", name) + _ <- log.error("Created project with actual name [{}].", name) _ <- validateProjectName(name) _ <- checkIfNameExists(name, repo) creationTime <- clock.nowInUtc() @@ -114,7 +114,7 @@ class ProjectService[ edition = None, path = path.toFile ) - _ <- log.debug( + _ <- log.error( "Found a path [{}] for a new project [{}, {}].", path, name, @@ -128,7 +128,7 @@ class ProjectService[ projectTemplate, missingComponentAction ) - _ <- log.debug( + _ <- log.error( "Project [{}] structure created with [{}, {}, {}, {}].", projectId, path, @@ -136,8 +136,8 @@ class ProjectService[ moduleName ) _ <- repo.update(project).mapError(toServiceFailure) - _ <- log.debug("Project [{}] updated in repository [{}].", projectId, repo) - _ <- log.info("Project created [{}].", project) + _ <- log.error("Project [{}] updated in repository [{}].", projectId, repo) + _ <- log.error("Project created [{}].", project) } yield project /** @inheritdoc */ @@ -302,7 +302,7 @@ class ProjectService[ projectsDirectory: Option[File] ): F[ProjectServiceFailure, RunningLanguageServerInfo] = { for { - _ <- log.debug(s"Opening project [{}].", projectId) + _ <- log.error(s"Opening project [{}].", projectId) repo = projectRepositoryFactory.getProjectRepository(projectsDirectory) project <- getUserProject(projectId, repo) openTime <- clock.nowInUtc() @@ -559,6 +559,9 @@ class ProjectService[ } object ProjectService { + // TODO: REMOVE + var SHOULD_LOG = false + val toServiceFailure: ProjectRepositoryFailure => ProjectServiceFailure = { case CannotLoadIndex(msg) => From 6dd405d0ca055c6490e41a13e82c1c1bccdc2657 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Tue, 24 Sep 2024 09:29:48 +0200 Subject: [PATCH 239/268] language-server/test didn't start because of missing lookup and fansi modules --- build.sbt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 8c5b83f51b3c..2d6c9639b76b 100644 --- a/build.sbt +++ b/build.sbt @@ -2263,7 +2263,8 @@ lazy val `language-server` = (project in file("engine/language-server")) "org.jline" % "jline" % jlineVersion, "org.apache.tika" % "tika-core" % tikaVersion, "com.ibm.icu" % "icu4j" % icuVersion, - "net.java.dev.jna" % "jna" % jnaVersion + "net.java.dev.jna" % "jna" % jnaVersion, + "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ) }, Test / internalModuleDependencies := Seq( @@ -2283,6 +2284,7 @@ lazy val `language-server` = (project in file("engine/language-server")) (`scala-libs-wrapper` / Compile / exportedModule).value, (`akka-wrapper` / Compile / exportedModule).value, (`language-server-deps-wrapper` / Compile / exportedModule).value, + (`fansi-wrapper` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, (`runtime-suggestions` / Compile / exportedModule).value, (`runtime-parser` / Compile / exportedModule).value, From c5404eb11b573aa58d54559221b93ac652ae6be5 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Tue, 24 Sep 2024 09:30:50 +0200 Subject: [PATCH 240/268] Formatting --- .../test/java/org/enso/runner/EngineRunnerDependenciesTest.java | 1 - .../logging-service-logback/src/test/java/module-info.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/engine/runner/src/test/java/org/enso/runner/EngineRunnerDependenciesTest.java b/engine/runner/src/test/java/org/enso/runner/EngineRunnerDependenciesTest.java index e2b944085407..02dde800f53b 100644 --- a/engine/runner/src/test/java/org/enso/runner/EngineRunnerDependenciesTest.java +++ b/engine/runner/src/test/java/org/enso/runner/EngineRunnerDependenciesTest.java @@ -7,7 +7,6 @@ import org.enso.runner.common.LanguageServerApi; import org.enso.runner.common.ProfilingConfig; import org.enso.runner.common.WrongOption; -import org.junit.Ignore; import org.junit.Test; import scala.Option; diff --git a/lib/scala/logging-service-logback/src/test/java/module-info.java b/lib/scala/logging-service-logback/src/test/java/module-info.java index 22ee35bdea59..c44701510d2f 100644 --- a/lib/scala/logging-service-logback/src/test/java/module-info.java +++ b/lib/scala/logging-service-logback/src/test/java/module-info.java @@ -12,6 +12,6 @@ provides SLF4JServiceProvider with org.enso.logging.service.logback.test.provider.TestLogProvider; - + exports org.enso.logging.service.logback.test.provider; } From 3c9dd949710893592573b0f74cc1513f682c267e Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Tue, 24 Sep 2024 09:49:27 +0200 Subject: [PATCH 241/268] org.enso.cli.task.notifications needs Akka and Circe to link --- build.sbt | 4 +++- .../src/main/java/module-info.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2d6c9639b76b..c1da8fc4e94a 100644 --- a/build.sbt +++ b/build.sbt @@ -1543,7 +1543,9 @@ lazy val `task-progress-notifications` = project ), Compile / internalModuleDependencies := Seq( (`cli` / Compile / exportedModule).value, - (`json-rpc-server` / Compile / exportedModule).value + (`json-rpc-server` / Compile / exportedModule).value, + (`akka-wrapper` / Compile / exportedModuleBin).value, + (`scala-libs-wrapper` / Compile / exportedModule).value ), Test / parallelExecution := false ) diff --git a/lib/scala/task-progress-notifications/src/main/java/module-info.java b/lib/scala/task-progress-notifications/src/main/java/module-info.java index 553e9ef8a51d..c69806558c1b 100644 --- a/lib/scala/task-progress-notifications/src/main/java/module-info.java +++ b/lib/scala/task-progress-notifications/src/main/java/module-info.java @@ -1,5 +1,7 @@ module org.enso.task.progress.notifications { requires scala.library; + requires org.enso.scala.wrapper; + requires org.enso.akka.wrapper; requires org.enso.cli; requires org.enso.json.rpc.server; From a7b9b0554c4bc2a28935dab372725cfbaa424192 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Tue, 24 Sep 2024 10:31:44 +0200 Subject: [PATCH 242/268] project-manager/test depends on buildEngineDistribution --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index c1da8fc4e94a..dfdc0a975241 100644 --- a/build.sbt +++ b/build.sbt @@ -1690,7 +1690,8 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) (`syntax-rust-definition` / Compile / exportedModule).value, (`ydoc-server` / Compile / exportedModule).value ), - Test / javaOptions ++= testLogProviderOptions + Test / javaOptions ++= testLogProviderOptions, + Test / test := (Test / test).dependsOn(buildEngineDistribution).value ) .settings( NativeImage.smallJdk := None, From fc6f53d4f1dd4a86a7b01e9c4f86b35a824bf88b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 10:46:53 +0200 Subject: [PATCH 243/268] [WIP] Even more verbose logging for creating projects --- .../service/ProjectCreationService.scala | 13 +++++++++---- .../enso/runtimeversionmanager/runner/Runner.scala | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectCreationService.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectCreationService.scala index 68678163b69c..a18d923c4623 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectCreationService.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectCreationService.scala @@ -3,7 +3,6 @@ package org.enso.projectmanager.service import akka.actor.ActorRef import com.typesafe.scalalogging.Logger import org.enso.semver.SemVer -import org.enso.logger.masking.MaskedPath import org.enso.projectmanager.control.core.CovariantFlatMap import org.enso.projectmanager.control.core.syntax._ import org.enso.projectmanager.control.effect.{ErrorChannel, Sync} @@ -70,14 +69,20 @@ class ProjectCreationService[ .get val jvmSettings = distributionConfiguration.defaultJVMSettings runner.withCommand(settings, jvmSettings) { command => - logger.trace( - s"Running engine $engineVersion to create project $name at " + - s"[${MaskedPath(path).applyMasking()}]." + logger.error( + "[ProjectCreationService.createProject] Runner arguments = {}, " + + "jvmSettings.jvmOptions = {}, jvmSettings.extraOptions = {}, " + + "jvmSettings.javaCommandOverride = {}", + settings.runnerArguments, + jvmSettings.jvmOptions, + jvmSettings.extraOptions, + jvmSettings.javaCommandOverride ) command.runAndCaptureOutput().get } } .mapRuntimeManagerErrors { other: Throwable => + logger.error("[ProjectCreationService.createProject] Error: {}", other) ProjectCreateFailed(other.getMessage) } .flatMap { case (exitCode, output) => diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala index 4b81789dd036..e8096cf2173b 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala @@ -231,6 +231,7 @@ class Runner( val extraEnvironmentOverrides = javaHome.map("JAVA_HOME" -> _).toSeq ++ distributionSettings.toSeq + Logger[Runner].error("Starting command: {}", command) action( Command( command, From a7067c8472c34b6934a0ea6f4d8075628eaf14e6 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 11:54:25 +0200 Subject: [PATCH 244/268] [WIP] Even more verbose logging for creating projects --- .../enso/runtimeversionmanager/runner/Command.scala | 2 +- .../enso/runtimeversionmanager/runner/Runner.scala | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Command.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Command.scala index 4c2e38e895fc..0439a1142fbe 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Command.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Command.scala @@ -46,7 +46,7 @@ case class Command( timeoutInSeconds: Option[Long] = Some(300) ): Try[(Int, String)] = wrapError { - logger.debug("Executing {}", this) + logger.error("Executing {}", this) val processBuilder = builder() val process = processBuilder.start() val wrappedProcess = new WrappedProcess(command, process) diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala index e8096cf2173b..4c8f6e437ddb 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala @@ -10,14 +10,10 @@ import org.slf4j.event.Level import java.net.URI import org.enso.runtimeversionmanager.components.Manifest.JVMOptionsContext -import org.enso.runtimeversionmanager.components.{ - Engine, - GraalRuntime, - RuntimeVersionManager -} +import org.enso.runtimeversionmanager.components.{Engine, GraalRuntime, RuntimeVersionManager} import org.enso.runtimeversionmanager.config.GlobalRunnerConfigurationManager -import java.nio.file.Path +import java.nio.file.{Files, Path} import scala.concurrent.duration.DurationInt import scala.concurrent.{Await, Future, TimeoutException} import scala.util.Try @@ -231,7 +227,10 @@ class Runner( val extraEnvironmentOverrides = javaHome.map("JAVA_HOME" -> _).toSeq ++ distributionSettings.toSeq - Logger[Runner].error("Starting command: {}", command) + val logger = Logger[Runner] + logger.error("Starting command: {}", command) + val allComponents = Files.list(componentPath).map(_.getFileName).toList + logger.error("Contents of component dir: [{}]", allComponents) action( Command( command, From 939e4526a87f20dd4cd5af5530d962bab2aba1fe Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 12:50:11 +0200 Subject: [PATCH 245/268] Revert "[WIP] Even more verbose logging for creating projects" This reverts commit a7067c8472c34b6934a0ea6f4d8075628eaf14e6. --- .../enso/runtimeversionmanager/runner/Command.scala | 2 +- .../enso/runtimeversionmanager/runner/Runner.scala | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Command.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Command.scala index 0439a1142fbe..4c2e38e895fc 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Command.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Command.scala @@ -46,7 +46,7 @@ case class Command( timeoutInSeconds: Option[Long] = Some(300) ): Try[(Int, String)] = wrapError { - logger.error("Executing {}", this) + logger.debug("Executing {}", this) val processBuilder = builder() val process = processBuilder.start() val wrappedProcess = new WrappedProcess(command, process) diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala index 4c8f6e437ddb..e8096cf2173b 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala @@ -10,10 +10,14 @@ import org.slf4j.event.Level import java.net.URI import org.enso.runtimeversionmanager.components.Manifest.JVMOptionsContext -import org.enso.runtimeversionmanager.components.{Engine, GraalRuntime, RuntimeVersionManager} +import org.enso.runtimeversionmanager.components.{ + Engine, + GraalRuntime, + RuntimeVersionManager +} import org.enso.runtimeversionmanager.config.GlobalRunnerConfigurationManager -import java.nio.file.{Files, Path} +import java.nio.file.Path import scala.concurrent.duration.DurationInt import scala.concurrent.{Await, Future, TimeoutException} import scala.util.Try @@ -227,10 +231,7 @@ class Runner( val extraEnvironmentOverrides = javaHome.map("JAVA_HOME" -> _).toSeq ++ distributionSettings.toSeq - val logger = Logger[Runner] - logger.error("Starting command: {}", command) - val allComponents = Files.list(componentPath).map(_.getFileName).toList - logger.error("Contents of component dir: [{}]", allComponents) + Logger[Runner].error("Starting command: {}", command) action( Command( command, From 63bc656fd28406702fcb4552dee50e374c9ccb3e Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 12:50:17 +0200 Subject: [PATCH 246/268] Revert "[WIP] Even more verbose logging for creating projects" This reverts commit fc6f53d4f1dd4a86a7b01e9c4f86b35a824bf88b. --- .../service/ProjectCreationService.scala | 13 ++++--------- .../enso/runtimeversionmanager/runner/Runner.scala | 1 - 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectCreationService.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectCreationService.scala index a18d923c4623..68678163b69c 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectCreationService.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectCreationService.scala @@ -3,6 +3,7 @@ package org.enso.projectmanager.service import akka.actor.ActorRef import com.typesafe.scalalogging.Logger import org.enso.semver.SemVer +import org.enso.logger.masking.MaskedPath import org.enso.projectmanager.control.core.CovariantFlatMap import org.enso.projectmanager.control.core.syntax._ import org.enso.projectmanager.control.effect.{ErrorChannel, Sync} @@ -69,20 +70,14 @@ class ProjectCreationService[ .get val jvmSettings = distributionConfiguration.defaultJVMSettings runner.withCommand(settings, jvmSettings) { command => - logger.error( - "[ProjectCreationService.createProject] Runner arguments = {}, " + - "jvmSettings.jvmOptions = {}, jvmSettings.extraOptions = {}, " + - "jvmSettings.javaCommandOverride = {}", - settings.runnerArguments, - jvmSettings.jvmOptions, - jvmSettings.extraOptions, - jvmSettings.javaCommandOverride + logger.trace( + s"Running engine $engineVersion to create project $name at " + + s"[${MaskedPath(path).applyMasking()}]." ) command.runAndCaptureOutput().get } } .mapRuntimeManagerErrors { other: Throwable => - logger.error("[ProjectCreationService.createProject] Error: {}", other) ProjectCreateFailed(other.getMessage) } .flatMap { case (exitCode, output) => diff --git a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala index e8096cf2173b..4b81789dd036 100644 --- a/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala +++ b/lib/scala/runtime-version-manager/src/main/scala/org/enso/runtimeversionmanager/runner/Runner.scala @@ -231,7 +231,6 @@ class Runner( val extraEnvironmentOverrides = javaHome.map("JAVA_HOME" -> _).toSeq ++ distributionSettings.toSeq - Logger[Runner].error("Starting command: {}", command) action( Command( command, From fb7b7d82b3720d208a579c98120d87c6d09acef2 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 12:50:21 +0200 Subject: [PATCH 247/268] Revert "[WIP] Make logging in ProjectService more verbose" This reverts commit 427428e1420984c5faee0ce0981a3b405964df47. --- .../projectmanager/service/ProjectService.scala | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectService.scala b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectService.scala index d315047b5ba1..b813e6e57f0a 100644 --- a/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectService.scala +++ b/lib/scala/project-manager/src/main/scala/org/enso/projectmanager/service/ProjectService.scala @@ -89,7 +89,7 @@ class ProjectService[ projectsDirectory: Option[File] ): F[ProjectServiceFailure, Project] = for { projectId <- gen.randomUUID() - _ <- log.error( + _ <- log.debug( "Creating project [{}, {}, {}, {}].", projectName, projectId, @@ -98,7 +98,7 @@ class ProjectService[ ) repo = projectRepositoryFactory.getProjectRepository(projectsDirectory) name <- getNameForNewProject(projectName, repo) - _ <- log.error("Created project with actual name [{}].", name) + _ <- log.info("Created project with actual name [{}].", name) _ <- validateProjectName(name) _ <- checkIfNameExists(name, repo) creationTime <- clock.nowInUtc() @@ -114,7 +114,7 @@ class ProjectService[ edition = None, path = path.toFile ) - _ <- log.error( + _ <- log.debug( "Found a path [{}] for a new project [{}, {}].", path, name, @@ -128,7 +128,7 @@ class ProjectService[ projectTemplate, missingComponentAction ) - _ <- log.error( + _ <- log.debug( "Project [{}] structure created with [{}, {}, {}, {}].", projectId, path, @@ -136,8 +136,8 @@ class ProjectService[ moduleName ) _ <- repo.update(project).mapError(toServiceFailure) - _ <- log.error("Project [{}] updated in repository [{}].", projectId, repo) - _ <- log.error("Project created [{}].", project) + _ <- log.debug("Project [{}] updated in repository [{}].", projectId, repo) + _ <- log.info("Project created [{}].", project) } yield project /** @inheritdoc */ @@ -302,7 +302,7 @@ class ProjectService[ projectsDirectory: Option[File] ): F[ProjectServiceFailure, RunningLanguageServerInfo] = { for { - _ <- log.error(s"Opening project [{}].", projectId) + _ <- log.debug(s"Opening project [{}].", projectId) repo = projectRepositoryFactory.getProjectRepository(projectsDirectory) project <- getUserProject(projectId, repo) openTime <- clock.nowInUtc() @@ -559,9 +559,6 @@ class ProjectService[ } object ProjectService { - // TODO: REMOVE - var SHOULD_LOG = false - val toServiceFailure: ProjectRepositoryFailure => ProjectServiceFailure = { case CannotLoadIndex(msg) => From d21c0d3dae88313c071c977bb7e4d4e876a10145 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 13:05:20 +0200 Subject: [PATCH 248/268] All the project with JPMSPlugin has stripped artifact names --- project/JPMSPlugin.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index f6c1cf034860..39fb42e5e2da 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -251,6 +251,10 @@ object JPMSPlugin extends AutoPlugin { .dependsOn(config / exportedModule) .value }, + // All the exported artifact names will be stripped. + // Do not use the default sbt artifact name which inserts scala version and module + // revision. + config / artifactName := stripArtifactName, config / patchModules := Map.empty, config / addExports := Map.empty, config / addReads := Map.empty, @@ -485,4 +489,15 @@ object JPMSPlugin extends AutoPlugin { opts } } + + /** + * Does not use the default artifact name which inserts scala version and module version. + */ + private def stripArtifactName( + scalaVersion: ScalaVersion, + modId: ModuleID, + artifact: Artifact + ): String = { + artifact.name + "." + artifact.extension + } } From eebe4f42cd25116c40ad2da07b38d62bd68b5f9b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 13:13:31 +0200 Subject: [PATCH 249/268] Revert all placeholder fake release components to runtime.jar without version --- .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 .../component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} | 0 24 files changed, 0 insertions(+), 0 deletions(-) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) rename lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/{runtime_2.13-0.0.0-dev.jar => runtime.jar} (100%) diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-linux-amd64.tar.gz/enso-0.0.0-pre/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-aarch64.tar.gz/enso-0.0.0-pre/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-macos-amd64.tar.gz/enso-0.0.0-pre/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0-pre/enso-engine-0.0.0-pre-windows-amd64.zip/enso-0.0.0-pre/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-linux-amd64.tar.gz/enso-0.0.0/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-aarch64.tar.gz/enso-0.0.0/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-macos-amd64.tar.gz/enso-0.0.0/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.0/enso-engine-0.0.0-windows-amd64.zip/enso-0.0.0/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-linux-amd64.tar.gz/enso-0.0.1-pre/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-aarch64.tar.gz/enso-0.0.1-pre/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-macos-amd64.tar.gz/enso-0.0.1-pre/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1-pre/enso-engine-0.0.1-pre-windows-amd64.zip/enso-0.0.1-pre/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-linux-amd64.tar.gz/enso-0.0.1/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-aarch64.tar.gz/enso-0.0.1/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-macos-amd64.tar.gz/enso-0.0.1/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.0.1/enso-engine-0.0.1-windows-amd64.zip/enso-0.0.1/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-linux-amd64.tar.gz/enso-0.1.0/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-aarch64.tar.gz/enso-0.1.0/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-macos-amd64.tar.gz/enso-0.1.0/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.1.0/enso-engine-0.1.0-windows-amd64.zip/enso-0.1.0/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-linux-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-aarch64.tar.gz/enso-0.9999.0-broken/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-macos-amd64.tar.gz/enso-0.9999.0-broken/component/runtime.jar diff --git a/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar b/lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime.jar similarity index 100% rename from lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime_2.13-0.0.0-dev.jar rename to lib/scala/runtime-version-manager-test/src/main/resources/org/enso/runtimeversionmanager/test/fake-releases/enso/enso-0.9999.0-broken/enso-engine-0.9999.0-broken-windows-amd64.zip/enso-0.9999.0-broken/component/runtime.jar From 8861dab288cbb0ff7f2f456c8725d75d4442aa9c Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Tue, 24 Sep 2024 15:23:37 +0200 Subject: [PATCH 250/268] Eliminate a cross version hack We shouldn't be specifying Scala dependencies with a Scala cross version in the suffix. --- build.sbt | 111 ++++++++++++++++++++------------------ project/JPMSPlugin.scala | 10 ++-- project/JPMSUtils.scala | 55 +++++++++---------- project/NativeImage.scala | 3 +- 4 files changed, 94 insertions(+), 85 deletions(-) diff --git a/build.sbt b/build.sbt index dfdc0a975241..313e24da5e2a 100644 --- a/build.sbt +++ b/build.sbt @@ -681,7 +681,8 @@ lazy val componentModulesPaths = fullCp, thirdPartyModIds, log, - projName = moduleName.value, + projName = moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) val thirdPartyModFiles = thirdPartyMods.map(_.data) @@ -1078,6 +1079,7 @@ lazy val `logging-service-logback` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + mixedJavaScalaProjectSetting, version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -1210,31 +1212,32 @@ lazy val `scala-libs-wrapper` = project ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) }, // Patch this JPMS module such that the JVM thinks that all the Scala stuff // is part of this module Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.typesafe.scala-logging" % ("scala-logging_" + scalaVer) % scalaLoggingVersion, - "io.circe" % ("circe-core_" + scalaVer) % circeVersion, - "io.circe" % ("circe-generic_" + scalaVer) % circeVersion, - "io.circe" % ("circe-parser_" + scalaVer) % circeVersion, - "io.circe" % ("circe-jawn_" + scalaVer) % circeVersion, - "io.circe" % ("circe-numbers_" + scalaVer) % circeVersion, - "org.typelevel" % ("cats-core_" + scalaVer) % catsVersion, - "org.typelevel" % ("cats-kernel_" + scalaVer) % catsVersion, - "org.typelevel" % ("jawn-parser_" + scalaVer) % jawnParserVersion, - "com.chuusai" % ("shapeless_" + scalaVer) % shapelessVersion, - "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-macros_" + scalaVer) % jsoniterVersion, - "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-core_" + scalaVer) % jsoniterVersion + "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, + "io.circe" %% "circe-core" % circeVersion, + "io.circe" %% "circe-generic" % circeVersion, + "io.circe" %% "circe-parser" % circeVersion, + "io.circe" %% "circe-jawn" % circeVersion, + "io.circe" %% "circe-numbers" % circeVersion, + "org.typelevel" %% "cats-core" % catsVersion, + "org.typelevel" %% "cats-kernel" % catsVersion, + "org.typelevel" %% "jawn-parser" % jawnParserVersion, + "com.chuusai" %% "shapeless" % shapelessVersion, + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1262,29 +1265,29 @@ lazy val `language-server-deps-wrapper` = project (`scala-libs-wrapper` / Compile / exportedModule).value ), assembly / assemblyExcludedJars := { - val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, scalaLibrary ++ Seq( - "com.chuusai" % ("shapeless_" + scalaVer) % shapelessVersion, - "com.typesafe" % "config" % typesafeConfigVersion + "com.chuusai" %% "shapeless" % shapelessVersion, + "com.typesafe" % "config" % typesafeConfigVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) }, Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.github.pureconfig" % ("pureconfig-core_" + scalaVer) % pureconfigVersion, - "com.github.pureconfig" % ("pureconfig-generic_" + scalaVer) % pureconfigVersion + "com.github.pureconfig" %% "pureconfig-core" % pureconfigVersion, + "com.github.pureconfig" %% "pureconfig-generic" % pureconfigVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1315,6 +1318,7 @@ lazy val `directory-watcher-wrapper` = project ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) }, @@ -1331,6 +1335,7 @@ lazy val `directory-watcher-wrapper` = project ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1350,15 +1355,15 @@ lazy val `fansi-wrapper` = project ), javaModuleName := "org.enso.fansi.wrapper", Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ Seq( - "com.lihaoyi" % ("fansi_" + scalaVer) % fansiVersion + "com.lihaoyi" %% "fansi" % fansiVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1371,6 +1376,7 @@ lazy val `fansi-wrapper` = project scalaLibrary, streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) } @@ -1409,46 +1415,46 @@ lazy val `akka-wrapper` = project "org.slf4j" % "slf4j-api" % slf4jVersion ), assembly / assemblyExcludedJars := { - val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ scalaCompiler ++ Seq( - "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % scalaJavaCompatVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "io.github.java-diff-utils" % "java-diff-utils" % javaDiffVersion, - "org.jline" % "jline" % jlineVersion, - "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, - "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, - "net.java.dev.jna" % "jna" % jnaVersion + "org.scala-lang.modules" %% "scala-java8-compat" % scalaJavaCompatVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.github.java-diff-utils" % "java-diff-utils" % javaDiffVersion, + "org.jline" % "jline" % jlineVersion, + "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, + "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, + "net.java.dev.jna" % "jna" % jnaVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) excludedJars .map(Attributed.blank) }, Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ scalaCompiler ++ Seq( - "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % scalaParserCombinatorsVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "io.spray" % ("spray-json_" + scalaVer) % sprayJsonVersion, - akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, - akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, - akkaURL % ("akka-http_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-http-spray-json_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-slf4j_" + scalaVer) % akkaVersion, - akkaURL % ("akka-parsing_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-protobuf-v3_" + scalaVer) % akkaVersion + "org.scala-lang.modules" %% "scala-parser-combinators" % scalaParserCombinatorsVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.spray" %% "spray-json" % sprayJsonVersion, + akkaURL %% "akka-actor" % akkaVersion, + akkaURL %% "akka-stream" % akkaVersion, + akkaURL %% "akka-http" % akkaHTTPVersion, + akkaURL %% "akka-http-core" % akkaHTTPVersion, + akkaURL %% "akka-http-spray-json" % akkaHTTPVersion, + akkaURL %% "akka-slf4j" % akkaVersion, + akkaURL %% "akka-parsing" % akkaHTTPVersion, + akkaURL %% "akka-protobuf-v3" % akkaVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1471,35 +1477,33 @@ lazy val `zio-wrapper` = project "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % zioIzumiReflectVersion ), assembly / assemblyExcludedJars := { - val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ scalaCompiler ++ - Seq( - "dev.zio" % ("zio-interop-cats_" + scalaVer) % zioInteropCatsVersion - ), + Seq("dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) excludedJars .map(Attributed.blank) }, Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ Seq( - "dev.zio" % ("zio_" + scalaVer) % zioVersion, - "dev.zio" % ("zio-internal-macros_" + scalaVer) % zioVersion, - "dev.zio" % ("zio-stacktracer_" + scalaVer) % zioVersion, - "dev.zio" % ("izumi-reflect_" + scalaVer) % zioIzumiReflectVersion, - "dev.zio" % ("izumi-reflect-thirdparty-boopickle-shaded_" + scalaVer) % zioIzumiReflectVersion + "dev.zio" %% "zio" % zioVersion, + "dev.zio" %% "zio-internal-macros" % zioVersion, + "dev.zio" %% "zio-stacktracer" % zioVersion, + "dev.zio" %% "izumi-reflect" % zioIzumiReflectVersion, + "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % zioIzumiReflectVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1645,6 +1649,7 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) ourFullCp, pkgsToExclude, streams.value.log, + scalaBinaryVersion.value, moduleName.value ) }, diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 39fb42e5e2da..2769d0410c45 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -222,7 +222,8 @@ object JPMSPlugin extends AutoPlugin { (config / internalModuleDependencies).value, (config / dependencyClasspath).value, streams.value.log, - moduleName.value + moduleName.value, + scalaBinaryVersion.value ) }, // Returns the reference to target/classes directory and ensures that module-info @@ -309,6 +310,7 @@ object JPMSPlugin extends AutoPlugin { internalModuleDeps: Seq[File], classPath: Def.Classpath, logger: ManagedLogger, + scalaBinaryVersion: String, currProjName: String ): Seq[File] = { moduleDeps.foreach { moduleDep => @@ -353,6 +355,7 @@ object JPMSPlugin extends AutoPlugin { moduleDeps, logger, currProjName, + scalaBinaryVersion, shouldContainAll = true ) val externalFiles = cp.map(_.data) @@ -490,9 +493,8 @@ object JPMSPlugin extends AutoPlugin { } } - /** - * Does not use the default artifact name which inserts scala version and module version. - */ + /** Does not use the default artifact name which inserts scala version and module version. + */ private def stripArtifactName( scalaVersion: ScalaVersion, modId: ModuleID, diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index 1e8c29b10c76..a816aef4f248 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -35,33 +35,28 @@ object JPMSUtils { /** Filters modules by their IDs from the given classpath. * * @param cp The classpath to filter - * @param modules These modules are looked for in the class path, can be duplicated. - * @param projName Name of the current sbt project for debugging. + * @param modules These modules are looked for in the class path, can be duplicated + * @param projName Name of the current sbt project for debugging * @param shouldContainAll If true, the method will throw an exception if not all modules were found - * in the classpath. - * @return The classpath with only the provided modules searched by their IDs. + * in the classpath + * @param scalaBinaryVersion Scala version used in all dependencies + * @return The classpath with only the provided modules searched by their IDs */ def filterModulesFromClasspath( cp: Def.Classpath, modules: Seq[ModuleID], log: sbt.util.Logger, projName: String, + scalaBinaryVersion: String, shouldContainAll: Boolean = false ): Def.Classpath = { val distinctModules = modules.distinct - def shouldFilterModule(module: ModuleID): Boolean = { - distinctModules.exists(m => - m.organization == module.organization && - m.name == module.name && - m.revision == module.revision - ) - } - val ret = cp.filter(dep => { val moduleID = dep.metadata.get(AttributeKey[ModuleID]("moduleID")).get - shouldFilterModule(moduleID) + shouldFilterModule(distinctModules)(moduleID) }) + if (shouldContainAll) { if (ret.size < distinctModules.size) { log.error( @@ -81,11 +76,12 @@ object JPMSUtils { /** Filters all the requested modules from the given [[UpdateReport]]. * - * @param updateReport The update report to filter. This is the result of `update.value`. - * @param modules The modules to filter from the update report. Can be duplicated. - * @param log The logger to use for logging. - * @param projName Name of the current sbt project for debugging. - * @param shouldContainAll If true, the method will log an error if not all modules were found. + * @param updateReport The update report to filter. This is the result of `update.value`. + * @param modules The modules to filter from the update report. Can be duplicated. + * @param log The logger to use for logging. + * @param projName Name of the current sbt project for debugging. + * @param scalaBinaryVersion Scala version used in all dependencies + * @param shouldContainAll If true, the method will log an error if not all modules were found. * @return The list of files (Jar archives, directories, etc.) that were found in the update report. */ def filterModulesFromUpdate( @@ -93,20 +89,13 @@ object JPMSUtils { modules: Seq[ModuleID], log: sbt.util.Logger, projName: String, + scalaBinaryVersion: String, shouldContainAll: Boolean = false ): Seq[File] = { val distinctModules = modules.distinct - def shouldFilterModule(module: ModuleID): Boolean = { - distinctModules.exists(m => - m.organization == module.organization && - m.name == module.name && - m.revision == module.revision - ) - } - val foundFiles = updateReport.select( - module = shouldFilterModule + module = shouldFilterModule(distinctModules) ) if (shouldContainAll) { if (foundFiles.size < distinctModules.size) { @@ -127,6 +116,18 @@ object JPMSUtils { foundFiles } + def shouldFilterModule( + distinctModules: Seq[ModuleID] + )(module: ModuleID): Boolean = { + distinctModules.exists(m => + m.organization == module.organization && + (m.name == module.name || m.crossVersion.isInstanceOf[ + sbt.librarymanagement.Binary + ] && s"${m.name}_$scalaBinaryVersion" == module.name) && + m.revision == module.revision + ) + } + def filterArtifacts( classPath: Def.Classpath, predicates: String* diff --git a/project/NativeImage.scala b/project/NativeImage.scala index 09febb8c70e3..a9aaf6bd97b9 100644 --- a/project/NativeImage.scala +++ b/project/NativeImage.scala @@ -204,7 +204,8 @@ object NativeImage { cpToSearch, JPMSUtils.componentModules, log, - projName = (moduleName.value), + projName = (moduleName.value), + scalaBinaryVersion.value, shouldContainAll = true ) .map(_.data.getAbsolutePath) From 57be99e4982db2111e8fc67ae1e03805bf1fba31 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Tue, 24 Sep 2024 15:27:41 +0200 Subject: [PATCH 251/268] Address SBT lint warnings --- build.sbt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build.sbt b/build.sbt index 313e24da5e2a..75a64548ed0b 100644 --- a/build.sbt +++ b/build.sbt @@ -1133,7 +1133,6 @@ lazy val filewatcher = project frgaalJavaCompilerSetting, scalaModuleDependencySetting, compileOrder := CompileOrder.ScalaThenJava, - javaModuleName := "org.enso.filewatcher", version := "0.1", libraryDependencies ++= Seq( "io.methvin" % "directory-watcher" % directoryWatcherVersion, @@ -2109,7 +2108,6 @@ lazy val `polyglot-api` = project "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.scalacheck" %% "scalacheck" % scalacheckVersion % Test ), - javaModuleName := "org.enso.polyglot.api", Compile / moduleDependencies ++= Seq( "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, "org.graalvm.sdk" % "word" % graalMavenPackagesVersion, @@ -2532,7 +2530,6 @@ lazy val `runtime-language-epb` = .enablePlugins(JPMSPlugin) .settings( frgaalJavaCompilerSetting, - javaModuleName := "org.enso.runtime.language.epb", inConfig(Compile)(truffleRunOptionsSettings), truffleDslSuppressWarnsSetting, commands += WithDebugCommand.withDebug, @@ -3088,7 +3085,6 @@ lazy val `runtime-parser` = "org.scalatest" %% "scalatest" % scalatestVersion % Test, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided" ), - javaModuleName := "org.enso.runtime.parser", Compile / moduleDependencies ++= Seq( "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion ), From edaa436ee89670f4065c13dda7593e19fb207b10 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 16:52:32 +0200 Subject: [PATCH 252/268] Revert "Eliminate a cross version hack" This reverts commit 8861dab288cbb0ff7f2f456c8725d75d4442aa9c. --- build.sbt | 111 ++++++++++++++++++-------------------- project/JPMSPlugin.scala | 10 ++-- project/JPMSUtils.scala | 55 ++++++++++--------- project/NativeImage.scala | 3 +- 4 files changed, 85 insertions(+), 94 deletions(-) diff --git a/build.sbt b/build.sbt index 75a64548ed0b..b84c2054efbd 100644 --- a/build.sbt +++ b/build.sbt @@ -681,8 +681,7 @@ lazy val componentModulesPaths = fullCp, thirdPartyModIds, log, - projName = moduleName.value, - scalaBinaryVersion.value, + projName = moduleName.value, shouldContainAll = true ) val thirdPartyModFiles = thirdPartyMods.map(_.data) @@ -1079,7 +1078,6 @@ lazy val `logging-service-logback` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - mixedJavaScalaProjectSetting, version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -1211,32 +1209,31 @@ lazy val `scala-libs-wrapper` = project ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) }, // Patch this JPMS module such that the JVM thinks that all the Scala stuff // is part of this module Compile / patchModules := { + val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, - "io.circe" %% "circe-core" % circeVersion, - "io.circe" %% "circe-generic" % circeVersion, - "io.circe" %% "circe-parser" % circeVersion, - "io.circe" %% "circe-jawn" % circeVersion, - "io.circe" %% "circe-numbers" % circeVersion, - "org.typelevel" %% "cats-core" % catsVersion, - "org.typelevel" %% "cats-kernel" % catsVersion, - "org.typelevel" %% "jawn-parser" % jawnParserVersion, - "com.chuusai" %% "shapeless" % shapelessVersion, - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, - "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion + "com.typesafe.scala-logging" % ("scala-logging_" + scalaVer) % scalaLoggingVersion, + "io.circe" % ("circe-core_" + scalaVer) % circeVersion, + "io.circe" % ("circe-generic_" + scalaVer) % circeVersion, + "io.circe" % ("circe-parser_" + scalaVer) % circeVersion, + "io.circe" % ("circe-jawn_" + scalaVer) % circeVersion, + "io.circe" % ("circe-numbers_" + scalaVer) % circeVersion, + "org.typelevel" % ("cats-core_" + scalaVer) % catsVersion, + "org.typelevel" % ("cats-kernel_" + scalaVer) % catsVersion, + "org.typelevel" % ("jawn-parser_" + scalaVer) % jawnParserVersion, + "com.chuusai" % ("shapeless_" + scalaVer) % shapelessVersion, + "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-macros_" + scalaVer) % jsoniterVersion, + "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-core_" + scalaVer) % jsoniterVersion ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1264,29 +1261,29 @@ lazy val `language-server-deps-wrapper` = project (`scala-libs-wrapper` / Compile / exportedModule).value ), assembly / assemblyExcludedJars := { + val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, scalaLibrary ++ Seq( - "com.chuusai" %% "shapeless" % shapelessVersion, - "com.typesafe" % "config" % typesafeConfigVersion + "com.chuusai" % ("shapeless_" + scalaVer) % shapelessVersion, + "com.typesafe" % "config" % typesafeConfigVersion ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) }, Compile / patchModules := { + val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.github.pureconfig" %% "pureconfig-core" % pureconfigVersion, - "com.github.pureconfig" %% "pureconfig-generic" % pureconfigVersion + "com.github.pureconfig" % ("pureconfig-core_" + scalaVer) % pureconfigVersion, + "com.github.pureconfig" % ("pureconfig-generic_" + scalaVer) % pureconfigVersion ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1317,7 +1314,6 @@ lazy val `directory-watcher-wrapper` = project ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) }, @@ -1334,7 +1330,6 @@ lazy val `directory-watcher-wrapper` = project ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1354,15 +1349,15 @@ lazy val `fansi-wrapper` = project ), javaModuleName := "org.enso.fansi.wrapper", Compile / patchModules := { + val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ Seq( - "com.lihaoyi" %% "fansi" % fansiVersion + "com.lihaoyi" % ("fansi_" + scalaVer) % fansiVersion ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1375,7 +1370,6 @@ lazy val `fansi-wrapper` = project scalaLibrary, streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) } @@ -1414,46 +1408,46 @@ lazy val `akka-wrapper` = project "org.slf4j" % "slf4j-api" % slf4jVersion ), assembly / assemblyExcludedJars := { + val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ scalaCompiler ++ Seq( - "org.scala-lang.modules" %% "scala-java8-compat" % scalaJavaCompatVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "io.github.java-diff-utils" % "java-diff-utils" % javaDiffVersion, - "org.jline" % "jline" % jlineVersion, - "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, - "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, - "net.java.dev.jna" % "jna" % jnaVersion + "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % scalaJavaCompatVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.github.java-diff-utils" % "java-diff-utils" % javaDiffVersion, + "org.jline" % "jline" % jlineVersion, + "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, + "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, + "net.java.dev.jna" % "jna" % jnaVersion ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) excludedJars .map(Attributed.blank) }, Compile / patchModules := { + val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ scalaCompiler ++ Seq( - "org.scala-lang.modules" %% "scala-parser-combinators" % scalaParserCombinatorsVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "io.spray" %% "spray-json" % sprayJsonVersion, - akkaURL %% "akka-actor" % akkaVersion, - akkaURL %% "akka-stream" % akkaVersion, - akkaURL %% "akka-http" % akkaHTTPVersion, - akkaURL %% "akka-http-core" % akkaHTTPVersion, - akkaURL %% "akka-http-spray-json" % akkaHTTPVersion, - akkaURL %% "akka-slf4j" % akkaVersion, - akkaURL %% "akka-parsing" % akkaHTTPVersion, - akkaURL %% "akka-protobuf-v3" % akkaVersion + "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % scalaParserCombinatorsVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.spray" % ("spray-json_" + scalaVer) % sprayJsonVersion, + akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, + akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, + akkaURL % ("akka-http_" + scalaVer) % akkaHTTPVersion, + akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, + akkaURL % ("akka-http-spray-json_" + scalaVer) % akkaHTTPVersion, + akkaURL % ("akka-slf4j_" + scalaVer) % akkaVersion, + akkaURL % ("akka-parsing_" + scalaVer) % akkaHTTPVersion, + akkaURL % ("akka-protobuf-v3_" + scalaVer) % akkaVersion ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1476,33 +1470,35 @@ lazy val `zio-wrapper` = project "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % zioIzumiReflectVersion ), assembly / assemblyExcludedJars := { + val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ scalaCompiler ++ - Seq("dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion), + Seq( + "dev.zio" % ("zio-interop-cats_" + scalaVer) % zioInteropCatsVersion + ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) excludedJars .map(Attributed.blank) }, Compile / patchModules := { + val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ Seq( - "dev.zio" %% "zio" % zioVersion, - "dev.zio" %% "zio-internal-macros" % zioVersion, - "dev.zio" %% "zio-stacktracer" % zioVersion, - "dev.zio" %% "izumi-reflect" % zioIzumiReflectVersion, - "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % zioIzumiReflectVersion + "dev.zio" % ("zio_" + scalaVer) % zioVersion, + "dev.zio" % ("zio-internal-macros_" + scalaVer) % zioVersion, + "dev.zio" % ("zio-stacktracer_" + scalaVer) % zioVersion, + "dev.zio" % ("izumi-reflect_" + scalaVer) % zioIzumiReflectVersion, + "dev.zio" % ("izumi-reflect-thirdparty-boopickle-shaded_" + scalaVer) % zioIzumiReflectVersion ), streams.value.log, moduleName.value, - scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1648,7 +1644,6 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) ourFullCp, pkgsToExclude, streams.value.log, - scalaBinaryVersion.value, moduleName.value ) }, diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 2769d0410c45..39fb42e5e2da 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -222,8 +222,7 @@ object JPMSPlugin extends AutoPlugin { (config / internalModuleDependencies).value, (config / dependencyClasspath).value, streams.value.log, - moduleName.value, - scalaBinaryVersion.value + moduleName.value ) }, // Returns the reference to target/classes directory and ensures that module-info @@ -310,7 +309,6 @@ object JPMSPlugin extends AutoPlugin { internalModuleDeps: Seq[File], classPath: Def.Classpath, logger: ManagedLogger, - scalaBinaryVersion: String, currProjName: String ): Seq[File] = { moduleDeps.foreach { moduleDep => @@ -355,7 +353,6 @@ object JPMSPlugin extends AutoPlugin { moduleDeps, logger, currProjName, - scalaBinaryVersion, shouldContainAll = true ) val externalFiles = cp.map(_.data) @@ -493,8 +490,9 @@ object JPMSPlugin extends AutoPlugin { } } - /** Does not use the default artifact name which inserts scala version and module version. - */ + /** + * Does not use the default artifact name which inserts scala version and module version. + */ private def stripArtifactName( scalaVersion: ScalaVersion, modId: ModuleID, diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index a816aef4f248..1e8c29b10c76 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -35,28 +35,33 @@ object JPMSUtils { /** Filters modules by their IDs from the given classpath. * * @param cp The classpath to filter - * @param modules These modules are looked for in the class path, can be duplicated - * @param projName Name of the current sbt project for debugging + * @param modules These modules are looked for in the class path, can be duplicated. + * @param projName Name of the current sbt project for debugging. * @param shouldContainAll If true, the method will throw an exception if not all modules were found - * in the classpath - * @param scalaBinaryVersion Scala version used in all dependencies - * @return The classpath with only the provided modules searched by their IDs + * in the classpath. + * @return The classpath with only the provided modules searched by their IDs. */ def filterModulesFromClasspath( cp: Def.Classpath, modules: Seq[ModuleID], log: sbt.util.Logger, projName: String, - scalaBinaryVersion: String, shouldContainAll: Boolean = false ): Def.Classpath = { val distinctModules = modules.distinct + def shouldFilterModule(module: ModuleID): Boolean = { + distinctModules.exists(m => + m.organization == module.organization && + m.name == module.name && + m.revision == module.revision + ) + } + val ret = cp.filter(dep => { val moduleID = dep.metadata.get(AttributeKey[ModuleID]("moduleID")).get - shouldFilterModule(distinctModules)(moduleID) + shouldFilterModule(moduleID) }) - if (shouldContainAll) { if (ret.size < distinctModules.size) { log.error( @@ -76,12 +81,11 @@ object JPMSUtils { /** Filters all the requested modules from the given [[UpdateReport]]. * - * @param updateReport The update report to filter. This is the result of `update.value`. - * @param modules The modules to filter from the update report. Can be duplicated. - * @param log The logger to use for logging. - * @param projName Name of the current sbt project for debugging. - * @param scalaBinaryVersion Scala version used in all dependencies - * @param shouldContainAll If true, the method will log an error if not all modules were found. + * @param updateReport The update report to filter. This is the result of `update.value`. + * @param modules The modules to filter from the update report. Can be duplicated. + * @param log The logger to use for logging. + * @param projName Name of the current sbt project for debugging. + * @param shouldContainAll If true, the method will log an error if not all modules were found. * @return The list of files (Jar archives, directories, etc.) that were found in the update report. */ def filterModulesFromUpdate( @@ -89,13 +93,20 @@ object JPMSUtils { modules: Seq[ModuleID], log: sbt.util.Logger, projName: String, - scalaBinaryVersion: String, shouldContainAll: Boolean = false ): Seq[File] = { val distinctModules = modules.distinct + def shouldFilterModule(module: ModuleID): Boolean = { + distinctModules.exists(m => + m.organization == module.organization && + m.name == module.name && + m.revision == module.revision + ) + } + val foundFiles = updateReport.select( - module = shouldFilterModule(distinctModules) + module = shouldFilterModule ) if (shouldContainAll) { if (foundFiles.size < distinctModules.size) { @@ -116,18 +127,6 @@ object JPMSUtils { foundFiles } - def shouldFilterModule( - distinctModules: Seq[ModuleID] - )(module: ModuleID): Boolean = { - distinctModules.exists(m => - m.organization == module.organization && - (m.name == module.name || m.crossVersion.isInstanceOf[ - sbt.librarymanagement.Binary - ] && s"${m.name}_$scalaBinaryVersion" == module.name) && - m.revision == module.revision - ) - } - def filterArtifacts( classPath: Def.Classpath, predicates: String* diff --git a/project/NativeImage.scala b/project/NativeImage.scala index a9aaf6bd97b9..09febb8c70e3 100644 --- a/project/NativeImage.scala +++ b/project/NativeImage.scala @@ -204,8 +204,7 @@ object NativeImage { cpToSearch, JPMSUtils.componentModules, log, - projName = (moduleName.value), - scalaBinaryVersion.value, + projName = (moduleName.value), shouldContainAll = true ) .map(_.data.getAbsolutePath) From b82394615543b1cfc6311ba782a43f772e6e3dea Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 16:53:26 +0200 Subject: [PATCH 253/268] logging-service-logback is mixedJavaScalaProject --- build.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/build.sbt b/build.sbt index b84c2054efbd..6a24b2198d62 100644 --- a/build.sbt +++ b/build.sbt @@ -1078,6 +1078,7 @@ lazy val `logging-service-logback` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + mixedJavaScalaProjectSetting, version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, From 6f1b855f8ce17ef8c0b9f933e28031d2366e4072 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 16:56:18 +0200 Subject: [PATCH 254/268] fmt --- .../org/enso/launcher/components/LauncherRunnerSpec.scala | 2 +- project/JPMSPlugin.scala | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala b/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala index 2e918aaa7899..e8f8d1d4b11e 100644 --- a/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala +++ b/engine/launcher/src/test/scala/org/enso/launcher/components/LauncherRunnerSpec.scala @@ -67,7 +67,7 @@ class LauncherRunnerSpec extends RuntimeVersionManagerTest with FlakySpec { workingDirectory = None, connectLoggerIfAvailable = true ) - val jvmOptions = Seq(("locally-added-options", "value1")) + val jvmOptions = Seq(("locally-added-options", "value1")) val runnerEntryPoint = "org.enso.runner/org.enso.runner.Main" def checkCommandLine(command: Command): Unit = { diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 39fb42e5e2da..9e27244aac27 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -490,9 +490,8 @@ object JPMSPlugin extends AutoPlugin { } } - /** - * Does not use the default artifact name which inserts scala version and module version. - */ + /** Does not use the default artifact name which inserts scala version and module version. + */ private def stripArtifactName( scalaVersion: ScalaVersion, modId: ModuleID, From 8eb3ea49f66764c250147ed028252883131f2abe Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 17:27:26 +0200 Subject: [PATCH 255/268] Stripped artifact name contains classifier. This fixes tests as those were named like `artifact-tests.jar`. --- project/JPMSPlugin.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 9e27244aac27..15ebcf315e33 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -497,6 +497,11 @@ object JPMSPlugin extends AutoPlugin { modId: ModuleID, artifact: Artifact ): String = { - artifact.name + "." + artifact.extension + // Classifier optionally adds e.g. `-test` or `-sources` to the artifact name + // This needs to be retained for the tests to work. + val classifierStr = artifact.classifier match { + case None => ""; case Some(c) => "-" + c + } + artifact.name + classifierStr + "." + artifact.extension } } From cb6b7321fa0f7e5bf319b7e388e749708e86adb0 Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Tue, 24 Sep 2024 17:44:08 +0200 Subject: [PATCH 256/268] Don't use LocalProject unless really needed --- build.sbt | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/build.sbt b/build.sbt index 6a24b2198d62..76b0b665a562 100644 --- a/build.sbt +++ b/build.sbt @@ -643,7 +643,7 @@ lazy val componentModulesPaths = ) (ThisBuild / componentModulesPaths) := { val runnerCp = (`engine-runner` / Runtime / fullClasspath).value - val runtimeCp = (LocalProject("runtime") / Runtime / fullClasspath).value + val runtimeCp = (`runtime` / Runtime / fullClasspath).value val langServerCp = (`language-server` / Runtime / fullClasspath).value val akkaWrapperCp = (`akka-wrapper` / Compile / fullClasspath).value val fullCp = (runnerCp ++ runtimeCp ++ langServerCp ++ akkaWrapperCp).distinct @@ -2566,8 +2566,7 @@ lazy val `runtime-language-arrow` = ), javaModuleName := "org.enso.interpreter.arrow", Compile / moduleDependencies ++= GraalVM.modules, - Test / moduleDependencies += - (LocalProject("runtime-language-arrow") / projectID).value, + Test / moduleDependencies += projectID.value, Test / patchModules := { val testClassesDir = (Test / productDirectories).value.head Map(javaModuleName.value -> Seq(testClassesDir)) @@ -3258,11 +3257,7 @@ lazy val `runtime-instrument-common` = ) ) .dependsOn(`refactoring-utils`) - .dependsOn( - LocalProject( - "runtime" - ) % "compile->compile;runtime->runtime;bench->bench" - ) + .dependsOn(`runtime` % "compile->compile;runtime->runtime;bench->bench") lazy val `runtime-instrument-id-execution` = (project in file("engine/runtime-instrument-id-execution")) @@ -3285,7 +3280,7 @@ lazy val `runtime-instrument-id-execution` = (`polyglot-api` / Compile / exportedModule).value ) ) - .dependsOn(LocalProject("runtime")) + .dependsOn(`runtime`) .dependsOn(`runtime-instrument-common`) lazy val `runtime-instrument-repl-debugger` = @@ -3312,7 +3307,7 @@ lazy val `runtime-instrument-repl-debugger` = (`runtime-parser` / Compile / exportedModule).value ) ) - .dependsOn(LocalProject("runtime")) + .dependsOn(`runtime`) .dependsOn(`runtime-instrument-common`) lazy val `runtime-instrument-runtime-server` = @@ -3340,7 +3335,7 @@ lazy val `runtime-instrument-runtime-server` = (`connected-lock-manager` / Compile / exportedModule).value ) ) - .dependsOn(LocalProject("runtime")) + .dependsOn(`runtime`) .dependsOn(`runtime-instrument-common` % "test->test;compile->compile") /* Note [Unmanaged Classpath] @@ -3870,7 +3865,7 @@ lazy val `std-benchmarks` = (project in file("std-bits/benchmarks")) run / fork := true, run / connectInput := true, mainClass := - (LocalProject("bench-processor") / mainClass).value, + (`bench-processor` / mainClass).value, Compile / javacOptions ++= Seq( "-Xlint:unchecked" ), @@ -5125,8 +5120,8 @@ updateLibraryManifests := { val libraries = Editions.standardLibraries.map(libName => BundledLibrary(libName, stdLibVersion) ) - val runnerCp = (LocalProject("engine-runner") / Runtime / fullClasspath).value - val runtimeCp = (LocalProject("runtime") / Runtime / fullClasspath).value + val runnerCp = (`engine-runner` / Runtime / fullClasspath).value + val runtimeCp = (`runtime` / Runtime / fullClasspath).value val fullCp = (runnerCp ++ runtimeCp).distinct val modulePath = componentModulesPaths.value val javaOpts = Seq( From dbae9105ee462a0e77cd1094c3cb0fd1bfdf3d9b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 19:07:33 +0200 Subject: [PATCH 257/268] Add more logging when BenchProcessor fails --- .../enso/benchmarks/processor/BenchProcessor.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java index f2720e704896..38436449bf85 100644 --- a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java +++ b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java @@ -2,7 +2,9 @@ import java.io.File; import java.io.IOException; +import java.lang.module.FindException; import java.lang.module.ModuleFinder; +import java.lang.module.ResolutionException; import java.lang.reflect.InvocationTargetException; import java.nio.charset.StandardCharsets; import java.nio.file.Path; @@ -107,8 +109,17 @@ private static ModuleLayer createTruffleModuleLayer() { "org.enso.runtime.language.epb", "org.enso.interpreter.arrow", "org.enso.bench.processor"); - var truffleLayer = createLayerFromPaths(pathsToUse, rootModules, bootLayer); - return truffleLayer; + try { + var truffleLayer = createLayerFromPaths(pathsToUse, rootModules, bootLayer); + return truffleLayer; + } catch (FindException | ResolutionException e) { + System.out.println("Error creating truffle module layer: " + e.getMessage() + " :"); + System.out.println(" Paths used for the module finder: " + pathsToUse); + System.out.println(" Out of all paths: " + Arrays.toString(paths)); + System.out.println(" Root modules for resolution: " + rootModules); + System.out.println(" Boot layer: " + bootLayer); + throw new AssertionError(e); + } } /** From bcfb6d76771f793459918779bf754240e2fb12b2 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Tue, 24 Sep 2024 19:17:18 +0200 Subject: [PATCH 258/268] logging-service-logback is not mixed project --- build.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sbt b/build.sbt index 76b0b665a562..c5837242e42d 100644 --- a/build.sbt +++ b/build.sbt @@ -1078,7 +1078,6 @@ lazy val `logging-service-logback` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - mixedJavaScalaProjectSetting, version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, From 10dc148f66434f6d10dcbf8d821771a072055cd2 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Wed, 25 Sep 2024 08:29:20 +0200 Subject: [PATCH 259/268] Work with java.io.File.getPath to avoid mixing slash and backslash on Windows --- .../main/java/org/enso/benchmarks/processor/BenchProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java index 38436449bf85..fbadc65f4a4b 100644 --- a/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java +++ b/lib/scala/bench-processor/src/main/java/org/enso/benchmarks/processor/BenchProcessor.java @@ -90,7 +90,7 @@ private static ModuleLayer createTruffleModuleLayer() { () -> new AssertionError( "Module " + modRef.descriptor().name() + " has no location")); - duplicatedModPaths.add(uri.getPath()); + duplicatedModPaths.add(new File(uri).getPath()); }); } // Path to modules without duplicated ones. From 09713bdcbc6ded6a7c787084f5f1f1eb5b06f7cd Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Wed, 25 Sep 2024 12:51:41 +0200 Subject: [PATCH 260/268] Reapply "Eliminate a cross version hack" This reverts commit edaa436ee89670f4065c13dda7593e19fb207b10. --- build.sbt | 111 ++++++++++++++++++++------------------ project/JPMSPlugin.scala | 5 +- project/JPMSUtils.scala | 55 +++++++++---------- project/NativeImage.scala | 3 +- 4 files changed, 92 insertions(+), 82 deletions(-) diff --git a/build.sbt b/build.sbt index c5837242e42d..b039d6240ae6 100644 --- a/build.sbt +++ b/build.sbt @@ -681,7 +681,8 @@ lazy val componentModulesPaths = fullCp, thirdPartyModIds, log, - projName = moduleName.value, + projName = moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) val thirdPartyModFiles = thirdPartyMods.map(_.data) @@ -1078,6 +1079,7 @@ lazy val `logging-service-logback` = project .configs(Test) .settings( frgaalJavaCompilerSetting, + mixedJavaScalaProjectSetting, version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion, @@ -1209,31 +1211,32 @@ lazy val `scala-libs-wrapper` = project ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) }, // Patch this JPMS module such that the JVM thinks that all the Scala stuff // is part of this module Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.typesafe.scala-logging" % ("scala-logging_" + scalaVer) % scalaLoggingVersion, - "io.circe" % ("circe-core_" + scalaVer) % circeVersion, - "io.circe" % ("circe-generic_" + scalaVer) % circeVersion, - "io.circe" % ("circe-parser_" + scalaVer) % circeVersion, - "io.circe" % ("circe-jawn_" + scalaVer) % circeVersion, - "io.circe" % ("circe-numbers_" + scalaVer) % circeVersion, - "org.typelevel" % ("cats-core_" + scalaVer) % catsVersion, - "org.typelevel" % ("cats-kernel_" + scalaVer) % catsVersion, - "org.typelevel" % ("jawn-parser_" + scalaVer) % jawnParserVersion, - "com.chuusai" % ("shapeless_" + scalaVer) % shapelessVersion, - "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-macros_" + scalaVer) % jsoniterVersion, - "com.github.plokhotnyuk.jsoniter-scala" % ("jsoniter-scala-core_" + scalaVer) % jsoniterVersion + "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, + "io.circe" %% "circe-core" % circeVersion, + "io.circe" %% "circe-generic" % circeVersion, + "io.circe" %% "circe-parser" % circeVersion, + "io.circe" %% "circe-jawn" % circeVersion, + "io.circe" %% "circe-numbers" % circeVersion, + "org.typelevel" %% "cats-core" % catsVersion, + "org.typelevel" %% "cats-kernel" % catsVersion, + "org.typelevel" %% "jawn-parser" % jawnParserVersion, + "com.chuusai" %% "shapeless" % shapelessVersion, + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, + "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % jsoniterVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1261,29 +1264,29 @@ lazy val `language-server-deps-wrapper` = project (`scala-libs-wrapper` / Compile / exportedModule).value ), assembly / assemblyExcludedJars := { - val scalaVer = scalaBinaryVersion.value JPMSUtils.filterModulesFromClasspath( (Compile / fullClasspath).value, scalaLibrary ++ Seq( - "com.chuusai" % ("shapeless_" + scalaVer) % shapelessVersion, - "com.typesafe" % "config" % typesafeConfigVersion + "com.chuusai" %% "shapeless" % shapelessVersion, + "com.typesafe" % "config" % typesafeConfigVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) }, Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, Seq( - "com.github.pureconfig" % ("pureconfig-core_" + scalaVer) % pureconfigVersion, - "com.github.pureconfig" % ("pureconfig-generic_" + scalaVer) % pureconfigVersion + "com.github.pureconfig" %% "pureconfig-core" % pureconfigVersion, + "com.github.pureconfig" %% "pureconfig-generic" % pureconfigVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1314,6 +1317,7 @@ lazy val `directory-watcher-wrapper` = project ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) }, @@ -1330,6 +1334,7 @@ lazy val `directory-watcher-wrapper` = project ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1349,15 +1354,15 @@ lazy val `fansi-wrapper` = project ), javaModuleName := "org.enso.fansi.wrapper", Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ Seq( - "com.lihaoyi" % ("fansi_" + scalaVer) % fansiVersion + "com.lihaoyi" %% "fansi" % fansiVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1370,6 +1375,7 @@ lazy val `fansi-wrapper` = project scalaLibrary, streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) } @@ -1408,46 +1414,46 @@ lazy val `akka-wrapper` = project "org.slf4j" % "slf4j-api" % slf4jVersion ), assembly / assemblyExcludedJars := { - val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ scalaCompiler ++ Seq( - "org.scala-lang.modules" % ("scala-java8-compat_" + scalaVer) % scalaJavaCompatVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "io.github.java-diff-utils" % "java-diff-utils" % javaDiffVersion, - "org.jline" % "jline" % jlineVersion, - "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, - "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, - "net.java.dev.jna" % "jna" % jnaVersion + "org.scala-lang.modules" %% "scala-java8-compat" % scalaJavaCompatVersion, + "org.slf4j" % "slf4j-api" % slf4jVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.github.java-diff-utils" % "java-diff-utils" % javaDiffVersion, + "org.jline" % "jline" % jlineVersion, + "com.google.protobuf" % "protobuf-java" % googleProtobufVersion, + "org.reactivestreams" % "reactive-streams" % reactiveStreamsVersion, + "net.java.dev.jna" % "jna" % jnaVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) excludedJars .map(Attributed.blank) }, Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ scalaCompiler ++ Seq( - "org.scala-lang.modules" % ("scala-parser-combinators_" + scalaVer) % scalaParserCombinatorsVersion, - "com.typesafe" % "config" % typesafeConfigVersion, - "io.spray" % ("spray-json_" + scalaVer) % sprayJsonVersion, - akkaURL % ("akka-actor_" + scalaVer) % akkaVersion, - akkaURL % ("akka-stream_" + scalaVer) % akkaVersion, - akkaURL % ("akka-http_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-http-core_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-http-spray-json_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-slf4j_" + scalaVer) % akkaVersion, - akkaURL % ("akka-parsing_" + scalaVer) % akkaHTTPVersion, - akkaURL % ("akka-protobuf-v3_" + scalaVer) % akkaVersion + "org.scala-lang.modules" %% "scala-parser-combinators" % scalaParserCombinatorsVersion, + "com.typesafe" % "config" % typesafeConfigVersion, + "io.spray" %% "spray-json" % sprayJsonVersion, + akkaURL %% "akka-actor" % akkaVersion, + akkaURL %% "akka-stream" % akkaVersion, + akkaURL %% "akka-http" % akkaHTTPVersion, + akkaURL %% "akka-http-core" % akkaHTTPVersion, + akkaURL %% "akka-http-spray-json" % akkaHTTPVersion, + akkaURL %% "akka-slf4j" % akkaVersion, + akkaURL %% "akka-parsing" % akkaHTTPVersion, + akkaURL %% "akka-protobuf-v3" % akkaVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1470,35 +1476,33 @@ lazy val `zio-wrapper` = project "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % zioIzumiReflectVersion ), assembly / assemblyExcludedJars := { - val scalaVer = scalaBinaryVersion.value val excludedJars = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ scalaCompiler ++ - Seq( - "dev.zio" % ("zio-interop-cats_" + scalaVer) % zioInteropCatsVersion - ), + Seq("dev.zio" %% "zio-interop-cats" % zioInteropCatsVersion), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) excludedJars .map(Attributed.blank) }, Compile / patchModules := { - val scalaVer = scalaBinaryVersion.value val scalaLibs = JPMSUtils.filterModulesFromUpdate( update.value, scalaLibrary ++ Seq( - "dev.zio" % ("zio_" + scalaVer) % zioVersion, - "dev.zio" % ("zio-internal-macros_" + scalaVer) % zioVersion, - "dev.zio" % ("zio-stacktracer_" + scalaVer) % zioVersion, - "dev.zio" % ("izumi-reflect_" + scalaVer) % zioIzumiReflectVersion, - "dev.zio" % ("izumi-reflect-thirdparty-boopickle-shaded_" + scalaVer) % zioIzumiReflectVersion + "dev.zio" %% "zio" % zioVersion, + "dev.zio" %% "zio-internal-macros" % zioVersion, + "dev.zio" %% "zio-stacktracer" % zioVersion, + "dev.zio" %% "izumi-reflect" % zioIzumiReflectVersion, + "dev.zio" %% "izumi-reflect-thirdparty-boopickle-shaded" % zioIzumiReflectVersion ), streams.value.log, moduleName.value, + scalaBinaryVersion.value, shouldContainAll = true ) Map( @@ -1644,6 +1648,7 @@ lazy val `project-manager` = (project in file("lib/scala/project-manager")) ourFullCp, pkgsToExclude, streams.value.log, + scalaBinaryVersion.value, moduleName.value ) }, diff --git a/project/JPMSPlugin.scala b/project/JPMSPlugin.scala index 15ebcf315e33..570520875cfd 100644 --- a/project/JPMSPlugin.scala +++ b/project/JPMSPlugin.scala @@ -222,7 +222,8 @@ object JPMSPlugin extends AutoPlugin { (config / internalModuleDependencies).value, (config / dependencyClasspath).value, streams.value.log, - moduleName.value + moduleName.value, + scalaBinaryVersion.value ) }, // Returns the reference to target/classes directory and ensures that module-info @@ -309,6 +310,7 @@ object JPMSPlugin extends AutoPlugin { internalModuleDeps: Seq[File], classPath: Def.Classpath, logger: ManagedLogger, + scalaBinaryVersion: String, currProjName: String ): Seq[File] = { moduleDeps.foreach { moduleDep => @@ -353,6 +355,7 @@ object JPMSPlugin extends AutoPlugin { moduleDeps, logger, currProjName, + scalaBinaryVersion, shouldContainAll = true ) val externalFiles = cp.map(_.data) diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index 1e8c29b10c76..a816aef4f248 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -35,33 +35,28 @@ object JPMSUtils { /** Filters modules by their IDs from the given classpath. * * @param cp The classpath to filter - * @param modules These modules are looked for in the class path, can be duplicated. - * @param projName Name of the current sbt project for debugging. + * @param modules These modules are looked for in the class path, can be duplicated + * @param projName Name of the current sbt project for debugging * @param shouldContainAll If true, the method will throw an exception if not all modules were found - * in the classpath. - * @return The classpath with only the provided modules searched by their IDs. + * in the classpath + * @param scalaBinaryVersion Scala version used in all dependencies + * @return The classpath with only the provided modules searched by their IDs */ def filterModulesFromClasspath( cp: Def.Classpath, modules: Seq[ModuleID], log: sbt.util.Logger, projName: String, + scalaBinaryVersion: String, shouldContainAll: Boolean = false ): Def.Classpath = { val distinctModules = modules.distinct - def shouldFilterModule(module: ModuleID): Boolean = { - distinctModules.exists(m => - m.organization == module.organization && - m.name == module.name && - m.revision == module.revision - ) - } - val ret = cp.filter(dep => { val moduleID = dep.metadata.get(AttributeKey[ModuleID]("moduleID")).get - shouldFilterModule(moduleID) + shouldFilterModule(distinctModules)(moduleID) }) + if (shouldContainAll) { if (ret.size < distinctModules.size) { log.error( @@ -81,11 +76,12 @@ object JPMSUtils { /** Filters all the requested modules from the given [[UpdateReport]]. * - * @param updateReport The update report to filter. This is the result of `update.value`. - * @param modules The modules to filter from the update report. Can be duplicated. - * @param log The logger to use for logging. - * @param projName Name of the current sbt project for debugging. - * @param shouldContainAll If true, the method will log an error if not all modules were found. + * @param updateReport The update report to filter. This is the result of `update.value`. + * @param modules The modules to filter from the update report. Can be duplicated. + * @param log The logger to use for logging. + * @param projName Name of the current sbt project for debugging. + * @param scalaBinaryVersion Scala version used in all dependencies + * @param shouldContainAll If true, the method will log an error if not all modules were found. * @return The list of files (Jar archives, directories, etc.) that were found in the update report. */ def filterModulesFromUpdate( @@ -93,20 +89,13 @@ object JPMSUtils { modules: Seq[ModuleID], log: sbt.util.Logger, projName: String, + scalaBinaryVersion: String, shouldContainAll: Boolean = false ): Seq[File] = { val distinctModules = modules.distinct - def shouldFilterModule(module: ModuleID): Boolean = { - distinctModules.exists(m => - m.organization == module.organization && - m.name == module.name && - m.revision == module.revision - ) - } - val foundFiles = updateReport.select( - module = shouldFilterModule + module = shouldFilterModule(distinctModules) ) if (shouldContainAll) { if (foundFiles.size < distinctModules.size) { @@ -127,6 +116,18 @@ object JPMSUtils { foundFiles } + def shouldFilterModule( + distinctModules: Seq[ModuleID] + )(module: ModuleID): Boolean = { + distinctModules.exists(m => + m.organization == module.organization && + (m.name == module.name || m.crossVersion.isInstanceOf[ + sbt.librarymanagement.Binary + ] && s"${m.name}_$scalaBinaryVersion" == module.name) && + m.revision == module.revision + ) + } + def filterArtifacts( classPath: Def.Classpath, predicates: String* diff --git a/project/NativeImage.scala b/project/NativeImage.scala index 09febb8c70e3..a9aaf6bd97b9 100644 --- a/project/NativeImage.scala +++ b/project/NativeImage.scala @@ -204,7 +204,8 @@ object NativeImage { cpToSearch, JPMSUtils.componentModules, log, - projName = (moduleName.value), + projName = (moduleName.value), + scalaBinaryVersion.value, shouldContainAll = true ) .map(_.data.getAbsolutePath) From 97d941cca326b0aa568dd345b2d86e0a77c3faeb Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Wed, 25 Sep 2024 13:17:12 +0200 Subject: [PATCH 261/268] Pass scalaBinaryVersion correctly --- project/JPMSUtils.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/project/JPMSUtils.scala b/project/JPMSUtils.scala index a816aef4f248..14f2ea1fe76a 100644 --- a/project/JPMSUtils.scala +++ b/project/JPMSUtils.scala @@ -54,7 +54,7 @@ object JPMSUtils { val ret = cp.filter(dep => { val moduleID = dep.metadata.get(AttributeKey[ModuleID]("moduleID")).get - shouldFilterModule(distinctModules)(moduleID) + shouldFilterModule(distinctModules, scalaBinaryVersion)(moduleID) }) if (shouldContainAll) { @@ -95,7 +95,7 @@ object JPMSUtils { val distinctModules = modules.distinct val foundFiles = updateReport.select( - module = shouldFilterModule(distinctModules) + module = shouldFilterModule(distinctModules, scalaBinaryVersion) ) if (shouldContainAll) { if (foundFiles.size < distinctModules.size) { @@ -117,7 +117,8 @@ object JPMSUtils { } def shouldFilterModule( - distinctModules: Seq[ModuleID] + distinctModules: Seq[ModuleID], + scalaBinaryVersion: String )(module: ModuleID): Boolean = { distinctModules.exists(m => m.organization == module.organization && From 8b043b450c98ff888887b762c05f470cd4196934 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 25 Sep 2024 14:53:39 +0200 Subject: [PATCH 262/268] Remove scala-compiler from the distribution --- build.sbt | 11 ++++++----- .../scala-libs-wrapper/src/main/java/module-info.java | 2 -- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build.sbt b/build.sbt index b039d6240ae6..0f67890423e5 100644 --- a/build.sbt +++ b/build.sbt @@ -654,10 +654,10 @@ lazy val componentModulesPaths = GraalVM.toolsPkgs ++ helidon ++ scalaLibrary ++ - scalaCompiler ++ ioSentry ++ logbackPkg ++ Seq( + "org.scala-lang" % "scala-reflect" % scalacVersion, "org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion, "org.netbeans.api" % "org-netbeans-modules-sampler" % netbeansApiVersion, "com.google.flatbuffers" % "flatbuffers-java" % flatbuffersVersion, @@ -1184,17 +1184,17 @@ lazy val `scala-libs-wrapper` = project modularFatJarWrapperSettings, scalaModuleDependencySetting, javaModuleName := "org.enso.scala.wrapper", - libraryDependencies ++= circe ++ Seq( + libraryDependencies ++= circe ++ scalaCompiler ++ Seq( "com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "org.typelevel" %% "cats-core" % catsVersion, - "org.scala-lang" % "scala-compiler" % scalacVersion, "org.jline" % "jline" % jlineVersion, "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % jsoniterVersion, "net.java.dev.jna" % "jna" % jnaVersion ), - Compile / moduleDependencies ++= scalaCompiler ++ Seq( - "org.jline" % "jline" % jlineVersion, + Compile / moduleDependencies ++= scalaLibrary ++ Seq( + "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.jline" % "jline" % jlineVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "net.java.dev.jna" % "jna" % jnaVersion ), @@ -1204,6 +1204,7 @@ lazy val `scala-libs-wrapper` = project scalaLibrary ++ scalaCompiler ++ Seq( + "org.scala-lang" % "scala-reflect" % scalacVersion, "org.slf4j" % "slf4j-api" % slf4jVersion, "io.github.java-diff-utils" % "java-diff-utils" % javaDiffVersion, "org.jline" % "jline" % jlineVersion, diff --git a/lib/java/scala-libs-wrapper/src/main/java/module-info.java b/lib/java/scala-libs-wrapper/src/main/java/module-info.java index 9a4678553946..04d49c3c5f0a 100644 --- a/lib/java/scala-libs-wrapper/src/main/java/module-info.java +++ b/lib/java/scala-libs-wrapper/src/main/java/module-info.java @@ -1,8 +1,6 @@ module org.enso.scala.wrapper { requires scala.library; requires scala.reflect; - // scala-compiler.jar - requires scala.tools.nsc; requires org.jline; requires org.slf4j; From 4b6bbf3b516ec833dec93e3f787b3e59ee27bd0d Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 25 Sep 2024 16:34:06 +0200 Subject: [PATCH 263/268] Fix IllegalAccessErrors from serde --- build.sbt | 2 ++ engine/polyglot-api/src/main/java/module-info.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/build.sbt b/build.sbt index 0f67890423e5..e819dff86796 100644 --- a/build.sbt +++ b/build.sbt @@ -2120,6 +2120,8 @@ lazy val `polyglot-api` = project Compile / internalModuleDependencies := Seq( (`scala-libs-wrapper` / Compile / exportedModule).value, (`engine-common` / Compile / exportedModule).value, + (`editions` / Compile / exportedModule).value, + (`pkg` / Compile / exportedModule).value, (`logging-utils` / Compile / exportedModule).value, (`text-buffer` / Compile / exportedModule).value, (`polyglot-api-macros` / Compile / exportedModule).value diff --git a/engine/polyglot-api/src/main/java/module-info.java b/engine/polyglot-api/src/main/java/module-info.java index aa2a9a4f6ca2..b0d8fa9fe105 100644 --- a/engine/polyglot-api/src/main/java/module-info.java +++ b/engine/polyglot-api/src/main/java/module-info.java @@ -5,8 +5,10 @@ requires org.graalvm.polyglot; requires org.enso.engine.common; + requires org.enso.editions; requires org.enso.logging.utils; requires org.enso.scala.wrapper; + requires org.enso.pkg; requires org.enso.polyglot.api.macros; requires org.enso.text.buffer; From f439835d1aea75ccf823c18438cdc65ee07e503b Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 25 Sep 2024 16:54:19 +0200 Subject: [PATCH 264/268] typos --- .../runtime-instrument-common/src/main/java/module-info.java | 1 - lib/java/akka-wrapper/src/main/java/module-info.java | 2 +- .../org/enso/projectmanager/TestLogProviderOnClasspath.java | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/engine/runtime-instrument-common/src/main/java/module-info.java b/engine/runtime-instrument-common/src/main/java/module-info.java index aa4df1340861..437c0f4f059c 100644 --- a/engine/runtime-instrument-common/src/main/java/module-info.java +++ b/engine/runtime-instrument-common/src/main/java/module-info.java @@ -22,7 +22,6 @@ requires org.graalvm.truffle; requires org.graalvm.polyglot; - // TODO: com.oracle.truffle.api.TruffleContext? exports org.enso.interpreter.instrument; exports org.enso.interpreter.service; diff --git a/lib/java/akka-wrapper/src/main/java/module-info.java b/lib/java/akka-wrapper/src/main/java/module-info.java index e137feeadcde..d4f85e94c190 100644 --- a/lib/java/akka-wrapper/src/main/java/module-info.java +++ b/lib/java/akka-wrapper/src/main/java/module-info.java @@ -128,7 +128,7 @@ // io.spray:spray-json_2.13 exports spray.json; - // scala-lang.modules:scala-arser-combinators_2.13:1.1.2 + // scala-lang.modules:scala-parser-combinators_2.13:1.1.2 // Loaded by classes from com.typesafe.sslconfig.ssl.* exports scala.util.parsing.combinator; exports scala.util.parsing.combinator.lexical; diff --git a/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java b/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java index 7f78742c4911..ba53670b0d39 100644 --- a/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java +++ b/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java @@ -12,8 +12,7 @@ import org.slf4j.spi.SLF4JServiceProvider; /** - * In the `runtime/Test` testing suite, {@link - * }org.enso.logging.service.logback.test.provider.TestLogProvider} should be among the logging + * In the `runtime/Test` testing suite, {@link org.enso.logging.service.logback.test.provider.TestLogProvider} should be among the logging * providers, because it is explicitly chosen as the logging provider for the tests. * *

Note that the same test is in the `runtime/Test` project. From a281746f39d99d186e57fa4b63deaf5aa1fbbcb7 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 25 Sep 2024 17:55:51 +0200 Subject: [PATCH 265/268] License review --- distribution/engine/THIRD-PARTY/NOTICE | 32 ++- .../NOTICES | 13 ++ .../net.java.dev.jna.jna-5.14.0/NOTICES | 29 +++ .../org.graalvm.sdk.jniutils-24.0.0/NOTICES | 13 ++ .../NOTICES | 43 ++++ .../NOTICES | 17 ++ .../NOTICES | 31 +++ .../LICENSE | 201 ++++++++++++++++++ .../NOTICE | 16 ++ .../NOTICES | 9 + distribution/launcher/THIRD-PARTY/NOTICE | 30 +++ .../LICENSE | 21 ++ .../LICENSE | 21 ++ .../NOTICES | 41 ++++ .../THIRD-PARTY/licenses/BSD-3-Clause | 9 + .../net.java.dev.jna.jna-5.14.0/NOTICES | 29 +++ .../org.jline.jline-3.23.0/NOTICES | 37 ++++ .../LICENSE | 201 ++++++++++++++++++ .../NOTICE | 16 ++ .../NOTICES | 11 + .../project-manager/THIRD-PARTY/NOTICE | 20 ++ .../NOTICES | 13 ++ .../THIRD-PARTY/licenses/BSD-3-Clause | 9 + .../net.java.dev.jna.jna-5.14.0/NOTICES | 29 +++ .../org.jline.jline-3.23.0/NOTICES | 73 +++++++ .../LICENSE | 201 ++++++++++++++++++ .../NOTICE | 16 ++ .../NOTICES | 11 + .../copyright-keep | 7 + .../copyright-ignore | 1 - .../copyright-keep | 4 +- .../copyright-keep | 7 + .../copyright-keep | 22 ++ .../copyright-keep | 9 + .../copyright-keep | 16 ++ .../copyright-ignore | 7 + .../copyright-keep | 5 + .../default-and-custom-license | 0 .../files-keep | 2 + tools/legal-review/engine/report-state | 4 +- .../default-and-custom-license | 0 .../files-keep | 1 + .../default-and-custom-license | 0 .../files-keep | 1 + .../copyright-keep | 5 + .../copyright-keep-context | 2 + .../copyright-keep | 14 +- .../org.jline.jline-3.23.0/copyright-keep | 19 ++ .../copyright-ignore | 6 + .../copyright-keep | 6 + .../default-and-custom-license | 0 .../files-keep | 2 + tools/legal-review/launcher/report-state | 4 +- .../reviewed-licenses/The_BSD_License | 1 + .../copyright-keep | 7 + .../copyright-keep | 13 ++ .../copyright-keep-context | 2 + .../org.jline.jline-3.23.0/copyright-keep | 17 ++ .../copyright-keep-context | 2 + .../copyright-ignore | 6 + .../copyright-keep | 6 + .../default-and-custom-license | 0 .../files-keep | 2 + .../legal-review/project-manager/report-state | 4 +- .../reviewed-licenses/The_BSD_License | 1 + 65 files changed, 1376 insertions(+), 21 deletions(-) create mode 100644 distribution/engine/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES create mode 100644 distribution/engine/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES create mode 100644 distribution/engine/THIRD-PARTY/org.graalvm.sdk.jniutils-24.0.0/NOTICES create mode 100644 distribution/engine/THIRD-PARTY/org.graalvm.tools.chromeinspector-tool-24.0.0/NOTICES create mode 100644 distribution/engine/THIRD-PARTY/org.graalvm.truffle.truffle-compiler-24.0.0/NOTICES create mode 100644 distribution/engine/THIRD-PARTY/org.graalvm.truffle.truffle-runtime-24.0.0/NOTICES create mode 100644 distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE create mode 100644 distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE create mode 100644 distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES create mode 100644 distribution/launcher/THIRD-PARTY/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/LICENSE create mode 100644 distribution/launcher/THIRD-PARTY/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/LICENSE create mode 100644 distribution/launcher/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES create mode 100644 distribution/launcher/THIRD-PARTY/licenses/BSD-3-Clause create mode 100644 distribution/launcher/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES create mode 100644 distribution/launcher/THIRD-PARTY/org.jline.jline-3.23.0/NOTICES create mode 100644 distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE create mode 100644 distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE create mode 100644 distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES create mode 100644 distribution/project-manager/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES create mode 100644 distribution/project-manager/THIRD-PARTY/licenses/BSD-3-Clause create mode 100644 distribution/project-manager/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES create mode 100644 distribution/project-manager/THIRD-PARTY/org.jline.jline-3.23.0/NOTICES create mode 100644 distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE create mode 100644 distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE create mode 100644 distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES create mode 100644 tools/legal-review/engine/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep delete mode 100644 tools/legal-review/engine/net.java.dev.jna.jna-5.12.1/copyright-ignore rename tools/legal-review/engine/{net.java.dev.jna.jna-5.12.1 => net.java.dev.jna.jna-5.14.0}/copyright-keep (89%) create mode 100644 tools/legal-review/engine/org.graalvm.sdk.jniutils-24.0.0/copyright-keep create mode 100644 tools/legal-review/engine/org.graalvm.tools.chromeinspector-tool-24.0.0/copyright-keep create mode 100644 tools/legal-review/engine/org.graalvm.truffle.truffle-compiler-24.0.0/copyright-keep create mode 100644 tools/legal-review/engine/org.graalvm.truffle.truffle-runtime-24.0.0/copyright-keep create mode 100644 tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/copyright-ignore create mode 100644 tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/copyright-keep create mode 100644 tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/default-and-custom-license create mode 100644 tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/files-keep create mode 100644 tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/default-and-custom-license create mode 100644 tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/files-keep create mode 100644 tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/default-and-custom-license create mode 100644 tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/files-keep create mode 100644 tools/legal-review/launcher/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep create mode 100644 tools/legal-review/launcher/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep-context rename distribution/engine/THIRD-PARTY/net.java.dev.jna.jna-5.12.1/NOTICES => tools/legal-review/launcher/net.java.dev.jna.jna-5.14.0/copyright-keep (89%) create mode 100644 tools/legal-review/launcher/org.jline.jline-3.23.0/copyright-keep create mode 100644 tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/copyright-ignore create mode 100644 tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/copyright-keep create mode 100644 tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/default-and-custom-license create mode 100644 tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/files-keep create mode 100644 tools/legal-review/launcher/reviewed-licenses/The_BSD_License create mode 100644 tools/legal-review/project-manager/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep create mode 100644 tools/legal-review/project-manager/net.java.dev.jna.jna-5.14.0/copyright-keep create mode 100644 tools/legal-review/project-manager/net.java.dev.jna.jna-5.14.0/copyright-keep-context create mode 100644 tools/legal-review/project-manager/org.jline.jline-3.23.0/copyright-keep create mode 100644 tools/legal-review/project-manager/org.jline.jline-3.23.0/copyright-keep-context create mode 100644 tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/copyright-ignore create mode 100644 tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/copyright-keep create mode 100644 tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/default-and-custom-license create mode 100644 tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/files-keep create mode 100644 tools/legal-review/project-manager/reviewed-licenses/The_BSD_License diff --git a/distribution/engine/THIRD-PARTY/NOTICE b/distribution/engine/THIRD-PARTY/NOTICE index 46beb0b7e6f7..6e2221a492a6 100644 --- a/distribution/engine/THIRD-PARTY/NOTICE +++ b/distribution/engine/THIRD-PARTY/NOTICE @@ -201,6 +201,11 @@ The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `io.circe.circe-parser_2.13-0.14.7`. +'java-diff-utils', licensed under the The Apache Software License, Version 2.0, is distributed with the engine. +The license file can be found at `licenses/APACHE2.0`. +Copyright notices related to this dependency can be found in the directory `io.github.java-diff-utils.java-diff-utils-4.12`. + + 'helidon-builder-api', licensed under the Apache 2.0, is distributed with the engine. The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `io.helidon.builder.helidon-builder-api-4.0.8`. @@ -383,7 +388,7 @@ Copyright notices related to this dependency can be found in the directory `jaka 'jna', licensed under the Apache-2.0, is distributed with the engine. The license file can be found at `licenses/APACHE2.0`. -Copyright notices related to this dependency can be found in the directory `net.java.dev.jna.jna-5.12.1`. +Copyright notices related to this dependency can be found in the directory `net.java.dev.jna.jna-5.14.0`. 'commons-compress', licensed under the Apache-2.0, is distributed with the engine. @@ -456,6 +461,11 @@ The license file can be found at `licenses/Universal_Permissive_License__Version Copyright notices related to this dependency can be found in the directory `org.graalvm.sdk.collections-24.0.0`. +'jniutils', licensed under the Universal Permissive License, Version 1.0, is distributed with the engine. +The license file can be found at `licenses/Universal_Permissive_License__Version_1.0`. +Copyright notices related to this dependency can be found in the directory `org.graalvm.sdk.jniutils-24.0.0`. + + 'nativeimage', licensed under the Universal Permissive License, Version 1.0, is distributed with the engine. The license file can be found at `licenses/Universal_Permissive_License__Version_1.0`. Copyright notices related to this dependency can be found in the directory `org.graalvm.sdk.nativeimage-24.0.0`. @@ -481,6 +491,11 @@ The license file can be found at `licenses/Universal_Permissive_License__Version Copyright notices related to this dependency can be found in the directory `org.graalvm.shadowed.xz-24.0.0`. +'chromeinspector-tool', licensed under the GNU General Public License, version 2, with the Classpath Exception, is distributed with the engine. +The license file can be found at `licenses/GNU_General_Public_License__version_2__with_the_Classpath_Exception`. +Copyright notices related to this dependency can be found in the directory `org.graalvm.tools.chromeinspector-tool-24.0.0`. + + 'profiler-tool', licensed under the GNU General Public License, version 2, with the Classpath Exception, is distributed with the engine. The license file can be found at `licenses/GNU_General_Public_License__version_2__with_the_Classpath_Exception`. Copyright notices related to this dependency can be found in the directory `org.graalvm.tools.profiler-tool-24.0.0`. @@ -491,6 +506,11 @@ The license file can be found at `licenses/Universal_Permissive_License__Version Copyright notices related to this dependency can be found in the directory `org.graalvm.truffle.truffle-api-24.0.0`. +'truffle-compiler', licensed under the Universal Permissive License, Version 1.0, is distributed with the engine. +The license file can be found at `licenses/Universal_Permissive_License__Version_1.0`. +Copyright notices related to this dependency can be found in the directory `org.graalvm.truffle.truffle-compiler-24.0.0`. + + 'truffle-nfi', licensed under the Universal Permissive License, Version 1.0, is distributed with the engine. The license file can be found at `licenses/Universal_Permissive_License__Version_1.0`. Copyright notices related to this dependency can be found in the directory `org.graalvm.truffle.truffle-nfi-24.0.0`. @@ -501,6 +521,11 @@ The license file can be found at `licenses/Universal_Permissive_License__Version Copyright notices related to this dependency can be found in the directory `org.graalvm.truffle.truffle-nfi-libffi-24.0.0`. +'truffle-runtime', licensed under the Universal Permissive License, Version 1.0, is distributed with the engine. +The license file can be found at `licenses/Universal_Permissive_License__Version_1.0`. +Copyright notices related to this dependency can be found in the directory `org.graalvm.truffle.truffle-runtime-24.0.0`. + + 'jline', licensed under the The BSD License, is distributed with the engine. The license file can be found at `licenses/BSD-3-Clause`. Copyright notices related to this dependency can be found in the directory `org.jline.jline-3.23.0`. @@ -536,6 +561,11 @@ The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `org.scala-lang.modules.scala-parser-combinators_2.13-1.1.2`. +'scala-compiler', licensed under the Apache-2.0, is distributed with the engine. +The license file can be found at `licenses/APACHE2.0`. +Copyright notices related to this dependency can be found in the directory `org.scala-lang.scala-compiler-2.13.11`. + + 'scala-library', licensed under the Apache-2.0, is distributed with the engine. The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `org.scala-lang.scala-library-2.13.11`. diff --git a/distribution/engine/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES b/distribution/engine/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES new file mode 100644 index 000000000000..a1238ebd303e --- /dev/null +++ b/distribution/engine/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES @@ -0,0 +1,13 @@ +Copyright (C) 2009 - 2017 java-diff-utils + +Copyright 2009-2017 java-diff-utils. + +Copyright 2017 java-diff-utils. + +Copyright 2018 java-diff-utils. + +Copyright 2019 java-diff-utils. + +Copyright 2020 java-diff-utils. + +Copyright 2021 java-diff-utils. diff --git a/distribution/engine/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES b/distribution/engine/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES new file mode 100644 index 000000000000..ff7264fb2cba --- /dev/null +++ b/distribution/engine/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES @@ -0,0 +1,29 @@ +Copyright (c) 2007 Timothy Wall, All Rights Reserved + +Copyright (c) 2007 Wayne Meissner, All Rights Reserved + +Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved + +Copyright (c) 2007-2012 Timothy Wall, All Rights Reserved + +Copyright (c) 2007-2013 Timothy Wall, All Rights Reserved + +Copyright (c) 2007-2015 Timothy Wall, All Rights Reserved + +Copyright (c) 2009 Timothy Wall, All Rights Reserved + +Copyright (c) 2011 Timothy Wall, All Rights Reserved + +Copyright (c) 2012 Timothy Wall, All Rights Reserved + +Copyright (c) 2017 Matthias Bläsing, All Rights Reserved + +Copyright (c) 2018 Matthias Bläsing + +Copyright (c) 2019 Matthias Bläsing, All Rights Reserved + +Copyright (c) 2021, Matthias Bläsing, All Rights Reserved + +Copyright (c) 2022 Carlos Ballesteros, All Rights Reserved + +Copyright 2007 Timothy Wall diff --git a/distribution/engine/THIRD-PARTY/org.graalvm.sdk.jniutils-24.0.0/NOTICES b/distribution/engine/THIRD-PARTY/org.graalvm.sdk.jniutils-24.0.0/NOTICES new file mode 100644 index 000000000000..b306ef52d7a1 --- /dev/null +++ b/distribution/engine/THIRD-PARTY/org.graalvm.sdk.jniutils-24.0.0/NOTICES @@ -0,0 +1,13 @@ +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + +Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + +The above copyright notice and either this complete permission notice or at a + +copyright rights in the Software, and any and all patent rights owned or diff --git a/distribution/engine/THIRD-PARTY/org.graalvm.tools.chromeinspector-tool-24.0.0/NOTICES b/distribution/engine/THIRD-PARTY/org.graalvm.tools.chromeinspector-tool-24.0.0/NOTICES new file mode 100644 index 000000000000..2254d51226fb --- /dev/null +++ b/distribution/engine/THIRD-PARTY/org.graalvm.tools.chromeinspector-tool-24.0.0/NOTICES @@ -0,0 +1,43 @@ +Copyright (c) 2010-2020 Nathan Rajlich + +Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + +The above copyright notice and this permission notice shall be diff --git a/distribution/engine/THIRD-PARTY/org.graalvm.truffle.truffle-compiler-24.0.0/NOTICES b/distribution/engine/THIRD-PARTY/org.graalvm.truffle.truffle-compiler-24.0.0/NOTICES new file mode 100644 index 000000000000..964b1f452f25 --- /dev/null +++ b/distribution/engine/THIRD-PARTY/org.graalvm.truffle.truffle-compiler-24.0.0/NOTICES @@ -0,0 +1,17 @@ +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + +Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved. + +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + +The above copyright notice and either this complete permission notice or at a + +copyright rights in the Software, and any and all patent rights owned or diff --git a/distribution/engine/THIRD-PARTY/org.graalvm.truffle.truffle-runtime-24.0.0/NOTICES b/distribution/engine/THIRD-PARTY/org.graalvm.truffle.truffle-runtime-24.0.0/NOTICES new file mode 100644 index 000000000000..b42345fede90 --- /dev/null +++ b/distribution/engine/THIRD-PARTY/org.graalvm.truffle.truffle-runtime-24.0.0/NOTICES @@ -0,0 +1,31 @@ +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + +Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved. + +Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + +The above copyright notice and either this complete permission notice or at a + +copyright rights in the Software, and any and all patent rights owned or diff --git a/distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE b/distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE new file mode 100644 index 000000000000..261eeb9e9f8b --- /dev/null +++ b/distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE b/distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE new file mode 100644 index 000000000000..5bceee7b366a --- /dev/null +++ b/distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE @@ -0,0 +1,16 @@ +Scala +Copyright (c) 2002-2023 EPFL +Copyright (c) 2011-2023 Lightbend, Inc. + +Scala includes software developed at +LAMP/EPFL (https://lamp.epfl.ch/) and +Lightbend, Inc. (https://www.lightbend.com/). + +Licensed under the Apache License, Version 2.0 (the "License"). +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +This software includes projects with other licenses -- see `doc/LICENSE.md`. diff --git a/distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES b/distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES new file mode 100644 index 000000000000..ffad47f71a4d --- /dev/null +++ b/distribution/engine/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES @@ -0,0 +1,9 @@ +Copyright 2002-2017 LAMP/EPFL and Lightbend, Inc. + +Copyright 2005-2013 LAMP/EPFL + +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc + +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc. + +Copyright EPFL and Lightbend, Inc. diff --git a/distribution/launcher/THIRD-PARTY/NOTICE b/distribution/launcher/THIRD-PARTY/NOTICE index cb590dcc28a5..a82fd5ac1607 100644 --- a/distribution/launcher/THIRD-PARTY/NOTICE +++ b/distribution/launcher/THIRD-PARTY/NOTICE @@ -21,6 +21,16 @@ The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `com.chuusai.shapeless_2.13-2.3.10`. +'jsoniter-scala-core_2.13', licensed under the MIT License, is distributed with the launcher. +The license file can be found at `licenses/MIT`. +Copyright notices related to this dependency can be found in the directory `com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5`. + + +'jsoniter-scala-macros_2.13', licensed under the MIT License, is distributed with the launcher. +The license file can be found at `licenses/MIT`. +Copyright notices related to this dependency can be found in the directory `com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5`. + + 'akka-actor_2.13', licensed under the Apache-2.0, is distributed with the launcher. The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `com.typesafe.akka.akka-actor_2.13-2.6.20`. @@ -86,16 +96,36 @@ The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `io.circe.circe-parser_2.13-0.14.7`. +'java-diff-utils', licensed under the The Apache Software License, Version 2.0, is distributed with the launcher. +The license file can be found at `licenses/APACHE2.0`. +Copyright notices related to this dependency can be found in the directory `io.github.java-diff-utils.java-diff-utils-4.12`. + + +'jna', licensed under the Apache-2.0, is distributed with the launcher. +The license file can be found at `licenses/APACHE2.0`. +Copyright notices related to this dependency can be found in the directory `net.java.dev.jna.jna-5.14.0`. + + 'commons-compress', licensed under the Apache-2.0, is distributed with the launcher. The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `org.apache.commons.commons-compress-1.23.0`. +'jline', licensed under the The BSD License, is distributed with the launcher. +The license file can be found at `licenses/BSD-3-Clause`. +Copyright notices related to this dependency can be found in the directory `org.jline.jline-3.23.0`. + + 'scala-java8-compat_2.13', licensed under the Apache-2.0, is distributed with the launcher. The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `org.scala-lang.modules.scala-java8-compat_2.13-1.0.0`. +'scala-compiler', licensed under the Apache-2.0, is distributed with the launcher. +The license file can be found at `licenses/APACHE2.0`. +Copyright notices related to this dependency can be found in the directory `org.scala-lang.scala-compiler-2.13.11`. + + 'scala-library', licensed under the Apache-2.0, is distributed with the launcher. The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `org.scala-lang.scala-library-2.13.11`. diff --git a/distribution/launcher/THIRD-PARTY/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/LICENSE b/distribution/launcher/THIRD-PARTY/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/LICENSE new file mode 100644 index 000000000000..a33507599b43 --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Andriy Plokhotnyuk, and respective contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/distribution/launcher/THIRD-PARTY/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/LICENSE b/distribution/launcher/THIRD-PARTY/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/LICENSE new file mode 100644 index 000000000000..a33507599b43 --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Andriy Plokhotnyuk, and respective contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/distribution/launcher/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES b/distribution/launcher/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES new file mode 100644 index 000000000000..cdeb637890f5 --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES @@ -0,0 +1,41 @@ +/* + * Copyright 2018 java-diff-utils. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Copyright 2019 java-diff-utils. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Copyright (C) 2009 - 2017 java-diff-utils + +Copyright 2009-2017 java-diff-utils. + +Copyright 2017 java-diff-utils. + +Copyright 2020 java-diff-utils. + +Copyright 2021 java-diff-utils. diff --git a/distribution/launcher/THIRD-PARTY/licenses/BSD-3-Clause b/distribution/launcher/THIRD-PARTY/licenses/BSD-3-Clause new file mode 100644 index 000000000000..731a7373159e --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/licenses/BSD-3-Clause @@ -0,0 +1,9 @@ +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/distribution/launcher/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES b/distribution/launcher/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES new file mode 100644 index 000000000000..ff7264fb2cba --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES @@ -0,0 +1,29 @@ +Copyright (c) 2007 Timothy Wall, All Rights Reserved + +Copyright (c) 2007 Wayne Meissner, All Rights Reserved + +Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved + +Copyright (c) 2007-2012 Timothy Wall, All Rights Reserved + +Copyright (c) 2007-2013 Timothy Wall, All Rights Reserved + +Copyright (c) 2007-2015 Timothy Wall, All Rights Reserved + +Copyright (c) 2009 Timothy Wall, All Rights Reserved + +Copyright (c) 2011 Timothy Wall, All Rights Reserved + +Copyright (c) 2012 Timothy Wall, All Rights Reserved + +Copyright (c) 2017 Matthias Bläsing, All Rights Reserved + +Copyright (c) 2018 Matthias Bläsing + +Copyright (c) 2019 Matthias Bläsing, All Rights Reserved + +Copyright (c) 2021, Matthias Bläsing, All Rights Reserved + +Copyright (c) 2022 Carlos Ballesteros, All Rights Reserved + +Copyright 2007 Timothy Wall diff --git a/distribution/launcher/THIRD-PARTY/org.jline.jline-3.23.0/NOTICES b/distribution/launcher/THIRD-PARTY/org.jline.jline-3.23.0/NOTICES new file mode 100644 index 000000000000..d69984f3ea90 --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/org.jline.jline-3.23.0/NOTICES @@ -0,0 +1,37 @@ +Copyright (C) 2022 the original author(s). + +Copyright (c) 2000-2005 Dieter Wimberger + +Copyright (c) 2002-2016, the original author or authors. + +Copyright (c) 2002-2016, the original author(s). + +Copyright (c) 2002-2017, the original author(s). + +Copyright (c) 2002-2018, the original author or authors. + +Copyright (c) 2002-2018, the original author(s). + +Copyright (c) 2002-2019, the original author(s). + +Copyright (c) 2002-2020, the original author or authors. + +Copyright (c) 2002-2020, the original author(s). + +Copyright (c) 2002-2021, the original author(s). + +Copyright (c) 2002-2022, the original author(s). + +Copyright (c) 2002-2023, the original author(s). + +Copyright (c) 2009-2018, the original author(s). + +Copyright (c) 2022, the original author(s). + +Copyright (c) 2023, the original author(s). + +Copyright 2019 the original author or authors. + +regarding copyright ownership. The ASF licenses this file + +this work for additional information regarding copyright ownership. diff --git a/distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE b/distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE new file mode 100644 index 000000000000..261eeb9e9f8b --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE b/distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE new file mode 100644 index 000000000000..5bceee7b366a --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE @@ -0,0 +1,16 @@ +Scala +Copyright (c) 2002-2023 EPFL +Copyright (c) 2011-2023 Lightbend, Inc. + +Scala includes software developed at +LAMP/EPFL (https://lamp.epfl.ch/) and +Lightbend, Inc. (https://www.lightbend.com/). + +Licensed under the Apache License, Version 2.0 (the "License"). +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +This software includes projects with other licenses -- see `doc/LICENSE.md`. diff --git a/distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES b/distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES new file mode 100644 index 000000000000..28f3becac42a --- /dev/null +++ b/distribution/launcher/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES @@ -0,0 +1,11 @@ +Copyright 2002-2017 LAMP/EPFL and Lightbend, Inc. + +Copyright 2005-2013 LAMP/EPFL + +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc + +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc. + +Copyright EPFL and Lightbend, Inc. + +additional information regarding copyright ownership. diff --git a/distribution/project-manager/THIRD-PARTY/NOTICE b/distribution/project-manager/THIRD-PARTY/NOTICE index 0048eb272b67..a2d85053533f 100644 --- a/distribution/project-manager/THIRD-PARTY/NOTICE +++ b/distribution/project-manager/THIRD-PARTY/NOTICE @@ -176,6 +176,11 @@ The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `io.circe.circe-parser_2.13-0.14.7`. +'java-diff-utils', licensed under the The Apache Software License, Version 2.0, is distributed with the project-manager. +The license file can be found at `licenses/APACHE2.0`. +Copyright notices related to this dependency can be found in the directory `io.github.java-diff-utils.java-diff-utils-4.12`. + + 'helidon-builder-api', licensed under the Apache 2.0, is distributed with the project-manager. The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `io.helidon.builder.helidon-builder-api-4.0.8`. @@ -341,6 +346,11 @@ The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `jakarta.inject.jakarta.inject-api-2.0.1`. +'jna', licensed under the Apache-2.0, is distributed with the project-manager. +The license file can be found at `licenses/APACHE2.0`. +Copyright notices related to this dependency can be found in the directory `net.java.dev.jna.jna-5.14.0`. + + 'commons-compress', licensed under the Apache-2.0, is distributed with the project-manager. The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `org.apache.commons.commons-compress-1.23.0`. @@ -351,6 +361,11 @@ The license information can be found along with the copyright notices. Copyright notices related to this dependency can be found in the directory `org.apache.commons.commons-lang3-3.12.0`. +'jline', licensed under the The BSD License, is distributed with the project-manager. +The license file can be found at `licenses/BSD-3-Clause`. +Copyright notices related to this dependency can be found in the directory `org.jline.jline-3.23.0`. + + 'reactive-streams', licensed under the CC0, is distributed with the project-manager. The license file can be found at `licenses/CC0`. Copyright notices related to this dependency can be found in the directory `org.reactivestreams.reactive-streams-1.0.3`. @@ -366,6 +381,11 @@ The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `org.scala-lang.modules.scala-parser-combinators_2.13-1.1.2`. +'scala-compiler', licensed under the Apache-2.0, is distributed with the project-manager. +The license file can be found at `licenses/APACHE2.0`. +Copyright notices related to this dependency can be found in the directory `org.scala-lang.scala-compiler-2.13.11`. + + 'scala-library', licensed under the Apache-2.0, is distributed with the project-manager. The license file can be found at `licenses/APACHE2.0`. Copyright notices related to this dependency can be found in the directory `org.scala-lang.scala-library-2.13.11`. diff --git a/distribution/project-manager/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES b/distribution/project-manager/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES new file mode 100644 index 000000000000..a1238ebd303e --- /dev/null +++ b/distribution/project-manager/THIRD-PARTY/io.github.java-diff-utils.java-diff-utils-4.12/NOTICES @@ -0,0 +1,13 @@ +Copyright (C) 2009 - 2017 java-diff-utils + +Copyright 2009-2017 java-diff-utils. + +Copyright 2017 java-diff-utils. + +Copyright 2018 java-diff-utils. + +Copyright 2019 java-diff-utils. + +Copyright 2020 java-diff-utils. + +Copyright 2021 java-diff-utils. diff --git a/distribution/project-manager/THIRD-PARTY/licenses/BSD-3-Clause b/distribution/project-manager/THIRD-PARTY/licenses/BSD-3-Clause new file mode 100644 index 000000000000..731a7373159e --- /dev/null +++ b/distribution/project-manager/THIRD-PARTY/licenses/BSD-3-Clause @@ -0,0 +1,9 @@ +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/distribution/project-manager/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES b/distribution/project-manager/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES new file mode 100644 index 000000000000..c214b358619a --- /dev/null +++ b/distribution/project-manager/THIRD-PARTY/net.java.dev.jna.jna-5.14.0/NOTICES @@ -0,0 +1,29 @@ +/* Copyright (c) 2012 Timothy Wall, All Rights Reserved + +/* Copyright (c) 2017 Matthias Bläsing, All Rights Reserved + +Copyright (c) 2007 Timothy Wall, All Rights Reserved + +Copyright (c) 2007 Wayne Meissner, All Rights Reserved + +Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved + +Copyright (c) 2007-2012 Timothy Wall, All Rights Reserved + +Copyright (c) 2007-2013 Timothy Wall, All Rights Reserved + +Copyright (c) 2007-2015 Timothy Wall, All Rights Reserved + +Copyright (c) 2009 Timothy Wall, All Rights Reserved + +Copyright (c) 2011 Timothy Wall, All Rights Reserved + +Copyright (c) 2018 Matthias Bläsing + +Copyright (c) 2019 Matthias Bläsing, All Rights Reserved + +Copyright (c) 2021, Matthias Bläsing, All Rights Reserved + +Copyright (c) 2022 Carlos Ballesteros, All Rights Reserved + +Copyright 2007 Timothy Wall diff --git a/distribution/project-manager/THIRD-PARTY/org.jline.jline-3.23.0/NOTICES b/distribution/project-manager/THIRD-PARTY/org.jline.jline-3.23.0/NOTICES new file mode 100644 index 000000000000..8d779e074170 --- /dev/null +++ b/distribution/project-manager/THIRD-PARTY/org.jline.jline-3.23.0/NOTICES @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2002-2017, the original author(s). + * + * This software is distributable under the BSD license. See the terms of the + * BSD license in the documentation provided with this software. + * + * https://opensource.org/licenses/BSD-3-Clause + */ + +/* + * Java TelnetD library (embeddable telnet daemon) + * Copyright (c) 2000-2005 Dieter Wimberger + * All rights reserved. + *

+ * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + *

+ * Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + *

+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ***/ + +Copyright (C) 2022 the original author(s). + +Copyright (c) 2002-2016, the original author or authors. + +Copyright (c) 2002-2016, the original author(s). + +Copyright (c) 2002-2018, the original author or authors. + +Copyright (c) 2002-2018, the original author(s). + +Copyright (c) 2002-2019, the original author(s). + +Copyright (c) 2002-2020, the original author or authors. + +Copyright (c) 2002-2020, the original author(s). + +Copyright (c) 2002-2021, the original author(s). + +Copyright (c) 2002-2022, the original author(s). + +Copyright (c) 2002-2023, the original author(s). + +Copyright (c) 2009-2018, the original author(s). + +Copyright (c) 2022, the original author(s). + +Copyright (c) 2023, the original author(s). + +Copyright 2019 the original author or authors. + +regarding copyright ownership. The ASF licenses this file + +this work for additional information regarding copyright ownership. diff --git a/distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE b/distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE new file mode 100644 index 000000000000..261eeb9e9f8b --- /dev/null +++ b/distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE b/distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE new file mode 100644 index 000000000000..5bceee7b366a --- /dev/null +++ b/distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICE @@ -0,0 +1,16 @@ +Scala +Copyright (c) 2002-2023 EPFL +Copyright (c) 2011-2023 Lightbend, Inc. + +Scala includes software developed at +LAMP/EPFL (https://lamp.epfl.ch/) and +Lightbend, Inc. (https://www.lightbend.com/). + +Licensed under the Apache License, Version 2.0 (the "License"). +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +This software includes projects with other licenses -- see `doc/LICENSE.md`. diff --git a/distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES b/distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES new file mode 100644 index 000000000000..28f3becac42a --- /dev/null +++ b/distribution/project-manager/THIRD-PARTY/org.scala-lang.scala-compiler-2.13.11/NOTICES @@ -0,0 +1,11 @@ +Copyright 2002-2017 LAMP/EPFL and Lightbend, Inc. + +Copyright 2005-2013 LAMP/EPFL + +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc + +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc. + +Copyright EPFL and Lightbend, Inc. + +additional information regarding copyright ownership. diff --git a/tools/legal-review/engine/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep b/tools/legal-review/engine/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep new file mode 100644 index 000000000000..a3e403167764 --- /dev/null +++ b/tools/legal-review/engine/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep @@ -0,0 +1,7 @@ +Copyright (C) 2009 - 2017 java-diff-utils +Copyright 2009-2017 java-diff-utils. +Copyright 2017 java-diff-utils. +Copyright 2018 java-diff-utils. +Copyright 2019 java-diff-utils. +Copyright 2020 java-diff-utils. +Copyright 2021 java-diff-utils. diff --git a/tools/legal-review/engine/net.java.dev.jna.jna-5.12.1/copyright-ignore b/tools/legal-review/engine/net.java.dev.jna.jna-5.12.1/copyright-ignore deleted file mode 100644 index 60ceb70d65a8..000000000000 --- a/tools/legal-review/engine/net.java.dev.jna.jna-5.12.1/copyright-ignore +++ /dev/null @@ -1 +0,0 @@ -Copyright 2007 Timothy Wall diff --git a/tools/legal-review/engine/net.java.dev.jna.jna-5.12.1/copyright-keep b/tools/legal-review/engine/net.java.dev.jna.jna-5.14.0/copyright-keep similarity index 89% rename from tools/legal-review/engine/net.java.dev.jna.jna-5.12.1/copyright-keep rename to tools/legal-review/engine/net.java.dev.jna.jna-5.14.0/copyright-keep index 871364d9737a..489c03ab287c 100644 --- a/tools/legal-review/engine/net.java.dev.jna.jna-5.12.1/copyright-keep +++ b/tools/legal-review/engine/net.java.dev.jna.jna-5.14.0/copyright-keep @@ -1,6 +1,7 @@ Copyright (c) 2007 Timothy Wall, All Rights Reserved Copyright (c) 2007 Wayne Meissner, All Rights Reserved Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved +Copyright (c) 2007-2012 Timothy Wall, All Rights Reserved Copyright (c) 2007-2013 Timothy Wall, All Rights Reserved Copyright (c) 2007-2015 Timothy Wall, All Rights Reserved Copyright (c) 2009 Timothy Wall, All Rights Reserved @@ -9,5 +10,6 @@ Copyright (c) 2012 Timothy Wall, All Rights Reserved Copyright (c) 2017 Matthias Bläsing, All Rights Reserved Copyright (c) 2018 Matthias Bläsing Copyright (c) 2019 Matthias Bläsing, All Rights Reserved -Copyright (c) 2007-2012 Timothy Wall, All Rights Reserved Copyright (c) 2021, Matthias Bläsing, All Rights Reserved +Copyright (c) 2022 Carlos Ballesteros, All Rights Reserved +Copyright 2007 Timothy Wall diff --git a/tools/legal-review/engine/org.graalvm.sdk.jniutils-24.0.0/copyright-keep b/tools/legal-review/engine/org.graalvm.sdk.jniutils-24.0.0/copyright-keep new file mode 100644 index 000000000000..bc8d1a3bd420 --- /dev/null +++ b/tools/legal-review/engine/org.graalvm.sdk.jniutils-24.0.0/copyright-keep @@ -0,0 +1,7 @@ +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +The above copyright notice and either this complete permission notice or at a +copyright rights in the Software, and any and all patent rights owned or diff --git a/tools/legal-review/engine/org.graalvm.tools.chromeinspector-tool-24.0.0/copyright-keep b/tools/legal-review/engine/org.graalvm.tools.chromeinspector-tool-24.0.0/copyright-keep new file mode 100644 index 000000000000..2ba24551e116 --- /dev/null +++ b/tools/legal-review/engine/org.graalvm.tools.chromeinspector-tool-24.0.0/copyright-keep @@ -0,0 +1,22 @@ +Copyright (c) 2010-2020 Nathan Rajlich +Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +The above copyright notice and this permission notice shall be diff --git a/tools/legal-review/engine/org.graalvm.truffle.truffle-compiler-24.0.0/copyright-keep b/tools/legal-review/engine/org.graalvm.truffle.truffle-compiler-24.0.0/copyright-keep new file mode 100644 index 000000000000..5504ba9ac491 --- /dev/null +++ b/tools/legal-review/engine/org.graalvm.truffle.truffle-compiler-24.0.0/copyright-keep @@ -0,0 +1,9 @@ +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved. +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +The above copyright notice and either this complete permission notice or at a +copyright rights in the Software, and any and all patent rights owned or diff --git a/tools/legal-review/engine/org.graalvm.truffle.truffle-runtime-24.0.0/copyright-keep b/tools/legal-review/engine/org.graalvm.truffle.truffle-runtime-24.0.0/copyright-keep new file mode 100644 index 000000000000..726fb1a2ac50 --- /dev/null +++ b/tools/legal-review/engine/org.graalvm.truffle.truffle-runtime-24.0.0/copyright-keep @@ -0,0 +1,16 @@ +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. +DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +The above copyright notice and either this complete permission notice or at a +copyright rights in the Software, and any and all patent rights owned or diff --git a/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/copyright-ignore b/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/copyright-ignore new file mode 100644 index 000000000000..e1d2bdd31c44 --- /dev/null +++ b/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/copyright-ignore @@ -0,0 +1,7 @@ +"A footer on every Scaladoc page, by default the EPFL/Lightbend copyright notice. Can be overridden with a custom footer.", +Div(id = "footer", elems = Txt("Scala programming documentation. Copyright (c) 2002-2023 ") :: A(href = "https://www.epfl.ch", target = "_top", elems = Txt("EPFL")) :: Txt(" and ") :: A(href = "https://www.lightbend.com", target = "_top", elems = Txt("Lightbend")) :: Txt(".")) +Properties.copyrightString +additional information regarding copyright ownership. +rem # Copyright EPFL and Lightbend, Inc. +rem # additional information regarding copyright ownership. +val versionMsg = s"Scaladoc ${Properties.versionString} -- ${Properties.copyrightString}" diff --git a/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/copyright-keep b/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/copyright-keep new file mode 100644 index 000000000000..44e14e43e3af --- /dev/null +++ b/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/copyright-keep @@ -0,0 +1,5 @@ +Copyright 2002-2017 LAMP/EPFL and Lightbend, Inc. +Copyright 2005-2013 LAMP/EPFL +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc. +Copyright EPFL and Lightbend, Inc. diff --git a/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/default-and-custom-license b/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/default-and-custom-license new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/files-keep b/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/files-keep new file mode 100644 index 000000000000..9ef2c9b4d859 --- /dev/null +++ b/tools/legal-review/engine/org.scala-lang.scala-compiler-2.13.11/files-keep @@ -0,0 +1,2 @@ +LICENSE +NOTICE diff --git a/tools/legal-review/engine/report-state b/tools/legal-review/engine/report-state index 438247edc394..75d0b6949c92 100644 --- a/tools/legal-review/engine/report-state +++ b/tools/legal-review/engine/report-state @@ -1,3 +1,3 @@ -C718BB86771844038E1BB1BA727149161FF58ECBC8BC7D7F67184FFD380ED42D -A4D2615997541FBF4E5539AF13EB9B21FD029529A4E832E2204E9D4FC4460CAE +BB86D1B567C0AAA64F305458CF8B9D010E79E58F0FF2C832342D5F5CA52594E4 +EEA31A0407950FBDE014CDD81ABA2D1BDCDC0723BD210D47CC7D4DA1B73A0D20 0 diff --git a/tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/default-and-custom-license b/tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/default-and-custom-license new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/files-keep b/tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/files-keep new file mode 100644 index 000000000000..ed345faefcec --- /dev/null +++ b/tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-core_2.13-2.28.5/files-keep @@ -0,0 +1 @@ +/plokhotnyuk/jsoniter-scala/blob/master/LICENSE diff --git a/tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/default-and-custom-license b/tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/default-and-custom-license new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/files-keep b/tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/files-keep new file mode 100644 index 000000000000..ed345faefcec --- /dev/null +++ b/tools/legal-review/launcher/com.github.plokhotnyuk.jsoniter-scala.jsoniter-scala-macros_2.13-2.28.5/files-keep @@ -0,0 +1 @@ +/plokhotnyuk/jsoniter-scala/blob/master/LICENSE diff --git a/tools/legal-review/launcher/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep b/tools/legal-review/launcher/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep new file mode 100644 index 000000000000..b5e96fbe69ec --- /dev/null +++ b/tools/legal-review/launcher/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep @@ -0,0 +1,5 @@ +Copyright (C) 2009 - 2017 java-diff-utils +Copyright 2009-2017 java-diff-utils. +Copyright 2017 java-diff-utils. +Copyright 2020 java-diff-utils. +Copyright 2021 java-diff-utils. diff --git a/tools/legal-review/launcher/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep-context b/tools/legal-review/launcher/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep-context new file mode 100644 index 000000000000..308bb604ced8 --- /dev/null +++ b/tools/legal-review/launcher/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep-context @@ -0,0 +1,2 @@ +Copyright 2018 java-diff-utils. +Copyright 2019 java-diff-utils. diff --git a/distribution/engine/THIRD-PARTY/net.java.dev.jna.jna-5.12.1/NOTICES b/tools/legal-review/launcher/net.java.dev.jna.jna-5.14.0/copyright-keep similarity index 89% rename from distribution/engine/THIRD-PARTY/net.java.dev.jna.jna-5.12.1/NOTICES rename to tools/legal-review/launcher/net.java.dev.jna.jna-5.14.0/copyright-keep index aedb25f10454..489c03ab287c 100644 --- a/distribution/engine/THIRD-PARTY/net.java.dev.jna.jna-5.12.1/NOTICES +++ b/tools/legal-review/launcher/net.java.dev.jna.jna-5.14.0/copyright-keep @@ -1,25 +1,15 @@ Copyright (c) 2007 Timothy Wall, All Rights Reserved - Copyright (c) 2007 Wayne Meissner, All Rights Reserved - Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved - Copyright (c) 2007-2012 Timothy Wall, All Rights Reserved - Copyright (c) 2007-2013 Timothy Wall, All Rights Reserved - Copyright (c) 2007-2015 Timothy Wall, All Rights Reserved - Copyright (c) 2009 Timothy Wall, All Rights Reserved - Copyright (c) 2011 Timothy Wall, All Rights Reserved - Copyright (c) 2012 Timothy Wall, All Rights Reserved - Copyright (c) 2017 Matthias Bläsing, All Rights Reserved - Copyright (c) 2018 Matthias Bläsing - Copyright (c) 2019 Matthias Bläsing, All Rights Reserved - Copyright (c) 2021, Matthias Bläsing, All Rights Reserved +Copyright (c) 2022 Carlos Ballesteros, All Rights Reserved +Copyright 2007 Timothy Wall diff --git a/tools/legal-review/launcher/org.jline.jline-3.23.0/copyright-keep b/tools/legal-review/launcher/org.jline.jline-3.23.0/copyright-keep new file mode 100644 index 000000000000..ebc27285eeba --- /dev/null +++ b/tools/legal-review/launcher/org.jline.jline-3.23.0/copyright-keep @@ -0,0 +1,19 @@ +Copyright (C) 2022 the original author(s). +Copyright (c) 2000-2005 Dieter Wimberger +Copyright (c) 2002-2016, the original author or authors. +Copyright (c) 2002-2016, the original author(s). +Copyright (c) 2002-2017, the original author(s). +Copyright (c) 2002-2018, the original author or authors. +Copyright (c) 2002-2018, the original author(s). +Copyright (c) 2002-2019, the original author(s). +Copyright (c) 2002-2020, the original author or authors. +Copyright (c) 2002-2020, the original author(s). +Copyright (c) 2002-2021, the original author(s). +Copyright (c) 2002-2022, the original author(s). +Copyright (c) 2002-2023, the original author(s). +Copyright (c) 2009-2018, the original author(s). +Copyright (c) 2022, the original author(s). +Copyright (c) 2023, the original author(s). +Copyright 2019 the original author or authors. +regarding copyright ownership. The ASF licenses this file +this work for additional information regarding copyright ownership. diff --git a/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/copyright-ignore b/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/copyright-ignore new file mode 100644 index 000000000000..da57f7f4fd90 --- /dev/null +++ b/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/copyright-ignore @@ -0,0 +1,6 @@ +"A footer on every Scaladoc page, by default the EPFL/Lightbend copyright notice. Can be overridden with a custom footer.", +Div(id = "footer", elems = Txt("Scala programming documentation. Copyright (c) 2002-2023 ") :: A(href = "https://www.epfl.ch", target = "_top", elems = Txt("EPFL")) :: Txt(" and ") :: A(href = "https://www.lightbend.com", target = "_top", elems = Txt("Lightbend")) :: Txt(".")) +Properties.copyrightString +rem # Copyright EPFL and Lightbend, Inc. +rem # additional information regarding copyright ownership. +val versionMsg = s"Scaladoc ${Properties.versionString} -- ${Properties.copyrightString}" diff --git a/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/copyright-keep b/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/copyright-keep new file mode 100644 index 000000000000..826fec04eaa3 --- /dev/null +++ b/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/copyright-keep @@ -0,0 +1,6 @@ +Copyright 2002-2017 LAMP/EPFL and Lightbend, Inc. +Copyright 2005-2013 LAMP/EPFL +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc. +Copyright EPFL and Lightbend, Inc. +additional information regarding copyright ownership. diff --git a/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/default-and-custom-license b/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/default-and-custom-license new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/files-keep b/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/files-keep new file mode 100644 index 000000000000..7b5afa970a01 --- /dev/null +++ b/tools/legal-review/launcher/org.scala-lang.scala-compiler-2.13.11/files-keep @@ -0,0 +1,2 @@ +NOTICE +LICENSE diff --git a/tools/legal-review/launcher/report-state b/tools/legal-review/launcher/report-state index 288ec5466753..f35a97096a72 100644 --- a/tools/legal-review/launcher/report-state +++ b/tools/legal-review/launcher/report-state @@ -1,3 +1,3 @@ -61FA814CA4FC0688FB059CC530561D4B5E329B33919A6DBEAD9CBD9C19D49337 -F356D9CC4CE4F118B02747EBA189642FCFB2EA96121262374402C3BA3B6B5ECD +42A92935AB5EAF576CE4EE0ACB6C887DE0F5419DD454A5EBA39423FA07DFB5A5 +CD5084004A695E9EE0C26239A10F9D3129D02AC9A85C72950A56B468F597FB36 0 diff --git a/tools/legal-review/launcher/reviewed-licenses/The_BSD_License b/tools/legal-review/launcher/reviewed-licenses/The_BSD_License new file mode 100644 index 000000000000..c547acb36c9b --- /dev/null +++ b/tools/legal-review/launcher/reviewed-licenses/The_BSD_License @@ -0,0 +1 @@ +tools/legal-review/license-texts/BSD-3-Clause diff --git a/tools/legal-review/project-manager/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep b/tools/legal-review/project-manager/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep new file mode 100644 index 000000000000..a3e403167764 --- /dev/null +++ b/tools/legal-review/project-manager/io.github.java-diff-utils.java-diff-utils-4.12/copyright-keep @@ -0,0 +1,7 @@ +Copyright (C) 2009 - 2017 java-diff-utils +Copyright 2009-2017 java-diff-utils. +Copyright 2017 java-diff-utils. +Copyright 2018 java-diff-utils. +Copyright 2019 java-diff-utils. +Copyright 2020 java-diff-utils. +Copyright 2021 java-diff-utils. diff --git a/tools/legal-review/project-manager/net.java.dev.jna.jna-5.14.0/copyright-keep b/tools/legal-review/project-manager/net.java.dev.jna.jna-5.14.0/copyright-keep new file mode 100644 index 000000000000..441eb2c5f0b6 --- /dev/null +++ b/tools/legal-review/project-manager/net.java.dev.jna.jna-5.14.0/copyright-keep @@ -0,0 +1,13 @@ +Copyright (c) 2007 Timothy Wall, All Rights Reserved +Copyright (c) 2007 Wayne Meissner, All Rights Reserved +Copyright (c) 2007-2008 Timothy Wall, All Rights Reserved +Copyright (c) 2007-2012 Timothy Wall, All Rights Reserved +Copyright (c) 2007-2013 Timothy Wall, All Rights Reserved +Copyright (c) 2007-2015 Timothy Wall, All Rights Reserved +Copyright (c) 2009 Timothy Wall, All Rights Reserved +Copyright (c) 2011 Timothy Wall, All Rights Reserved +Copyright (c) 2018 Matthias Bläsing +Copyright (c) 2019 Matthias Bläsing, All Rights Reserved +Copyright (c) 2021, Matthias Bläsing, All Rights Reserved +Copyright (c) 2022 Carlos Ballesteros, All Rights Reserved +Copyright 2007 Timothy Wall diff --git a/tools/legal-review/project-manager/net.java.dev.jna.jna-5.14.0/copyright-keep-context b/tools/legal-review/project-manager/net.java.dev.jna.jna-5.14.0/copyright-keep-context new file mode 100644 index 000000000000..8761961d7bfc --- /dev/null +++ b/tools/legal-review/project-manager/net.java.dev.jna.jna-5.14.0/copyright-keep-context @@ -0,0 +1,2 @@ +Copyright (c) 2012 Timothy Wall, All Rights Reserved +Copyright (c) 2017 Matthias Bläsing, All Rights Reserved diff --git a/tools/legal-review/project-manager/org.jline.jline-3.23.0/copyright-keep b/tools/legal-review/project-manager/org.jline.jline-3.23.0/copyright-keep new file mode 100644 index 000000000000..eb81f73fb954 --- /dev/null +++ b/tools/legal-review/project-manager/org.jline.jline-3.23.0/copyright-keep @@ -0,0 +1,17 @@ +Copyright (C) 2022 the original author(s). +Copyright (c) 2002-2016, the original author or authors. +Copyright (c) 2002-2016, the original author(s). +Copyright (c) 2002-2018, the original author or authors. +Copyright (c) 2002-2018, the original author(s). +Copyright (c) 2002-2019, the original author(s). +Copyright (c) 2002-2020, the original author or authors. +Copyright (c) 2002-2020, the original author(s). +Copyright (c) 2002-2021, the original author(s). +Copyright (c) 2002-2022, the original author(s). +Copyright (c) 2002-2023, the original author(s). +Copyright (c) 2009-2018, the original author(s). +Copyright (c) 2022, the original author(s). +Copyright (c) 2023, the original author(s). +Copyright 2019 the original author or authors. +regarding copyright ownership. The ASF licenses this file +this work for additional information regarding copyright ownership. diff --git a/tools/legal-review/project-manager/org.jline.jline-3.23.0/copyright-keep-context b/tools/legal-review/project-manager/org.jline.jline-3.23.0/copyright-keep-context new file mode 100644 index 000000000000..44d9fb1c3272 --- /dev/null +++ b/tools/legal-review/project-manager/org.jline.jline-3.23.0/copyright-keep-context @@ -0,0 +1,2 @@ +Copyright (c) 2000-2005 Dieter Wimberger +Copyright (c) 2002-2017, the original author(s). diff --git a/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/copyright-ignore b/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/copyright-ignore new file mode 100644 index 000000000000..da57f7f4fd90 --- /dev/null +++ b/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/copyright-ignore @@ -0,0 +1,6 @@ +"A footer on every Scaladoc page, by default the EPFL/Lightbend copyright notice. Can be overridden with a custom footer.", +Div(id = "footer", elems = Txt("Scala programming documentation. Copyright (c) 2002-2023 ") :: A(href = "https://www.epfl.ch", target = "_top", elems = Txt("EPFL")) :: Txt(" and ") :: A(href = "https://www.lightbend.com", target = "_top", elems = Txt("Lightbend")) :: Txt(".")) +Properties.copyrightString +rem # Copyright EPFL and Lightbend, Inc. +rem # additional information regarding copyright ownership. +val versionMsg = s"Scaladoc ${Properties.versionString} -- ${Properties.copyrightString}" diff --git a/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/copyright-keep b/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/copyright-keep new file mode 100644 index 000000000000..826fec04eaa3 --- /dev/null +++ b/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/copyright-keep @@ -0,0 +1,6 @@ +Copyright 2002-2017 LAMP/EPFL and Lightbend, Inc. +Copyright 2005-2013 LAMP/EPFL +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc +Copyright 2005-2017 LAMP/EPFL and Lightbend, Inc. +Copyright EPFL and Lightbend, Inc. +additional information regarding copyright ownership. diff --git a/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/default-and-custom-license b/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/default-and-custom-license new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/files-keep b/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/files-keep new file mode 100644 index 000000000000..9ef2c9b4d859 --- /dev/null +++ b/tools/legal-review/project-manager/org.scala-lang.scala-compiler-2.13.11/files-keep @@ -0,0 +1,2 @@ +LICENSE +NOTICE diff --git a/tools/legal-review/project-manager/report-state b/tools/legal-review/project-manager/report-state index 492524cc3032..955b7e0ee5cc 100644 --- a/tools/legal-review/project-manager/report-state +++ b/tools/legal-review/project-manager/report-state @@ -1,3 +1,3 @@ -840F3CE1999E3571BB8F34C26AD16ECCE957B9C04F1B0F1929B1F00767BDFE23 -745841A9324FF45EBF74239F66CCC5C7E412D6270A7FAE08B1B1972B6C63A1B3 +E8E4ADF17F1DF20C3121553870BC2C6EE3BCE9C918F1BC255296343990EEEBB8 +AA2EFB4C118AF15F07AF8CFEED3E01CF44D274CD6AE965CA667BA418D8C90A8D 0 diff --git a/tools/legal-review/project-manager/reviewed-licenses/The_BSD_License b/tools/legal-review/project-manager/reviewed-licenses/The_BSD_License new file mode 100644 index 000000000000..0c685af98d57 --- /dev/null +++ b/tools/legal-review/project-manager/reviewed-licenses/The_BSD_License @@ -0,0 +1 @@ +tools/legal-review/license-texts/BSD-3-Clause \ No newline at end of file From d689e6c489b557273e0f6235e81748d9ffc934d0 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 25 Sep 2024 17:56:32 +0200 Subject: [PATCH 266/268] fmt --- build.sbt | 6 +++--- .../org/enso/projectmanager/TestLogProviderOnClasspath.java | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index e819dff86796..0e8a2364af88 100644 --- a/build.sbt +++ b/build.sbt @@ -1193,10 +1193,10 @@ lazy val `scala-libs-wrapper` = project "net.java.dev.jna" % "jna" % jnaVersion ), Compile / moduleDependencies ++= scalaLibrary ++ Seq( - "org.scala-lang" % "scala-reflect" % scalacVersion, + "org.scala-lang" % "scala-reflect" % scalacVersion, "org.jline" % "jline" % jlineVersion, - "org.slf4j" % "slf4j-api" % slf4jVersion, - "net.java.dev.jna" % "jna" % jnaVersion + "org.slf4j" % "slf4j-api" % slf4jVersion, + "net.java.dev.jna" % "jna" % jnaVersion ), assembly / assemblyExcludedJars := { JPMSUtils.filterModulesFromClasspath( diff --git a/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java b/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java index ba53670b0d39..515120642b4a 100644 --- a/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java +++ b/lib/scala/project-manager/src/test/java/org/enso/projectmanager/TestLogProviderOnClasspath.java @@ -12,7 +12,8 @@ import org.slf4j.spi.SLF4JServiceProvider; /** - * In the `runtime/Test` testing suite, {@link org.enso.logging.service.logback.test.provider.TestLogProvider} should be among the logging + * In the `runtime/Test` testing suite, {@link + * org.enso.logging.service.logback.test.provider.TestLogProvider} should be among the logging * providers, because it is explicitly chosen as the logging provider for the tests. * *

Note that the same test is in the `runtime/Test` project. From 78b7b5357ea5c5b3775a0e6a2e699f6fc54b68b8 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 25 Sep 2024 18:52:53 +0200 Subject: [PATCH 267/268] Move testLogProviderOnModulePath to TestJPMSConfiguration --- .../test/TestJPMSModuleConfiguration.java | 13 ++++++++++++ .../test/TestLogProviderOnModulePath.java | 20 ------------------- 2 files changed, 13 insertions(+), 20 deletions(-) delete mode 100644 engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java index 5b57fb4af057..52cc8deb3f33 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestJPMSModuleConfiguration.java @@ -41,4 +41,17 @@ public void testClassIsOpenForLookup() throws IllegalAccessException { var newClazz = lookup.accessClass(clazz); assertThat(newClazz, is(notNullValue())); } + + @Test + public void logProviderIsOnModulePath() { + var modName = "org.enso.logging.service.logback.test.provider"; + var logProviderMod = ModuleLayer.boot().findModule(modName); + var bootModuleNames = ModuleLayer.boot().modules().stream().map(Module::getName).toList(); + assertThat( + "Test log provider module should be in the boot module layer. " + + "Contents of boot module layer: " + + bootModuleNames, + logProviderMod.isPresent(), + is(true)); + } } diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java deleted file mode 100644 index f06dfec025c1..000000000000 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/TestLogProviderOnModulePath.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.enso.interpreter.test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.is; - -import org.enso.logging.service.logback.test.provider.TestLogProvider; -import org.junit.Test; - -/** - * In the `runtime/Test` testing suite, {@link TestLogProvider} should be among the logging - * providers, because it is explicitly chosen as the logging provider for the tests. - */ -public class TestLogProviderOnModulePath { - @Test - public void testLogProviderOnClasspath() { - var modName = "org.enso.logging.service.logback.test.provider"; - var logProviderMod = ModuleLayer.boot().findModule(modName); - assertThat(logProviderMod.isPresent(), is(true)); - } -} From 7266b9a62ad4c889518070b8baeaa3033e21f6f6 Mon Sep 17 00:00:00 2001 From: Pavel Marek Date: Wed, 25 Sep 2024 19:24:26 +0200 Subject: [PATCH 268/268] logging-service-logback is not a mixed project --- build.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/build.sbt b/build.sbt index 0e8a2364af88..d780d49e80b3 100644 --- a/build.sbt +++ b/build.sbt @@ -1079,7 +1079,6 @@ lazy val `logging-service-logback` = project .configs(Test) .settings( frgaalJavaCompilerSetting, - mixedJavaScalaProjectSetting, version := "0.1", libraryDependencies ++= Seq( "org.slf4j" % "slf4j-api" % slf4jVersion,