Skip to content

Commit

Permalink
Merge pull request #143 from kolmar/feature/parallel_generation_flag
Browse files Browse the repository at this point in the history
feature: parameter for `generate` to enable parallel generation
  • Loading branch information
sergej-koscejev authored Jun 30, 2023
2 parents 17eae3e + a02c8ae commit e921726
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 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.17

### Added

- `generate` now supports `parallelGenerationThreads` option. Positive values will turn on parallel generation, and
the value will be used as the number of threads. The default is 0, which means no parallel generation.

## 1.16

### Added
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ Parameters:
* `excludeModules` (since 1.14) - optional list of modules to exclude from generate. RegEx can be used for matching multiple modules.
* `macros` - optional list of path macros. The notation is `new Macro("name", "value")`.
* `projectLocation` - location of the MPS project to generate.
* `parallelGenerationThreads` (since 1.17) - optional number of threads to use for parallel generation. Defaults to `0`,
which means that parallel generation is turned off.
* `debug` - optionally allows to start the JVM that is used to generated with a debugger. Setting it to `true` will cause
the started JVM to suspend until a debugger is attached. Useful for debugging classloading problems or exceptions during
the build.
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 {
}

val versionMajor = 1
val versionMinor = 16
val versionMinor = 17

group = "de.itemis.mps"

Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/de/itemis/mps/gradle/Common.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private val logger = Logger.getLogger("de.itemis.mps.gradle.common")

const val MPS_SUPPORT_MSG = "Version 1.8 doesn't only support MPS 2020.1+, please use versions 1.4 or below with older versions of MPS."

const val MPS_BUILD_BACKENDS_VERSION = "[1.6,2.0)"
const val MPS_BUILD_BACKENDS_VERSION = "[1.7,2.0)"

data class Plugin(
var id: String,
Expand Down
14 changes: 8 additions & 6 deletions src/main/kotlin/de/itemis/mps/gradle/generate/Plugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ open class GeneratePluginExtensions(objectFactory: ObjectFactory): BasePluginExt
var modules: List<String> = emptyList()
var excludeModels: List<String> = emptyList()
var excludeModules: List<String> = emptyList()
var parallelGenerationThreads: Int = 0
}

open class GenerateMpsProjectPlugin : Plugin<Project> {
Expand Down Expand Up @@ -67,12 +68,13 @@ open class GenerateMpsProjectPlugin : Plugin<Project> {

argumentProviders.add(argsFromBaseExtension(extension))
argumentProviders.add(CommandLineArgumentProvider {
val args = mutableListOf<String>()
args.addAll(extension.models.map { "--model=$it" })
args.addAll(extension.modules.map { "--module=$it" })
args.addAll(extension.excludeModels.map { "--exclude-model=$it" })
args.addAll(extension.excludeModules.map { "--exclude-module=$it" })
args
mutableListOf<String>().apply {
addAll(extension.models.map { "--model=$it" })
addAll(extension.modules.map { "--module=$it" })
addAll(extension.excludeModels.map { "--exclude-model=$it" })
addAll(extension.excludeModules.map { "--exclude-module=$it" })
add("--parallel-generation-threads=${extension.parallelGenerationThreads}")
}
})

if (extension.javaExec != null)
Expand Down

0 comments on commit e921726

Please sign in to comment.