Skip to content

Commit 8fd58ea

Browse files
authored
Merge pull request #1306 from modelix/MODELIX-829-Split-INode-interface-into-multiple-interfaces
MODELIX-829 Split INode interface into multiple interfaces
2 parents 8c989ce + aeb7c4b commit 8fd58ea

File tree

119 files changed

+4707
-1644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+4707
-1644
lines changed

.github/workflows/mps-compatibility.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
strategy:
1818
matrix:
1919
version:
20+
- "2020.3"
2021
- "2021.1"
2122
- "2021.2"
2223
- "2021.3"
@@ -42,6 +43,7 @@ jobs:
4243
run: >-
4344
./gradlew --build-cache
4445
:bulk-model-sync-mps:build
46+
:bulk-model-sync-lib:mps-test:build
4547
:metamodel-export:build
4648
:mps-model-adapters:build
4749
:mps-model-adapters-plugin:build

build-logic/src/main/kotlin/modelix-project-repositories.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// because plugins like npm and intellij may override our settings
33
repositories {
44
val modelixRegex = "org\\.modelix.*"
5-
mavenLocal {
6-
content {
7-
includeGroupByRegex(modelixRegex)
8-
}
9-
}
105
gradlePluginPortal {
116
content {
127
excludeGroupByRegex(modelixRegex)
@@ -24,4 +19,5 @@ repositories {
2419
excludeGroupByRegex(modelixRegex)
2520
}
2621
}
22+
mavenLocal()
2723
}

build-logic/src/main/kotlin/modelix-repositories.settings.gradle.kts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
val modelixRegex = "org\\.modelix.*"
22
pluginManagement {
33
repositories {
4-
mavenLocal {
5-
content {
6-
includeGroupByRegex(modelixRegex)
7-
}
8-
}
94
gradlePluginPortal {
105
content {
116
excludeGroupByRegex(modelixRegex)
@@ -22,6 +17,7 @@ pluginManagement {
2217
includeGroupByRegex(modelixRegex)
2318
}
2419
}
20+
mavenLocal()
2521
}
2622
}
2723
dependencyResolutionManagement {
@@ -44,5 +40,6 @@ dependencyResolutionManagement {
4440
includeGroup("com.jetbrains")
4541
}
4642
}
43+
mavenLocal()
4744
}
4845
}

build-logic/src/main/kotlin/org/modelix/CopyMps.kt

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
package org.modelix
22

33
import org.gradle.api.Project
4+
import org.gradle.api.artifacts.ModuleDependency
45
import org.gradle.api.file.Directory
56
import org.gradle.api.provider.Provider
67
import org.gradle.kotlin.dsl.dependencies
8+
import org.gradle.kotlin.dsl.exclude
79
import java.io.File
810
import java.util.zip.ZipInputStream
911

1012
val Project.mpsMajorVersion: String get() {
11-
if (project != rootProject) return rootProject.mpsVersion
13+
if (project != rootProject) return rootProject.mpsMajorVersion
1214
return project.findProperty("mps.version.major")?.toString()?.takeIf { it.isNotEmpty() }
1315
?: project.findProperty("mps.version")?.toString()?.takeIf { it.isNotEmpty() }?.replace(Regex("""(20\d\d\.\d+).*"""), "$1")
14-
?: "2021.1"
16+
?: "2024.1"
1517
}
1618

