588
|
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.helium.sbs.ant.taskdefs;
|
|
19 |
|
|
20 |
import java.util.List;
|
628
|
21 |
|
588
|
22 |
import org.apache.tools.ant.BuildException;
|
|
23 |
import org.apache.tools.ant.Task;
|
628
|
24 |
|
|
25 |
import com.nokia.helium.sbs.ant.SBSBuildList;
|
|
26 |
import com.nokia.helium.sbs.ant.types.SBSInput;
|
588
|
27 |
|
|
28 |
/**
|
|
29 |
* This task provide a way to get the list of sbs command input for a particular
|
|
30 |
* configuration from abld. For every abld command mentioned for a configuration
|
|
31 |
* from schema 1.4.0, there should be a corresponding sbsinput and for all
|
|
32 |
* abld commands in the sysdef configuration a corresponding sbsbuild command has
|
|
33 |
* to be there. And using this task the list of sbs commands are extracted and executed
|
|
34 |
* one after another. This is only for backward compatibility, once the sysdef config
|
|
35 |
* is migrated to 3.0, this task would be deprecated.
|
|
36 |
*
|
|
37 |
* This is internal task and should not be used outside helium.
|
|
38 |
*
|
|
39 |
* <pre>
|
|
40 |
* Example 1:
|
|
41 |
* <getsbsinputs config="sysdef.configuration"
|
|
42 |
* outputProperty="sbs.internal.list"/>
|
|
43 |
* </pre>
|
|
44 |
*
|
|
45 |
* @ant.task name="getsbsinputs" category="SBS"
|
|
46 |
*/
|
|
47 |
|
|
48 |
public class GetSBSInputsTask extends Task {
|
|
49 |
|
|
50 |
private String configName;
|
|
51 |
private String outputProperty;
|
|
52 |
|
|
53 |
/**
|
|
54 |
* Helper function to set the configuration name for
|
|
55 |
* which the sbs commands to be extracted.
|
|
56 |
* @param name of the configuration for which sbs commands to be obtained.
|
|
57 |
*/
|
|
58 |
public void setConfig(String name) {
|
|
59 |
configName = name;
|
|
60 |
}
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Helper function to retrive the sbs input list (list of sbs commands
|
|
64 |
* to be executed one after another). The list is provided with comma
|
|
65 |
* separated values.
|
|
66 |
* @param property name of the property where the sbs input list to be stored.
|
|
67 |
*/
|
|
68 |
public void setOutputProperty(String property) {
|
|
69 |
outputProperty = property;
|
|
70 |
}
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Execute the task. Finds the list of sbsinput and store it in
|
|
74 |
* outputproperty with comma separated values.
|
|
75 |
* @throws BuildException
|
|
76 |
*/
|
|
77 |
public void execute() {
|
|
78 |
if (configName == null) {
|
|
79 |
throw new BuildException("configInput is not defined");
|
|
80 |
}
|
|
81 |
List<SBSInput> sbsInputList = SBSBuildList.getSBSInputList(getProject(), configName);
|
|
82 |
StringBuffer inputs = new StringBuffer();
|
|
83 |
for (SBSInput input : sbsInputList) {
|
|
84 |
if (inputs.length() > 0) {
|
|
85 |
inputs.append(",");
|
|
86 |
}
|
|
87 |
inputs.append(input.getRefid().getRefId());
|
|
88 |
getProject().setProperty(outputProperty,inputs.toString());
|
|
89 |
}
|
|
90 |
}
|
|
91 |
} |