Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit 6b7e268

Browse files
author
Nikhil Bhoski
committed
Supporting backward compatibillity
1 parent b8a1c1a commit 6b7e268

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

src/main/java/com/mathworks/ci/RunMatlabTestsBuilder.java

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ public class RunMatlabTestsBuilder extends Builder implements SimpleBuildStep, M
3939

4040
private int buildResult;
4141
private EnvVars env;
42+
43+
// Make all old values transient which protects them writing back on disk.
44+
private transient boolean tapChkBx;
45+
private transient boolean junitChkBx;
46+
private transient boolean coberturaChkBx;
47+
private transient boolean stmResultsChkBx;
48+
private transient boolean modelCoverageChkBx;
49+
private transient boolean pdfReportChkBx;
50+
4251
private Artifact tapArtifact = new NullArtifact();
4352
private Artifact junitArtifact = new NullArtifact();
4453
private Artifact coberturaArtifact = new NullArtifact();
@@ -140,7 +149,42 @@ private void setEnv(EnvVars env) {
140149
private EnvVars getEnv() {
141150
return this.env;
142151
}
143-
152+
153+
// To retain Backward compatibility
154+
protected Object readResolve() {
155+
// Assign default values to new elements.
156+
this.pdfReportArtifact = new NullArtifact();
157+
this.tapArtifact = new NullArtifact();
158+
this.junitArtifact = new NullArtifact();
159+
this.coberturaArtifact = new NullArtifact();
160+
this.stmResultsArtifact = new NullArtifact();
161+
this.modelCoverageArtifact = new NullArtifact();
162+
163+
// Assign appropriate artifact type if it was selected earlier.
164+
if (pdfReportChkBx) {
165+
this.pdfReportArtifact = new PdfArtifact("matlabTestArtifacts/testreport.pdf");
166+
}
167+
if (tapChkBx) {
168+
this.tapArtifact = new TapArtifact("matlabTestArtifacts/taptestresults.tap");
169+
}
170+
if (junitChkBx) {
171+
this.junitArtifact = new JunitArtifact("matlabTestArtifacts/junittestresults.xml");
172+
}
173+
if (coberturaChkBx) {
174+
this.coberturaArtifact = new CoberturaArtifact("matlabTestArtifacts/cobertura.xml");
175+
}
176+
if (stmResultsChkBx) {
177+
this.stmResultsArtifact =
178+
new StmResultsArtifact("matlabTestArtifacts/simulinktestresults.mldatx");
179+
}
180+
if (modelCoverageChkBx) {
181+
this.pdfReportArtifact =
182+
new ModelCovArtifact("matlabTestArtifacts/coberturamodelcoverage.pdf");
183+
}
184+
return this;
185+
}
186+
187+
144188
@Symbol("RunMatlabTests")
145189
@Extension
146190
public static class RunMatlabTestsDescriptor extends BuildStepDescriptor<Builder> {

0 commit comments

Comments
 (0)