Skip to content

Commit 00dd73c

Browse files
authored
Merge pull request #336 from modelix/MODELIX-618
MODELIX-618 Notation language in MPS for the new text editor
2 parents 7d86075 + bb517af commit 00dd73c

File tree

28 files changed

+640
-74
lines changed

28 files changed

+640
-74
lines changed

.github/workflows/mps-compatibility.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
- "2021.3.3"
2323
- "2022.2"
2424
- "2022.3"
25+
- "2023.2"
2526

2627
steps:
2728
- uses: actions/checkout@v4

build.gradle.kts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ plugins {
4040
alias(libs.plugins.kotlin.multiplatform) apply false
4141
alias(libs.plugins.kotlin.serialization) apply false
4242
alias(libs.plugins.gitVersion)
43-
alias(libs.plugins.ktlint) apply false
4443
alias(libs.plugins.spotless) apply false
4544
alias(libs.plugins.tasktree)
4645
alias(libs.plugins.dokka)
@@ -78,7 +77,6 @@ subprojects {
7877
val subproject = this
7978
apply(plugin = "maven-publish")
8079
apply(plugin = "org.jetbrains.dokka")
81-
apply(plugin = "org.jlleitschuh.gradle.ktlint")
8280
apply(plugin = "io.gitlab.arturbosch.detekt")
8381

8482
version = rootProject.version
@@ -90,11 +88,6 @@ subprojects {
9088
}
9189
}
9290

93-
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
94-
// IMPORTANT: keep in sync with the version in .pre-commit-config.yaml
95-
version.set("0.50.0")
96-
}
97-
9891
tasks.withType<Detekt> {
9992
parallel = true
10093
// For now, we only use the results here as hints

bulk-model-sync-gradle-test/graph-lang-api/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ kotlin {
3636
sourceSets.named("main") {
3737
kotlin.srcDir(kotlinGenDir)
3838
}
39+
jvmToolchain(11)
3940
}
4041

4142
metamodel {

bulk-model-sync-gradle-test/src/test/kotlin/org/modelix/model/sync/bulk/gradle/test/PushTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ class PushTest {
7070
?.getDescendants(false)
7171
?.find { it.getConceptReference() == ConceptReference(_C_UntypedImpl_Graph.getUID()) },
7272
)
73-
assertEquals(solution1Graph, solution2Graph.getReferenceTarget(C_Graph.relatedGraph))
73+
assertEquals(solution1Graph, solution2Graph.getReferenceTarget(C_Graph.relatedGraph.untyped()))
7474
}
7575
}

