Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing Truffle API dependency from runtime-compiler project #9785

Merged
merged 16 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 36 additions & 19 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ lazy val enso = (project in file("."))
`runtime-benchmarks`,
`runtime-parser`,
`runtime-compiler`,
`runtime-suggestions`,
`runtime-language-epb`,
`runtime-language-arrow`,
`runtime-instrument-common`,
Expand Down Expand Up @@ -679,12 +680,11 @@ lazy val pkg = (project in file("lib/scala/pkg"))
Compile / run / mainClass := Some("org.enso.pkg.Main"),
frgaalJavaCompilerSetting,
version := "0.1",
libraryDependencies ++= circe ++ Seq(
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"io.circe" %% "circe-yaml" % circeYamlVersion,
"org.apache.commons" % "commons-compress" % commonsCompressVersion,
"commons-io" % "commons-io" % commonsIoVersion
libraryDependencies ++= Seq(
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"io.circe" %% "circe-yaml" % circeYamlVersion % "provided",
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.apache.commons" % "commons-compress" % commonsCompressVersion
)
)
.dependsOn(editions)
Expand Down Expand Up @@ -1294,6 +1294,7 @@ lazy val `language-server` = (project in file("engine/language-server"))
"com.typesafe.akka" %% "akka-http-testkit" % akkaHTTPVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.scalacheck" %% "scalacheck" % scalacheckVersion % Test,
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion % "provided",
"org.graalvm.sdk" % "polyglot-tck" % graalMavenPackagesVersion % "provided",
"org.eclipse.jgit" % "org.eclipse.jgit" % jgitVersion,
"org.bouncycastle" % "bcutil-jdk18on" % "1.76" % Test,
Expand Down Expand Up @@ -1679,6 +1680,7 @@ lazy val runtime = (project in file("engine/runtime"))
.dependsOn(`polyglot-api`)
.dependsOn(`text-buffer`)
.dependsOn(`runtime-compiler`)
.dependsOn(`runtime-suggestions`)
.dependsOn(`connected-lock-manager`)
.dependsOn(testkit % Test)

Expand Down Expand Up @@ -1956,19 +1958,36 @@ lazy val `runtime-compiler` =
(project in file("engine/runtime-compiler"))
.settings(
frgaalJavaCompilerSetting,
instrumentationSettings,
(Test / fork) := true,
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % shapelessVersion,
"org.graalvm.truffle" % "truffle-api" % graalMavenPackagesVersion,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
)
)
.dependsOn(`runtime-parser`)
.dependsOn(pkg)
.dependsOn(`engine-common`)
.dependsOn(editions)
.dependsOn(`persistance-dsl` % "provided")

lazy val `runtime-suggestions` =
(project in file("engine/runtime-suggestions"))
.settings(
frgaalJavaCompilerSetting,
(Test / fork) := true,
libraryDependencies ++= Seq(
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"org.netbeans.api" % "org-openide-util-lookup" % netbeansApiVersion % "provided"
)
)
.dependsOn(`runtime-parser`)
.dependsOn(pkg)
.dependsOn(`runtime-compiler`)
.dependsOn(`polyglot-api`)
.dependsOn(editions)
.dependsOn(`persistance-dsl` % "provided")

