587
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
package com.nokia.helium.sbs.ant.taskdefs;
|
|
18 |
|
618
|
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;
|
|
25 |
|
587
|
26 |
/**
|
|
27 |
* This task is to execute the CTCWrap command with the list of sbs parameters
|
|
28 |
* using sbsinput type. Based on the raptor input list of additional log file path
|
|
29 |
* used needs to be set, so that the scanlog, additional log files are generated
|
|
30 |
* properly.
|
|
31 |
*
|
|
32 |
* <pre>
|
|
33 |
* <ctctask sbsinput="sbs.input" sysdefFile="system.def.file"
|
|
34 |
* workingDir="build.drive" failOnError="false"
|
|
35 |
* cleanLog="sbs.log.file.clean.log"
|
|
36 |
* failOnError="false"
|
|
37 |
* errorfile="path to error file"/>
|
|
38 |
* </pre>
|
|
39 |
*
|
|
40 |
* @ant.task name="ctctask" category="SBS"
|
|
41 |
*/
|
|
42 |
public class CTCTask extends SBSTask {
|
|
43 |
|
|
44 |
private String instrumentType = "m";
|
618
|
45 |
private Vector<VariableSet> ctcOptions = new Vector<VariableSet>();
|
587
|
46 |
|
618
|
47 |
/**
|
|
48 |
* Constructing the task, overriding default executable to be
|
|
49 |
* ctcwrap.
|
|
50 |
*/
|
587
|
51 |
public CTCTask() {
|
|
52 |
super();
|
|
53 |
getSbsCmd().setExecutable("ctcwrap");
|
|
54 |
}
|
|
55 |
|
618
|
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)
|
587
|
62 |
{
|
618
|
63 |
this.instrumentType = instrumentType;
|
587
|
64 |
}
|
|
65 |
|
618
|
66 |
/**
|
|
67 |
* Override the command line construction.
|
|
68 |
*/
|
587
|
69 |
protected String getSBSCmdLine() {
|
618
|
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);
|
587
|
105 |
}
|
|
106 |
|
|
107 |
}
|