diff --git a/CHANGELOG.md b/CHANGELOG.md index 09e86a3..9764d4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 6.4.1 + +##### Fixes +- threat empty circleCI environment variables as not set + + ## 6.4.0 ##### Features diff --git a/README.md b/README.md index f730607..474af4a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ This plugin can virtually set project version and properties, based on current * ```groovy plugins { - id 'me.qoomon.git-versioning' version '6.3.8' + id 'me.qoomon.git-versioning' version '6.4.1' } version = '0.0.0-SNAPSHOT' @@ -41,7 +41,7 @@ gitVersioning.apply { ```kotlin plugins { - id("me.qoomon.git-versioning") version "6.3.8" + id("me.qoomon.git-versioning") version "6.4.1" } version = "0.0.0-SNAPSHOT" diff --git a/build.gradle b/build.gradle index a1eea07..01d886e 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ plugins { } group 'me.qoomon' -version '6.4.0' +version '6.4.1' sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPluginExtension.java b/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPluginExtension.java index eea59ef..7170194 100644 --- a/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPluginExtension.java +++ b/src/main/java/me/qoomon/gradle/gitversioning/GitVersioningPluginExtension.java @@ -39,8 +39,7 @@ import static java.util.stream.Collectors.toList; import static me.qoomon.gitversioning.commons.GitRefType.*; import static me.qoomon.gitversioning.commons.StringUtil.*; -import static org.apache.commons.lang3.StringUtils.leftPad; -import static org.apache.commons.lang3.StringUtils.rightPad; +import static org.apache.commons.lang3.StringUtils.*; import static org.eclipse.jgit.lib.Constants.HEAD; public abstract class GitVersioningPluginExtension { @@ -351,11 +350,11 @@ private void handleEnvironment(Repository repository) throws IOException { project.getLogger().debug(" CI_COMMIT_TAG: " + commitTag); project.getLogger().debug(" CI_MERGE_REQUEST_SOURCE_BRANCH_NAME: " + mrSourceBranch); - if (commitBranch != null) { + if (!isBlank(commitBranch)) { setBranch(commitBranch); - } else if (mrSourceBranch != null) { + } else if (!isBlank(mrSourceBranch)) { setBranch(mrSourceBranch); - } else if (commitTag != null) { + } else if (!isBlank(commitTag)) { addTag(commitTag); } return; @@ -373,10 +372,10 @@ private void handleEnvironment(Repository repository) throws IOException { project.getLogger().debug(" CIRCLE_BRANCH: " + commitBranch); project.getLogger().debug(" CIRCLE_TAG: " + commitTag); - if (commitBranch != null) { - setBranch(commitBranch); - } else if (commitTag != null) { - addTag(commitTag); + if (!isBlank(commitBranch)) { + setBranch(commitBranch.trim()); + } else if (!isBlank(commitTag)) { + addTag(commitTag.trim()); } return; } @@ -392,13 +391,13 @@ private void handleEnvironment(Repository repository) throws IOException { project.getLogger().debug(" BRANCH_NAME: " + commitBranch); project.getLogger().debug(" TAG_NAME: " + commitTag); - if (commitBranch != null) { + if (!isBlank(commitBranch)) { if (commitBranch.equals(commitTag)) { addTag(commitBranch); } else { setBranch(commitBranch); } - } else if (commitTag != null) { + } else if (!isBlank(commitTag)) { addTag(commitTag); } return;