Skip to content

Commit

Permalink
Use YAML-based grammar for our models (#28)
Browse files Browse the repository at this point in the history
* New examples, + moving old examples around

* Does not work good enough yet, but it work enough to keep going

* Implemented testing for new language

* GmodelFactory refactor, serailizer broken, fixing that first

* Rewrote serializer, now dynamic and works with Yaml

* GModel-factory now works with new lang

* Extension should be working with new language

* Fix error about character needing to be non-negative caused by  '-1'

* Fix errors by using a specific chevrotain version

- Downgrade from 10.5.0 to 10.4.2 as it does not work for our YAML lang
-- Chevrotain/chevrotain@v10.4.2...v10.5.0
-- Main extension: Chevrotain/chevrotain#1917

* To get it working on my machine

* readme update for license

* fixing tests

* Improve stability of cross-updates and fix edge structure

- Ensure edges (relationships) are created between nodes (entities)
-- Ensure node entity matches expected relationship entity

- Improve stability of cross-updates
-- Ensure 'save' does an implicit 'update' of the internal structure
-- Ensure update only updates text editor when it was opened
-- Only do full textual updates to avoid merging issues
-- Let UI react to updates, not only on save
-- Debounce model update for form editor

- Minors
-- Adapt grammar to better reflect semantic element (instead of 'for')
-- Always serialize properties in same order

* Update example files and fix IDs for GLSP server for better update

* Extend protocol with client id and improve update mechanism

- Use open/close as lifecycle methods for clients
- Let extension startup early to handle non-textual editors

* Fixed wrong use of name vs name_val when showing and synching the model.

* Added missing name property on Order entity.

* Initial gitpod setup.

* Added yarn test in build action.

* Refactored test build part into seperate action and added in feature build only (for now).

* Disabled test action for now, since it doesn't seem to work on GitHub easily.

* Refactored serializer so indentation and characters used are in constants.
Updated/added some comments.
Updated model-service-impl so have more specific console/promise messages and added some comments.

---------

Co-authored-by: Özcan Seker <ozcan@x-breeze.com>
Co-authored-by: Harmen Wessels <harmen@x-breeze.com>
Co-authored-by: Harmen Wessels <97173058+harmen-xb@users.noreply.github.com>
  • Loading branch information
4 people authored Oct 18, 2023
1 parent 6cf2f43 commit 1a3ce57
Show file tree
Hide file tree
Showing 150 changed files with 5,021 additions and 1,889 deletions.
9 changes: 6 additions & 3 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,27 @@ runs: # windows-2019 # is needed because the Setup Python task does not work wit
- name: Set up yarn to use version 1.22.19
uses: Amadevus/pwsh-script@v2.0.3
with:
# PowerShell script to execute in Actions-hydrated context
script: |
yarn policies set-version 1.22.19
- name: Yarn version
uses: Amadevus/pwsh-script@v2.0.3
with:
# PowerShell script to execute in Actions-hydrated context
script: |
yarn --version | Write-Host
- name: Yarn build
uses: Amadevus/pwsh-script@v2.0.3
with:
# PowerShell script to execute in Actions-hydrated context
script: |
yarn
- name: Yarn test
uses: Amadevus/pwsh-script@v2.0.3
with:
script: |
yarn test
#- name: Yarn start browser
# run: |
# yarn start:browser
Expand Down
11 changes: 11 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: test
description: 'Test CrossModel'

runs: # windows-2019 # is needed because the Setup Python task does not work with ubuntu
using: 'composite'
steps:
- name: Yarn test
uses: Amadevus/pwsh-script@v2.0.3
with:
script: |
yarn test
18 changes: 10 additions & 8 deletions .github/workflows/feature.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
name: feature

on:
push:
branches:
- feature/*
push:
branches:
- feature/*

jobs:
build:
runs-on: windows-2019 # is needed because the Setup Python task does not work with ubuntu
steps:
# Checkout the code.
- name: check out # is needed to read the files on the root folder of the repo
uses: actions/checkout@v3
# Use the build-addin action.
- uses: ./.github/actions/build
# Checkout the code.
- name: check out # is needed to read the files on the root folder of the repo
uses: actions/checkout@v3
# Use the build action.
- uses: ./.github/actions/build
# Use the test action.
# - uses: ./.github/actions/test
17 changes: 17 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This configuration file was automatically generated by Gitpod.
# Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml)
# and commit this file to your remote git repository to share the goodness with others.

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

# To have the dependencies for Theia installed execute the following commands in the GitPod workspace once:
# sudo apt-get install libsecret-1-dev libxkbfile-dev
# nvm install 16.20.0
# pyenv install -s 3.11.4
# pyenv global 3.11.4

tasks:
- init: yarn install && yarn run build
command: yarn run watch


16 changes: 15 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"--loglevel=debug",
"--hostname=localhost",
"--no-cluster",
"--root-dir=${workspaceRoot}/examples/workspace",
"--root-dir=${workspaceRoot}/examples/yaml-example",
"--app-project-path=${workspaceFolder}/applications/electron-app",
"--remote-debugging-port=9222",
"--no-app-auto-install",
Expand Down Expand Up @@ -114,6 +114,20 @@
"${workspaceFolder}/node_modules/vscode-languageclient/**/*.js",
"${workspaceFolder}/node_modules/vscode-jsonrpc/**/*.js"
]
},
{
"name": "Debug Jest Tests",
"type": "node",
"request": "launch",
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/jest/bin/jest.js",
"--runInBand",
"--config=extensions/crossmodel-lang/jest.config.js",
"--testPathPattern=extensions/crossmodel-lang/test/language-server/util/name-util.test.ts"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ The repository itself contains the following components structured as follows:

## Used libraries and license

- mui-x : MUI X is open core—base components are MIT-licensed, while more advanced features require a Pro or Premium commercial license. We are
currently only using core-base
- mui-x : MUI X is open core—base components are MIT-licensed, while more advanced features require a Pro or Premium commercial license. We are currently only using core-base
- react-tabs: MIT
- chevotain: This library is a dependency of langium. To get the Yaml language working in crossmodel an example implementation of the python language of chevrotrain has been used. This example has been modified to make it work for the yaml language.
- https://github.com/Chevrotain/chevrotain
- example that has been used: https://github.com/Chevrotain/chevrotain/tree/master/examples/lexer/python_indentation
5 changes: 5 additions & 0 deletions configs/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node'
};
8 changes: 8 additions & 0 deletions examples/cross-model-project-example/.theia/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
"version": "0.2.0",
"configurations": [

]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
entity Aantal {
description := "Test description";
attributes {
nope := 'Float';
test123456 := 'Bool';
test3 := 'Float';
test4 := 'Char';
}
}
10 changes: 10 additions & 0 deletions examples/cross-model-project-example/systemA/entities/Klant.cm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
entity Klant {
description := "test123";
attributes {
werk := 'Float';
test49999912somsdit := 'Char';
wat111234 := 'Varchar';
hall1123 := 'Integer';
ditwerktdusnietaltijd := 'test1234';
}
}
17 changes: 17 additions & 0 deletions examples/cross-model-project-example/systemA/entities/Order.cm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
entity Order {
description := "Orders geplaatst door de klant";
attributes {
test49999912somsdit := 'Varchar';
werk := 'Integer';
wat111234 := 'Varchar';
hall1123 := 'Integer';
ditwerktdusnietaltijd := 'test1234';
empty_attribute5 := 'Float';
empty_attribute6 := 'Float';
empty_attribute7 := 'Float';
empty_attribute8 := 'Float';
empty_attribute9 := 'Float';
empty_attribute10 := 'Float';
empty_attribute11 := 'Float';
}
}
10 changes: 10 additions & 0 deletions examples/cross-model-project-example/systemA/entities/Product.cm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
entity Product {
description := "Producten die verkocht worden";
attributes {
test1 := 'test2';
test2 := 'test3';
test3 := 'test';
test4 := 'test';
test5 := 'test';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
relationship AantalToProduct {
source := Aantal;
target := Product ;
type := 1:1;
properties {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
relationship AantalToProduct0 {
source := Aantal;
target := Product;
type := 1:1;
properties {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
relationship KlantToOrder {
source := Klant;
target := Order;
type := 1:1;
properties {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
relationship KlantToOrder0 {
source := Klant;
target := Order;
type := 1:1;
properties {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
relationship OrderToAantal {
source := Order;
target := Aantal;
type := 1:1;
properties {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
relationship OrderToProduct {
source := Order;
target := Product;
type := 1:1;
properties {

}
}
Loading

0 comments on commit 1a3ce57

Please sign in to comment.