More defaults

This commit is contained in:
Jim Nicholson 2024-02-01 01:40:36 -08:00
parent c716586e0d
commit b10fe3a4eb

View File

@ -4,16 +4,18 @@ import groovy.transform.Field
@Field
Map defaults = [
buildTest: 'Makefile',
buildCmd: 'make all'
]
def call(Map config = [:]) {
assert config.artifacts : 'must specify artifacts!'
config = defaults + config
if ( fileExists(config.buildCmd)) {
sh 'make'
String runConfig = defaults + config
if ( fileExists(runConfig.buildTest)) {
sh """
${runConfig.buildCmd}
"""
} else {
echo "Skipping buildStep since ${runConfig.buildTest} does not exist in workspace."
}
}