716 lines
23 KiB
Groovy
716 lines
23 KiB
Groovy
import java.nio.file.Paths
|
|
import java.nio.file.Path
|
|
|
|
abstract class GISJsonSerialised implements Serializable {
|
|
def script
|
|
|
|
GISJsonSerialised(script) {
|
|
this.script = script
|
|
}
|
|
|
|
abstract LinkedHashMap serialisationdata()
|
|
|
|
abstract void deserialiseJson(rawmeta)
|
|
|
|
def saveJsonSerialised(String outputfile, int prettylevel = 4) {
|
|
def outJson = script.readJSON text: groovy.json.JsonOutput.toJson(serialisationdata())
|
|
script.writeJSON(file: outputfile, json: outJson, pretty: prettylevel)
|
|
}
|
|
}
|
|
|
|
class ProductInfo extends GISJsonSerialised {
|
|
String productname
|
|
String subcomponentname
|
|
String jirakey
|
|
|
|
ProductInfo(script, productname = "", subcomponentname = "", jirakey = "") {
|
|
super(script)
|
|
this.productname = productname
|
|
this.subcomponentname = subcomponentname
|
|
this.jirakey = jirakey
|
|
}
|
|
|
|
void set(String productname, String subcomponentname, String jirakey) {
|
|
// Make sure the fields can be used in git tags
|
|
def int pstatus = 0
|
|
if (script.isUnix()) {
|
|
pstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${productname}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
|
}
|
|
else {
|
|
pstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${productname}\" > NUL 2> NUL", , returnStatus: true)
|
|
}
|
|
if (pstatus > 0) {
|
|
script.error("The product name: ${productname} needs to be renamed as it cannot be used in a git tag name")
|
|
}
|
|
def int sstatus = 0
|
|
if (script.isUnix()) {
|
|
sstatus = script.sh(script: "git check-ref-format --normalize \"refs/tags/${subcomponentname}\" >/dev/null 2>/dev/null", , returnStatus: true)
|
|
}
|
|
else {
|
|
sstatus = script.bat(script: "@git check-ref-format --normalize \"refs/tags/${subcomponentname}\" > NUL 2> NUL", , returnStatus: true)
|
|
}
|
|
if (sstatus > 0) {
|
|
script.error("The subcomponent name: ${subcomponentname} needs to be renamed as it cannot be used in a git tag name")
|
|
}
|
|
this.productname = productname
|
|
this.subcomponentname = subcomponentname
|
|
this.jirakey = jirakey
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
productname = rawmeta['productname']
|
|
subcomponentname = rawmeta['subcomponentname']
|
|
jirakey = rawmeta['jirakey']
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'productname' : productname,
|
|
'subcomponentname' : subcomponentname,
|
|
'jirakey' : jirakey,
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
class GitInfo extends GISJsonSerialised {
|
|
private String sourcepath
|
|
private String sourcerevision
|
|
private String gitrevision
|
|
private String remoteurl
|
|
private String remoteinfo
|
|
|
|
GitInfo(script, sourcepath = "", sourcerevision = "", gitrevision = "", remoteurl = "", remoteinfo = "") {
|
|
super(script)
|
|
this.sourcepath = sourcepath
|
|
this.sourcerevision = sourcerevision
|
|
this.gitrevision = gitrevision
|
|
this.remoteurl = remoteurl
|
|
this.remoteinfo = remoteinfo
|
|
}
|
|
|
|
void set(String sourcepath, String sourcerevision, String gitrevision, String remoteurl, String remoteinfo) {
|
|
this.sourcepath = sourcepath
|
|
this.sourcerevision = sourcerevision
|
|
this.gitrevision = gitrevision
|
|
this.remoteurl = remoteurl
|
|
this.remoteinfo = remoteinfo
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
sourcepath = rawmeta['sourcepath']
|
|
sourcerevision = rawmeta['sourcerevision']
|
|
gitrevision = rawmeta['gitrevision']
|
|
remoteurl = rawmeta['remoteurl']
|
|
remoteinfo = rawmeta['remoteinfo']
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'sourcepath' : sourcepath,
|
|
'sourcerevision' : sourcerevision,
|
|
'gitrevision' : gitrevision,
|
|
'remoteurl' : remoteurl,
|
|
'remoteinfo' : remoteinfo,
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
class JenkinsBuildInfo extends GISJsonSerialised {
|
|
private String buildjobname
|
|
private int buildnumber
|
|
private String buildmachine
|
|
private String builddate
|
|
|
|
JenkinsBuildInfo(script, String buildjobname = "", int buildnumber = 0, String buildmachine = "", String builddate = "") {
|
|
super(script)
|
|
this.buildjobname = buildjobname
|
|
this.buildnumber = buildnumber
|
|
this.buildmachine = buildmachine
|
|
this.builddate = builddate
|
|
}
|
|
|
|
void set(String buildjobname, int buildnumber, String buildmachine, String builddate) {
|
|
this.buildjobname = buildjobname
|
|
this.buildnumber = buildnumber
|
|
this.buildmachine = buildmachine
|
|
this.builddate = builddate
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
buildjobname = rawmeta['buildjobname']
|
|
buildnumber = rawmeta['buildnumber']
|
|
buildmachine = rawmeta['buildmachine']
|
|
builddate = rawmeta['builddate']
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'buildjobname' : buildjobname,
|
|
'buildnumber' : buildnumber,
|
|
'buildmachine' : buildmachine,
|
|
'builddate' : builddate,
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
class BuildStampInfo extends GISJsonSerialised {
|
|
private String buildstampprefix
|
|
int revision
|
|
String buildstamp
|
|
|
|
BuildStampInfo(script, buildstampprefix = "1.30000.0.", revision = 0, buildstamp = "1.30000.0.0") {
|
|
super(script)
|
|
this.buildstampprefix = buildstampprefix
|
|
this.revision = revision
|
|
this.buildstamp = buildstamp
|
|
}
|
|
|
|
void set(String buildstampprefix, int revision, String buildstamp) {
|
|
this.buildstampprefix = buildstampprefix
|
|
this.revision = revision
|
|
this.buildstamp = buildstamp
|
|
}
|
|
|
|
String buildstampcommasep() {
|
|
def String buildstampcommasep = buildstamp.replace(".", ",")
|
|
return buildstampcommasep
|
|
}
|
|
|
|
void changerevision(int newrevision) {
|
|
script.echo("Build stamp currently ${buildstamp}")
|
|
revision = newrevision
|
|
def List buildstampsplit = buildstamp.split('\\.')
|
|
buildstampsplit[-1] = newrevision.toString()
|
|
buildstamp = buildstampsplit.join('.')
|
|
script.echo("Build stamp now ${buildstamp}")
|
|
}
|
|
|
|
void set(String buildstampprefix, int revision) {
|
|
buildstampprefix += buildstampprefix.endsWith('.') ? '' : '.'
|
|
this.buildstampprefix = buildstampprefix
|
|
this.buildstamp = buildstampprefix + "0"
|
|
changerevision(revision)
|
|
}
|
|
|
|
void set(String buildstampprefix, String revision) {
|
|
set(buildstampprefix, revision.toInteger())
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
buildstampprefix = rawmeta['buildstampprefix']
|
|
revision = rawmeta['revision']
|
|
buildstamp = rawmeta['buildstamp']
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'buildstampprefix' : buildstampprefix,
|
|
'revision' : revision,
|
|
'buildstamp' : buildstamp,
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
class ReleaseInfo extends GISJsonSerialised {
|
|
String releaserepoURL
|
|
ArrayList<String> releaseitems
|
|
|
|
ReleaseInfo(script, releaserepoURL = "") {
|
|
super(script)
|
|
this.releaserepoURL = releaserepoURL
|
|
this.releaseitems = new ArrayList<String>()
|
|
}
|
|
|
|
void set(String releaserepoURL = "") {
|
|
this.releaserepoURL = releaserepoURL
|
|
}
|
|
|
|
void addReleaseItem(String releaseitem) {
|
|
releaseitems.add(releaseitem)
|
|
}
|
|
|
|
List releaseitemssserialised() {
|
|
def items = []
|
|
for (ri in releaseitems) {
|
|
items.add(ri)
|
|
}
|
|
return items
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
releaserepoURL = rawmeta['releaserepoURL']
|
|
releaseitems = new ArrayList<String>()
|
|
for (rawreleaseitem in rawmeta['releaseitems']) {
|
|
releaseitems.add(rawreleaseitem)
|
|
}
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'releaserepoURL' : releaserepoURL,
|
|
'releaseitems' : releaseitemssserialised(),
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
class ConfigurationInfo extends GISJsonSerialised {
|
|
private String configurationname
|
|
private String configurationURL
|
|
private String configurationversion
|
|
private String configurationSHA
|
|
|
|
ConfigurationInfo(script, configurationname = "", configurationURL = "", configurationversion = "", configurationSHA = "") {
|
|
super(script)
|
|
this.configurationname = configurationname
|
|
this.configurationURL = configurationURL
|
|
this.configurationversion = configurationversion
|
|
this.configurationSHA = configurationSHA
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
configurationname = rawmeta['configurationname']
|
|
configurationURL = rawmeta['configurationURL']
|
|
configurationversion = rawmeta['configurationversion']
|
|
configurationSHA = rawmeta['configurationSHA']
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'configurationname' : configurationname,
|
|
'configurationURL' : configurationURL,
|
|
'configurationversion' : configurationversion,
|
|
'configurationSHA' : configurationSHA,
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
class ChecksumPair extends GISJsonSerialised {
|
|
private String filepath
|
|
private String sum
|
|
|
|
ChecksumPair(script, String filepath = "", String sum = "") {
|
|
super(script)
|
|
this.filepath = filepath
|
|
this.sum = sum
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
filepath = rawmeta['filepath']
|
|
sum = rawmeta['sum']
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'filepath' : filepath,
|
|
'sum' : sum,
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
class ChecksumSet extends GISJsonSerialised {
|
|
private String artifactpath
|
|
private ArrayList<ChecksumPair> checksumpairs
|
|
|
|
ChecksumSet(script, artifactpath = "") {
|
|
super(script)
|
|
this.artifactpath = artifactpath
|
|
checksumpairs = new ArrayList<ChecksumPair>()
|
|
}
|
|
|
|
ChecksumPair addChecksumPair(String filepath, String sum) {
|
|
def cp = new ChecksumPair(script, filepath, sum)
|
|
checksumpairs.add(cp)
|
|
return cp
|
|
}
|
|
|
|
List checksumpairsserialised() {
|
|
def associated = []
|
|
for (cp in checksumpairs) {
|
|
associated.add(cp.serialisationdata())
|
|
}
|
|
return associated
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
artifactpath = rawmeta['artifactpath']
|
|
checksumpairs = new ArrayList<ChecksumPair>()
|
|
for (rawchecksumpair in rawmeta['checksumpairs']) {
|
|
def csp = new ChecksumPair(script)
|
|
csp.deserialiseJson(rawchecksumpair)
|
|
checksumpairs.add(csp)
|
|
}
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'artifactpath' : artifactpath,
|
|
'checksumpairs' : checksumpairsserialised(),
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
class ChecksumInfo extends GISJsonSerialised {
|
|
private ArrayList<ChecksumSet> checksumsets
|
|
|
|
ChecksumInfo(script) {
|
|
super(script)
|
|
checksumsets = new ArrayList<ChecksumSet>()
|
|
}
|
|
|
|
ChecksumSet addChecksumSet(String artifactpath) {
|
|
def cs = new ChecksumSet(script, artifactpath)
|
|
checksumsets.add(cs)
|
|
return cs
|
|
}
|
|
|
|
List checksumsetsserialised() {
|
|
def associated = []
|
|
for (cs in checksumsets) {
|
|
associated.add(cs.serialisationdata())
|
|
}
|
|
return associated
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
checksumsets = new ArrayList<ChecksumSet>()
|
|
for (rawchecksumset in rawmeta['checksumsets']) {
|
|
def cs = new ChecksumSet(script)
|
|
cs.deserialiseJson(rawchecksumset)
|
|
checksumsets.add(cs)
|
|
}
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'checksumsets' : checksumsetsserialised(),
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
class PublishableInfo extends GISJsonSerialised {
|
|
private String filepath
|
|
|
|
PublishableInfo(script, String filepath = "") {
|
|
super(script)
|
|
this.filepath = filepath
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
filepath = rawmeta['filepath']
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'filepath' : filepath,
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
class MetaInfo extends GISJsonSerialised {
|
|
private static String FORMAT = "0.1"
|
|
private static String METAFOLDERNAME = "meta"
|
|
private static String METAFILENAME = "info.json"
|
|
private static String METADIFFFILENAME = "differences.txt"
|
|
private static String METAARTIFACTS = "${METAFOLDERNAME}/**"
|
|
|
|
class RelatedMetaInfo extends GISJsonSerialised {
|
|
String offsetpath
|
|
MetaInfo meta
|
|
|
|
RelatedMetaInfo(script, offsetpath = "", MetaInfo meta = null) {
|
|
super(script)
|
|
this.offsetpath = offsetpath
|
|
this.meta = meta
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
offsetpath = rawmeta['offsetpath']
|
|
meta = new MetaInfo(script)
|
|
meta.deserialiseJson(rawmeta['meta'])
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'offsetpath' : offsetpath,
|
|
'meta' : meta.serialisationdata(),
|
|
]
|
|
return data
|
|
}
|
|
}
|
|
|
|
private String format = FORMAT
|
|
ProductInfo productinfo
|
|
GitInfo gitinfo
|
|
JenkinsBuildInfo jenkinsbuildinfo
|
|
BuildStampInfo buildstampinfo
|
|
ReleaseInfo releaseinfo
|
|
ChecksumInfo checksuminfo
|
|
private ArrayList<ConfigurationInfo> configurationinfo
|
|
private ArrayList<PublishableInfo> publishableinfo
|
|
private LinkedHashMap<String, String> custominfo
|
|
private ArrayList<RelatedMetaInfo> associatedmeta
|
|
|
|
MetaInfo(script) {
|
|
super(script)
|
|
productinfo = new ProductInfo(script)
|
|
gitinfo = new GitInfo(script)
|
|
jenkinsbuildinfo = new JenkinsBuildInfo(script)
|
|
buildstampinfo = new BuildStampInfo(script)
|
|
releaseinfo = new ReleaseInfo(script)
|
|
checksuminfo = new ChecksumInfo(script)
|
|
configurationinfo = new ArrayList<ConfigurationInfo>()
|
|
publishableinfo = new ArrayList<PublishableInfo>()
|
|
custominfo = new LinkedHashMap<String, String>()
|
|
associatedmeta = new ArrayList<RelatedMetaInfo>()
|
|
}
|
|
|
|
List configurationinfoserialised() {
|
|
def configuration = []
|
|
for (configurationitem in configurationinfo) {
|
|
configuration.add(configurationitem.serialisationdata())
|
|
}
|
|
return configuration
|
|
}
|
|
|
|
void addPublishable(String filepath) {
|
|
def PublishableInfo pi = new PublishableInfo(script, filepath)
|
|
publishableinfo.add(pi)
|
|
}
|
|
|
|
void addConfigurationInfo(String configurationname, String configurationURL, String configurationversion, String configurationSHA) {
|
|
def ConfigurationInfo ci = new ConfigurationInfo(script, configurationname, configurationURL, configurationversion, configurationSHA)
|
|
configurationinfo.add(ci)
|
|
}
|
|
|
|
void addCustomInfo(String customId, String customValue) {
|
|
custominfo.put(customId.trim(), customValue)
|
|
}
|
|
|
|
String getCustomInfo(String customId) {
|
|
return custominfo.getAt(customId.trim())
|
|
}
|
|
|
|
List publishableinfoserialised() {
|
|
def publishable = []
|
|
for (publishableitem in publishableinfo) {
|
|
publishable.add(publishableitem.serialisationdata())
|
|
}
|
|
return publishable
|
|
}
|
|
|
|
List associatedmetaserialised() {
|
|
def associated = []
|
|
for (metaitem in associatedmeta) {
|
|
associated.add(metaitem.serialisationdata())
|
|
}
|
|
return associated
|
|
}
|
|
|
|
void deserialiseJson(rawmeta) {
|
|
if (rawmeta['format'] != FORMAT) {
|
|
script.error("Unsupported meta format found at ${filepath}")
|
|
return
|
|
}
|
|
productinfo.deserialiseJson(rawmeta['productinfo'])
|
|
gitinfo.deserialiseJson(rawmeta['gitinfo'])
|
|
jenkinsbuildinfo.deserialiseJson(rawmeta['jenkinsbuildinfo'])
|
|
buildstampinfo.deserialiseJson(rawmeta['buildstampinfo'])
|
|
releaseinfo.deserialiseJson(rawmeta['releaseinfo'])
|
|
checksuminfo.deserialiseJson(rawmeta['checksuminfo'])
|
|
for (rawconfig in rawmeta['configuration']) {
|
|
def cf = new ConfigurationInfo(script)
|
|
cf.deserialiseJson(rawconfig)
|
|
configurationinfo.add(cf)
|
|
}
|
|
for (rawpublishable in rawmeta['publishableinfo']) {
|
|
def pb = new PublishableInfo(script)
|
|
pb.deserialiseJson(rawpublishable)
|
|
publishableinfo.add(pb)
|
|
}
|
|
custominfo = rawmeta['custominfo']
|
|
for (rawrelatedmeta in rawmeta['associatedmeta']) {
|
|
def rm = new RelatedMetaInfo(script)
|
|
rm.deserialiseJson(rawrelatedmeta)
|
|
associatedmeta.add(rm)
|
|
}
|
|
}
|
|
|
|
def deserialiseJson(String filepath) {
|
|
def rawmeta = script.readJSON(file: filepath)
|
|
deserialiseJson(rawmeta)
|
|
}
|
|
|
|
String relativize(String path) {
|
|
def Path thispath = Paths.get(path)
|
|
if (thispath.startsWith(script.WORKSPACE)) {
|
|
def Path wspath = Paths.get(script.WORKSPACE)
|
|
def Path wsrelativePath = wspath.relativize(thispath)
|
|
return wsrelativePath.toString()
|
|
}
|
|
return path
|
|
}
|
|
|
|
static String metafilepath() {
|
|
return METAFOLDERNAME + "/" + METAFILENAME
|
|
}
|
|
|
|
static String difffilepath() {
|
|
return METAFOLDERNAME + "/" + METADIFFFILENAME
|
|
}
|
|
|
|
MetaInfo importrelated(String destpath) {
|
|
MetaInfo mi = new MetaInfo(script)
|
|
|
|
def String adjustedpath = relativize(destpath)
|
|
def importedmetafile = adjustedpath + "/" + metafilepath()
|
|
if (script.fileExists(importedmetafile)) {
|
|
mi.deserialiseJson(importedmetafile)
|
|
}
|
|
|
|
RelatedMetaInfo rmi = new RelatedMetaInfo(script, adjustedpath, mi)
|
|
associatedmeta.add(rmi)
|
|
|
|
def importedmetadifffile = adjustedpath + "/" + difffilepath()
|
|
if (script.fileExists(importedmetadifffile)) {
|
|
def String newcontents = script.readFile(file: importedmetadifffile)
|
|
def String currentcontents = ""
|
|
if (script.fileExists(difffilepath())) {
|
|
currentcontents = script.readFile(file: difffilepath())
|
|
}
|
|
|
|
script.writeFile(file: difffilepath(), text: currentcontents + "\n" + mi.productinfo.productname + " " + mi.productinfo.subcomponentname + ":\n" + newcontents)
|
|
}
|
|
|
|
return mi
|
|
}
|
|
|
|
LinkedHashMap serialisationdata() {
|
|
def data = [
|
|
'format' : format,
|
|
'productinfo' : productinfo.serialisationdata(),
|
|
'gitinfo' : gitinfo.serialisationdata(),
|
|
'jenkinsbuildinfo' : jenkinsbuildinfo.serialisationdata(),
|
|
'buildstampinfo' : buildstampinfo.serialisationdata(),
|
|
'releaseinfo' : releaseinfo.serialisationdata(),
|
|
'configuration' : configurationinfoserialised(),
|
|
'checksuminfo' : checksuminfo.serialisationdata(),
|
|
'publishableinfo' : publishableinfoserialised(),
|
|
'custominfo' : custominfo,
|
|
'associatedmeta' : associatedmetaserialised(),
|
|
]
|
|
return data
|
|
}
|
|
|
|
|
|
static String folder() {
|
|
return METAFOLDERNAME
|
|
}
|
|
|
|
String generateartifacts(ArrayList<String> releasedfromhere = new ArrayList<String>(), // These items are recorded in meta as released from here
|
|
ArrayList<String> releasedfromsubmeta = new ArrayList<String>(), // These items are not recorded in meta as released from here
|
|
String metafilepath ="${METAFOLDERNAME}/${METAFILENAME}"
|
|
) {
|
|
def String artifactlist = METAARTIFACTS
|
|
releaseinfo.addReleaseItem(METAARTIFACTS)
|
|
for (releaseitem in releasedfromhere) {
|
|
artifactlist += "," + releaseitem
|
|
releaseinfo.addReleaseItem(releaseitem)
|
|
}
|
|
for (releaseitem in releasedfromsubmeta) {
|
|
artifactlist += "," + releaseitem
|
|
}
|
|
saveJsonSerialised(metafilepath)
|
|
return artifactlist
|
|
}
|
|
|
|
// Recurse tree of meta looking for release info and accumulate path - Pass by reference unavailable in Groovy/Java
|
|
private ArrayList<RelatedMetaInfo> releasewalkerp(int maxdepth, ArrayList<RelatedMetaInfo> releasemetacollection, String pathsofar) {
|
|
if (maxdepth > 0) {
|
|
if (releaseinfo.releaserepoURL) {
|
|
RelatedMetaInfo rmi = new RelatedMetaInfo(script, pathsofar, this)
|
|
releasemetacollection.add(rmi)
|
|
}
|
|
if (pathsofar) {
|
|
pathsofar += "/"
|
|
}
|
|
for (relatedmetainfo in associatedmeta) {
|
|
MetaInfo othermeta = relatedmetainfo.meta
|
|
String newpathsofar = pathsofar + relatedmetainfo.offsetpath
|
|
releasemetacollection = othermeta.releasewalkerp(maxdepth - 1, releasemetacollection, newpathsofar)
|
|
}
|
|
}
|
|
return releasemetacollection
|
|
}
|
|
|
|
ArrayList<RelatedMetaInfo> releasewalker(int maxdepth, String startpath = "") {
|
|
ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
|
|
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
|
|
return releasemetacollection
|
|
}
|
|
|
|
String componentidentifier() {
|
|
return productinfo.productname + "_" + productinfo.subcomponentname
|
|
}
|
|
|
|
String componentversionuniqueidentifier() {
|
|
return productinfo.productname + "_" + productinfo.subcomponentname + "_" + buildstampinfo.buildstamp
|
|
}
|
|
|
|
Map<String, RelatedMetaInfo> releasewalkerunique(int maxdepth, String startpath = "") {
|
|
def ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
|
|
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
|
|
|
|
def Map<String, RelatedMetaInfo> releasemetauniquecollection = new LinkedHashMap<String, RelatedMetaInfo>()
|
|
for (relatedmetainfo in releasemetacollection) {
|
|
def String uniquestring = relatedmetainfo.meta.componentidentifier()
|
|
releasemetauniquecollection.put(uniquestring, relatedmetainfo)
|
|
}
|
|
|
|
return releasemetauniquecollection
|
|
}
|
|
|
|
Map<String, RelatedMetaInfo> releasewalkerversionunique(int maxdepth, String startpath = "") {
|
|
ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
|
|
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
|
|
|
|
def Map<String, RelatedMetaInfo> releasemetaversionuniquecollection = new LinkedHashMap<String, RelatedMetaInfo>()
|
|
for (relatedmetainfo in releasemetacollection) {
|
|
def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier()
|
|
releasemetaversionuniquecollection.put(uniquestring, relatedmetainfo)
|
|
}
|
|
|
|
return releasemetaversionuniquecollection
|
|
}
|
|
|
|
MetaInfo getNewMetaObject(script) {
|
|
return new MetaInfo(script)
|
|
}
|
|
}
|
|
|
|
MetaInfo metareset(script) {
|
|
echo "Resetting meta folder"
|
|
def mi = new MetaInfo(script)
|
|
|
|
dir(mi.folder()) {
|
|
deleteDir()
|
|
}
|
|
return mi
|
|
}
|
|
|
|
MetaInfo metafromfolder(String folder = "") {
|
|
MetaInfo buildmeta = new MetaInfo(this)
|
|
buildmeta.deserialiseJson("${folder}/${MetaInfo.metafilepath()}")
|
|
return buildmeta
|
|
}
|
|
|
|
return this;
|