diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index adabc90..005e2c0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,14 +1,18 @@
image: maven:latest
variables:
+ BUILD_PROPS: "-Dbuild.revision=$CI_COMMIT_SHA -Dbuild.branch=$CI_COMMIT_REF_NAME -Dbuild.number=$CI_PIPELINE_IID "
MAVEN_CLI_OPTS: " --batch-mode -Dmaven.repo.local=/cache/repository -Dfile.encoding=UTF-8"
+before_script:
+ - export CI_JOB_TIMESTAMP="-Dbuild.timestamp=$(date --utc --iso-8601=seconds)"
+
build-java-latest:
stage: build
image: maven:3-jdk-13
script:
- - mvn $MAVEN_CLI_OPTS verify
+ - mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
artifacts:
name: java-latest
paths:
@@ -22,7 +26,7 @@ build-java-12:
stage: build
image: maven:3-jdk-12
script:
- - mvn $MAVEN_CLI_OPTS verify
+ - mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
artifacts:
name: java-12
paths:
@@ -37,7 +41,7 @@ build-java-11:
stage: build
image: maven:3-jdk-11
script:
- - mvn $MAVEN_CLI_OPTS verify
+ - mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
artifacts:
name: java-11
paths:
@@ -51,7 +55,7 @@ build-java8:
stage: build
image: maven:3-jdk-8-alpine
script:
- - mvn $MAVEN_CLI_OPTS verify
+ - mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
artifacts:
name: java8
paths:
diff --git a/pom.xml b/pom.xml
index 59cdc93..5235fd8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -138,6 +138,10 @@
src/main/model
+
+ src/main/resources
+ true
+
diff --git a/src/main/java/de/kosit/validationtool/impl/DefaultCheck.java b/src/main/java/de/kosit/validationtool/impl/DefaultCheck.java
index 823ee18..9c295cd 100644
--- a/src/main/java/de/kosit/validationtool/impl/DefaultCheck.java
+++ b/src/main/java/de/kosit/validationtool/impl/DefaultCheck.java
@@ -58,10 +58,6 @@ import net.sf.saxon.s9api.Processor;
@Slf4j
public class DefaultCheck implements Check {
- private static final String ENGINE_NAME = "KoSIT Prüftool";
-
- private static final String ENGINE_VERSION = "1.0.0";
-
@Getter
private final ScenarioRepository repository;
@@ -99,10 +95,10 @@ public class DefaultCheck implements Check {
protected static CreateReportInput createReport() {
final CreateReportInput type = new CreateReportInput();
final EngineType e = new EngineType();
- e.setName(ENGINE_NAME);
+ e.setName(EngineInformation.getName());
type.setEngine(e);
type.setTimestamp(ObjectFactory.createTimestamp());
- type.setFrameworkVersion(ENGINE_VERSION);
+ type.setFrameworkVersion(EngineInformation.getFrameworkVersion());
return type;
}
diff --git a/src/main/java/de/kosit/validationtool/impl/EngineInformation.java b/src/main/java/de/kosit/validationtool/impl/EngineInformation.java
new file mode 100644
index 0000000..3774f9b
--- /dev/null
+++ b/src/main/java/de/kosit/validationtool/impl/EngineInformation.java
@@ -0,0 +1,58 @@
+package de.kosit.validationtool.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+/**
+ * Hält statische Informatione über diesen Validator.
+ *
+ * @author Andreas Penski
+ */
+public class EngineInformation {
+
+ private static final Properties PROPERTIES;
+
+ static {
+ PROPERTIES = new Properties();
+ try ( final InputStream input = EngineInformation.class.getClassLoader().getResourceAsStream("app-info.properties") ) {
+ if (input != null) {
+ PROPERTIES.load(input);
+ }
+ } catch (final IOException e) {
+ throw new IllegalStateException("Can not engine information", e);
+ }
+ }
+
+ private EngineInformation() {
+ // hide
+ }
+
+ /**
+ * Gibt die Versions-Nummer des Validators zurück.
+ *
+ * @return die Version
+ */
+ public static String getVersion() {
+ return PROPERTIES.getProperty("project_version");
+ }
+
+ /**
+ * Gibt den Namen der Engine zurück.
+ *
+ * @return der Name
+ */
+ public static String getName() {
+ return PROPERTIES.getProperty("engine_name");
+ }
+
+ /**
+ * Gibt die Versions-Nummer des verwendeten Frameworks zurück. Diese ist relevant um Scenario-Konfiguration und
+ * Validator-Versionen aufeinander abzustimmen.
+ *
+ * @return die Framework-Version
+ */
+ public static String getFrameworkVersion() {
+ return PROPERTIES.getProperty("framework_version");
+ }
+}
diff --git a/src/main/resources/app-info.properties b/src/main/resources/app-info.properties
new file mode 100644
index 0000000..e19ce35
--- /dev/null
+++ b/src/main/resources/app-info.properties
@@ -0,0 +1,9 @@
+# do not edit this file
+# this properties are overriden by build process
+project_version=${project.version}
+framework_version=1.0.0
+engine_name=KoSIT Prüftool
+build_timestamp=${build.timestamp}
+build_number=${build.number}
+build_revision=${build.revision}
+build_branch=${build.branch}
\ No newline at end of file