Merge pull request #479 from marcusholl/pr/seeAnnotationInDocu

implement @see strategy
This commit is contained in:
Marcus Holl
2019-02-06 10:50:03 +01:00
committed by GitHub
+33
View File
@@ -418,6 +418,19 @@ for (step in steps) {
}
}
// replace @see tag in docu by docu from referenced step.
for(step in stepDescriptors) {
if(step.value.parameters) {
for(param in step.value.parameters) {
if( param?.value?.docu?.contains('@see')) {
def otherStep = param.value.docu.replaceAll('@see', '').trim()
param.value.docu = fetchTextFrom(otherStep, param.key, stepDescriptors)
param.value.mandatory = fetchMandatoryFrom(otherStep, param.key, stepDescriptors)
}
}
}
}
for(step in stepDescriptors) {
try {
renderStep(step.key, step.value)
@@ -461,6 +474,26 @@ void renderStep(stepName, stepProperties) {
theStepDocu.withWriter { w -> w.write text }
}
def fetchTextFrom(def step, def parameterName, def steps) {
try {
def docuFromOtherStep = steps[step]?.parameters[parameterName]?.docu
if(! docuFromOtherStep) throw new IllegalStateException("No docu found for parameter '${parameterName}' in step ${step}.")
return docuFromOtherStep
} catch(e) {
System.err << "[ERROR] Cannot retrieve docu for parameter ${parameterName} from step ${step}.\n"
throw e
}
}
def fetchMandatoryFrom(def step, def parameterName, def steps) {
try {
return steps[step]?.parameters[parameterName]?.mandatory
} catch(e) {
System.err << "[ERROR] Cannot retrieve docu for parameter ${parameterName} from step ${step}.\n"
throw e
}
}
def handleStep(stepName, prepareDefaultValuesStep, gse) {
File theStep = new File(stepsDir, "${stepName}.groovy")