Skip to content

Commit

Permalink
Merge branch 'main' of github.com:epsilonlabs/epsilon-with-lsp
Browse files Browse the repository at this point in the history
  • Loading branch information
pkourouklidis committed Sep 10, 2024
2 parents d657b2d + 574ed53 commit d5b8918
Show file tree
Hide file tree
Showing 223 changed files with 5,560 additions and 3,259 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
os: [ubuntu-22.04, macos-14, windows-2022]
runs-on: ${{ matrix.os }}
steps:
- name: Support longpaths on Windows
run: git config --system core.longpaths true
if: runner.os == 'Windows'
- uses: actions/checkout@v3
- name: Install Webkit + GTK bindings
run: sudo apt-get install -yq libwebkit2gtk-4.0-dev
if: runner.os == 'Linux'
- name: Set up Maven 3.9.5
uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1
with:
Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# Eclipse Epsilon

[Epsilon](https://eclipse.org/epsilon) is a family of Java-based scripting languages for automating common model-based software engineering tasks, such as code generation, model-to-model transformation and model validation, that work out of the box with EMF (including Xtext and Sirius), UML, Simulink, XML and other types of models. Epsilon also includes Eclipse-based editors and debuggers, convenient reflective tools for textual modelling and model visualisation, and Apache Ant tasks.
[Epsilon](https://eclipse.org/epsilon/) is a family of scripting languages and tools for automating common model-based software engineering tasks such as [code generation](https://eclipse.org/epsilon/doc/egl), [model-to-model transformation](https://eclipse.org/epsilon/doc/etl), [model validation](https://eclipse.org/epsilon/doc/evl) and [model visualisation](https://eclipse.org/epsilon/doc/picto), that work out of the box with EMF (including [Xtext](https://www.eclipse.org/Xtext) and [Sirius](https://www.eclipse.org/sirius)), UML (including Cameo/MagicDraw), Simulink, XML and [other types of models](https://eclipse.org/epsilon/doc/emc).

[![Epsilon's Model-to-Text Transformation Language](https://github.com/user-attachments/assets/ba30b435-2ff9-471c-b132-7981a6e9148f)](https://eclipse.dev/epsilon/playground/?egx)

Epsilon can be used as a [standard Java library](https://eclipse.org/epsilon/getting-started/#using-epsilon-as-a-java-library), and also provides [Apache Ant](https://eclipse.org/epsilon/doc/workflow) tasks that can be embedded in [Maven/Gradle builds](https://eclipse.org/epsilon/getting-started/#epsilon-in-mavengradle-builds). Editing support for Epsilon programs is available in [Eclipse](https://eclipse.org/epsilon/download), [VS Code](https://eclipse.org/epsilon/doc/articles/vscode) and [Sublime](https://github.com/epsilonlabs/sublime).

## Quick Access

- [Getting Started](https://eclipse.dev/epsilon/getting-started/)
- [Playground](https://eclipse.dev/epsilon/playground/)
- [Download](https://eclipse.dev/epsilon/download/)
- [Documentation](https://eclipse.dev/epsilon/doc/)

4 changes: 3 additions & 1 deletion examples/org.eclipse.epsilon.edl.dt/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
delegate="org.eclipse.epsilon.edl.dt.launching.EdlLaunchConfigurationDelegate"
id="org.epsilon.edl.eclipse.dt.launching.EdlLaunchConfigurationDelegate"
modes="run, debug"
name="EDL Demo"/>
name="EDL Demo"
sourceLocatorId="org.eclipse.lsp4e.debug.sourceLocator"
sourcePathComputerId="org.eclipse.lsp4e.debug.sourcePathComputer"/>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.lsp4e.debug.launchType">
<launchConfiguration type="org.eclipse.epsilon.eol.dt.debug.RemoteEpsilonLaunchConfigurationDelegate">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<booleanAttribute key="org.eclipse.lsp4e.debug.model.ATTR_CUSTOM_DEBUG_ADAPTER" value="false"/>
<booleanAttribute key="org.eclipse.lsp4e.debug.model.ATTR_CUSTOM_LAUNCH_PARAMS" value="false"/>
<stringAttribute key="org.eclipse.lsp4e.debug.model.ATTR_DSP_MODE" value="connect to server"/>
<booleanAttribute key="org.eclipse.lsp4e.debug.model.ATTR_DSP_MONITOR_ADAPTER" value="false"/>
<stringAttribute key="org.eclipse.lsp4e.debug.model.ATTR_DSP_PARAM" value="{&#10; &quot;request&quot;: &quot;attach&quot;&#10;}"/>
<stringAttribute key="org.eclipse.lsp4e.debug.model.ATTR_DSP_SERVER_HOST" value="127.0.0.1"/>
<stringAttribute key="org.eclipse.lsp4e.debug.model.ATTR_DSP_PARAM" value="{&quot;request&quot;: &quot;attach&quot;}"/>
<stringAttribute key="org.eclipse.lsp4e.debug.model.ATTR_DSP_SERVER_HOST" value="localhost"/>
<intAttribute key="org.eclipse.lsp4e.debug.model.ATTR_DSP_SERVER_PORT" value="4040"/>
</launchConfiguration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/org.eclipse.epsilon.examples.eol.dap/src/org/eclipse/epsilon/examples/eol/dap/DebugFileBasedEGX.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.epsilon.examples.eol.dap.DebugFileBasedEGX"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="org.eclipse.epsilon.examples.eol.dap"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="${workspace_loc:/org.eclipse.epsilon.examples.eol.dap/epsilon/07-orchestration.egx}"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.epsilon.examples.eol.dap"/>
</launchConfiguration>
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/.gradle/
/*.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
"name": "Debug 04-inspectObject",
"port": 4040,
"preLaunchTask": "epsilonDebug: inspectObject"
},
{
"type": "epsilon",
"request": "attach",
"name": "Debug 07-orchestration",
"port": 4040,
"preLaunchTask": "epsilonDebug: debugEGX"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
],
"label": "epsilonDebug: inspectObject",
"isBackground": true
},
{
"type": "gradle",
"script": "debugEGX",
"group": "other",
"buildFile": "${workspaceFolder}/build.gradle",
"projectFolder": "${workspaceFolder}",
"workspaceFolder": "${workspaceFolder}",
"args": "--info",
"problemMatcher": [
"$gradle",
"$epsilon-debug"
],
"label": "epsilonDebug: debugEGX",
"isBackground": true
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ smallCollection.println('Small collection: ');
var largeCollection = 1.to(1000).asSet();
largeCollection.size.println('Large collection size: ');

var smallMap = Map {"x" = 3, "y" = 10};
smallMap.println('Small map: ');

var largeMap = 1.to(250).aggregate(x | x, x * 10);
largeMap.println('Large map: ');

operation produceGreeting(firstName: String, lastName: String) {
var fullName = firstName + ' ' + lastName;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
operation computeTarget(firstName, lastName) {
return firstName + '-' + lastName + '.txt';
}

rule Person2Text transform p: Person {
template: '07-person.egl'
target: computeTarget(p.firstName, p.lastName)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[% import '07-utils.eol'; %]
# [%=p.firstName%] [%=p.lastName%]

[%=p.generateGreeting()%]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
operation Person generateGreeting() {
return 'Hello ' + self.firstName + ' ' + self.lastName;
}
18 changes: 18 additions & 0 deletions examples/org.eclipse.epsilon.examples.eol.dap/epsilon/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,21 @@ task debugHelloEGL {
debugEpsilon = true
}
}

task runEGX {
dependsOn tasks.setupEpsilonTasks
doLast {
ant.'epsilon.emf.loadModel'(modelFile: 'models/person.model', metamodelFile: 'models/person.ecore', read: true, store: false, name: 'M')
ant.'epsilon.egl'(src: '07-orchestration.egx', debug: debugEpsilon, debugPort: debugPort) {
model(ref: 'M')
}
ant.'epsilon.disposeModel'(model: 'M')
}
}

task debugEGX {
finalizedBy "runEGX"
doLast {
debugEpsilon = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,11 @@ public static void main(String[] args) throws Exception {
Paths.get("src/org/eclipse/epsilon/examples/eol/dap/03-helloFromClasspath.eol"));

server.run();

/*
* Retrieves the result from running the Epsilon script - may rethrow any
* exception produced by execute().
*/
server.getResult().get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ public static void main(String[] args) throws Exception {

EpsilonDebugServer server = new EpsilonDebugServer(module, 4040);
server.run();

/*
* Retrieves the result from running the Epsilon script - may rethrow any
* exception produced by execute().
*/
server.getResult().get();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package org.eclipse.epsilon.examples.eol.dap;

import java.io.File;
import java.nio.file.Paths;

import org.eclipse.epsilon.egl.EgxModule;
import org.eclipse.epsilon.emc.emf.EmfModel;
import org.eclipse.epsilon.eol.dap.EpsilonDebugServer;

public class DebugFileBasedEGX {

public static void main(String[] args) throws Exception {
EgxModule module = new EgxModule(Paths.get("epsilon"));
module.parse(new File(args[0]));

EmfModel model = new EmfModel();
model.setModelFile("epsilon/models/person.model");
model.setMetamodelFile("epsilon/models/person.ecore");
model.setReadOnLoad(true);
model.setStoredOnDisposal(false);
model.load();
module.getContext().getModelRepository().addModel(model);

EpsilonDebugServer server = new EpsilonDebugServer(module, 4040);
server.run();

/*
* Retrieves the result from running the Epsilon script - may rethrow any
* exception produced by execute().
*/
server.getResult().get();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,11 @@ public static void main(String[] args) throws Exception {

EpsilonDebugServer server = new EpsilonDebugServer(module, 4040);
server.run();

/*
* Retrieves the result from running the Epsilon script - may rethrow any
* exception produced by execute().
*/
server.getResult().get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public boolean handle(Request request, Response response, Callback callback) thr
EpsilonDebugServer server = new EpsilonDebugServer(module, 4040);
server.getDebugAdapter().getUriToPathMappings().put(new URI(serverUri), Paths.get("epsilon"));
server.run();

/*
* Retrieves the result from running the Epsilon script - may rethrow any
* exception produced by execute().
*/
server.getResult().get();
} finally {
httpServer.stop();
httpServer.join();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,11 @@ public static void main(String[] args) throws Exception {

EpsilonDebugServer server = new EpsilonDebugServer(module, 4040);
server.run();

/*
* Retrieves the result from running the Epsilon script - may rethrow any
* exception produced by execute().
*/
server.getResult().get();
}
}
9 changes: 9 additions & 0 deletions examples/org.eclipse.epsilon.examples.evl.crossrefs/a.flexmi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?nsuri ccl?>
<?import b.flexmi?>
<_>
<component name="A">
<in name="in"/>
<out name="out" type="String"/>
</component>
<connector name="A2B" from="A.out" to="B.in"/>
</_>
9 changes: 9 additions & 0 deletions examples/org.eclipse.epsilon.examples.evl.crossrefs/b.flexmi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?nsuri ccl?>
<?import c.flexmi?>
<_>
<component name="B">
<in name="in"/>
<out name="out" type="String"/>
</component>
<connector name="B2C" from="B.out" to="C.in"/>
</_>
9 changes: 9 additions & 0 deletions examples/org.eclipse.epsilon.examples.evl.crossrefs/c.flexmi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?nsuri ccl?>
<?import a.flexmi?>
<_>
<component name="C">
<in name="in"/>
<out name="out" type="String"/>
</component>
<connector name="C2A" from="C.out" to="A.in"/>
</_>
22 changes: 22 additions & 0 deletions examples/org.eclipse.epsilon.examples.evl.crossrefs/ccl.emf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ccl;

class Component {
attr String name;
val Port[*]#component ports;
}

class Connector {
attr String name;
ref OutPort source;
ref InPort target;
}

class InPort extends Port {}

class OutPort extends Port {}

abstract class Port {
attr String name;
attr String type = "boolean";
ref Component#ports component;
}
17 changes: 17 additions & 0 deletions examples/org.eclipse.epsilon.examples.evl.crossrefs/ccl.evl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
context Connector {

/* If a connector connects two ports, their types must match */
constraint PortTypesMatch {
guard: self.source.satisfies("HasValidType") and self.target.satisfies("HasValidType")
check: self.source.type = self.target.type
message: "The types of the source and target ports of connector " + self.name + " don't match"
}
}

context Port {

/* The only valid port types are boolean, int and String */
constraint HasValidType {
check: Sequence{"boolean", "int", "String"}.contains(self.type)
}
}
Loading

0 comments on commit d5b8918

Please sign in to comment.