diff --git a/legend-pure-ide-light/pom.xml b/legend-pure-ide-light/pom.xml
index b7793fac09..ceb2ba829e 100644
--- a/legend-pure-ide-light/pom.xml
+++ b/legend-pure-ide-light/pom.xml
@@ -155,6 +155,11 @@
jackson-annotations
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
org.eclipse.collections
eclipse-collections
diff --git a/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/PureIDEServer.java b/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/PureIDEServer.java
index e2fce0df68..42a2e43f35 100644
--- a/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/PureIDEServer.java
+++ b/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/PureIDEServer.java
@@ -27,11 +27,7 @@
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.api.set.MutableSet;
import org.eclipse.jetty.servlets.CrossOriginFilter;
-import org.finos.legend.pure.ide.light.api.Activities;
-import org.finos.legend.pure.ide.light.api.FileManagement;
-import org.finos.legend.pure.ide.light.api.LifeCycle;
-import org.finos.legend.pure.ide.light.api.Service;
-import org.finos.legend.pure.ide.light.api.Suggestion;
+import org.finos.legend.pure.ide.light.api.*;
import org.finos.legend.pure.ide.light.api.concept.Concept;
import org.finos.legend.pure.ide.light.api.concept.MovePackageableElements;
import org.finos.legend.pure.ide.light.api.concept.RenameConcept;
@@ -105,6 +101,7 @@ public void run(ServerConfiguration configuration, Environment environment) thro
environment.jersey().register(new Activities(pureSession));
environment.jersey().register(new FileManagement(pureSession));
environment.jersey().register(new LifeCycle(pureSession));
+ environment.jersey().register(new PureRuntimeOptions(pureSession));
environment.jersey().register(new Suggestion(pureSession));
diff --git a/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/api/PureRuntimeOptions.java b/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/api/PureRuntimeOptions.java
new file mode 100644
index 0000000000..92d48e5036
--- /dev/null
+++ b/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/api/PureRuntimeOptions.java
@@ -0,0 +1,50 @@
+package org.finos.legend.pure.ide.light.api;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.annotations.Api;
+import org.finos.legend.pure.ide.light.session.PureSession;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.StreamingOutput;
+
+@Api(tags = "Pure Runtime Options")
+@Path("/pureRuntimeOptions")
+public class PureRuntimeOptions
+{
+ private final PureSession pureSession;
+
+ public PureRuntimeOptions(PureSession session)
+ {
+ this.pureSession = session;
+ }
+
+ @GET
+ public void setPureRuntimeOption(@PathParam("name") String optionName, @PathParam("value") Boolean value)
+ {
+ this.pureSession.setPureRuntimeOption(optionName, value);
+ }
+
+ @GET
+ public Boolean getPureRuntimeOption(@PathParam("optionName") String optionName)
+ {
+ return this.pureSession.getPureRuntimeOption(optionName);
+ }
+
+ @GET
+ public Response getAllPureRuntimeOptions(@Context HttpServletRequest request, @Context HttpServletResponse response)
+ {
+ return Response.ok((StreamingOutput) outputStream ->
+ {
+ ObjectMapper om = new ObjectMapper();
+ outputStream.write(om.writeValueAsBytes(this.pureSession.getAllPureRuntimeOptions()));
+ outputStream.close();
+ }).build();
+ }
+
+}
diff --git a/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/session/PureSession.java b/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/session/PureSession.java
index c1809901c6..d0ead46edf 100644
--- a/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/session/PureSession.java
+++ b/legend-pure-ide-light/src/main/java/org/finos/legend/pure/ide/light/session/PureSession.java
@@ -30,11 +30,7 @@
import org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.RepositoryCodeStorage;
import org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.composite.CompositeCodeStorage;
import org.finos.legend.pure.m3.serialization.filesystem.usercodestorage.welcome.WelcomeCodeStorage;
-import org.finos.legend.pure.m3.serialization.runtime.ExecutedTestTracker;
-import org.finos.legend.pure.m3.serialization.runtime.Message;
-import org.finos.legend.pure.m3.serialization.runtime.PureRuntime;
-import org.finos.legend.pure.m3.serialization.runtime.PureRuntimeBuilder;
-import org.finos.legend.pure.m3.serialization.runtime.Source;
+import org.finos.legend.pure.m3.serialization.runtime.*;
import org.finos.legend.pure.m3.statelistener.VoidExecutionActivityListener;
import org.finos.legend.pure.m4.coreinstance.CoreInstance;
import org.finos.legend.pure.m4.coreinstance.SourceInformation;
@@ -48,6 +44,7 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.file.Paths;
+import java.util.Map;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
@@ -69,6 +66,9 @@ public class PureSession
public Message message = new Message("");
public MutableList repos;
+ private final Map pureRuntimeOptions = new ConcurrentHashMap<>();
+
+ private final String PURE_OPTION_PREFIX = "pure.option.";
public PureSession(SourceLocationConfiguration sourceLocationConfiguration, MutableList repos)
{
@@ -82,8 +82,26 @@ public PureSession(SourceLocationConfiguration sourceLocationConfiguration, Muta
this.functionExecution = new FunctionExecutionInterpreted(VoidExecutionActivityListener.VOID_EXECUTION_ACTIVITY_LISTENER);
+ for (String property : System.getProperties().stringPropertyNames())
+ {
+ if (property.startsWith(PURE_OPTION_PREFIX))
+ {
+ setPureRuntimeOption(property.substring(PURE_OPTION_PREFIX.length()), Boolean.getBoolean(property));
+ }
+ }
+
this.codeStorage = new CompositeCodeStorage(this.repos.toArray(new RepositoryCodeStorage[0]));
- this.pureRuntime = new PureRuntimeBuilder(this.codeStorage).withMessage(this.message).setUseFastCompiler(true).build();
+ this.pureRuntime = new PureRuntimeBuilder(this.codeStorage)
+ .withMessage(this.message)
+ .setUseFastCompiler(true)
+ .withOptions(new RuntimeOptions() {
+ @Override
+ public boolean isOptionSet(String name) {
+ return getPureRuntimeOption(name);
+ }
+ })
+ .build();
+
this.functionExecution.init(this.pureRuntime, this.message);
this.codeStorage.initialize(this.message);
}
@@ -103,6 +121,21 @@ public FunctionExecution getFunctionExecution()
return this.functionExecution;
}
+ public boolean getPureRuntimeOption(String optionName)
+ {
+ Boolean value = this.pureRuntimeOptions.get(optionName);
+ return value != null && value;
+ }
+
+ public Map getAllPureRuntimeOptions()
+ {
+ return this.pureRuntimeOptions;
+ }
+
+ public void setPureRuntimeOption(String optionName, boolean value)
+ {
+ this.pureRuntimeOptions.put(optionName, value);
+ }
public TestRunner newTestRunner(int testRunId, TestCollection collection)
{
TestRunnerWrapper testRunnerWrapper = new TestRunnerWrapper(collection, this.getPureRuntime().executedTestTracker);