lazy val `runtime-instrument-common` =
(project in file("engine/runtime-instrument-common"))
Expand Down Expand Up @@ -2493,9 +2512,8 @@ lazy val editions = project
.settings(
frgaalJavaCompilerSetting,
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"io.circe" %% "circe-yaml" % circeYamlVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test
"io.circe" %% "circe-yaml" % circeYamlVersion % "provided",
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
.settings(
Expand Down Expand Up @@ -2523,11 +2541,10 @@ lazy val semver = project
.settings(
frgaalJavaCompilerSetting,
libraryDependencies ++= Seq(
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"io.circe" %% "circe-yaml" % circeYamlVersion,
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test
"io.circe" %% "circe-yaml" % circeYamlVersion % "provided",
"org.scalatest" %% "scalatest" % scalatestVersion % Test,
"junit" % "junit" % junitVersion % Test,
"com.github.sbt" % "junit-interface" % junitIfVersion % Test
)
)
.settings(
Expand Down
25 changes: 0 additions & 25 deletions distribution/launcher/THIRD-PARTY/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -141,31 +141,6 @@ 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.httpcomponents.httpcore-4.4.1`.


'polyglot', licensed under the Universal Permissive License, Version 1.0, is distributed with the launcher.
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.polyglot.polyglot-24.0.0`.


'collections', licensed under the Universal Permissive License, Version 1.0, is distributed with the launcher.
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.collections-24.0.0`.


'nativeimage', licensed under the Universal Permissive License, Version 1.0, is distributed with the launcher.
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`.


'word', licensed under the Universal Permissive License, Version 1.0, is distributed with the launcher.
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.word-24.0.0`.


'truffle-api', licensed under the Universal Permissive License, Version 1.0, is distributed with the launcher.
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-api-24.0.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`.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

25 changes: 0 additions & 25 deletions distribution/project-manager/THIRD-PARTY/NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -266,31 +266,6 @@ 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.httpcomponents.httpcore-4.4.1`.


'polyglot', licensed under the Universal Permissive License, Version 1.0, is distributed with the project-manager.
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.polyglot.polyglot-24.0.0`.


'collections', licensed under the Universal Permissive License, Version 1.0, is distributed with the project-manager.
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.collections-24.0.0`.


'nativeimage', licensed under the Universal Permissive License, Version 1.0, is distributed with the project-manager.
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`.


'word', licensed under the Universal Permissive License, Version 1.0, is distributed with the project-manager.
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.word-24.0.0`.


'truffle-api', licensed under the Universal Permissive License, Version 1.0, is distributed with the project-manager.
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-api-24.0.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`.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,10 @@ void initializeBuiltinsIr(

CompilationStage getCompilationStage(Module module);

org.enso.polyglot.data.TypeGraph getTypeHierarchy();

Future<Boolean> serializeLibrary(
Compiler compiler, LibraryName libraryName, boolean useGlobalCacheLocations);

scala.Option<List<org.enso.polyglot.Suggestion>> deserializeSuggestions(LibraryName libraryName)
throws InterruptedException;
scala.Option<Object> deserializeSuggestions(LibraryName libraryName) throws InterruptedException;

Future<Boolean> serializeModule(
Compiler compiler, Module module, boolean useGlobalCacheLocations, boolean usePool);
Expand All @@ -129,6 +126,8 @@ public static interface Updater {
public abstract static class Module {
public abstract Source getSource() throws IOException;

public abstract CharSequence getCharacters() throws IOException;

public abstract String getPath();

public abstract Package<TruffleFile> getPackage();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.enso.compiler;

import static org.junit.Assert.fail;

import org.junit.Ignore;
import org.junit.Test;

public final class CompilerDependenciesTest {
@Ignore
@Test
public void noTruffleDependency() {
assertNoClass("com.oracle.truffle.api.nodes.Node");
}

@Test
public void noCirceDependency() {
assertNoClass("io.circe.Error");
}

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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.logging.Level;
import org.enso.common.LanguageInfo;
import org.enso.common.MethodNames;
import org.enso.compiler.context.SimpleUpdate;
import org.enso.compiler.suggestions.SimpleUpdate;
import org.enso.interpreter.instrument.Endpoint;
import org.enso.interpreter.instrument.MethodCallsCache;
import org.enso.interpreter.instrument.NotificationHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ 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.module.scope.definition
import org.enso.compiler.pass.analyse.DataflowAnalysis
import org.enso.interpreter.instrument.execution.model.PendingEdit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.enso.interpreter.instrument.job

import org.enso.compiler.context.{
import org.enso.compiler.suggestions.{
ExportsBuilder,
ModuleExportsDiff,
SuggestionBuilder,
Expand Down Expand Up @@ -49,10 +49,13 @@ final class AnalyzeModuleInScopeJob(
ctx.executionService.getLogger
.log(Level.FINEST, s"Analyzing module in scope {0}", module.getName)
val moduleName = module.getName
val compiler = ctx.executionService.getContext.getCompiler
val types = Module.findTypeHierarchy(compiler.context)
val newSuggestions =
SuggestionBuilder(
module.asCompilerModule(),
ctx.executionService.getContext.getCompiler
types,
compiler
)
.build(moduleName, state.ir)
.filter(Suggestion.isGlobal)
Expand Down
Loading
Loading