Skip to content

Commit

Permalink
WIP MPS notation language with Kotlin generator
Browse files Browse the repository at this point in the history
  • Loading branch information
slisson committed Nov 22, 2023
1 parent 332bf2a commit 2a4b0a1
Show file tree
Hide file tree
Showing 21 changed files with 547 additions and 1 deletion.
4 changes: 4 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ println("Version: $version")

fun computeVersion(): Any {
val versionFile = file("version.txt")
if (versionFile.exists()) return versionFile.readText().trim()

val gitVersion: groovy.lang.Closure<String> by extra
var version = if (versionFile.exists()) versionFile.readText().trim() else gitVersion()
if (!versionFile.exists() && "true" != project.findProperty("ciBuild")) {
Expand All @@ -36,6 +38,8 @@ fun computeVersion(): Any {
} catch (_: IllegalArgumentException) {
version = "0.0.0-$version"
}
versionFile.writeText(version)

return version
}

Expand Down
5 changes: 5 additions & 0 deletions mps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test_gen
test_gen.caches
classes_gen
source_gen
source_gen.caches
3 changes: 3 additions & 0 deletions mps/.mps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
1 change: 1 addition & 0 deletions mps/.mps/.name
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.modelix.editor
6 changes: 6 additions & 0 deletions mps/.mps/migration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MigrationProperties">
<entry key="project.baseline.version" value="232" />
</component>
</project>
11 changes: 11 additions & 0 deletions mps/.mps/modules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MPSProject">
<projectModules>
<modulePath path="$PROJECT_DIR$/languages/org.modelix.mps.notation/org.modelix.mps.notation.mpl" folder="" />
<modulePath path="$PROJECT_DIR$/org.modelix.mps.editor.ssr.stubs/org.modelix.mps.editor.ssr.stubs.msd" folder="" />
<modulePath path="$PROJECT_DIR$/org.modelix.mps.notation.runtime/org.modelix.mps.notation.runtime.msd" folder="" />
<modulePath path="$PROJECT_DIR$/solutions/org.modelix.mps.notation.impl.baseLanguage/org.modelix.mps.notation.impl.baseLanguage.msd" folder="" />
</projectModules>
</component>
</project>
6 changes: 6 additions & 0 deletions mps/.mps/vcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>
16 changes: 16 additions & 0 deletions mps/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
base
`maven-publish`
}

