I'm trying to get a list of all steps used in a configuration tree in a quickbuild script but I'm struggling to find the right APIs to do this.
What I'm trying to do to get the steps in a config:
Set<String> sortedStepNames = new TreeSet<String>();
myConfig = Quickbuild.getInstance().getConfiguration('path/to/config');
masterStep = myConfig .findStep(com.pmease.quickbuild.stepsupport.Step.MASTER_NAME);
compositeStep = masterStep as CompositeStep;
addChildrenToList(compositeStep, sortedStepNames);
def addChildrenToList(compositeStep, sortedStepNames)
{
children = compositeStep.getChildren();
for (Step s : children)
{
synchronized(this)
{
stepNames.add(s.getName());
}
if (s instanceof CompositeStep)
{
addChildrenToList(s, stepNames);
}
}
}
But this is always failing with Exception: The step is not associated with any build.
What's the proper way to find all steps defined and used in a configuration tree. This will also help immensely if I can then delete all unused steps, as it could save me a great deal of time on the diffs.
Thanks in advance,
Tom Z.