Skip to content
Permalink
Browse files

Also capture the Java version ORT is running on

This can be helpful to debug issues.

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@here.com>
  • Loading branch information...
sschuberth authored and mnonnenmacher committed May 13, 2019
1 parent 672eef7 commit a2fd7c288dbf2a313ad75b7ea2ca962ada987def
@@ -16,6 +16,7 @@ analyzer:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "HEAD"
java_version: "<REPLACE_JAVA>"
os: "<REPLACE_OS>"
variables: {}
tool_versions: {}
@@ -47,6 +47,7 @@ analyzer:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "HEAD"
java_version: "<REPLACE_JAVA>"
os: "<REPLACE_OS>"
variables: {}
tool_versions: {}
@@ -16,6 +16,7 @@ analyzer:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "HEAD"
java_version: "<REPLACE_JAVA>"
os: "<REPLACE_OS>"
variables: {}
tool_versions: {}
@@ -40,6 +40,7 @@ analyzer:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "HEAD"
java_version: "<REPLACE_JAVA>"
os: "<REPLACE_OS>"
variables: {}
tool_versions: {}
@@ -40,6 +40,7 @@ analyzer:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "HEAD"
java_version: "<REPLACE_JAVA>"
os: "<REPLACE_OS>"
variables: {}
tool_versions: {}
@@ -124,7 +124,7 @@ object Main : CommandWithHelp() {
"""
________ _____________________
\_____ \\______ \__ ___/ the OSS Review Toolkit, version ${env.ortVersion}.
/ | \| _/ | | Running$command on ${env.os} $with
/ | \| _/ | | Running$command on Java ${env.javaVersion} and ${env.os} $with
/ | \ | \ | | ${variables.getOrElse(variableIndex++) { "" }}
\_______ /____|_ / |____| ${variables.getOrElse(variableIndex++) { "" }}
\/ \/
@@ -30,6 +30,11 @@ data class Environment(
*/
val ortVersion: String = ORT_VERSION,

/**
* The version of Java used.
*/
val javaVersion: String = System.getProperty("java.version"),

/**
* Name of the operating system, defaults to [OS.name].
*/
@@ -21,6 +21,7 @@ analyzer:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "6fd0fde"
java_version: "1.8.0_181"
os: "Linux"
variables: {}
tool_versions: {}
@@ -320,6 +321,7 @@ scanner:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "6fd0fde"
java_version: "1.8.0_181"
os: "Linux"
variables: {}
tool_versions: {}
@@ -16,6 +16,7 @@ analyzer:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "6fd0fde"
java_version: "1.8.0_181"
os: "Linux"
variables: {}
tool_versions: {}
@@ -315,6 +316,7 @@ scanner:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "6fd0fde"
java_version: "1.8.0_181"
os: "Linux"
variables: {}
tool_versions: {}
@@ -30,6 +30,7 @@ analyzer:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "72463cc"
java_version: "1.8.0_181"
os: "Linux"
variables: {}
tool_versions: {}
@@ -194,6 +195,7 @@ scanner:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "72463cc"
java_version: "1.8.0_181"
os: "Linux"
variables: {}
tool_versions: {}
@@ -16,6 +16,7 @@ analyzer:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "9c6ed1c"
java_version: "1.8.0_181"
os: "Linux"
variables: {}
tool_versions: {}
@@ -16,6 +16,7 @@ analyzer:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "HEAD"
java_version: "<REPLACE_JAVA>"
os: "Linux"
variables: {}
tool_versions: {}
@@ -179,6 +180,7 @@ scanner:
end_time: "1970-01-01T00:00:00Z"
environment:
ort_version: "HEAD"
java_version: "<REPLACE_JAVA>"
os: "<REPLACE_OS>"
variables: {}
tool_versions: {}
@@ -31,6 +31,7 @@ val DEFAULT_REPOSITORY_CONFIGURATION = RepositoryConfiguration()
val USER_DIR = File(System.getProperty("user.dir"))

private val ORT_VERSION_REGEX = Regex("(ort_version): \".*\"")
private val JAVA_VERSION_REGEX = Regex("(java_version): \".*\"")
private val ENV_VAR_REGEX = Regex(
"(variables):.*?^(\\s{4}\\w+):",
setOf(RegexOption.DOT_MATCHES_ALL, RegexOption.MULTILINE)
@@ -52,6 +53,7 @@ fun patchExpectedResult(

return result.readText()
.replaceIfNotNull(custom)
.replaceIfNotNull("<REPLACE_JAVA>", System.getProperty("java.version"))
.replaceIfNotNull("<REPLACE_OS>", System.getProperty("os.name"))
.replaceIfNotNull("<REPLACE_DEFINITION_FILE_PATH>", definitionFilePath)
.replaceIfNotNull("<REPLACE_URL>", url)
@@ -67,6 +69,7 @@ fun patchActualResult(result: String, patchDownloadTime: Boolean = false, patchS

return result
.replace(ORT_VERSION_REGEX) { "${it.groupValues[1]}: \"HEAD\"" }
.replace(JAVA_VERSION_REGEX) { "${it.groupValues[1]}: \"${System.getProperty("java.version")}\"" }
.replace(ENV_VAR_REGEX) { "${it.groupValues[1]}: {}\n${it.groupValues[2]}:" }
.replace(TIMESTAMP_REGEX) { "${it.groupValues[1]}: \"${Instant.EPOCH}\"" }
.replaceIf(patchDownloadTime, DOWNLOAD_TIME_REGEX) { "${it.groupValues[1]}: \"${Instant.EPOCH}\"" }

0 comments on commit a2fd7c2

Please sign in to comment.
You can’t perform that action at this time.