//val ssrStubs: Configuration by configurations.creating
//
//dependencies {
// ssrStubs(project(":projectional-editor-ssr-mps"))
//}
//
//val copyStubs = tasks.register("copySSRStubs", Sync::class) {
// from(ssrStubs)
// into(project.layout.projectDirectory.dir("org.modelix.mps.editor.ssr.stubs/lib"))
//
//}
119 changes: 119 additions & 0 deletions ...s.notation/generator/templates/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<model ref="r:2fe6cd77-4aa8-40a0-b3ed-e4eb6d6a496f(org.modelix.mps.notation.generator.templates@generator)">
<persistence version="9" />
<languages>
<use id="6b3888c1-9802-44d8-8baf-f8e6c33ed689" name="jetbrains.mps.kotlin" version="11" />
<use id="2405a196-e75d-462c-938b-ae8e3fac20aa" name="jetbrains.mps.baseLanguage.kotlinRefs" version="0" />
<use id="eb56ebf4-df56-438e-af06-fc1cd08b495a" name="jetbrains.mps.kotlin.smodel" version="0" />
<use id="b17a9ec8-44a5-40a1-9216-058d277424eb" name="jetbrains.mps.kotlin.internal" version="0" />
<use id="9e4ff22b-60f1-43ef-a50b-f9f0fcec22e0" name="jetbrains.mps.kotlin.javaRefs" version="0" />
<devkit ref="a2eb3a43-fcc2-4200-80dc-c60110c4862d(jetbrains.mps.devkit.templates)" />
</languages>
<imports>
<import index="f8gn" ref="r:37580d55-803b-40f6-8108-d95a9fce8d6e(org.modelix.mps.notation.structure)" />
<import index="i6vs" ref="771cf896-ab1b-409b-93b4-48c3bbb6b23f/kotlinJvm:org.modelix.aspects(org.modelix.mps.editor.ssr.stubs/)" />
<import index="dbfy" ref="771cf896-ab1b-409b-93b4-48c3bbb6b23f/kotlinJvm:org.modelix.editor(org.modelix.mps.editor.ssr.stubs/)" />
</imports>
<registry>
<language id="b401a680-8325-4110-8fd3-84331ff25bef" name="jetbrains.mps.lang.generator">
<concept id="1095416546421" name="jetbrains.mps.lang.generator.structure.MappingConfiguration" flags="ig" index="bUwia">
<child id="1167514678247" name="rootMappingRule" index="3lj3bC" />
</concept>
<concept id="1168619357332" name="jetbrains.mps.lang.generator.structure.RootTemplateAnnotation" flags="lg" index="n94m4">
<reference id="1168619429071" name="applicableConcept" index="n9lRv" />
</concept>
<concept id="1167169308231" name="jetbrains.mps.lang.generator.structure.BaseMappingRule" flags="ng" index="30H$t8">
<reference id="1167169349424" name="applicableConcept" index="30HIoZ" />
</concept>
<concept id="1167514355419" name="jetbrains.mps.lang.generator.structure.Root_MappingRule" flags="lg" index="3lhOvk">
<reference id="1167514355421" name="template" index="3lhOvi" />
</concept>
</language>
<language id="6b3888c1-9802-44d8-8baf-f8e6c33ed689" name="jetbrains.mps.kotlin">
<concept id="5622728304609204267" name="jetbrains.mps.kotlin.structure.EmptyDeclaration" flags="ng" index="eKYAL" />
<concept id="1991556721070973461" name="jetbrains.mps.kotlin.structure.EmptyStatement" flags="ng" index="AQkLs" />
<concept id="1314219036499415210" name="jetbrains.mps.kotlin.structure.AbstractPropertyDeclaration" flags="ng" index="TDTJE">
<property id="2936055411806090009" name="isReadonly" index="1Xb$ne" />
<child id="2936055411798374330" name="assignment" index="1XD05H" />
</concept>
<concept id="1314219036498225646" name="jetbrains.mps.kotlin.structure.IStatementHolder" flags="ngI" index="THmaI">
<child id="1314219036498225649" name="statements" index="THmaL" />
</concept>
<concept id="6565639133219057675" name="jetbrains.mps.kotlin.structure.IArguments" flags="ngI" index="TWioa">
<child id="6565639133219057676" name="arguments" index="TWiod" />
</concept>
<concept id="7027413324315184167" name="jetbrains.mps.kotlin.structure.ILambdaAsArgument" flags="ngI" index="3$8iW8">
<child id="2936055411798374269" name="lambda" index="1XD06E" />
</concept>
<concept id="4662566628538083705" name="jetbrains.mps.kotlin.structure.FunctionCallExpression" flags="ng" index="1NbEFs" />
<concept id="2936055411798373537" name="jetbrains.mps.kotlin.structure.PropertyDeclaration" flags="ng" index="1XD09Q">
<child id="1314219036499436525" name="declaration" index="TDYyH" />
</concept>
<concept id="2936055411798373439" name="jetbrains.mps.kotlin.structure.AbstractFunctionCall" flags="ng" index="1XD0bC">
<reference id="1991556721072067817" name="function" index="AarEw" />
</concept>
<concept id="2936055411798373745" name="jetbrains.mps.kotlin.structure.VariableDeclaration" flags="ng" index="1XD0eA" />
<concept id="2936055411798373753" name="jetbrains.mps.kotlin.structure.ValueArgument" flags="ng" index="1XD0eI">
<child id="2936055411798374692" name="expression" index="1XD0ZN" />
</concept>
<concept id="2936055411798373655" name="jetbrains.mps.kotlin.structure.LambdaLiteral" flags="ng" index="1XD0f0" />
<concept id="2936055411798373673" name="jetbrains.mps.kotlin.structure.KotlinFile" flags="ng" index="1XD0fY">
<child id="2936055411798374537" name="declarations" index="1XD0Tu" />
</concept>
<concept id="2936055411798373333" name="jetbrains.mps.kotlin.structure.NullLiteral" flags="ng" index="1XD0k2" />
<concept id="2936055411798373223" name="jetbrains.mps.kotlin.structure.PropertyDefaultAssignement" flags="ng" index="1XD0mK">
<child id="2936055411798373866" name="expression" index="1XD0cX" />
</concept>
</language>
<language id="ceab5195-25ea-4f22-9b92-103b95ca8c0c" name="jetbrains.mps.lang.core">
<concept id="1133920641626" name="jetbrains.mps.lang.core.structure.BaseConcept" flags="ng" index="2VYdi">
<child id="5169995583184591170" name="smodelAttribute" index="lGtFl" />
</concept>
<concept id="1169194658468" name="jetbrains.mps.lang.core.structure.INamedConcept" flags="ngI" index="TrEIO">
<property id="1169194664001" name="name" index="TrG5h" />
</concept>
</language>
</registry>
<node concept="bUwia" id="3hw8cNzhJ6K">
<property role="TrG5h" value="main" />
<node concept="3lhOvk" id="63DBII8qadT" role="3lj3bC">
<ref role="30HIoZ" to="f8gn:7dm8yUsM9Ro" resolve="NotationModule" />
<ref role="3lhOvi" node="63DBII8pVW4" resolve="EditorAspect" />
</node>
</node>
<node concept="1XD0fY" id="63DBII8pVW4">
<property role="TrG5h" value="EditorAspect" />
<node concept="eKYAL" id="63DBII8pVZv" role="1XD0Tu" />
<node concept="1XD09Q" id="63DBII8pW1k" role="1XD0Tu">
<property role="1Xb$ne" value="true" />
<node concept="1XD0eA" id="63DBII8pW1m" role="TDYyH">
<property role="TrG5h" value="generatedEditor" />
</node>
<node concept="1XD0mK" id="63DBII8pW2j" role="1XD05H">
<node concept="1NbEFs" id="63DBII8pWcj" role="1XD0cX">
<ref role="AarEw" to="i6vs:~.languageAspects[org/modelix/model/api/ILanguage](0,kotlin/Function1&lt;LanguageAspectsBuilder&lt;0&gt;,kotlin/Unit&gt;)" resolve="languageAspects" />
<node concept="1XD0eI" id="63DBII8pWe2" role="TWiod">
<node concept="1XD0k2" id="63DBII8pWg8" role="1XD0ZN" />
</node>
<node concept="1XD0f0" id="63DBII8pWiQ" role="1XD06E">
<node concept="1NbEFs" id="63DBII8qceh" role="THmaL">
<ref role="AarEw" to="dbfy:~#org/modelix/aspects/LanguageAspectsBuilder&lt;*&gt;.editor[org/modelix/metamodel/ITypedNode,org/modelix/metamodel/IConceptOfTypedNode&lt;0&gt;](1,kotlin/Function1&lt;CellTemplateBuilder&lt;0,1&gt;,kotlin/Unit&gt;)" resolve="editor" />
<node concept="1XD0eI" id="63DBII8qcei" role="TWiod">
<node concept="1XD0k2" id="63DBII8qcej" role="1XD0ZN" />
</node>
<node concept="1XD0f0" id="63DBII8qcek" role="1XD06E">
<node concept="AQkLs" id="63DBII8qcem" role="THmaL" />
</node>
</node>
<node concept="AQkLs" id="63DBII8pWru" role="THmaL" />
</node>
</node>
</node>
</node>
<node concept="eKYAL" id="63DBII8pVZx" role="1XD0Tu" />
<node concept="n94m4" id="63DBII8pVW5" role="lGtFl">
<ref role="n9lRv" to="f8gn:7dm8yUsM9Ro" resolve="NotationModule" />
</node>
</node>
</model>

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<model ref="r:d1d5cd51-6710-43f8-bd5b-f958da6e1ca2(org.modelix.mps.notation.behavior)">
<persistence version="9" />
<languages>
<use id="7866978e-a0f0-4cc7-81bc-4d213d9375e1" name="jetbrains.mps.lang.smodel" version="19" />
<use id="af65afd8-f0dd-4942-87d9-63a55f2a9db1" name="jetbrains.mps.lang.behavior" version="2" />
<devkit ref="fbc25dd2-5da4-483a-8b19-70928e1b62d7(jetbrains.mps.devkit.general-purpose)" />
</languages>
<imports />
<registry />
</model>

Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<model ref="r:1eb9d7a2-a9d5-4c85-befd-ebacc58c1884(org.modelix.mps.notation.constraints)">
<persistence version="9" />
<languages>
<use id="5dae8159-ab99-46bb-a40d-0cee30ee7018" name="jetbrains.mps.lang.constraints.rules.kinds" version="0" />
<use id="ea3159bf-f48e-4720-bde2-86dba75f0d34" name="jetbrains.mps.lang.context.defs" version="0" />
<use id="e51810c5-7308-4642-bcb6-469e61b5dd18" name="jetbrains.mps.lang.constraints.msg.specification" version="0" />
<use id="134c38d4-e3af-4d9e-b069-1c7df0a4005d" name="jetbrains.mps.lang.constraints.rules.skeleton" version="0" />
<use id="b3551702-269c-4f05-ba61-58060cef4292" name="jetbrains.mps.lang.rulesAndMessages" version="0" />
<use id="3f4bc5f5-c6c1-4a28-8b10-c83066ffa4a1" name="jetbrains.mps.lang.constraints" version="6" />
<use id="13744753-c81f-424a-9c1b-cf8943bf4e86" name="jetbrains.mps.lang.sharedConcepts" version="0" />
<use id="3ad5badc-1d9c-461c-b7b1-fa2fcd0a0ae7" name="jetbrains.mps.lang.context" version="0" />
<use id="ad93155d-79b2-4759-b10c-55123e763903" name="jetbrains.mps.lang.messages" version="0" />
<devkit ref="00000000-0000-4000-0000-5604ebd4f22c(jetbrains.mps.devkit.aspect.constraints)" />
</languages>
<imports />
<registry />
</model>

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<model ref="r:44e47501-1389-4b40-ad1c-bb8c47922510(org.modelix.mps.notation.editor)">
<persistence version="9" />
<languages>
<use id="18bc6592-03a6-4e29-a83a-7ff23bde13ba" name="jetbrains.mps.lang.editor" version="14" />
<use id="aee9cad2-acd4-4608-aef2-0004f6a1cdbd" name="jetbrains.mps.lang.actions" version="4" />
<devkit ref="fbc25dd2-5da4-483a-8b19-70928e1b62d7(jetbrains.mps.devkit.general-purpose)" />
</languages>
<imports />
<registry />
</model>

Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<model ref="r:37580d55-803b-40f6-8108-d95a9fce8d6e(org.modelix.mps.notation.structure)">
<persistence version="9" />
<languages>
<devkit ref="78434eb8-b0e5-444b-850d-e7c4ad2da9ab(jetbrains.mps.devkit.aspect.structure)" />
</languages>
<imports>
<import index="tpce" ref="r:00000000-0000-4000-0000-011c89590292(jetbrains.mps.lang.structure.structure)" />
<import index="hcm8" ref="r:72a7bf00-0175-42ca-b99b-fe8519b6a16f(jetbrains.mps.kotlin.structure)" />
<import index="tpck" ref="r:00000000-0000-4000-0000-011c89590288(jetbrains.mps.lang.core.structure)" implicit="true" />
</imports>
<registry>
<language id="c72da2b9-7cce-4447-8389-f407dc1158b7" name="jetbrains.mps.lang.structure">
<concept id="1169125787135" name="jetbrains.mps.lang.structure.structure.AbstractConceptDeclaration" flags="ig" index="PkWjJ">
<property id="6714410169261853888" name="conceptId" index="EcuMT" />
<property id="5092175715804935370" name="conceptAlias" index="34LRSv" />
<child id="1071489727083" name="linkDeclaration" index="1TKVEi" />
<child id="1071489727084" name="propertyDeclaration" index="1TKVEl" />
</concept>
<concept id="1169125989551" name="jetbrains.mps.lang.structure.structure.InterfaceConceptDeclaration" flags="ig" index="PlHQZ" />
<concept id="1169127622168" name="jetbrains.mps.lang.structure.structure.InterfaceConceptReference" flags="ig" index="PrWs8">
<reference id="1169127628841" name="intfc" index="PrY4T" />
</concept>
<concept id="1071489090640" name="jetbrains.mps.lang.structure.structure.ConceptDeclaration" flags="ig" index="1TIwiD">
<property id="1096454100552" name="rootable" index="19KtqR" />
<reference id="1071489389519" name="extends" index="1TJDcQ" />
<child id="1169129564478" name="implements" index="PzmwI" />
</concept>
<concept id="1071489288299" name="jetbrains.mps.lang.structure.structure.PropertyDeclaration" flags="ig" index="1TJgyi">
<property id="241647608299431129" name="propertyId" index="IQ2nx" />
<reference id="1082985295845" name="dataType" index="AX2Wp" />
</concept>
<concept id="1071489288298" name="jetbrains.mps.lang.structure.structure.LinkDeclaration" flags="ig" index="1TJgyj">
<property id="1071599776563" name="role" index="20kJfa" />
<property id="1071599893252" name="sourceCardinality" index="20lbJX" />
<property id="1071599937831" name="metaClass" index="20lmBu" />
<property id="241647608299431140" name="linkId" index="IQ2ns" />
<reference id="1071599976176" name="target" index="20lvS9" />
</concept>
</language>
<language id="ceab5195-25ea-4f22-9b92-103b95ca8c0c" name="jetbrains.mps.lang.core">
<concept id="1169194658468" name="jetbrains.mps.lang.core.structure.INamedConcept" flags="ngI" index="TrEIO">
<property id="1169194664001" name="name" index="TrG5h" />
</concept>
</language>
</registry>
<node concept="1TIwiD" id="7dm8yUsM9Ro">
<property role="EcuMT" value="8310867745953062360" />
<property role="TrG5h" value="NotationModule" />
<property role="19KtqR" value="true" />
<ref role="1TJDcQ" to="tpck:gw2VY9q" />
<node concept="1TJgyj" id="7dm8yUsMfq9" role="1TKVEi">
<property role="IQ2ns" value="8310867745953085065" />
<property role="20lmBu" value="fLJjDmT/aggregation" />
<property role="20kJfa" value="content" />
<property role="20lbJX" value="fLJekj5/_0__n" />
<ref role="20lvS9" node="7dm8yUsMflU" resolve="INotationModuleContent" />
</node>
<node concept="PrWs8" id="7dm8yUsMfwV" role="PzmwI">
<ref role="PrY4T" to="tpck:h0TrEE$" resolve="INamedConcept" />
</node>
</node>
<node concept="PlHQZ" id="7dm8yUsMflU">
<property role="EcuMT" value="8310867745953084794" />
<property role="TrG5h" value="INotationModuleContent" />
</node>
<node concept="1TIwiD" id="7dm8yUsMf_c">
<property role="EcuMT" value="8310867745953085772" />
<property role="TrG5h" value="EmptyLine" />
<ref role="1TJDcQ" to="tpck:gw2VY9q" />
<node concept="PrWs8" id="7dm8yUsMfEi" role="PzmwI">
<ref role="PrY4T" node="7dm8yUsMflU" resolve="INotationModuleContent" />
</node>
</node>
<node concept="1TIwiD" id="7dm8yUsMfHH">
<property role="EcuMT" value="8310867745953086317" />
<property role="TrG5h" value="ConceptNotation" />
<property role="34LRSv" value="notation" />
<ref role="1TJDcQ" to="tpck:gw2VY9q" />
<node concept="1TJgyj" id="7dm8yUsMfYJ" role="1TKVEi">
<property role="IQ2ns" value="8310867745953087407" />
<property role="20lmBu" value="fLJjDmT/aggregation" />
<property role="20kJfa" value="cell" />
<property role="20lbJX" value="fLJekj4/_1" />
<ref role="20lvS9" node="7dm8yUsMxhg" resolve="ICell" />
</node>
<node concept="1TJgyj" id="7dm8yUsMfZC" role="1TKVEi">
<property role="IQ2ns" value="8310867745953087464" />
<property role="20lmBu" value="fLJjDmT/aggregation" />
<property role="20kJfa" value="condition" />
<ref role="20lvS9" to="hcm8:2yYXHtl6Jjg" resolve="IExpression" />
</node>
<node concept="1TJgyj" id="7dm8yUsMfNE" role="1TKVEi">
<property role="IQ2ns" value="8310867745953086698" />
<property role="20kJfa" value="concept" />
<property role="20lbJX" value="fLJekj4/_1" />
<ref role="20lvS9" to="tpce:h0PkWnZ" resolve="AbstractConceptDeclaration" />
</node>
<node concept="PrWs8" id="7dm8yUsMfLW" role="PzmwI">
<ref role="PrY4T" node="7dm8yUsMflU" resolve="INotationModuleContent" />
</node>
</node>
<node concept="PlHQZ" id="7dm8yUsMxhg">
<property role="EcuMT" value="8310867745953158224" />
<property role="TrG5h" value="ICell" />
</node>
<node concept="1TIwiD" id="7dm8yUsMxrq">
<property role="EcuMT" value="8310867745953158874" />
<property role="TrG5h" value="ConstantCell" />
<property role="34LRSv" value="&quot;" />
<ref role="1TJDcQ" node="7dm8yUsMxww" resolve="Cell" />
<node concept="1TJgyi" id="7dm8yUsMxD1" role="1TKVEl">
<property role="IQ2nx" value="8310867745953159745" />
<property role="TrG5h" value="text" />
<ref role="AX2Wp" to="tpck:fKAOsGN" resolve="string" />
</node>
</node>
<node concept="1TIwiD" id="7dm8yUsMxww">
<property role="EcuMT" value="8310867745953159200" />
<property role="TrG5h" value="Cell" />
<ref role="1TJDcQ" to="tpck:gw2VY9q" />
<node concept="PrWs8" id="7dm8yUsMxzU" role="PzmwI">
<ref role="PrY4T" node="7dm8yUsMxhg" resolve="ICell" />
</node>
</node>
</model>

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<model ref="r:2f03a0c4-ecda-4da5-926b-92cba019727a(org.modelix.mps.notation.typesystem)">
<persistence version="9" />
<languages>
<use id="7a5dda62-9140-4668-ab76-d5ed1746f2b2" name="jetbrains.mps.lang.typesystem" version="5" />
<devkit ref="00000000-0000-4000-0000-1de82b3a4936(jetbrains.mps.devkit.aspect.typesystem)" />
</languages>
<imports />
<registry />
</model>

Loading

0 comments on commit 2a4b0a1

Please sign in to comment.