Skip to content

Commit

Permalink
#455 #456 #348 Update coffee-editor to latest versions and run server…
Browse files Browse the repository at this point in the history
…s as JAR products (#457)

* #455 #456 Update to latest versions and run servers as JAR products

#455 Update to Model Server V2 and latest GLSP version
- Migrate Model Server to latest version and to V2

#456 Consider running backend services as JAR products
- Run Model Server product as Java application instead of Eclipse product
  - TODO: Package as standalone JAR

* #455 #456 Update to latest versions and run servers as JAR products

#455 Update to Model Server V2 and latest GLSP version
- Migrate GLSP Server to latest version 1.1.0
- Reuse EMF server and modelserver glsp integration code and remove obsolete classes

#456 Consider running backend services as JAR products
- Run GLSP Server product as Java application instead of Eclipse product
  - TODO: Package as standalone JAR

* #455 #456 Update to latest versions and run servers as JAR products

#456 Consider running backend services as JAR products
- Run Model Server product as Java application instead of Eclipse product
  - Package as standalone JAR
- Run GLSP Server product as Java application instead of Eclipse product
  - Package as standalone JAR

* #455 #456 Update to latest versions

- Move example project 'SuperBrewer3000' to client/workspace and adapt all paths accordingly
- Rename frontend folder to client and adapt all paths
- Update client code to Theia 1.27.0 an current versions of glsp, sprotty and emfcloud components
- Update to newer typescript version and adapt code accordingly
- Update theia plugins to newest compatible versions to ensure cpp and java debugging
- Reuse tsconfig, eslint and prettier configs by eclipse-glsp
- Align build scripts, devDependencies and package.json descriptions
- Fix custom file icons alignment
-  #348 Replace run.sh script with ts-node scripts and yarn scripts
  - Create parent package.json that offers the main build scripts build:server and build:client as well as a convenience script that combines those two
  - Move copying of backend products in the build of the repsonsible client package coffee-servers and replace with ts-node script
  - Move all server backend registrations to coffee-servers package

* #455 Update Getting Started

- Enhance styling and replace outdated Theia variables
- Structure Java and CPP features in detail sections
- Improve link styling, behaviour and add titles

* Fix leftovers

* Fix ESLint warnings and leftovers

* Update coffee model and use ID attributes for EObjects

* Fix Coffee resource handling

- Remove obsolete coffee codec
- Use basic generated coffee resource implementation
- Remove unused CoffeeModelServerClient

* Fix Coffee commands

- Ensure UUIDs are used as id attributes
- Reuse notation element commands from modelserver-glsp-integration

* Cleanup leftover GLSP glitches

* Cleanup id attribute handling and naming

* Add application branding

* Fix debugging of WorkflowAnalyzerServer

- Clean up start up arguments
- Start wf-analyzer server with arguments to be able to connect from client in debug mode (either start:debug oder launch config external servers)

* Fix diagram editor unsubscribe from Model Server

* Align icons in diagram editor and coffee tree editor

- Align icons for workflow elements in 
  - GLSP tool palette
  - GLSP command palette
  - Theia tree editor

* Adapt coffee model

- Rename RAM member type to ramType to avoid possible overlaps with json attributes $type and type

* Align CSS styling

* Re-enable direct task editing via context menu on Tasks

* Adapt coffee model

* Update coffee-tree-editor

- Update tree node factory and assign actual types and ids to the tree nodes for easier navigation and identification of the tree nodes
- Update commands to new ModelServerCommand structure
- Introduce typescript version of the semantic model (coffee-model) and provide type checks for all coffee model elements
- Update add/remove/edit tree elements either via custom commands (e.g. add/removing nodes and flows), otherwise use json patches for editing

Workarounds:
- To use custom commands for editing, a simple adaptation in the model-server-client-v2 needs to be made (see PR eclipse-emfcloud/emfcloud-modelserver-theia#116), currently, we have a custom modelserver client implementation which should be removed once the PR is merged
- The CoffeeMasterTreeWidget overrides the theia-tree-editor one to be able to select nodes via its unique id. If the tree-editor is updated this custom implementation should be removed again.

* Fix build

- Lover node engine requirement to node 14

* Remove workaround for TheiaModelServerClientV2

- Update modelserver-theia dependency
- Remove custom CoffeeModelServerClient

* Update test resources for AnalyzeWorkflowTest

- Update wfconfig and coffee test resources to match current metamodels

* Fix graphical model comparison

* Revert node colors

For clearer colors during comparison

* Update dockerfile to node 14

* Removed validation questions from ModelServerAccess

I will open a follow up for this.

* Removed "no duplicate GLSP Editor" code

Is no longer needed, as we create files with new URIs during the compare

* Update README

* Update CSS styling

- Update colors for weighted flows
- Merge comparison css rules and add rules for arrow heads
- Align CSS colors of workflow analyser with diagram colors

* Fix ControlUnit child creation in tree-editor

- Ensure element creation of nested components for new ControlUnits
- Add workspace specific Theia settings
  - Disable auto-save for example workspace
- Remove node version restriction (also works with node 16)

* Fix diagram node label edit validation

- Fix label edit validation in GLSP diagram
- Revert node version restriction to `>=14 <16`

* Address Eugen's review comments

- Remove unused variables
- Introduce CSS variables for common colors
- Update README

Co-authored-by: Simon Graband <[email protected]>
  • Loading branch information
ndoschek and sgraband authored Nov 4, 2022
1 parent 8661ae1 commit b4ed8d1
Show file tree
Hide file tree
Showing 371 changed files with 11,682 additions and 12,826 deletions.
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN apt-get update && \

RUN update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-10 100

RUN curl -fsSL https://deb.nodesource.com/setup_12.x | bash - && \
RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install nodejs -y && \
npm install -g yarn

Expand All @@ -23,19 +23,20 @@ WORKDIR /coffee-editor
COPY --chown=theia:theia . .
USER theia

RUN ./run.sh -bcf && \
cp ./web/favicon.ico ./web/browser-app/lib
RUN sed -i 's/<\/head>/<link rel="icon" href="favicon.ico" \/><\/head>/g' web/browser-app/lib/index.html
# Trigger build: Build backend, build client
RUN yarn build
RUN cp ./client/favicon.ico ./client/browser-app/lib
RUN sed -i 's/<\/head>/<link rel="icon" href="favicon.ico" \/><\/head>/g' client/browser-app/lib/index.html

WORKDIR /coffee-editor/backend/examples/SuperBrewer3000
WORKDIR /coffee-editor/client/workspace/SuperBrewer3000

RUN git config --global user.name "Test User"
RUN git config --global user.email "[email protected]"
RUN git init
RUN git add *
RUN git commit -m "init"

WORKDIR /coffee-editor/web/browser-app
WORKDIR /coffee-editor/client/browser-app

EXPOSE 3000

Expand Down
19 changes: 5 additions & 14 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,7 @@ pipeline {
container('ci') {
timeout(30){
dir('backend/releng/org.eclipse.emfcloud.coffee.parent') {
sh 'mvn clean install -Pfatjar -U --batch-mode -Dmaven.repo.local=/home/jenkins/.m2/repository'
}
}
}
}
}
stage('Copy server') {
steps {
container('ci') {
timeout(30){
dir('.') {
sh './run.sh -c'
sh 'mvn clean install -U --batch-mode -Dmaven.repo.local=/home/jenkins/.m2/repository'
}
}
}
Expand All @@ -72,7 +61,7 @@ pipeline {
withCredentials([string(credentialsId: "github-bot-token", variable: 'GITHUB_TOKEN')]) {
timeout(30){
dir('.') {
sh './run.sh -f'
sh 'yarn build:client'
}
}
}
Expand All @@ -85,7 +74,9 @@ pipeline {
steps {
container('ci') {
archiveArtifacts artifacts: 'backend/releng/org.eclipse.emfcloud.coffee.product/target/products/*.zip' , fingerprint: true
archiveArtifacts artifacts: 'web/browser-app/**', fingerprint: true
archiveArtifacts artifacts: 'backend/plugins/org.eclipse.emfcloud.coffee.workflow.glsp.server/target/org.eclipse.emfcloud.coffee.workflow.glsp.server-0.1.0-SNAPSHOT-glsp.jar' , fingerprint: true
archiveArtifacts artifacts: 'backend/plugins/org.eclipse.emfcloud.coffee.modelserver/target/org.eclipse.emfcloud.coffee.modelserver-0.1.0-SNAPSHOT-standalone.jar' , fingerprint: true
archiveArtifacts artifacts: 'client/browser-app/**', fingerprint: true
}
}
}
Expand Down
67 changes: 32 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ To build the docker container run the following command once:

Now you can start the Theia Demo app using the following command (or change the host port to your preferences):

docker run -it -p 0.0.0.0:3000:3000 coffee-editor:latest yarn start
docker run -it -p 0.0.0.0:3000:3000 coffee-editor:latest

Next, open a browser pointing to localhost:3000/#/coffee-editor/backend/examples/SuperBrewer3000 in your host.
Next, open a browser pointing to <http://localhost:3000/#/coffee-editor/client/workspace/SuperBrewer3000> in your host.
You should see a Theia application with an example project being loaded.
Refer to the README.md in the workspace for more details on how to use the example project.
Refer to the `Getting Started` widget in the right area of the application for more details on how to use the example project.

### Docker Image information

The docker image includes the Theia application and the following VSCode plugins (among others):

- Clangd for C/C++ editing support
- Debug for C/C++ debugging support
- Java LSP
Expand All @@ -42,24 +42,32 @@ The runtime environment has installed (among others)

The coffee-editor consists of a frontend and a backend.

The frontend is located in the `web/` folder and frontend specific documentation can be found in the [frontend README](web/README.md)
The backend is located in the `backend/` folder and backend specific documentation can be found in the [backend README](backend/README.md)
The frontend is located in the [`client/`](./client/) folder and frontend specific documentation can be found in the [client README](client/README.md)
The backend is located in the [`backend/`](./backend/) folder and backend specific documentation can be found in the [backend README](backend/README.md)

## Used Projects

We are relying on a bunch of projects:

- https://github.com/eclipsesource/jsonforms
- https://github.com/eclipse-glsp/glsp
- https://github.com/eclipse-emfcloud/emfcloud-modelserver
- https://github.com/eclipse-emfcloud/emfcloud-modelserver-theia
- https://github.com/eclipse-emfcloud/theia-tree-editor
- <https://github.com/eclipsesource/jsonforms>
- <https://github.com/eclipse-glsp/glsp>
- <https://github.com/eclipse-emfcloud/emfcloud-modelserver>
- <https://github.com/eclipse-emfcloud/emfcloud-modelserver-theia>
- <https://github.com/eclipse-emfcloud/theia-tree-editor>

If you encounter issues please report them in the corresponding project.
This project should not contain much code and should mostly consist of 'glue' code to combine the different components.

## Prerequisites

The following libraries/frameworks need to be installed on your system:

| | |
| ---------------------------------------------------------------------------- | ---------- |
| [Java](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html) | `11` |
| [Maven](https://maven.apache.org/) | `>=3.8.6` |
| [Node](https://nodejs.org/en/) | `>=14 <16` |

### Java

You need Java 11 to build the Coffee Editor.
Expand All @@ -70,8 +78,8 @@ You need Java 11 to build the Coffee Editor.

### Install npm and node

nvm install 12
nvm use 12
nvm install 14
nvm use 14

### Install yarn

Expand All @@ -96,32 +104,22 @@ On Windows the most reliable way seems to be to install Python and set `npm conf

## Getting started

Clone and build the coffee-editor:
Clone the coffee-editor:

git clone https://github.com/eclipsesource/coffee-editor.git
cd coffee-editor
./run.sh

Run the built coffee-editor:

./run.sh -r
Build the coffee-editor:

Open http://localhost:3000 in the browser.
yarn build

In Theia open the example workspace `backend/examples/SuperBrewer3000` and double click a `.coffee` file. This opens it in a tree master detail editor.

## The build and run script

The `run.sh` script provides funtionality to build the coffee-editor, download used libraries, and run the IDE.
Every part step can be executed independently from each other by using the corresponding paramater:

`-b`: Builds the backend services
Run the built coffee-editor:

`-c`: Integrates the built backend artifacts in the coffee-editor IDE
yarn start

`-f`: Builds the frontend shown in the web browser
Open <http://localhost:3000> in the browser.

`-r`: Runs the coffee-editor and exposes it at http://localhost:3000
In Theia open the example workspace `client/workspace/SuperBrewer3000` and double click a `.coffee` file. This opens it in a tree master detail editor.

## Publishing the coffee-editor-extension

Expand Down Expand Up @@ -164,17 +162,16 @@ You can also use the predefined `RunSocketServer-Headless.launch` run config.

#### Coffee Model Server

Use the `org.eclipse.emfcloud.coffee.modelserver.app.application` Eclipse Application or the corresponding `modelserver.product` from `org.eclipse.emfcloud.coffee.product` to start the Model Server.
Use the `CoffeeModelServer` launch config to start the Model Server.

#### Coffee GLSP Server

Use the `workflowserver.product` product to start the GLSP Server.
On the client side, set the `isRunning` flag of the [CoffeeGlspLaunchOptions](web/coffee-server/src/node/backend-module.ts) to `true`.
Use the `WorkflowGLSPServer` launch config to start the GLSP Server.

### Debug Frontend
### Debug Client

- Install VSCode
- Import projects from `web`
- Open folder `client`

#### Debug Theia Backend

Expand Down
3 changes: 2 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Compiled class file
*.class

# Log file
# Log files
*.log
*.log.gz

# BlueJ files
*.ctxt
Expand Down

This file was deleted.

9 changes: 0 additions & 9 deletions backend/examples/SuperBrewer3000/.theia/settings.json

This file was deleted.

20 changes: 0 additions & 20 deletions backend/examples/SuperBrewer3000/.theia/tasks.json

This file was deleted.

32 changes: 0 additions & 32 deletions backend/examples/SuperBrewer3000/superbrewer3000.coffee

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: org.eclipse.emfcloud.modelserver.client;bundle-version="0.7.0",
org.eclipse.emfcloud.modelserver.common;bundle-version="0.7.0",
org.eclipse.emfcloud.modelserver.emf;bundle-version="0.7.0",
org.eclipse.emfcloud.modelserver.lib;bundle-version="0.7.0",
org.eclipse.emf.ecore;bundle-version="[2.23.0,3.0.0)"
Export-Package: org.eclipse.emfcloud.coffee.common
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emfcloud.modelserver.client.ModelServerClient;
import org.eclipse.emfcloud.modelserver.common.ModelServerPathParametersV2;

public final class ModelServerClientUtil {
private static final String FORMAT = "xmi";
private static final String MODEL_SERVER_BASE_URL = "http://localhost:8081/api/v1/";
private static final String MODEL_SERVER_BASE_URL = "http://localhost:8081/api/v2/";

private ModelServerClientUtil() {}

@SuppressWarnings("IllegalThrows")
public static EObject loadResource(final URI uri) throws Exception {
@SuppressWarnings("resource")
ModelServerClient client = new ModelServerClient(MODEL_SERVER_BASE_URL);
return client.get(Paths.get(uri).getFileName().toString(), FORMAT).get().body();
return client.get(Paths.get(uri).getFileName().toString(), ModelServerPathParametersV2.FORMAT_XMI).get().body();
}

@SuppressWarnings("IllegalThrows")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="coffee" nsURI="http://www.eclipse.org/emfcloud/coffee/model"
nsPrefix="org.eclipse.emfcloud.coffee.model">
<eClassifiers xsi:type="ecore:EClass" name="Component" abstract="true">
<eClassifiers xsi:type="ecore:EClass" name="Identifiable" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
iD="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Component" abstract="true" eSuperTypes="#//Identifiable">
<eStructuralFeatures xsi:type="ecore:EReference" name="children" upperBound="-1"
eType="#//Component" containment="true" eOpposite="#//Component/parent"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="parent" eType="#//Component"
Expand All @@ -27,7 +31,7 @@
<eClassifiers xsi:type="ecore:EClass" name="BrewingUnit" eSuperTypes="#//Component"/>
<eClassifiers xsi:type="ecore:EClass" name="DipTray" eSuperTypes="#//Component"/>
<eClassifiers xsi:type="ecore:EClass" name="WaterTank" eSuperTypes="#//Component"/>
<eClassifiers xsi:type="ecore:EClass" name="Processor">
<eClassifiers xsi:type="ecore:EClass" name="Processor" eSuperTypes="#//Identifiable">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="vendor" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="clockSpeed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="numberOfCores" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
Expand All @@ -43,32 +47,32 @@
<eLiterals name="nm18" literal="18nm"/>
<eLiterals name="nm25" value="1"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Dimension">
<eClassifiers xsi:type="ecore:EClass" name="Dimension" eSuperTypes="#//Identifiable">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="width" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="height" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="length" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RAM">
<eClassifiers xsi:type="ecore:EClass" name="RAM" eSuperTypes="#//Identifiable">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="clockSpeed" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="size" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="#//RamType"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="ramType" eType="#//RamType"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="RamType">
<eLiterals name="SODIMM" literal="SO-DIMM"/>
<eLiterals name="SIDIMM" literal="SI-DIMM"/>
<eLiterals name="SODIMM" literal="SODIMM"/>
<eLiterals name="SIDIMM" value="1" literal="SIDIMM"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Display">
<eClassifiers xsi:type="ecore:EClass" name="Display" eSuperTypes="#//Identifiable">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="width" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="height" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Workflow">
<eClassifiers xsi:type="ecore:EClass" name="Workflow" eSuperTypes="#//Identifiable">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="nodes" lowerBound="1" upperBound="-1"
eType="#//Node" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="flows" upperBound="-1"
eType="#//Flow" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Node" abstract="true">
<eClassifiers xsi:type="ecore:EClass" name="Node" abstract="true" eSuperTypes="#//Identifiable">
<eOperations name="hasCycle" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eParameters name="chain" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDiagnosticChain"/>
<eParameters name="context">
Expand Down Expand Up @@ -158,7 +162,7 @@
</eParameters>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Flow">
<eClassifiers xsi:type="ecore:EClass" name="Flow" eSuperTypes="#//Identifiable">
<eStructuralFeatures xsi:type="ecore:EReference" name="source" lowerBound="1"
eType="#//Node"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="target" lowerBound="1"
Expand Down
Loading

0 comments on commit b4ed8d1

Please sign in to comment.