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 |
|
|
18 |
package com.nokia.tools.configuration;
|
|
19 |
|
|
20 |
import com.nokia.helium.core.ant.types.VariableSet;
|
|
21 |
import com.nokia.helium.core.ant.types.Variable;
|
|
22 |
import com.nokia.tools.*;
|
|
23 |
import org.apache.tools.ant.Project;
|
|
24 |
|
|
25 |
/**
|
|
26 |
* Command Line wrapper for configuration tools
|
|
27 |
*/
|
|
28 |
public class CONFIGURATIONTool implements Tool {
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Sets the command line variables to be used to execute and validates for
|
|
32 |
* the required parameters
|
|
33 |
*
|
|
34 |
* @param varSet
|
|
35 |
* variable(name / value list)
|
|
36 |
*/
|
|
37 |
public void execute(VariableSet varSet, Project prj)
|
|
38 |
throws ToolsProcessException {
|
|
39 |
String path = null;
|
|
40 |
String masterConf = null;
|
|
41 |
String confml = null;
|
|
42 |
String impl = null;
|
|
43 |
String iby = null;
|
|
44 |
String keepGoing = "false";
|
|
45 |
String report = null;
|
|
46 |
String varName;
|
|
47 |
String value;
|
|
48 |
for (Variable variable : varSet.getVariables()) {
|
|
49 |
varName = variable.getName();
|
|
50 |
value = variable.getValue();
|
|
51 |
if (varName.equals("path")) {
|
|
52 |
path = value;
|
|
53 |
} else if (varName.equals("master_conf")) {
|
|
54 |
masterConf = value;
|
|
55 |
} else if (varName.equals("confml")) {
|
|
56 |
confml = value;
|
|
57 |
} else if (varName.equals("impl")) {
|
|
58 |
impl = value;
|
|
59 |
} else if (varName.equals("iby")) {
|
|
60 |
iby = value;
|
|
61 |
} else if (varName.equals("keepgoing")) {
|
|
62 |
keepGoing = value;
|
|
63 |
} else if (varName.equals("report")) {
|
|
64 |
report = value;
|
|
65 |
}
|
|
66 |
}
|
|
67 |
if (path == null || masterConf == null || confml == null || iby == null) {
|
|
68 |
throw new ToolsProcessException("Config Tool Parameter missing");
|
|
69 |
}
|
|
70 |
org.apache.tools.ant.taskdefs.ExecTask task = new org.apache.tools.ant.taskdefs.ExecTask();
|
|
71 |
task.setTaskName("Configuration");
|
|
72 |
task.setDir(new java.io.File(path));
|
|
73 |
task.setExecutable(path + java.io.File.separator + "cli_build.cmd");
|
|
74 |
if (keepGoing.equals("false")) {
|
|
75 |
task.setFailonerror(true);
|
|
76 |
} else {
|
|
77 |
task.createArg().setValue("-ignore_errors");
|
|
78 |
}
|
|
79 |
task.createArg().setValue("-master_conf");
|
|
80 |
task.createArg().setValue(masterConf);
|
|
81 |
task.createArg().setValue("-impl");
|
|
82 |
task.createArg().setValue(impl);
|
|
83 |
task.createArg().setValue("-confml");
|
|
84 |
task.createArg().setValue(confml);
|
|
85 |
task.createArg().setValue("-iby");
|
|
86 |
task.createArg().setValue(iby);
|
|
87 |
if (report != null) {
|
|
88 |
task.createArg().setValue("-report");
|
|
89 |
task.createArg().setValue(report);
|
|
90 |
}
|
|
91 |
task.execute();
|
|
92 |
}
|
|
93 |
} |