Skip to content

Commit 0745514

Browse files
Create a commit hash for local builds as well (#2673) (#2674)
(cherry picked from commit fbbc756) Co-authored-by: Christoph Läubrich <laeubi@laeubi-soft.de>
1 parent 28e50ee commit 0745514

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

tycho-spi/pom.xml

+17
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,23 @@
5757
<groupId>org.apache.maven.plugins</groupId>
5858
<artifactId>maven-plugin-plugin</artifactId>
5959
</plugin>
60+
<plugin>
61+
<groupId>org.codehaus.mojo</groupId>
62+
<artifactId>buildnumber-maven-plugin</artifactId>
63+
<version>3.1.0</version>
64+
<executions>
65+
<execution>
66+
<phase>validate</phase>
67+
<goals>
68+
<goal>create</goal>
69+
</goals>
70+
</execution>
71+
</executions>
72+
<configuration>
73+
<doCheck>false</doCheck>
74+
<doUpdate>false</doUpdate>
75+
</configuration>
76+
</plugin>
6077
</plugins>
6178
</build>
6279
</project>

tycho-spi/src/main/java/org/eclipse/tycho/version/TychoVersion.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public class TychoVersion {
2222

2323
private static final String TYCHO_SCM = readVersion("scm");
2424

25+
private static final String TYCHO_BUILDNUMBER = readVersion("buildNumber");
26+
2527
private static final String BND_VERSION = readVersion("bnd");
2628

2729
private static Properties PROPERTIES;
@@ -36,7 +38,11 @@ public static String getBndVersion() {
3638

3739
public static String getSCMInfo() {
3840
if ("${env.GIT_COMMIT}".equals(TYCHO_SCM)) {
39-
return "local build";
41+
if ("${buildNumber}".equals(TYCHO_BUILDNUMBER)) {
42+
//no way then...
43+
return "local build";
44+
}
45+
return TYCHO_BUILDNUMBER;
4046
}
4147
return TYCHO_SCM;
4248
}

tycho-spi/src/main/resources/org/eclipse/tycho/version/version.properties

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ version=${project.version}
22
bnd=${bnd.version}
33
scm=${env.GIT_COMMIT}
44
url=${env.GIT_URL}
5-
branch=${env.GIT_BRANCH}
5+
branch=${env.GIT_BRANCH}
6+
scmBranch=${scmBranch}
7+
buildNumber=${buildNumber}

0 commit comments

Comments
 (0)