From e8ea9a29325af9f421560eefb97dc540a0fac420 Mon Sep 17 00:00:00 2001 From: Dan Hawkins Date: Tue, 9 Nov 2021 12:07:09 +0000 Subject: [PATCH] Perform a deep copy of version objects --- meta/folder.groovy | 16 ++++++++++++++++ versionnumbering/generate.groovy | 8 ++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/meta/folder.groovy b/meta/folder.groovy index 3c9f98f..aee84f6 100644 --- a/meta/folder.groovy +++ b/meta/folder.groovy @@ -108,6 +108,15 @@ class GitInfo extends GISJsonSerialised { this.remoteinfo = remoteinfo } + GitInfo(GitInfo another) { + super(another.script) + this.sourcepath = another.sourcepath + this.sourcerevision = another.sourcerevision + this.gitrevision = another.gitrevision + this.remoteurl = another.remoteurl + this.remoteinfo = another.remoteinfo + } + void set(String sourcepath, String sourcerevision, String gitrevision, String remoteurl, String remoteinfo) { this.sourcepath = sourcepath this.sourcerevision = sourcerevision @@ -267,6 +276,13 @@ class BuildStampInfo extends GISJsonSerialised { this.buildstamp = buildstamp } + BuildStampInfo(BuildStampInfo another) { + super(another.script) + this.buildstampprefix = another.buildstampprefix + this.revision = another.revision + this.buildstamp = another.buildstamp + } + void set(String buildstampprefix, int revision, String buildstamp) { this.buildstampprefix = buildstampprefix this.revision = revision diff --git a/versionnumbering/generate.groovy b/versionnumbering/generate.groovy index 405b7be..a1ab40f 100644 --- a/versionnumbering/generate.groovy +++ b/versionnumbering/generate.groovy @@ -160,8 +160,12 @@ String generate(meta, String sourcerevision, String sourcepath, String basebuild } String copyfrom(meta, othermeta) { - meta.gitinfo = othermeta.gitinfo - meta.buildstampinfo = othermeta.buildstampinfo + // Deep copy + def newgitinfo = othermeta.gitinfo.getClass().newInstance(othermeta.gitinfo) + def newbuildstampinfo = othermeta.buildstampinfo.getClass().newInstance(othermeta.buildstampinfo) + + meta.gitinfo = newgitinfo + meta.buildstampinfo = newbuildstampinfo return meta.buildstampinfo.buildstamp }