1719
val Project.mpsVersion: String get() {
@@ -25,11 +27,12 @@ val Project.mpsVersion: String get() {
2527
"2021.1" to "2021.1.4",
2628
"2021.2" to "2021.2.6",
2729
"2021.3" to "2021.3.5",
28-
"2022.2" to "2022.2.3",
29-
"2022.3" to "2022.3.1",
30-
"2023.2" to "2023.2",
31-
"2023.3" to "2023.3",
32-
"2024.1" to "2024.1-EAP1",
30+
"2022.2" to "2022.2.4",
31+
"2022.3" to "2022.3.3",
32+
"2023.2" to "2023.2.2",
33+
"2023.3" to "2023.3.2",
34+
"2024.1" to "2024.1.1",
35+
"2024.3" to "2024.3",
3336
)[it],
3437
) { "Unknown MPS version: $it" }
3538
}
@@ -100,3 +103,14 @@ fun Project.copyMps(): File {
100103
println("Extracting MPS done.")
101104
return mpsHome
102105
}
106+
107+
val excludeMPSLibraries: (ModuleDependency).() -> Unit = {
108+
exclude("org.jetbrains.kotlinx", "kotlinx-coroutines-core")
109+
exclude("org.jetbrains.kotlinx", "kotlinx-coroutines-jdk8")
110+
exclude("org.jetbrains.kotlinx", "kotlinx-coroutines-swing")
111+
exclude("org.jetbrains.kotlin", "kotlin-stdlib")
112+
exclude("org.jetbrains.kotlin", "kotlin-stdlib-common")
113+
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk7")
114+
exclude("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
115+
exclude("org.jetbrains", "annotations")
116+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
kotlin.code.style=official
2+
org.gradle.jvmargs=-Xmx1024m -Xms256m -XX:MaxMetaspaceSize=2g -XX:+HeapDumpOnOutOfMemoryError
3+
org.gradle.parallel=true
4+
systemProp.org.gradle.internal.http.socketTimeout=120000
5+
kotlin.daemon.jvmargs=-Xmx2G

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
package org.modelix.model.sync.bulk.gradle.test
22

3+
import GraphLang.L_GraphLang
34
import org.junit.jupiter.api.Test
45
import org.junit.jupiter.api.TestInstance
6+
import org.modelix.model.api.ConceptReference
57
import org.xmlunit.builder.Input
68
import org.xmlunit.xpath.JAXPXPathEngine
79
import java.io.File
10+
import javax.xml.transform.Source
811
import kotlin.test.assertContains
912
import kotlin.test.assertContentEquals
1013
import kotlin.test.assertEquals
@@ -25,10 +28,21 @@ class PullTest {
2528
.readText(),
2629
).build()
2730

31+
private fun getRegisteredConcepts(xml: Source): Map<ConceptReference, String> {
32+
val conceptNodes = JAXPXPathEngine().selectNodes("model/registry/language/concept", xml)
33+
return conceptNodes.associate { c ->
34+
val conceptId = c.attributes.getNamedItem("id").nodeValue
35+
val languageId = c.parentNode.attributes.getNamedItem("id").nodeValue
36+
val shortId = c.attributes.getNamedItem("index").nodeValue
37+
ConceptReference("mps:$languageId/$conceptId") to shortId
38+
}
39+
}
40+
2841
@Test
2942
fun `properties were synced to local`() {
43+
val shortConceptId = getRegisteredConcepts(solution1Xml)[L_GraphLang.Node.untyped().getReference()]
3044
val properties = JAXPXPathEngine()
31-
.selectNodes("model/node/node[@concept='1DmExO']/property", solution1Xml)
45+
.selectNodes("model/node/node[@concept='$shortConceptId']/property", solution1Xml)
3246

3347
val actual = properties.map { it.attributes.getNamedItem("value").nodeValue }
3448
val expected = listOf("X", "Y", "Z", "NewNode", "D", "E")
@@ -38,8 +52,9 @@ class PullTest {
3852

3953
@Test
4054
fun `added child was synced to local`() {
55+
val shortConceptId = getRegisteredConcepts(solution1Xml)[L_GraphLang.Node.untyped().getReference()]
4156
val xpath = JAXPXPathEngine()
42-
val nodes = xpath.selectNodes("model/node/node[@concept='1DmExO']", solution1Xml)
57+
val nodes = xpath.selectNodes("model/node/node[@concept='$shortConceptId']", solution1Xml)
4358

4459
val nodeNames = nodes.flatMap { xpath.selectNodes("property", it) }
4560
.map { it.attributes.getNamedItem("value").nodeValue }

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import org.modelix.model.lazy.RepositoryId
2020
import org.modelix.model.sync.bulk.asExported
2121
import org.modelix.model.withAutoTransactions
2222
import java.io.File
23-
import kotlin.test.assertContentEquals
2423
import kotlin.test.assertEquals
2524

2625
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@@ -41,9 +40,9 @@ class PushTest {
4140
val files = inputDir.listFiles()?.filter { it.extension == "json" } ?: error("no json files found in ${inputDir.absolutePath}")
4241

4342
val modules = files.map { ModelData.fromJson(it.readText()) }
44-
val inputModel = ModelData(root = NodeData(children = modules.map { it.root }))
43+
val inputModel = ModelData(root = NodeData(children = modules.map { it.root }).normalize())
4544

46-
assertContentEquals(inputModel.root.children, root.allChildren.map { it.asExported() })
45+
assertEquals(inputModel.toJson(), ModelData(root = NodeData(children = root.allChildren.map { it.asExported() }).normalize()).toJson())
4746
}
4847

4948
@Test

bulk-model-sync-gradle/src/main/kotlin/org/modelix/model/sync/bulk/gradle/tasks/ExportFromModelServer.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ abstract class ExportFromModelServer : DefaultTask() {
8989
val nameRole = BuiltinLanguages.jetbrains_mps_lang_core.INamedConcept.name
9090

9191
return root.allChildren.filter {
92-
val isModule = it.concept?.getUID() == BuiltinLanguages.MPSRepositoryConcepts.Module.getUID()
92+
val isModule = it.concept?.isSubConceptOf(BuiltinLanguages.MPSRepositoryConcepts.Module) == true
9393
val moduleName = it.getPropertyValue(nameRole) ?: return@filter false
9494
val isIncluded = isModuleIncluded(
9595
moduleName,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package org.modelix.model.sync.bulk.gradle
22

33
import io.kotest.matchers.file.shouldContainFile
44
import io.kotest.matchers.file.shouldContainNFiles
5-
import org.gradle.testkit.runner.GradleRunner
5+
import org.gradle.testkit.runner.internal.DefaultGradleRunner
66
import org.junit.jupiter.api.io.CleanupMode
77
import org.junit.jupiter.api.io.TempDir
88
import java.io.File
@@ -15,7 +15,7 @@ class ExportFunctionalTest {
1515

1616
@TempDir(cleanup = CleanupMode.ON_SUCCESS)
1717
private lateinit var projectDir: File
18-
private val gradle by lazy { GradleRunner.create().withProjectDir(projectDir) }
18+
private val gradle by lazy { DefaultGradleRunner().withJvmArguments("-Xmx1024m").withProjectDir(projectDir) }
1919

2020
@BeforeTest
2121
fun setup() {

bulk-model-sync-lib/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ kotlin {
77
val commonMain by getting {
88
dependencies {
99
implementation(project(":model-api"))
10+
implementation(project(":model-datastructure"))
1011
implementation(libs.kotlin.serialization.json)
1112
implementation(libs.kotlin.logging)
1213
}

0 commit comments

Comments
 (0)