Skip to content

Commit 811916e

Browse files
1.29.0: Change classpath construction order to avoid Kotlin incompatibilities
1 parent f8ee996 commit 811916e

File tree

5 files changed

+19
-21
lines changed

5 files changed

+19
-21
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
33
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
44

5+
## 1.29.0
6+
7+
- `MpsCheck`, `MpsGenerate`, `MpsExecute`: put MPS jars at the beginning of the classpath of the corresponding backends,
8+
in an attempt to solve incompatibility between the Kotlin version that the backends are built against and the Kotlin
9+
version included in newer MPS versions (2024.1+).
10+
511
## 1.28.0
612

713
### Added

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ plugins {
2424
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
2525
}
2626

27-
val baseVersion = "1.28.0"
27+
val baseVersion = "1.29.0"
2828

2929
group = "de.itemis.mps"
3030

src/main/kotlin/de/itemis/mps/gradle/tasks/MpsCheck.kt

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
package de.itemis.mps.gradle.tasks
22

33
import de.itemis.mps.gradle.BackendConfigurations
4-
import de.itemis.mps.gradle.ErrorMessages
54
import de.itemis.mps.gradle.TaskGroups
65
import de.itemis.mps.gradle.launcher.MpsBackendBuilder
76
import de.itemis.mps.gradle.launcher.MpsVersionDetection
8-
import org.gradle.api.GradleException
97
import org.gradle.api.Incubating
108
import org.gradle.api.file.*
11-
import org.gradle.api.logging.LogLevel
129
import org.gradle.api.provider.ListProperty
1310
import org.gradle.api.provider.MapProperty
1411
import org.gradle.api.provider.Property
1512
import org.gradle.api.provider.SetProperty
1613
import org.gradle.api.tasks.*
1714
import org.gradle.kotlin.dsl.*
18-
import org.gradle.language.base.plugins.LifecycleBasePlugin
1915
import org.gradle.process.CommandLineArgumentProvider
2016

