Add a new meta walker and test it

This commit is contained in:
Dan Hawkins 2021-11-06 11:49:23 +00:00
commit 04067e214d
2 changed files with 7 additions and 6 deletions

View file

@ -7,8 +7,8 @@ def check(buildmeta) {
// Walk the meta looking for different versions of the same components
def allmeta = buildmeta.allrelatedmeta()
echo "All meta:"
for (meta in allmeta) {
echo "All meta:\n${allmeta.comment}"
for (meta in allmeta.metacollection) {
echo meta.componentversionuniqueidentifier()
}
return results

View file

@ -847,16 +847,17 @@ class MetaInfo extends GISJsonSerialised {
return releasemetaversionuniquecollection
}
ArrayList<MetaInfo> walkrelated(ArrayList<MetaInfo> metacollection) {
def walkrelated(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0) {
metacollection.add(this)
comment += ''.padright(level) + componentversionuniqueidentifier() + '\n'
for (relatedmetainfo in associatedmeta) {
MetaInfo othermeta = relatedmetainfo.meta
metacollection = othermeta.walkrelated(metacollection)
results = othermeta.walkrelated(metacollection, comment, level + 1)
}
return metacollection
return [ 'metacollection' : results.metacollection, 'comment': results.comment]
}
ArrayList<MetaInfo> allrelatedmeta() {
def allrelatedmeta() {
ArrayList<MetaInfo> metacollection = new ArrayList<MetaInfo>()
return walkrelated(metacollection)
}