mirror of
https://github.com/SAP/jenkins-library.git
synced 2026-06-19 22:58:55 +02:00
Merge pull request #479 from marcusholl/pr/seeAnnotationInDocu
implement @see strategy
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user