model-api-gen-gradle/src/main/kotlin/org/modelix/metamodel/gradle/GenerateAntScriptForMpsMetaModelExport.kt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,41 @@ abstract class GenerateAntScriptForMpsMetaModelExport @Inject constructor(of: Ob
9191
<arg value="-Didea.system.path=${"$"}{build.mps.system.path}" />
9292
<arg value="-ea" />
9393
<arg value="-Xmx${heapSize.get()}" />
94+
<arg value="--add-opens=java.base/java.io=ALL-UNNAMED"/>
95+
<arg value="--add-opens=java.base/java.lang=ALL-UNNAMED"/>
96+
<arg value="--add-opens=java.base/java.lang.reflect=ALL-UNNAMED"/>
97+
<arg value="--add-opens=java.base/java.net=ALL-UNNAMED"/>
98+
<arg value="--add-opens=java.base/java.nio=ALL-UNNAMED"/>
99+
<arg value="--add-opens=java.base/java.nio.charset=ALL-UNNAMED"/>
100+
<arg value="--add-opens=java.base/java.text=ALL-UNNAMED"/>
101+
<arg value="--add-opens=java.base/java.time=ALL-UNNAMED"/>
102+
<arg value="--add-opens=java.base/java.util=ALL-UNNAMED"/>
103+
<arg value="--add-opens=java.base/java.util.concurrent=ALL-UNNAMED"/>
104+
<arg value="--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED"/>
105+
<arg value="--add-opens=java.base/jdk.internal.vm=ALL-UNNAMED"/>
106+
<arg value="--add-opens=java.base/sun.nio.ch=ALL-UNNAMED"/>
107+
<arg value="--add-opens=java.base/sun.nio.fs=ALL-UNNAMED"/>
108+
<arg value="--add-opens=java.base/sun.security.ssl=ALL-UNNAMED"/>
109+
<arg value="--add-opens=java.base/sun.security.util=ALL-UNNAMED"/>
110+
<arg value="--add-opens=java.desktop/java.awt=ALL-UNNAMED"/>
111+
<arg value="--add-opens=java.desktop/java.awt.dnd.peer=ALL-UNNAMED"/>
112+
<arg value="--add-opens=java.desktop/java.awt.event=ALL-UNNAMED"/>
113+
<arg value="--add-opens=java.desktop/java.awt.image=ALL-UNNAMED"/>
114+
<arg value="--add-opens=java.desktop/java.awt.peer=ALL-UNNAMED"/>
115+
<arg value="--add-opens=java.desktop/javax.swing=ALL-UNNAMED"/>
116+
<arg value="--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED"/>
117+
<arg value="--add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED"/>
118+
<arg value="--add-opens=java.desktop/sun.awt.datatransfer=ALL-UNNAMED"/>
119+
<arg value="--add-opens=java.desktop/sun.awt.image=ALL-UNNAMED"/>
120+
<arg value="--add-opens=java.desktop/sun.awt=ALL-UNNAMED"/>
121+
<arg value="--add-opens=java.desktop/sun.font=ALL-UNNAMED"/>
122+
<arg value="--add-opens=java.desktop/sun.java2d=ALL-UNNAMED"/>
123+
<arg value="--add-opens=java.desktop/sun.swing=ALL-UNNAMED"/>
124+
<arg value="--add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED"/>
125+
<arg value="--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"/>
126+
<arg value="--add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED"/>
127+
<arg value="--add-opens=jdk.jdi/com.sun.tools.jdi=ALL-UNNAMED"/>
128+
<arg value="--add-opens=java.desktop/sun.lwawt=ALL-UNNAMED"/>
94129
${
95130
if (exportModulesFilter.isPresent) {
96131
"""<arg value="-Dmodelix.export.includedModules=${exportModulesFilter.get()}" />"""

model-api-gen-runtime/src/commonMain/kotlin/org/modelix/metamodel/GeneratedConcept.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,10 @@ abstract class GeneratedChildLink<ChildNodeT : ITypedNode, ChildConceptT : IConc
231231

232232
override fun getSimpleName(): String = simpleName
233233
}
234-
fun IChildLink.typed() = this as? ITypedChildLink<ITypedNode>
234+
fun IChildLink.typed(): ITypedChildLink<ITypedNode> {
235+
return this as? ITypedChildLink<ITypedNode>
236+
?: if (isMultiple) UnknownTypedChildLinkList(this) else UnknownTypedSingleChildLink(this)
237+
}
235238

236239
open class GeneratedSingleChildLink<ChildNodeT : ITypedNode, ChildConceptT : IConceptOfTypedNode<ChildNodeT>>(
237240
owner: IConcept,
@@ -281,4 +284,4 @@ class GeneratedReferenceLink<TargetNodeT : ITypedNode, TargetConceptT : IConcept
281284

282285
override fun getSimpleName(): String = simpleName
283286
}
284-
fun IReferenceLink.typed() = this as? ITypedReferenceLink<ITypedNode>
287+
fun IReferenceLink.typed() = this as? ITypedReferenceLink<ITypedNode> ?: UnknownTypedReferenceLink(this)

model-api-gen-runtime/src/commonMain/kotlin/org/modelix/metamodel/ITypedChildLink.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import org.modelix.model.api.IChildLink
1717
import org.modelix.model.api.INode
1818
import org.modelix.model.api.remove
1919

20-
interface ITypedChildLink<ChildT : ITypedNode> : ITypedConceptFeature {
20+
interface ITypedChildLink<out ChildT : ITypedNode> : ITypedConceptFeature {
2121
fun untyped(): IChildLink
2222
fun castChild(childNode: INode): ChildT
2323
fun getTypedChildConcept(): IConceptOfTypedNode<ChildT>

model-api-gen-runtime/src/commonMain/kotlin/org/modelix/metamodel/ITypedReferenceLink.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package org.modelix.metamodel
1616
import org.modelix.model.api.INode
1717
import org.modelix.model.api.IReferenceLink
1818

19-
interface ITypedReferenceLink<TargetT : ITypedNode> : ITypedConceptFeature {
19+
interface ITypedReferenceLink<out TargetT : ITypedNode> : ITypedConceptFeature {
2020
fun untyped(): IReferenceLink
2121
fun castTarget(target: INode): TargetT
2222
fun getTypedTargetConcept(): IConceptOfTypedNode<TargetT>

model-api-gen-runtime/src/commonMain/kotlin/org/modelix/metamodel/TypedLanguagesRegistry.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ object TypedLanguagesRegistry : ILanguageRepository {
4949
override fun getPriority(): Int = 2000
5050
}
5151

52-
fun <NodeT : ITypedNode> INode.typed(nodeClass: KClass<NodeT>): NodeT = nodeClass.cast(TypedLanguagesRegistry.wrapNode(this))
52+
fun <NodeT : ITypedNode> INode.typed(nodeClass: KClass<out NodeT>): NodeT = nodeClass.cast(TypedLanguagesRegistry.wrapNode(this))
5353
inline fun <reified NodeT : ITypedNode> INode.typed(): NodeT = TypedLanguagesRegistry.wrapNode(this) as NodeT
5454
fun <NodeT : ITypedNode> INode.typedUnsafe(): NodeT = TypedLanguagesRegistry.wrapNode(this) as NodeT
5555

model-api-gen-runtime/src/commonMain/kotlin/org/modelix/metamodel/TypedNodeImpl.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ package org.modelix.metamodel
22

33
import org.modelix.model.api.IConcept
44
import org.modelix.model.api.INode
5-
import org.modelix.model.api.getConcept
65

76
abstract class TypedNodeImpl(val wrappedNode: INode) : ITypedNode {
87

98
init {
109
val expected: IConcept = _concept._concept
11-
val actual: IConcept? = unwrap().getConcept()
10+
val actual: IConcept? = unwrap().concept
1211
require(actual != null && actual.isSubConceptOf(expected)) {
1312
"Concept of node ${unwrap()} expected to be a sub-concept of $expected, but was $actual"
1413
}

0 commit comments

Comments
 (0)