Skip to content

Commit

Permalink
1.29.0: Change classpath construction order to avoid Kotlin incompati…
Browse files Browse the repository at this point in the history
…bilities
  • Loading branch information
sergej-koscejev committed Jan 22, 2025
1 parent f8ee996 commit 811916e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.29.0

- `MpsCheck`, `MpsGenerate`, `MpsExecute`: put MPS jars at the beginning of the classpath of the corresponding backends,
in an attempt to solve incompatibility between the Kotlin version that the backends are built against and the Kotlin
version included in newer MPS versions (2024.1+).

## 1.28.0

### Added
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ plugins {
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
}

val baseVersion = "1.28.0"
val baseVersion = "1.29.0"

group = "de.itemis.mps"

Expand Down
12 changes: 4 additions & 8 deletions src/main/kotlin/de/itemis/mps/gradle/tasks/MpsCheck.kt
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
package de.itemis.mps.gradle.tasks

import de.itemis.mps.gradle.BackendConfigurations
import de.itemis.mps.gradle.ErrorMessages
import de.itemis.mps.gradle.TaskGroups
import de.itemis.mps.gradle.launcher.MpsBackendBuilder
import de.itemis.mps.gradle.launcher.MpsVersionDetection
import org.gradle.api.GradleException
import org.gradle.api.Incubating
import org.gradle.api.file.*
import org.gradle.api.logging.LogLevel
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.SetProperty
import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.*
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.process.CommandLineArgumentProvider

@CacheableTask
@Incubating
abstract class MpsCheck : JavaExec(), VerificationTask {

@get:Internal("covered by mpsVersion, initialModelcheckBackendClasspath()")
@get:Internal("covered by mpsVersion, classpath")
val mpsHome: DirectoryProperty = objectFactory.directoryProperty()

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

@get:Internal("covered by classpath")
val additionalModelcheckBackendClasspath: ConfigurableFileCollection =
objectFactory.fileCollection().from(initialModelcheckBackendClasspath())
val additionalModelcheckBackendClasspath: ConfigurableFileCollection = objectFactory.fileCollection()

@Suppress("unused")
@get:InputFiles
Expand Down Expand Up @@ -142,6 +137,7 @@ abstract class MpsCheck : JavaExec(), VerificationTask {

group = TaskGroups.VERIFICATION

classpath(mpsAndPluginJars())
classpath(project.configurations.named(BackendConfigurations.MODELCHECK_BACKEND_CONFIGURATION_NAME))
classpath(additionalModelcheckBackendClasspath)

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

private fun initialModelcheckBackendClasspath() = mpsHome.asFileTree.matching {
private fun mpsAndPluginJars() = mpsHome.asFileTree.matching {
include("lib/**/*.jar")

// add only minimal number of plugins jars that are required by the modelcheck code
Expand Down
9 changes: 3 additions & 6 deletions src/main/kotlin/de/itemis/mps/gradle/tasks/MpsExecute.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package de.itemis.mps.gradle.tasks

import de.itemis.mps.gradle.BackendConfigurations
import de.itemis.mps.gradle.ErrorMessages
import de.itemis.mps.gradle.launcher.MpsBackendBuilder
import de.itemis.mps.gradle.launcher.MpsVersionDetection
import org.gradle.api.GradleException
import org.gradle.api.Incubating
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.Directory
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.logging.LogLevel
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
Expand Down Expand Up @@ -51,8 +48,7 @@ abstract class MpsExecute : JavaExec() {
abstract val methodArguments: ListProperty<String>

@get:Internal
val additionalExecuteBackendClasspath: ConfigurableFileCollection =
objectFactory.fileCollection().from(initialExecuteBackendClasspath())
val additionalExecuteBackendClasspath: ConfigurableFileCollection = objectFactory.fileCollection()

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

classpath(mpsJars())
classpath(project.configurations.named(BackendConfigurations.EXECUTE_BACKEND_CONFIGURATION_NAME))
classpath(additionalExecuteBackendClasspath)

Expand All @@ -95,7 +92,7 @@ abstract class MpsExecute : JavaExec() {
super.exec()
}

private fun initialExecuteBackendClasspath() = mpsHome.asFileTree.matching {
private fun mpsJars() = mpsHome.asFileTree.matching {
include("lib/**/*.jar")
}
}
11 changes: 5 additions & 6 deletions src/main/kotlin/de/itemis/mps/gradle/tasks/MpsGenerate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.Directory
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.FileTree
import org.gradle.api.logging.LogLevel
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
Expand All @@ -25,7 +24,7 @@ import org.gradle.process.CommandLineArgumentProvider
@Incubating
abstract class MpsGenerate : JavaExec() {

@get:Internal("covered by mpsVersion, initialGenerateBackendClasspath()")
@get:Internal("covered by mpsVersion, classpath")
val mpsHome: DirectoryProperty = objectFactory.directoryProperty()

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

@get:Internal("covered by classpath")
val additionalGenerateBackendClasspath: ConfigurableFileCollection =
objectFactory.fileCollection().from(initialGenerateBackendClasspath())
val additionalGenerateBackendClasspath: ConfigurableFileCollection = objectFactory.fileCollection()

@Suppress("unused")
@get:InputFiles
Expand Down Expand Up @@ -127,8 +125,9 @@ abstract class MpsGenerate : JavaExec() {

group = TaskGroups.GENERATION

classpath(project.configurations.named(BackendConfigurations.GENERATE_BACKEND_CONFIGURATION_NAME))
classpath(mpsJars())
classpath(additionalGenerateBackendClasspath)
classpath(project.configurations.named(BackendConfigurations.GENERATE_BACKEND_CONFIGURATION_NAME))

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

private fun initialGenerateBackendClasspath() = mpsHome.asFileTree.matching {
private fun mpsJars() = mpsHome.asFileTree.matching {
include("lib/**/*.jar")
}
}

0 comments on commit 811916e

Please sign in to comment.