2117
@CacheableTask
2218
@Incubating
2319
abstract class MpsCheck : JavaExec(), VerificationTask {
2420

25-
@get:Internal("covered by mpsVersion, initialModelcheckBackendClasspath()")
21+
@get:Internal("covered by mpsVersion, classpath")
2622
val mpsHome: DirectoryProperty = objectFactory.directoryProperty()
2723

2824
@get:Input
@@ -69,8 +65,7 @@ abstract class MpsCheck : JavaExec(), VerificationTask {
6965
val parallel: Property<Boolean> = objectFactory.property<Boolean>().convention(false)
7066

7167
@get:Internal("covered by classpath")
72-
val additionalModelcheckBackendClasspath: ConfigurableFileCollection =
73-
objectFactory.fileCollection().from(initialModelcheckBackendClasspath())
68+
val additionalModelcheckBackendClasspath: ConfigurableFileCollection = objectFactory.fileCollection()
7469

7570
@Suppress("unused")
7671
@get:InputFiles
@@ -142,6 +137,7 @@ abstract class MpsCheck : JavaExec(), VerificationTask {
142137

143138
group = TaskGroups.VERIFICATION
144139

140+
classpath(mpsAndPluginJars())
145141
classpath(project.configurations.named(BackendConfigurations.MODELCHECK_BACKEND_CONFIGURATION_NAME))
146142
classpath(additionalModelcheckBackendClasspath)
147143

@@ -153,7 +149,7 @@ abstract class MpsCheck : JavaExec(), VerificationTask {
153149
super.exec()
154150
}
155151

156-
private fun initialModelcheckBackendClasspath() = mpsHome.asFileTree.matching {
152+
private fun mpsAndPluginJars() = mpsHome.asFileTree.matching {
157153
include("lib/**/*.jar")
158154

159155
// add only minimal number of plugins jars that are required by the modelcheck code

src/main/kotlin/de/itemis/mps/gradle/tasks/MpsExecute.kt

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
package de.itemis.mps.gradle.tasks
22

33
import de.itemis.mps.gradle.BackendConfigurations
4-
import de.itemis.mps.gradle.ErrorMessages
54
import de.itemis.mps.gradle.launcher.MpsBackendBuilder
65
import de.itemis.mps.gradle.launcher.MpsVersionDetection
7-
import org.gradle.api.GradleException
86
import org.gradle.api.Incubating
97
import org.gradle.api.file.ConfigurableFileCollection
108
import org.gradle.api.file.Directory
119
import org.gradle.api.file.DirectoryProperty
12-
import org.gradle.api.logging.LogLevel
1310
import org.gradle.api.provider.ListProperty
1411
import org.gradle.api.provider.MapProperty
1512
import org.gradle.api.provider.Property
@@ -51,8 +48,7 @@ abstract class MpsExecute : JavaExec() {
5148
abstract val methodArguments: ListProperty<String>
5249

5350
@get:Internal
54-
val additionalExecuteBackendClasspath: ConfigurableFileCollection =
55-
objectFactory.fileCollection().from(initialExecuteBackendClasspath())
51+
val additionalExecuteBackendClasspath: ConfigurableFileCollection = objectFactory.fileCollection()
5652

5753
init {
5854
mpsVersion.convention(MpsVersionDetection.fromMpsHome(project.layout, providerFactory, mpsHome.asFile))
@@ -82,6 +78,7 @@ abstract class MpsExecute : JavaExec() {
8278
description = "Execute specified method from a generated class to modify the MPS project"
8379
group = "execute"
8480

81+
classpath(mpsJars())
8582
classpath(project.configurations.named(BackendConfigurations.EXECUTE_BACKEND_CONFIGURATION_NAME))
8683
classpath(additionalExecuteBackendClasspath)
8784

@@ -95,7 +92,7 @@ abstract class MpsExecute : JavaExec() {
9592
super.exec()
9693
}
9794

98-
private fun initialExecuteBackendClasspath() = mpsHome.asFileTree.matching {
95+
private fun mpsJars() = mpsHome.asFileTree.matching {
9996
include("lib/**/*.jar")
10097
}
10198
}

src/main/kotlin/de/itemis/mps/gradle/tasks/MpsGenerate.kt

+5-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import org.gradle.api.file.ConfigurableFileCollection
1010
import org.gradle.api.file.Directory
1111
import org.gradle.api.file.DirectoryProperty
1212
import org.gradle.api.file.FileTree
13-
import org.gradle.api.logging.LogLevel
1413
import org.gradle.api.provider.ListProperty
1514
import org.gradle.api.provider.MapProperty
1615
import org.gradle.api.provider.Property
@@ -25,7 +24,7 @@ import org.gradle.process.CommandLineArgumentProvider
2524
@Incubating
2625
abstract class MpsGenerate : JavaExec() {
2726

28-
@get:Internal("covered by mpsVersion, initialGenerateBackendClasspath()")
27+
@get:Internal("covered by mpsVersion, classpath")
2928
val mpsHome: DirectoryProperty = objectFactory.directoryProperty()
3029

3130
@get:Input
@@ -69,8 +68,7 @@ abstract class MpsGenerate : JavaExec() {
6968
val parallelGenerationThreads: Property<Int> = objectFactory.property<Int>().convention(0)
7069

7170
@get:Internal("covered by classpath")
72-
val additionalGenerateBackendClasspath: ConfigurableFileCollection =
73-
objectFactory.fileCollection().from(initialGenerateBackendClasspath())
71+
val additionalGenerateBackendClasspath: ConfigurableFileCollection = objectFactory.fileCollection()
7472

7573
@Suppress("unused")
7674
@get:InputFiles
@@ -127,8 +125,9 @@ abstract class MpsGenerate : JavaExec() {
127125

128126
group = TaskGroups.GENERATION
129127

130-
classpath(project.configurations.named(BackendConfigurations.GENERATE_BACKEND_CONFIGURATION_NAME))
128+
classpath(mpsJars())
131129
classpath(additionalGenerateBackendClasspath)
130+
classpath(project.configurations.named(BackendConfigurations.GENERATE_BACKEND_CONFIGURATION_NAME))
132131

133132
mainClass.set("de.itemis.mps.gradle.generate.MainKt")
134133
}
@@ -139,7 +138,7 @@ abstract class MpsGenerate : JavaExec() {
139138
super.exec()
140139
}
141140

142-
private fun initialGenerateBackendClasspath() = mpsHome.asFileTree.matching {
141+
private fun mpsJars() = mpsHome.asFileTree.matching {
143142
include("lib/**/*.jar")
144143
}
145144
}

0 commit comments

Comments
 (0)