|
14 | 14 | * limitations under the License.
|
15 | 15 | */
|
16 | 16 |
|
| 17 | +import org.modelix.copyMps |
| 18 | + |
17 | 19 | plugins {
|
18 |
| - alias(libs.plugins.kotlin.jvm) |
| 20 | + kotlin("jvm") |
19 | 21 | // We are not building an actual plugin here.
|
20 | 22 | // We use/abuse the gradle-intellij-plugin run tests with MPS.
|
21 | 23 | // (With enough time and effort,
|
22 | 24 | // one could inspect what the plugin does under the hood
|
23 | 25 | // and build something custom using the relevant parts.
|
24 | 26 | // For the time being, this solution works without much overhead and great benefit.)
|
25 | 27 | 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") |
56 | 29 | }
|
57 | 30 |
|
58 | 31 | 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")) |
61 | 34 | testImplementation(libs.kotlin.serialization.json)
|
62 | 35 | }
|
63 | 36 |
|
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 |
90 | 39 | }
|
91 | 40 |
|
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 | + } |
94 | 48 | }
|
0 commit comments