Skip to content
Snippets Groups Projects
Commit c720f811 authored by dgelessus's avatar dgelessus
Browse files

Set TranslationGlobals.VERSION_NUMBER automatically during build

This will avoid the version number getting outdated again in the future.
parent d258199a
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,13 @@ java { ...@@ -47,6 +47,13 @@ java {
withJavadocJar() withJavadocJar()
} }
processResources {
inputs.property("project.version", project.version)
filesMatching("de/tla2b/build.properties") {
expand(version: project.version)
}
}
jacoco { jacoco {
toolVersion = "0.8.9" toolVersion = "0.8.9"
reportsDirectory = file("$buildDir/customJacocoReportDir") reportsDirectory = file("$buildDir/customJacocoReportDir")
......
...@@ -6,7 +6,7 @@ import java.util.Arrays; ...@@ -6,7 +6,7 @@ import java.util.Arrays;
import tla2sany.semantic.FrontEnd; import tla2sany.semantic.FrontEnd;
public interface TranslationGlobals { public interface TranslationGlobals {
final String VERSION_NUMBER = "1.1.5-SNAPSHOT"; final String VERSION_NUMBER = VersionHelper.VERSION;
final int TLCValueKind = 100; final int TLCValueKind = 100;
......
package de.tla2b.global;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.util.Properties;
final class VersionHelper {
private VersionHelper() {
throw new AssertionError("Utility class");
}
static final String VERSION;
static {
final Properties buildProperties = new Properties();
final InputStream is = VersionHelper.class.getResourceAsStream("/de/tla2b/build.properties");
if (is == null) {
throw new AssertionError("Build properties not found, this should never happen!");
} else {
try (final Reader r = new InputStreamReader(is, StandardCharsets.UTF_8)) {
buildProperties.load(r);
} catch (final IOException e) {
throw new AssertionError("IOException while loading build properties, this should never happen!", e);
}
}
VERSION = buildProperties.getProperty("version");
}
}
# The values for these properties are generated during the build.
# See the configuration of the processResources task in build.gradle.
version=${version}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment