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

Add export to SysML and to PlantUML #34

Draft
wants to merge 75 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
1fd6af3
add printSysml optional to instance model and a CLI option to get sta…
EthanJamesLew Feb 22, 2023
2fcd404
start the sysml ast for compilation
EthanJamesLew Feb 23, 2023
4eb4c88
add visitor for pretty printer
EthanJamesLew Feb 23, 2023
aaf29a8
pprint sysml example
EthanJamesLew Feb 23, 2023
3d1870d
restructure for instance compiler, add ast package
EthanJamesLew Feb 23, 2023
34e9de6
change compiler to use multiplicity, part def
EthanJamesLew Feb 28, 2023
e527bbd
add SysmlAnnotation and pretty print annotations from the CLaferInstance
EthanJamesLew Feb 28, 2023
9d872f8
add a Clafer AST -> Sysml compiler
EthanJamesLew Feb 28, 2023
83531fa
allow Instance compiler to return null if no Sysml concepts are refer…
EthanJamesLew Feb 28, 2023
8c878d6
hoist getSuperClafers to the compiler utils
EthanJamesLew Feb 28, 2023
d02d62d
address emptyblocktag
EthanJamesLew Mar 1, 2023
9c97f20
remove the bad exception handling
EthanJamesLew Mar 1, 2023
95b84d7
allow visit to throw IOException
EthanJamesLew Mar 1, 2023
3d8f352
add maven CI/CD
EthanJamesLew Mar 1, 2023
a48271d
fix unhandled exception catching and null dereference issue
EthanJamesLew Mar 1, 2023
487755b
remove travis CI/CD
EthanJamesLew Mar 1, 2023
e79d0db
run maven CI/CD on push
EthanJamesLew Mar 1, 2023
f739f18
bump Maven Dependency Tree Dependency Submission action
EthanJamesLew Mar 1, 2023
f54dd17
remove dependency graph upload for now
EthanJamesLew Mar 1, 2023
29bd949
update CI/CD badge
EthanJamesLew Mar 1, 2023
3c70b75
add plantuml package and start adding the ast classes / interfaces
EthanJamesLew Mar 12, 2023
1044332
add plantuml to cli inputs and check for conflicting options
EthanJamesLew Mar 12, 2023
9205f45
flesh out compile and pprinter interfaces
EthanJamesLew Mar 12, 2023
204c102
add fields to the plantuml ast
EthanJamesLew Mar 12, 2023
3ff20d6
pretty print objects
EthanJamesLew Mar 13, 2023
25138b5
add basic connections compilation
EthanJamesLew Mar 13, 2023
b912367
add labels, support or and xor
EthanJamesLew Mar 13, 2023
ffe9904
close dataStream to properly handle dynamic allocation
EthanJamesLew Mar 13, 2023
1eaae94
make or arrowhead a filled shape
EthanJamesLew Mar 13, 2023
c4193df
make mandatory arrowhead for multiplicity one features
EthanJamesLew Mar 13, 2023
1c8438a
fold refs into object attributes
EthanJamesLew Mar 13, 2023
ab5bea8
remove Optimizing message for plantuml (which does not optimize)
EthanJamesLew Mar 13, 2023
71e9e85
fix confusing renaming assignment
EthanJamesLew Mar 13, 2023
a81d951
Minor tweaks for prettier diagrams
podhrmic Mar 15, 2023
a8062df
Added annotations for the TOML config file
podhrmic Mar 15, 2023
fa64280
add config toml to input argparse, create builder that can be built f…
EthanJamesLew Mar 15, 2023
57fc8a5
add levels, superClafers, constraints include fields
EthanJamesLew Mar 15, 2023
9152193
implement level, blacklist--update tomlj
EthanJamesLew Mar 15, 2023
04fcb3b
clean up the label, arrowhead code, add super_clafers_components to o…
EthanJamesLew Mar 16, 2023
284682b
revert pom.xml maven plugins config
EthanJamesLew Mar 16, 2023
9fcec60
Replace stream API with a loop (recommended by IntelliJ) so it works …
podhrmic Mar 16, 2023
1a64eb4
Add an optional plantuml header
podhrmic Mar 16, 2023
71dddf8
Handle null header case better
podhrmic Mar 16, 2023
2baf043
Added examples from ClaferMOOVisualizer
podhrmic Mar 16, 2023
3c2b96c
Merge branch 'feature/plantuml' into 'feature/sysml'
EthanJamesLew Mar 16, 2023
0203d9e
Added CI file
podhrmic Mar 16, 2023
75e8fe0
Enable CI
podhrmic Mar 17, 2023
4371767
Merge branch 'feature/CI-tweaks' into 'feature/sysml'
podhrmic Mar 17, 2023
973ba30
add alias and parent to PlantUML AST, update compiler and pretty prin…
EthanJamesLew Mar 29, 2023
10bdc5e
Merge branch 'feature/plantuml-alias' into 'feature/sysml'
podhrmic Mar 29, 2023
5843cdf
Add sysml output to CI tests
podhrmic Mar 29, 2023
ea224c1
switch base sysml clafer name to reflect update in identifier generation
EthanJamesLew Mar 29, 2023
3fdeaed
Add sysml output to CI tests
podhrmic Mar 29, 2023
5e13c32
Merge branch 'quickfix/sysml-compiler-qual' into 'feature/sysml'
podhrmic Mar 29, 2023
09ffa0b
Fix Bad Identifier Generation for SysMLv2 Compiler
EthanJamesLew Mar 30, 2023
1876087
Merge branch 'quickfix/sysml-compiler-qual-2' into 'feature/sysml'
podhrmic Mar 30, 2023
ae7ee03
CI-fixes
podhrmic Mar 30, 2023
7c3aa8f
Merge branch 'ci-fixes' into 'feature/sysml'
podhrmic Mar 30, 2023
b2dc4c7
increment index inside of sysml loop
EthanJamesLew Apr 4, 2023
02f8f08
Merge branch 'bugfix/limit-instances' into 'feature/sysml'
podhrmic Apr 4, 2023
f1d678a
Change the runner label from docker to stardust as recommended by the IT
podhrmic Oct 24, 2023
5a900d9
add .m2/repository to cache and add a deploy job on tagged commits
EthanJamesLew Jan 8, 2024
d047f8a
Merge branch 'feature/ci-cd-deploy' into 'feature/sysml'
EthanJamesLew Jan 8, 2024
9532e4c
change placeholder name to the correct jar file
EthanJamesLew Jan 8, 2024
cae0c29
Merge branch 'feature/ci-cd-deploy' into 'feature/sysml'
EthanJamesLew Jan 8, 2024
8ba10b6
change deploy to require the build stage, remove non-existent cache path
EthanJamesLew Jan 12, 2024
288ba65
Merge branch 'bugfix/ci-cd-release' into 'feature/sysml'
EthanJamesLew Jan 12, 2024
b5b99ba
Build MVN package workflow
podhrmic Apr 18, 2024
ceb037a
Comment out act specific setup
podhrmic Apr 18, 2024
618d154
Added sysml export test
podhrmic Apr 18, 2024
64faada
Update system path
podhrmic Apr 18, 2024
a85d627
Add PlantUML job
podhrmic Apr 19, 2024
15b6a36
Attempt to debug the pipeline
podhrmic Apr 19, 2024
f32c12b
Another debugging attempt
podhrmic Apr 19, 2024
345c299
Fix the CI (#2)
podhrmic Apr 19, 2024
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
117 changes: 117 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
push:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build_package:
name: Builld chocosolver package
runs-on: ubuntu-20.04
steps:
#### This step is only needed for GHA local runner, act: https://github.com/nektos/act
### That is because act ubuntu image does not have mvn installed, but the github one does
# - name: Install curl (for nektos/act local CI testing)
# run: apt-get update && apt-get install build-essential curl pkg-config openssl -y
# - name: Download Maven
# run: |
# curl -sL https://downloads.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.zip -o maven.zip
# apt-get update
# apt-get -y install unzip
# unzip -d /usr/share maven.zip
# rm maven.zip
# ln -s /usr/share/apache-maven-3.8.8/bin/mvn /usr/bin/mvn
# echo "M2_HOME=/usr/share/apache-maven-3.8.8" | tee -a /etc/environment
# file /usr/bin/mvn
# echo $PATH
# Rest of the actions
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
- run: mvn --batch-mode --update-snapshots verify
- run: mkdir staging && cp target/*.jar staging
- uses: actions/upload-artifact@v4
with:
name: chocosolver-release
path: staging/*.jar
retention-days: 7

test_sysml_export:
name: Test SysMLv2 export
needs: build_package
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Download Chocosolver package
uses: actions/download-artifact@v4
with:
name: chocosolver-release
path: /tmp/chocosolver-release
- name: Install clafer tools
run: |
wget --no-check-certificate https://gsd.uwaterloo.ca/clafer-tools-bin/clafer-tools-0.4.5-linux-x86_64.zip
unzip clafer-tools-0.4.5-linux-x86_64.zip
mv clafer-tools-0.4.5 /opt/clafer-tools-0.4.5
echo "/opt/clafer-tools-0.4.5" >> $GITHUB_PATH
- name: Process SysML examples
shell: bash
run: |
for f in examples/sysml-samples/*.cfr
do
echo "Processing $f"
java -jar /tmp/chocosolver-release/chocosolver-0.4.4-jar-with-dependencies.jar --sysml --file $f --output $f.sysml
done
- uses: actions/upload-artifact@v4
with:
name: SysML_generated
path: examples/sysml-samples/*.sysml
retention-days: 7

test_plantuml_export:
name: Test PlantUML export
needs: build_package
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Download Chocosolver package
uses: actions/download-artifact@v4
with:
name: chocosolver-release
path: /tmp/chocosolver-release
- name: Install clafer tools
shell: bash
run: |
wget --no-check-certificate https://gsd.uwaterloo.ca/clafer-tools-bin/clafer-tools-0.4.5-linux-x86_64.zip
unzip clafer-tools-0.4.5-linux-x86_64.zip
mv clafer-tools-0.4.5 /opt/clafer-tools-0.4.5
echo "/opt/clafer-tools-0.4.5" >> $GITHUB_PATH
- name: Install PlantUML
run: |
wget https://github.com/plantuml/plantuml/releases/download/v1.2023.4/plantuml-1.2023.4.jar
- name: Install graphviz
run: |
sudo apt-get update
sudo apt-get install graphviz
- name: Process SysML examples
run: |
for f in examples/**.cfr
do
echo "Processing $f"
java -jar /tmp/chocosolver-release/chocosolver-0.4.4-jar-with-dependencies.jar --plantuml --file $f --output $f.plantuml
java -jar /tmp/chocosolver-release/chocosolver-0.4.4-jar-with-dependencies.jar --sysml --file $f --output $f.sysml
echo "Rendering $f.plantuml"
java -jar plantuml-1.2023.4.jar $f.plantuml
done
- uses: actions/upload-artifact@v4
with:
name: PlantUML_generated
path: |
examples/**.plantuml
examples/**.sysml
examples/**.png
retention-days: 7
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ target
nb-configuration.xml
nbactions.xml
src/test/resources/user.properties
.idea
*.plantuml
*.js

91 changes: 91 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
stages:
- build
- test
- deploy

image: maven:3.6-jdk-11

before_script:
- export PATH="$PWD/clafer-tools-0.4.5:$PATH"

prepare_environment:
stage: build
script:
- wget --no-check-certificate https://gsd.uwaterloo.ca/clafer-tools-bin/clafer-tools-0.4.5-linux-x86_64.zip
- unzip clafer-tools-0.4.5-linux-x86_64.zip
artifacts:
when: always
paths:
- clafer-tools-0.4.5/
expire_in: 1 hour

build_package:
stage: build
tags: ["stardust"]
script:
- mvn package
artifacts:
when: always
paths:
- target/chocosolver-0.4.4-jar-with-dependencies.jar
expire_in: 1 week

test_sysml_export:
stage: test
needs:
- job: build_package
artifacts: true
- job: prepare_environment
artifacts: true
script:
- |
for f in examples/sysml-samples/*.cfr
do
echo "Processing $f"
java -jar target/chocosolver-0.4.4-jar-with-dependencies.jar --sysml --file $f --output $f.sysml
done
artifacts:
when: always
paths:
- ./examples/sysml-samples/*.sysml
expire_in: 1 week

test_plantuml_export:
stage: test
needs:
- job: build_package
artifacts: true
- job: prepare_environment
artifacts: true
script:
- wget https://github.com/plantuml/plantuml/releases/download/v1.2023.4/plantuml-1.2023.4.jar
- apt-get update && apt-get install -y graphviz
- |
for f in examples/**/*.cfr
do
echo "Processing $f"
java -jar target/chocosolver-0.4.4-jar-with-dependencies.jar --plantuml --file $f --output $f.plantuml
java -jar target/chocosolver-0.4.4-jar-with-dependencies.jar --sysml --file $f --output $f.sysml
echo "Rendering $f.plantuml"
java -jar plantuml-1.2023.4.jar $f.plantuml
done
artifacts:
when: always
paths:
- ./examples/*.plantuml
- ./examples/*.sysml
- ./examples/*.png
expire_in: 1 week

deploy_job:
stage: deploy
needs:
- job: build_package
artifacts: true
- job: prepare_environment
artifacts: true
script:
- 'echo "Deploying the project to GitLab Package Registry..."'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./target/chocosolver-0.4.4-jar-with-dependencies.jar "https://gitlab-ext.galois.com/api/v4/projects/$CI_PROJECT_ID/packages/maven/"'
only:
- tags
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://secure.travis-ci.org/gsdlab/chocosolver.svg)](http://travis-ci.org/gsdlab/chocosolver)
[![Build Status](https://github.com/EthanJamesLew/chocosolver-sysml/actions/workflows/maven.yml/badge.svg)](https://github.com/EthanJamesLew/chocosolver-sysml/actions/workflows/maven.yml)

# chocosolver

Expand Down
58 changes: 58 additions & 0 deletions examples/AndroidSampleMoo_2.cfr
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
abstract Component
performance : integer

abstract ComponentWithEnergy : Component
energy : integer

abstract androidPhone
hardware : Component
[ performance = 0 ]
screen : Component
[ performance = 0 ]
xor material : Component
[ performance = 0 ]
oled : ComponentWithEnergy
[ energy = 3]
[ performance = -3 ]
amoled : ComponentWithEnergy
[ energy = 2 ]
[ performance = -5 ]
lcd : ComponentWithEnergy
[ energy = 4 ]
[ performance = -2 ]
keyboard : ComponentWithEnergy ?
[ energy = 1 ]
[ performance = 3 ]
keyboardLight : ComponentWithEnergy ?
[ energy = 2 ]
[ performance = -1 ]
[ keyboard ]
cpu : ComponentWithEnergy
[ energy = 10 ]
[ performance = 15 ]
extra_cpu : ComponentWithEnergy ?
[ energy = 2 ]
[ performance = 20 ]
or location : Component ?
[ performance = 0 ]
gps : ComponentWithEnergy
[ energy = 5 ]
[ performance = -1 ]
wifitriangulation : ComponentWithEnergy
[ energy = 10 ]
[ performance = -2 ]
software : Component
[ performance = 0 ]
browser : Component ?
[ performance = -1 ]
[ extra_cpu ]
mediaplayer : Component ?
[ performance = -2 ]
total_performance : integer = sum Component.performance
total_energy : integer = sum ComponentWithEnergy.energy

aPhone : androidPhone
[ mediaplayer ]

<< min aPhone.total_energy >>
<< max aPhone.total_performance >>
42 changes: 42 additions & 0 deletions examples/AndroidSampleMoo_3.cfr
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
abstract Feature
performance : integer
energy : integer

abstract SecurityFeature : Feature
security : integer

abstract MobilePhone
or Connectivity : Feature
[ this.performance = 0]
[ this.energy = 0]
Bluetooth : Feature
[ this.performance = 9]
[ this.energy = 10 ]
USB : Feature
[ this.performance = 15]
[ this.energy = 7 ]
Wifi : Feature
[ this.performance = 22]
[ this.energy = 17 ]
PasswordProtection : SecurityFeature ?
[ this.security = 5]
[ this.performance = 1]
[ this.energy = 2 ]
FingerprintProtection : SecurityFeature ?
[ this.security = 5]
[ this.performance = 2]
[ this.energy = 4 ]
total_performance : integer
[ total_performance = sum Feature.performance ]
total_energy : integer
[ total_energy = sum Feature.energy ]
total_security : integer
[ total_security = sum SecurityFeature.security ]

MyPhone : MobilePhone
[ Connectivity.Bluetooth && !USB ]

<< min MyPhone.total_energy >>
<< max MyPhone.total_performance >>
<< max MyPhone.total_security >>

50 changes: 50 additions & 0 deletions examples/AndroidSampleMoo_4.cfr
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
abstract Feature
performance : integer
energy : integer
mass: integer

abstract SecurityFeature : Feature
security : integer

abstract MobilePhone
or Connectivity : Feature
[ this.performance = 0]
[ this.energy = 0]
[ this.mass = 0]
Bluetooth : Feature
[ this.performance = 9]
[ this.energy = 10 ]
[ this.mass = 2]
USB : Feature
[ this.performance = 10]
[ this.energy = 5 ]
[ this.mass = 3]
Wifi : Feature
[ this.performance = 22]
[ this.energy = 17 ]
[ this.mass = 6]
PasswordProtection : SecurityFeature ?
[ this.security = 5]
[ this.performance = 1]
[ this.energy = 2 ]
[ this.mass = 0]
FingerprintProtection : SecurityFeature ?
[ this.mass = 0]
[ this.security = 5]
[ this.performance = 2]
[ this.energy = 4 ]
total_performance : integer
[ total_performance = sum Feature.performance ]
total_energy : integer
[ total_energy = sum Feature.energy ]
total_security : integer
[ total_security = sum SecurityFeature.security ]
total_mass : integer
[ total_mass = sum Feature.mass ]

MyPhone : MobilePhone

<< min MyPhone.total_energy >>
<< max MyPhone.total_performance >>
<< max MyPhone.total_security >>
<< min MyPhone.total_mass >>
Loading