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

Debug Enso language in ChromeDev tools with --inspect option #3432

Merged
merged 13 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ Global / onChangedBuildSource := ReloadOnSourceChanges
ThisBuild / javacOptions ++= Seq(
"-encoding", // Provide explicit encoding (the next line)
"UTF-8", // Specify character encoding used by Java source files.
"-deprecation" // Shows a description of each use or override of a deprecated member or class.
"-deprecation",// Shows a description of each use or override of a deprecated member or class.
"-g" // Include debugging information
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
)

ThisBuild / scalacOptions ++= Seq(
Expand Down Expand Up @@ -1151,7 +1152,9 @@ lazy val runtime = (project in file("engine/runtime"))
// 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.
FrgaalJavaCompiler.frgaal
FrgaalJavaCompiler.frgaal,
"junit" % "junit" % "4.12" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test exclude("junit", "junit-dep")
JaroslavTulach marked this conversation as resolved.
Show resolved Hide resolved
),
// Note [Unmanaged Classpath]
Compile / unmanagedClasspath += (`core-definition` / Compile / packageBin).value,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.enso.interpreter.test;

import java.nio.file.Paths;
import java.util.Map;
import org.enso.polyglot.RuntimeOptions;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Engine;
import org.graalvm.polyglot.Language;
import org.junit.Assert;
import org.junit.Test;

public class JavaPolyglotTest {
@Test
public void evaluation() {
Engine eng = Engine.newBuilder()
.allowExperimentalOptions(true)
.option(
RuntimeOptions.LANGUAGE_HOME_OVERRIDE,
Paths.get("../../distribution/component").toFile().getAbsolutePath()
).build();
Context ctx = Context.newBuilder()
.engine(eng)
.allowIO(true)
.build();
final Map<String, Language> langs = ctx.getEngine().getLanguages();
org.junit.Assert.assertNotNull("Enso found: " + langs, langs.get("enso"));
var module = ctx.eval("enso", """
fac n =
if n <= 1 then 1 else n * here.fac n-1
""");
var facFn = module.invokeMember("eval_expression", "here.fac");
var fac5 = facFn.execute(5);
Assert.assertEquals("5!", 120, fac5.asInt());
}
}