mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
Resolve "Make engine version configurable"
This commit is contained in:
parent
94f872c752
commit
6fba84f31b
5 changed files with 81 additions and 10 deletions
|
|
@ -1,14 +1,18 @@
|
||||||
image: maven:latest
|
image: maven:latest
|
||||||
|
|
||||||
variables:
|
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"
|
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:
|
build-java-latest:
|
||||||
stage: build
|
stage: build
|
||||||
image: maven:3-jdk-13
|
image: maven:3-jdk-13
|
||||||
script:
|
script:
|
||||||
- mvn $MAVEN_CLI_OPTS verify
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
artifacts:
|
artifacts:
|
||||||
name: java-latest
|
name: java-latest
|
||||||
paths:
|
paths:
|
||||||
|
|
@ -22,7 +26,7 @@ build-java-12:
|
||||||
stage: build
|
stage: build
|
||||||
image: maven:3-jdk-12
|
image: maven:3-jdk-12
|
||||||
script:
|
script:
|
||||||
- mvn $MAVEN_CLI_OPTS verify
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
artifacts:
|
artifacts:
|
||||||
name: java-12
|
name: java-12
|
||||||
paths:
|
paths:
|
||||||
|
|
@ -37,7 +41,7 @@ build-java-11:
|
||||||
stage: build
|
stage: build
|
||||||
image: maven:3-jdk-11
|
image: maven:3-jdk-11
|
||||||
script:
|
script:
|
||||||
- mvn $MAVEN_CLI_OPTS verify
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
artifacts:
|
artifacts:
|
||||||
name: java-11
|
name: java-11
|
||||||
paths:
|
paths:
|
||||||
|
|
@ -51,7 +55,7 @@ build-java8:
|
||||||
stage: build
|
stage: build
|
||||||
image: maven:3-jdk-8-alpine
|
image: maven:3-jdk-8-alpine
|
||||||
script:
|
script:
|
||||||
- mvn $MAVEN_CLI_OPTS verify
|
- mvn $MAVEN_CLI_OPTS $BUILD_PROPS $CI_JOB_TIMESTAMP verify
|
||||||
artifacts:
|
artifacts:
|
||||||
name: java8
|
name: java8
|
||||||
paths:
|
paths:
|
||||||
|
|
|
||||||
4
pom.xml
4
pom.xml
|
|
@ -138,6 +138,10 @@
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/model</directory>
|
<directory>src/main/model</directory>
|
||||||
</resource>
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,6 @@ import net.sf.saxon.s9api.Processor;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class DefaultCheck implements Check {
|
public class DefaultCheck implements Check {
|
||||||
|
|
||||||
private static final String ENGINE_NAME = "KoSIT Prüftool";
|
|
||||||
|
|
||||||
private static final String ENGINE_VERSION = "1.0.0";
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final ScenarioRepository repository;
|
private final ScenarioRepository repository;
|
||||||
|
|
||||||
|
|
@ -99,10 +95,10 @@ public class DefaultCheck implements Check {
|
||||||
protected static CreateReportInput createReport() {
|
protected static CreateReportInput createReport() {
|
||||||
final CreateReportInput type = new CreateReportInput();
|
final CreateReportInput type = new CreateReportInput();
|
||||||
final EngineType e = new EngineType();
|
final EngineType e = new EngineType();
|
||||||
e.setName(ENGINE_NAME);
|
e.setName(EngineInformation.getName());
|
||||||
type.setEngine(e);
|
type.setEngine(e);
|
||||||
type.setTimestamp(ObjectFactory.createTimestamp());
|
type.setTimestamp(ObjectFactory.createTimestamp());
|
||||||
type.setFrameworkVersion(ENGINE_VERSION);
|
type.setFrameworkVersion(EngineInformation.getFrameworkVersion());
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
9
src/main/resources/app-info.properties
Normal file
9
src/main/resources/app-info.properties
Normal file
|
|
@ -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}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue