Skip to content

Commit f1da7ae

Browse files
author
James Leigh
authored
Merge pull request #844 from jamesrdf/issues/#827-build-number
Fix #827: Include Implementation-Build in META-INF/MANIFEST.MF
2 parents 89cf6d3 + 9063d7b commit f1da7ae

59 files changed

Lines changed: 484 additions & 85 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/config/pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,12 @@
3232
<scope>test</scope>
3333
</dependency>
3434
</dependencies>
35-
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.codehaus.mojo</groupId>
39+
<artifactId>buildnumber-maven-plugin</artifactId>
40+
</plugin>
41+
</plugins>
42+
</build>
3643
</project>

core/config/src/main/java/org/eclipse/rdf4j/RDF4J.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@
1414
*/
1515
public class RDF4J {
1616

17-
private static final String VERSION = MavenUtil.loadVersion("org.eclipse.rdf4j", "rdf4j-config", "dev");
17+
private static final String VERSION = loadVersion();
1818

1919
public final static String getVersion() {
2020
return VERSION;
2121
}
22+
23+
private static String loadVersion() {
24+
String impl = RDF4J.class.getPackage().getImplementationVersion();
25+
if (impl == null) {
26+
return MavenUtil.loadVersion("org.eclipse.rdf4j", "rdf4j-config", "dev");
27+
} else {
28+
return impl;
29+
}
30+
}
2231
}

