Skip to content

Commit dfb5a42

Browse files
author
Oleksandr Dzhychko
committed
build(bulk-model-sync): make tests for bulk-model-sync-lib with MPS a subproject
Previously they were a separate Gradle project.
1 parent 73402ad commit dfb5a42

File tree

11 files changed

+16
-200
lines changed

11 files changed

+16
-200
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,3 @@ jobs:
109109
env:
110110
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111111
run: bulk-model-sync-gradle-test/ci.sh
112-
- name: Test bulk-sync-lib with MPS
113-
env:
114-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115-
run: bulk-model-sync-lib-mps-test/ci.sh

bulk-model-sync-lib-mps-test/.gitignore

Lines changed: 0 additions & 49 deletions
This file was deleted.

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

Lines changed: 15 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -14,81 +14,35 @@
1414
* limitations under the License.
1515
*/
1616

17+
import org.modelix.copyMps
18+
1719
plugins {
18-
alias(libs.plugins.kotlin.jvm)
20+
kotlin("jvm")
1921
// We are not building an actual plugin here.
2022
// We use/abuse the gradle-intellij-plugin run tests with MPS.
2123
// (With enough time and effort,
2224
// one could inspect what the plugin does under the hood
2325
// and build something custom using the relevant parts.
2426
// For the time being, this solution works without much overhead and great benefit.)
2527
alias(libs.plugins.intellij)
26-
}
27-
28-
val modelixCoreVersion: String = file("../version.txt").readText()
29-
30-
version = modelixCoreVersion
31-
32-
repositories {
33-
val modelixRegex = "org\\.modelix.*"
34-
mavenLocal {
35-
content {
36-
includeGroupByRegex(modelixRegex)
37-
}
38-
}
39-
gradlePluginPortal {
40-
content {
41-
excludeGroupByRegex(modelixRegex)
42-
}
43-
}
44-
maven {
45-
url = uri("https://artifacts.itemis.cloud/repository/maven-mps/")
46-
content {
47-
includeGroupByRegex(modelixRegex)
48-
includeGroup("com.jetbrains")
49-
}
50-
}
51-
mavenCentral {
52-
content {
53-
excludeGroupByRegex(modelixRegex)
54-
}
55-
}
28+
id("modelix-project-repositories")
5629
}
5730

5831
dependencies {
59-
testImplementation("org.modelix:bulk-model-sync-lib:$modelixCoreVersion")
60-
testImplementation("org.modelix.mps:model-adapters:$modelixCoreVersion")
32+
testImplementation(project(":bulk-model-sync-lib"))
33+
testImplementation(project(":mps-model-adapters"))
6134
testImplementation(libs.kotlin.serialization.json)
6235
}
6336

64-
val mpsVersion = project.findProperty("mps.version")?.toString()?.takeIf { it.isNotEmpty() }
65-
?: "2021.1.4"
66-
println("Building for MPS version $mpsVersion")
67-
68-
// Extract MPS during configuration phase, because using it in intellij.localPath requires it to already exist.
69-
val mpsHome = project.layout.buildDirectory.dir("mps-$mpsVersion")
70-
val mpsZip: Configuration by configurations.creating
71-
dependencies { mpsZip("com.jetbrains:mps:$mpsVersion") }
72-
mpsHome.get().asFile.let { baseDir ->
73-
if (baseDir.exists()) return@let // the content of MPS zip is not expected to change
74-
75-
println("Extracting MPS ...")
76-
sync {
77-
from(zipTree({ mpsZip.singleFile }))
78-
into(mpsHome)
79-
}
80-
81-
// The build number of a local IDE is expected to contain a product code, otherwise an exception is thrown.
82-
val buildTxt = mpsHome.get().asFile.resolve("build.txt")
83-
val buildNumber = buildTxt.readText()
84-
val prefix = "MPS-"
85-
if (!buildNumber.startsWith(prefix)) {
86-
buildTxt.writeText("$prefix$buildNumber")
87-
}
88-
89-
println("Extracting MPS done.")
37+
intellij {
38+
localPath = copyMps().absolutePath
9039
}
9140

92-
intellij {
93-
localPath = mpsHome.map { it.asFile.absolutePath }
41+
tasks {
42+
// Workaround:
43+
// * Execution failed for task ':bulk-model-sync-lib-mps-test:buildSearchableOptions'.
44+
// * > Cannot find IDE platform prefix. Please create a bug report at https://github.com/jetbrains/gradle-intellij-plugin. As a workaround specify `idea.platform.prefix` system property for task `buildSearchableOptions` manually.
45+
buildSearchableOptions {
46+
enabled = false
47+
}
9448
}

bulk-model-sync-lib-mps-test/ci.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

bulk-model-sync-lib-mps-test/gradle.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

bulk-model-sync-lib-mps-test/gradle/wrapper/gradle-wrapper.jar

Lines changed: 0 additions & 1 deletion
This file was deleted.

bulk-model-sync-lib-mps-test/gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 1 deletion
This file was deleted.

bulk-model-sync-lib-mps-test/gradlew

Lines changed: 0 additions & 1 deletion
This file was deleted.

bulk-model-sync-lib-mps-test/gradlew.bat

Lines changed: 0 additions & 1 deletion
This file was deleted.

bulk-model-sync-lib-mps-test/settings.gradle.kts

Lines changed: 0 additions & 74 deletions
This file was deleted.

0 commit comments

Comments
 (0)