From a69d89b2741ad5e12c6c7865d7b29237de0fa3e8 Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Tue, 7 May 2024 14:13:21 +0200 Subject: [PATCH] Reduce set of JDK modules required by Enso (#9868) --- build.sbt | 2 +- .../runtime-fat-jar/src/main/java/module-info.java | 4 +--- .../enso/interpreter/test/BinaryOpFloatTest.java | 7 +++++-- .../enso/interpreter/test/BinaryOpIntegerTest.java | 7 +++++-- .../enso/interpreter/runtime/builtin/Builtins.java | 13 +++++++++---- tools/legal-review/engine/report-state | 2 +- 6 files changed, 22 insertions(+), 13 deletions(-) diff --git a/build.sbt b/build.sbt index e188670103..8ffa0f9309 100644 --- a/build.sbt +++ b/build.sbt @@ -1791,7 +1791,7 @@ lazy val runtime = (project in file("engine/runtime")) ) .dependsOn(`common-polyglot-core-utils`) .dependsOn(`edition-updater`) - .dependsOn(`interpreter-dsl`) + .dependsOn(`interpreter-dsl` % "provided") .dependsOn(`persistance-dsl` % "provided") .dependsOn(`library-manager`) .dependsOn(`logging-truffle-connector`) diff --git a/engine/runtime-fat-jar/src/main/java/module-info.java b/engine/runtime-fat-jar/src/main/java/module-info.java index ca8f410fa4..2af98817ee 100644 --- a/engine/runtime-fat-jar/src/main/java/module-info.java +++ b/engine/runtime-fat-jar/src/main/java/module-info.java @@ -1,8 +1,6 @@ open module org.enso.runtime { requires java.base; - requires java.compiler; - requires java.desktop; - requires java.se; + requires java.net.http; // Because of akka.util.Unsafe requires jdk.unsupported; requires org.graalvm.polyglot; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/BinaryOpFloatTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/BinaryOpFloatTest.java index b29e9f39e1..100f2a7a16 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/BinaryOpFloatTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/BinaryOpFloatTest.java @@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import com.google.common.collect.Streams; import java.util.Arrays; import java.util.Random; import java.util.stream.Stream; @@ -46,7 +45,11 @@ public class BinaryOpFloatTest extends TestBase { var oneOps = Arrays.asList(OPERATIONS).stream().map((op) -> new Object[] {op, r.nextDouble(), 1.0}); var extraOps = Stream.of(new Object[] {" %", 19.73, 12.10}, new Object[] {" ^", 10.12, 73.19}); - return Streams.concat(randomOps, zeroOps, oneOps, extraOps).toArray(Object[][]::new); + + var s1 = Stream.concat(randomOps, zeroOps); + var s2 = Stream.concat(s1, oneOps); + var s3 = Stream.concat(s2, extraOps); + return s3.toArray(Object[][]::new); } private static Context ctx; diff --git a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/BinaryOpIntegerTest.java b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/BinaryOpIntegerTest.java index 654828225e..9b6fea2c7d 100644 --- a/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/BinaryOpIntegerTest.java +++ b/engine/runtime-integration-tests/src/test/java/org/enso/interpreter/test/BinaryOpIntegerTest.java @@ -4,7 +4,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import com.google.common.collect.Streams; import java.util.Arrays; import java.util.Random; import java.util.stream.Stream; @@ -59,7 +58,11 @@ public class BinaryOpIntegerTest extends TestBase { Arrays.asList(OPERATIONS).stream().map((op) -> new Object[] {op, r.nextLong(), 0}); var oneOps = Arrays.asList(OPERATIONS).stream().map((op) -> new Object[] {op, r.nextLong(), 1}); var extraOps = Stream.of(new Object[] {" %", 19, 73}, new Object[] {".bit_shift", 12, 10}); - return Streams.concat(randomOps, zeroOps, oneOps, extraOps).toArray(Object[][]::new); + + var s1 = Stream.concat(randomOps, zeroOps); + var s2 = Stream.concat(s1, oneOps); + var s3 = Stream.concat(s2, extraOps); + return s3.toArray(Object[][]::new); } private static Context ctx; diff --git a/engine/runtime/src/main/java/org/enso/interpreter/runtime/builtin/Builtins.java b/engine/runtime/src/main/java/org/enso/interpreter/runtime/builtin/Builtins.java index 8ccd07e273..27f5bd7f07 100644 --- a/engine/runtime/src/main/java/org/enso/interpreter/runtime/builtin/Builtins.java +++ b/engine/runtime/src/main/java/org/enso/interpreter/runtime/builtin/Builtins.java @@ -25,8 +25,6 @@ import org.enso.compiler.context.FreshNameSupply; import org.enso.compiler.core.CompilerError; import org.enso.compiler.phase.BuiltinsIrBuilder; import org.enso.interpreter.EnsoLanguage; -import org.enso.interpreter.dsl.TypeProcessor; -import org.enso.interpreter.dsl.model.MethodDefinition; import org.enso.interpreter.node.expression.builtin.Any; import org.enso.interpreter.node.expression.builtin.Boolean; import org.enso.interpreter.node.expression.builtin.Builtin; @@ -337,7 +335,10 @@ public final class Builtins { private static List> readBuiltinTypes() { ClassLoader classLoader = Builtins.class.getClassLoader(); List lines; - try (InputStream resource = classLoader.getResourceAsStream(TypeProcessor.META_PATH)) { + final String NODE_PKG = "org.enso.interpreter.node.expression.builtin"; + final String META_PATH = + "META-INF" + "/" + NODE_PKG.replace('.', '/') + "/BuiltinTypes.metadata"; + try (InputStream resource = classLoader.getResourceAsStream(META_PATH)) { lines = new BufferedReader(new InputStreamReader(resource, StandardCharsets.UTF_8)) .lines() @@ -438,7 +439,11 @@ public final class Builtins { private static Map readBuiltinMethodsMeta() { ClassLoader classLoader = Builtins.class.getClassLoader(); List lines; - try (InputStream resource = classLoader.getResourceAsStream(MethodDefinition.META_PATH)) { + + final String NODE_PKG = "org.enso.interpreter.node.expression.builtin"; + final String META_PATH = + "META-INF" + "/" + NODE_PKG.replace('.', '/') + "/BuiltinMethods.metadata"; + try (InputStream resource = classLoader.getResourceAsStream(META_PATH)) { lines = new BufferedReader(new InputStreamReader(resource, StandardCharsets.UTF_8)) .lines() diff --git a/tools/legal-review/engine/report-state b/tools/legal-review/engine/report-state index 1a7b2b12c4..44e64adeb3 100644 --- a/tools/legal-review/engine/report-state +++ b/tools/legal-review/engine/report-state @@ -1,3 +1,3 @@ -63FF6DEF4A66E3D50D1F62B2C012C0FAF9B8C980D09E4E0F5A3EA72886AB0223 +D0D1595E3558C5D3E4E1D040FFF078F2EE815059BA46F1BA0AF546A524303AC0 3768984C1A9E71A22E77ED4EFEBA08B9A2BA4A8EB9220E5B206B67F9B58FDFDF 0