Skip to content

Commit

Permalink
Merge pull request #103 from LionWeb-io/meinte/update-cmdline-export
Browse files Browse the repository at this point in the history
Upgrade to version 0.2.8 of the LionWeb MPS plugin
  • Loading branch information
dslmeinte authored Sep 27, 2024
2 parents a7cf26e + 1bdd291 commit c56025e
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 11 deletions.
25 changes: 21 additions & 4 deletions solutions/io.lionweb.mps.cmdline/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,23 @@ usage: lionweb-export-language <project-dir> [<config-file>] <output-file>

* _output-file:_ The file the converted languages should be written to.
All languages will be written to the same file.

* _language:_ Supplies the key of a language to export.
Can be used multiple times; we accumulate all keys from _config-file_ and _language_ parameters.
**Note:** We're always using the language's [key](../../docs/reference/structure-extensions.adoc#custom-keys).
We're _not_ using the language's fully qualified name, module name, uuid, or anything else.

* _macro:_ Supplies key/value pair to set a path variable for the MPS project.
Can be used multiple times.
Example: `-mlionweb-mps.home=./../` sets path variable `lionweb-mps.home` to `./../`.

* _scope:_ Defines the export [scope as explained for converter languages](../../docs/reference/converter-lang.adoc#language-json-export).


### Examples

Minimal usage example without config file:

```shell
./gradlew runCommandLineTool -Pargs=". exported.lw-lang.json -lMyHappyLittleMulti-Reference_Language -s=listed"
```
Expand All @@ -60,6 +62,7 @@ Example with config file:
* `exported.lw-lang.json` sets the output file

Contents of `config-file.json`:

```json
{
"scope": "listed",
Expand All @@ -70,8 +73,21 @@ Contents of `config-file.json`:
}
```

#### Test exports

The directory `test-project/` can be used to test the command-line exporter.
Run

```shell
source test-scripts/export-library.sh
source test-scripts/export-multiple.sh
```

to export two example languages, and compare the exports to the reference exports in `test-references/`.


## Setup

We assume the MPS project that contains your to-be-exported languages is built with gradle.

Create or adjust the following contents of `build.gradle.kts` (Kotlin dialect):
Expand Down Expand Up @@ -140,14 +156,15 @@ pluginManagement {

and some `gradle.properties` (adjust the versions accordingly):
```properties
lionwebVersion=0.2.3-SNAPSHOT
lionwebVersion=0.2.8
lionwebRelease=2023.1
mpsVersionSuffix=2021.1
mpsVersion=2021.1.4
comSpecificlanguagesMpsVersion=1.6.0
```

**Note:** The implementation strongly assumes that lionweb will be deployed to directory `./build/dependencies/io.lionweb.mps`.
**Note:** The implementation strongly assumes that LionWeb will be deployed to directory `./build/dependencies/io.lionweb.mps`.


## Code design

Expand Down
2 changes: 1 addition & 1 deletion test-project/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lionwebVersion=0.2.3-SNAPSHOT
lionwebVersion=0.2.9-SNAPSHOT
lionwebRelease=2023.1
mpsVersionSuffix=2021.1
mpsVersion=2021.1.4
Expand Down
4 changes: 4 additions & 0 deletions test-project/test-references/library.lw-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
{
"key": "LionCore-M3",
"version": "2023.1"
},
{
"key": "LionCore-builtins",
"version": "2023.1"
}
],
"nodes": [
Expand Down
4 changes: 4 additions & 0 deletions test-project/test-references/multiple.lw-lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
{
"key": "LionCore-M3",
"version": "2023.1"
},
{
"key": "LionCore-builtins",
"version": "2023.1"
}
],
"nodes": [
Expand Down
6 changes: 3 additions & 3 deletions test-project/test-scripts/export-library.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

CONFIGFILE=library.lw-lang.json
OUTPUT_FILE=library.lw-lang.json

./gradlew runCommandLineTool -Pargs=". -lNTM3ZjljYjAtMGYyNS0zYzc2LThiODYtMzA4ZjQ1MDEwMTAw $CONFIGFILE -mlionweb-mps.home=./../ -s=listed"
./gradlew runCommandLineTool -Pargs=". -lNTM3ZjljYjAtMGYyNS0zYzc2LThiODYtMzA4ZjQ1MDEwMTAw $OUTPUT_FILE -mlionweb-mps.home=./../ -s=listed"

diff $CONFIGFILE test-references/$CONFIGFILE
diff $OUTPUT_FILE test-references/$OUTPUT_FILE
6 changes: 3 additions & 3 deletions test-project/test-scripts/export-multiple.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

CONFIGFILE=multiple.lw-lang.json
OUTPUT_FILE=multiple.lw-lang.json

./gradlew runCommandLineTool -Pargs=". export-languages.json $CONFIGFILE -mlionweb-mps.home=./../"
./gradlew runCommandLineTool -Pargs=". export-languages.json $OUTPUT_FILE -mlionweb-mps.home=./../"

diff $CONFIGFILE test-references/$CONFIGFILE
diff $OUTPUT_FILE test-references/$OUTPUT_FILE

0 comments on commit c56025e

Please sign in to comment.