core/config/src/main/java/org/eclipse/rdf4j/common/app/AppVersion.java

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ public class AppVersion implements Comparable<AppVersion> {
4343
*/
4444
private String modifier;
4545

46+
/**
47+
* The version's build, if any.
48+
*/
49+
private String build;
50+
4651
/**
4752
* Construct an uninitialized AppVersion.
4853
*/
@@ -83,11 +88,16 @@ public AppVersion(int major, int minor, int patch, String modifier) {
8388
* <tt>1.0.1M1-SNAPSHOT</tt>.
8489
*/
8590
public AppVersion(int major, int minor, int patch, int milestone, String modifier) {
91+
this(major, minor, patch, milestone, modifier, null);
92+
}
93+
94+
public AppVersion(int major, int minor, int patch, int milestone, String modifier, String build) {
8695
this.major = major;
8796
this.minor = minor;
8897
this.patch = patch;
8998
this.milestone = milestone;
9099
this.modifier = modifier;
100+
this.build = build;
91101
}
92102

93103
/**
@@ -264,6 +274,7 @@ public static AppVersion parse(String versionString) {
264274
int patchSeparator = versionString.indexOf('.', minorSeparator + 1);
265275
int milestoneSeparator = versionString.indexOf('M', Math.max(minorSeparator, patchSeparator));
266276
int modifierSeparator = versionString.indexOf('-', Math.max(minorSeparator, milestoneSeparator));
277+
int buildSeparator = versionString.indexOf('+', Math.max(Math.max(minorSeparator, milestoneSeparator), modifierSeparator));
267278

268279
if (minorSeparator == -1) {
269280
throw new NumberFormatException("Illegal version string: " + versionString);
@@ -272,21 +283,35 @@ public static AppVersion parse(String versionString) {
272283
final boolean hasPatch = patchSeparator > -1;
273284
final boolean hasMilestone = milestoneSeparator > -1;
274285
final boolean hasModifier = modifierSeparator > -1;
286+
final boolean hasBuild = buildSeparator > -1;
275287

276288
String major = versionString.substring(0, minorSeparator);
277289
String minor = null;
278290
String patch = null;
279291
String milestone = null;
280292
String modifier = null;
293+
String build = null;
294+
295+
if (hasBuild) {
296+
build = versionString.substring(buildSeparator + 1);
297+
}
281298

282299
if (hasModifier) {
283-
modifier = versionString.substring(modifierSeparator + 1);
300+
if (hasBuild) {
301+
modifier = versionString.substring(modifierSeparator + 1, buildSeparator);
302+
}
303+
else {
304+
modifier = versionString.substring(modifierSeparator + 1);
305+
}
284306
}
285307

286308
if (hasMilestone) {
287309
if (hasModifier) {
288310
milestone = versionString.substring(milestoneSeparator + 1, modifierSeparator);
289311
}
312+
else if (hasBuild) {
313+
milestone = versionString.substring(milestoneSeparator + 1, buildSeparator);
314+
}
290315
else {
291316
milestone = versionString.substring(milestoneSeparator + 1);
292317
}
@@ -300,6 +325,9 @@ public static AppVersion parse(String versionString) {
300325
else if (hasModifier) {
301326
patch = versionString.substring(patchSeparator + 1, modifierSeparator);
302327
}
328+
else if (hasBuild) {
329+
patch = versionString.substring(patchSeparator + 1, buildSeparator);
330+
}
303331
else {
304332
patch = versionString.substring(patchSeparator + 1);
305333
}
@@ -312,6 +340,9 @@ else if (hasModifier) {
312340
else if (hasModifier) {
313341
minor = versionString.substring(minorSeparator + 1, modifierSeparator);
314342
}
343+
else if (hasBuild) {
344+
minor = versionString.substring(minorSeparator + 1, buildSeparator);
345+
}
315346
else {
316347
minor = versionString.substring(minorSeparator + 1);
317348
}
@@ -322,7 +353,7 @@ else if (hasModifier) {
322353
int minorInt = Integer.parseInt(minor);
323354
int patchInt = patch == null ? -1 : Integer.parseInt(patch);
324355
int milestoneInt = milestone == null ? -1 : Integer.parseInt(milestone);
325-
return new AppVersion(majorInt, minorInt, patchInt, milestoneInt, modifier);
356+
return new AppVersion(majorInt, minorInt, patchInt, milestoneInt, modifier, build);
326357
}
327358

328359
/**
@@ -351,6 +382,13 @@ public String toString() {
351382
sb.append(modifier);
352383
}
353384

385+
if (build != null) {
386+
if (sb.length() > 0) {
387+
sb.append('+');
388+
}
389+
sb.append(build);
390+
}
391+
354392
return sb.toString();
355393
}
356394
}

core/console/pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@
9797
</archive>
9898
</configuration>
9999
</plugin>
100+
<plugin>
101+
<groupId>org.codehaus.mojo</groupId>
102+
<artifactId>buildnumber-maven-plugin</artifactId>
103+
</plugin>
100104
</plugins>
101105
</build>
102-
103106
</project>

core/http/client/pom.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@
8585
<groupId>com.github.siom79.japicmp</groupId>
8686
<artifactId>japicmp-maven-plugin</artifactId>
8787
</plugin>
88-
</plugins>
89-
</build>
90-
88+
<plugin>
89+
<groupId>org.codehaus.mojo</groupId>
90+
<artifactId>buildnumber-maven-plugin</artifactId>
91+
</plugin>
92+
</plugins>
93+
</build>
9194
</project>

core/http/protocol/pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,12 @@
4040
<artifactId>junit</artifactId>
4141
</dependency>
4242
</dependencies>
43-
43+
<build>
44+
<plugins>
45+
<plugin>
46+
<groupId>org.codehaus.mojo</groupId>
47+
<artifactId>buildnumber-maven-plugin</artifactId>
48+
</plugin>
49+
</plugins>
50+
</build>
4451
</project>

core/http/server-spring/pom.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,12 @@
8484
<artifactId>spring-test</artifactId>
8585
</dependency>
8686
</dependencies>
87-
87+
<build>
88+
<plugins>
89+
<plugin>
90+
<groupId>org.codehaus.mojo</groupId>
91+
<artifactId>buildnumber-maven-plugin</artifactId>
92+
</plugin>
93+
</plugins>
94+
</build>
8895
</project>

core/model/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
<groupId>com.github.siom79.japicmp</groupId>
3131
<artifactId>japicmp-maven-plugin</artifactId>
3232
</plugin>
33+
<plugin>
34+
<groupId>org.codehaus.mojo</groupId>
35+
<artifactId>buildnumber-maven-plugin</artifactId>
36+
</plugin>
3337
</plugins>
3438
</build>
3539
</project>

core/query/pom.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737
<groupId>com.github.siom79.japicmp</groupId>
3838
<artifactId>japicmp-maven-plugin</artifactId>
3939
</plugin>
40-
</plugins>
41-
</build>
42-
40+
<plugin>
41+
<groupId>org.codehaus.mojo</groupId>
42+
<artifactId>buildnumber-maven-plugin</artifactId>
43+
</plugin>
44+
</plugins>
45+
</build>
4346
</project>

core/queryalgebra/evaluation/pom.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@
7575
<groupId>com.github.siom79.japicmp</groupId>
7676
<artifactId>japicmp-maven-plugin</artifactId>
7777
</plugin>
78-
</plugins>
79-
</build>
80-
78+
<plugin>
79+
<groupId>org.codehaus.mojo</groupId>
80+
<artifactId>buildnumber-maven-plugin</artifactId>
81+
</plugin>
82+
</plugins>
83+
</build>
8184
</project>

0 commit comments

Comments
 (0)