Skip to content

Commit

Permalink
1.19.1: use backend launcher to support 2022.2 and above
Browse files Browse the repository at this point in the history
  • Loading branch information
sergej-koscejev committed Oct 24, 2023
1 parent 0607760 commit 5808514
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
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.19.1

### Fixed

- `generate` and `checkmodels` tasks now support MPS 2022.2 and above by adding the necessary `--add-opens` JVM
arguments (using `mps-build-backends/launcher`).

## 1.19

### Added
Expand Down
26 changes: 17 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,31 @@ plugins {
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
}

val versionMajor = 1
val versionMinor = 19
val baseVersion = "1.19.1"

group = "de.itemis.mps"

var currentBranch:String? = ""
currentBranch = GitBasedVersioning.getGitBranch()
val currentBranch : String? = GitBasedVersioning.getGitBranch()

version = if (!project.hasProperty("useSnapshot") &&
(project.hasProperty("forceCI") || project.hasProperty("teamcity"))
) {
GitBasedVersioning.getVersion(
// Publish releases from v1.x branch without v1.x prefix
if (currentBranch == "v1.x") "HEAD" else currentBranch,
versionMajor.toString(), versionMinor.toString())
val prefix = when (currentBranch) {
null, "", "v1.x", "HEAD", "master", "main" -> ""
else -> "$currentBranch."
}

val suffix = ".${GitBasedVersioning.getGitCommitCount()}.${GitBasedVersioning.getGitShortCommitHash()}"

prefix + baseVersion + suffix
} else {
"$versionMajor.$versionMinor-SNAPSHOT"
"$baseVersion-SNAPSHOT"
}

tasks.register("printVersion") {
doLast {
println("Version: $version")
}
}

val mpsConfiguration = configurations.create("mps")
Expand Down
2 changes: 1 addition & 1 deletion gradle.lockfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
de.itemis.mps.build-backends:launcher:1.0.0.55.b7ebac5=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
de.itemis.mps.build-backends:launcher:1.0.0.56.8c05881=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
junit:junit:4.13.2=testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
net.java.dev.jna:jna:5.6.0=kotlinCompilerClasspath,kotlinKlibCommonizerClasspath
net.swiftzer.semver:semver:1.1.2=compileClasspath,implementationDependenciesMetadata,runtimeClasspath,testCompileClasspath,testImplementationDependenciesMetadata,testRuntimeClasspath
Expand Down
4 changes: 4 additions & 0 deletions src/main/kotlin/de/itemis/mps/gradle/generate/Plugin.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package de.itemis.mps.gradle.generate

import de.itemis.mps.gradle.*
import de.itemis.mps.gradle.launcher.MpsBackendLauncher
import org.gradle.api.GradleException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.model.ObjectFactory
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.JavaExec
import org.gradle.kotlin.dsl.newInstance
import org.gradle.process.CommandLineArgumentProvider
import java.io.File

Expand Down Expand Up @@ -64,6 +66,8 @@ open class GenerateMpsProjectPlugin : Plugin<Project> {
}

generate.configure {
val backendLauncher: MpsBackendLauncher = project.objects.newInstance(MpsBackendLauncher::class)
backendLauncher.configureJavaForMpsVersion(this, mpsLocation, mpsVersion)
dependsOn(fake)

argumentProviders.add(argsFromBaseExtension(extension))
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/de/itemis/mps/gradle/modelcheck/Plugin.kt
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package de.itemis.mps.gradle.modelcheck

import de.itemis.mps.gradle.*
import de.itemis.mps.gradle.launcher.MpsBackendLauncher
import org.gradle.api.GradleException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.model.ObjectFactory
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.JavaExec
import org.gradle.kotlin.dsl.newInstance
import org.gradle.process.CommandLineArgumentProvider
import java.io.File
import javax.inject.Inject

open class ModelCheckPluginExtensions(objectFactory: ObjectFactory) : BasePluginExtensions(objectFactory) {
var models: List<String> = emptyList()
Expand Down Expand Up @@ -49,6 +52,8 @@ open class ModelcheckMpsProjectPlugin : Plugin<Project> {
}

checkmodels.configure {
val backendLauncher: MpsBackendLauncher = project.objects.newInstance(MpsBackendLauncher::class)
backendLauncher.configureJavaForMpsVersion(this, mpsLocation, mpsVersion)
dependsOn(resolveMps)

argumentProviders.add(argsFromBaseExtension(extension))
Expand Down

0 comments on commit 5808514

Please sign in to comment.