Set build hash to Unknown when unavailable

This commit changes the build hash to be the string "Unknown" when for
some reason this build hash is not available. This aligns the value with
the value we use when the hash is not available from the jar
manifest. This situation can occur when running tests from a worktree
which is not currently handled correctly by JGit, the upstream
dependency that is used to acquire the hash. This causes problems when
running tests locally because the warning header pattern expects a hash
or the string "Unknown". While the warning header pattern be changed to
allow "N/A" as well, it seemed more sensible to align the value here
with the value when the hash is not available from the jar manifest.

Relates #23421
This commit is contained in:
Jason Tedor 2017-03-01 07:57:14 -05:00 committed by GitHub
parent 8d31a2fa06
commit 640ab1ceab
1 changed files with 1 additions and 1 deletions

View File

@ -464,7 +464,7 @@ class BuildPlugin implements Plugin<Project> {
'Build-Java-Version': project.javaVersion)
if (jarTask.manifest.attributes.containsKey('Change') == false) {
logger.warn('Building without git revision id.')
jarTask.manifest.attributes('Change': 'N/A')
jarTask.manifest.attributes('Change': 'Unknown')
}
}
}