diff --git a/CHANGELOG.md b/CHANGELOG.md index d62754db..459f1c1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Extracted Git-based versioning into a separate subproject, `git-based-versioning`. +- `runMigrations`: `force` and `haltOnPrecheckFailure` are now nullable and null by default. ## 1.15 diff --git a/build.gradle.kts b/build.gradle.kts index 0d59590b..94cea2f3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -29,12 +29,12 @@ val versionMinor = 16 group = "de.itemis.mps" var currentBranch:String? = "" -currentBranch = de.itemis.mps.gradle.GitBasedVersioning.getGitBranch() +currentBranch = GitBasedVersioning.getGitBranch() version = if (!project.hasProperty("useSnapshot") && (project.hasProperty("forceCI") || project.hasProperty("teamcity")) ) { - de.itemis.mps.gradle.GitBasedVersioning.getVersion( + GitBasedVersioning.getVersion( // Publish releases from v1.x branch without v1.x prefix if (currentBranch == "v1.x") "HEAD" else currentBranch, versionMajor.toString(), versionMinor.toString()) diff --git a/src/main/kotlin/de/itemis/mps/gradle/runmigrations/Plugin.kt b/src/main/kotlin/de/itemis/mps/gradle/runmigrations/Plugin.kt index 07421e00..40674987 100644 --- a/src/main/kotlin/de/itemis/mps/gradle/runmigrations/Plugin.kt +++ b/src/main/kotlin/de/itemis/mps/gradle/runmigrations/Plugin.kt @@ -18,13 +18,13 @@ open class MigrationExecutorPluginExtensions @Inject constructor(of: ObjectFacto * (Since MPS 2021.1) Whether to halt if a pre-check has failed. Note that the check for migrated dependencies * cannot be skipped. */ - var haltOnPrecheckFailure = true + var haltOnPrecheckFailure: Boolean? = null /** * (Since MPS 2021.3) Whether to force a migration even if the project directory contains `.allow-pending-migrations` file. */ - var force = false + var force: Boolean? = null } @Suppress("unused") @@ -49,11 +49,11 @@ open class RunMigrationsMpsProjectPlugin : Plugin { val mpsVersion = extension.getMPSVersion() val parsedMPSVersion = SemVer.parse(mpsVersion) - if (extension.force && parsedMPSVersion < MIN_VERSION_FOR_FORCE) { + if (extension.force != null && parsedMPSVersion < MIN_VERSION_FOR_FORCE) { throw GradleException("The force migration flag is only supported for MPS version $MIN_VERSION_FOR_FORCE and higher.") } - if (!extension.haltOnPrecheckFailure && parsedMPSVersion < MIN_VERSION_FOR_HALT_ON_PRECHECK_FAILURE) { + if (extension.haltOnPrecheckFailure != null && parsedMPSVersion < MIN_VERSION_FOR_HALT_ON_PRECHECK_FAILURE) { throw GradleException("The 'do not halt on pre-check failure' option is only supported for MPS version $MIN_VERSION_FOR_HALT_ON_PRECHECK_FAILURE and higher.") } @@ -84,8 +84,8 @@ open class RunMigrationsMpsProjectPlugin : Plugin { add("project" to projectLocation) add("mpsHome" to mpsLocation) - if (parsedMPSVersion >= MIN_VERSION_FOR_FORCE) add("force" to extension.force) - if (parsedMPSVersion >= MIN_VERSION_FOR_HALT_ON_PRECHECK_FAILURE) add("haltOnPrecheckFailure" to extension.haltOnPrecheckFailure) + if (extension.force != null) add("force" to extension.force!!) + if (extension.haltOnPrecheckFailure != null) add("haltOnPrecheckFailure" to extension.haltOnPrecheckFailure!!) toTypedArray() }