13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 package com.nokia.helium.sbs.ant.taskdefs; |
17 package com.nokia.helium.sbs.ant.taskdefs; |
|
18 |
|
19 import java.util.Vector; |
|
20 |
|
21 import org.apache.tools.ant.BuildException; |
|
22 |
|
23 import com.nokia.helium.core.ant.types.Variable; |
|
24 import com.nokia.helium.core.ant.types.VariableSet; |
18 |
25 |
19 /** |
26 /** |
20 * This task is to execute the CTCWrap command with the list of sbs parameters |
27 * This task is to execute the CTCWrap command with the list of sbs parameters |
21 * using sbsinput type. Based on the raptor input list of additional log file path |
28 * using sbsinput type. Based on the raptor input list of additional log file path |
22 * used needs to be set, so that the scanlog, additional log files are generated |
29 * used needs to be set, so that the scanlog, additional log files are generated |
33 * @ant.task name="ctctask" category="SBS" |
40 * @ant.task name="ctctask" category="SBS" |
34 */ |
41 */ |
35 public class CTCTask extends SBSTask { |
42 public class CTCTask extends SBSTask { |
36 |
43 |
37 private String instrumentType = "m"; |
44 private String instrumentType = "m"; |
|
45 private Vector<VariableSet> ctcOptions = new Vector<VariableSet>(); |
38 |
46 |
|
47 /** |
|
48 * Constructing the task, overriding default executable to be |
|
49 * ctcwrap. |
|
50 */ |
39 public CTCTask() { |
51 public CTCTask() { |
40 super(); |
52 super(); |
41 getSbsCmd().setExecutable("ctcwrap"); |
53 getSbsCmd().setExecutable("ctcwrap"); |
42 } |
54 } |
43 |
55 |
44 public void setInstrumentType(String i) |
56 /** |
|
57 * Defined the instrumentation type. |
|
58 * @param instrumentType the instrumentation type. |
|
59 * @ant.not-required Default is 'm' |
|
60 */ |
|
61 public void setInstrumentType(String instrumentType) |
45 { |
62 { |
46 instrumentType = i; |
63 this.instrumentType = instrumentType; |
47 } |
64 } |
48 |
65 |
|
66 /** |
|
67 * Override the command line construction. |
|
68 */ |
49 protected String getSBSCmdLine() { |
69 protected String getSBSCmdLine() { |
50 return "-i " + instrumentType + " sbs" + super.getSBSCmdLine(); |
70 String ctcConfig = ""; |
|
71 for (VariableSet ctcOption : ctcOptions) { |
|
72 ctcConfig += " "; // needed for forward compatibility |
|
73 if (ctcOption.isReference()) { |
|
74 Object refObject = ctcOption.getRefid().getReferencedObject(); |
|
75 if (refObject instanceof VariableSet) { |
|
76 ctcOption = (VariableSet)refObject; |
|
77 } else { |
|
78 throw new BuildException(ctcOption.getRefid().getRefId() + " is not referencing a VariableSet."); |
|
79 } |
|
80 } |
|
81 for (VariableSet vset : ctcOption.getVariableSets()) { |
|
82 if (vset.isReference()) { |
|
83 Object refObject = vset.getRefid().getReferencedObject(); |
|
84 if (refObject instanceof VariableSet) { |
|
85 vset = (VariableSet)refObject; |
|
86 } else { |
|
87 throw new BuildException(vset.getRefid().getRefId() + " is not referencing a VariableSet."); |
|
88 } |
|
89 } |
|
90 for (Variable var : vset.getVariablesList()) { |
|
91 ctcConfig += " " + var.getParameter(); |
|
92 } |
|
93 } |
|
94 } |
|
95 return "-i " + instrumentType + ctcConfig + " sbs" + super.getSBSCmdLine(); |
|
96 } |
|
97 |
|
98 /** |
|
99 * To read the ctc arguments for ctcwrap command. |
|
100 * |
|
101 * @param ctcArg |
|
102 */ |
|
103 public void addCTCOptions(VariableSet ctcArg) { |
|
104 ctcOptions.add(ctcArg); |
51 } |
105 } |
52 |
106 |
53 } |
107 } |