From 0745514e8a0b6e75f5ec7ef7334f7d8f1e75e02a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 29 Jul 2023 06:27:19 +0200 Subject: [PATCH] Create a commit hash for local builds as well (#2673) (#2674) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit fbbc7565d43013153e429da57fc9ace0c4871782) Co-authored-by: Christoph Läubrich --- tycho-spi/pom.xml | 17 +++++++++++++++++ .../org/eclipse/tycho/version/TychoVersion.java | 8 +++++++- .../eclipse/tycho/version/version.properties | 4 +++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tycho-spi/pom.xml b/tycho-spi/pom.xml index e00b74c824..84b4b1b62c 100644 --- a/tycho-spi/pom.xml +++ b/tycho-spi/pom.xml @@ -57,6 +57,23 @@ org.apache.maven.plugins maven-plugin-plugin + + org.codehaus.mojo + buildnumber-maven-plugin + 3.1.0 + + + validate + + create + + + + + false + false + + diff --git a/tycho-spi/src/main/java/org/eclipse/tycho/version/TychoVersion.java b/tycho-spi/src/main/java/org/eclipse/tycho/version/TychoVersion.java index 71eb106006..482b420c53 100644 --- a/tycho-spi/src/main/java/org/eclipse/tycho/version/TychoVersion.java +++ b/tycho-spi/src/main/java/org/eclipse/tycho/version/TychoVersion.java @@ -22,6 +22,8 @@ public class TychoVersion { private static final String TYCHO_SCM = readVersion("scm"); + private static final String TYCHO_BUILDNUMBER = readVersion("buildNumber"); + private static final String BND_VERSION = readVersion("bnd"); private static Properties PROPERTIES; @@ -36,7 +38,11 @@ public static String getBndVersion() { public static String getSCMInfo() { if ("${env.GIT_COMMIT}".equals(TYCHO_SCM)) { - return "local build"; + if ("${buildNumber}".equals(TYCHO_BUILDNUMBER)) { + //no way then... + return "local build"; + } + return TYCHO_BUILDNUMBER; } return TYCHO_SCM; } diff --git a/tycho-spi/src/main/resources/org/eclipse/tycho/version/version.properties b/tycho-spi/src/main/resources/org/eclipse/tycho/version/version.properties index 0d5dc6ade2..fcb02b3da4 100644 --- a/tycho-spi/src/main/resources/org/eclipse/tycho/version/version.properties +++ b/tycho-spi/src/main/resources/org/eclipse/tycho/version/version.properties @@ -2,4 +2,6 @@ version=${project.version} bnd=${bnd.version} scm=${env.GIT_COMMIT} url=${env.GIT_URL} -branch=${env.GIT_BRANCH} \ No newline at end of file +branch=${env.GIT_BRANCH} +scmBranch=${scmBranch} +buildNumber=${buildNumber}