587
|
1 |
/*
|
628
|
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 |
*/
|
587
|
17 |
|
|
18 |
package com.nokia.helium.core.ant.types;
|
|
19 |
|
628
|
20 |
import java.io.File;
|
|
21 |
|
587
|
22 |
import org.apache.log4j.Logger;
|
|
23 |
import org.apache.tools.ant.Location;
|
|
24 |
import org.apache.tools.ant.Project;
|
628
|
25 |
import org.apache.tools.ant.Target;
|
|
26 |
import org.apache.tools.ant.taskdefs.ImportTask;
|
|
27 |
import org.apache.tools.ant.types.DataType;
|
587
|
28 |
|
628
|
29 |
import com.nokia.helium.core.ant.PreBuildAction;
|
587
|
30 |
|
|
31 |
/**
|
|
32 |
* This class implements an Executor importer pre-action.
|
|
33 |
*
|
|
34 |
* @ant.type name="importdef" category="Core"
|
|
35 |
*/
|
628
|
36 |
public class HlmImportDef extends DataType implements PreBuildAction {
|
587
|
37 |
|
|
38 |
private static Logger log = Logger.getLogger(HlmImportDef.class);
|
628
|
39 |
|
|
40 |
private File file;
|
587
|
41 |
|
|
42 |
public void setFile(File file) {
|
|
43 |
this.file = file;
|
|
44 |
}
|
|
45 |
|
|
46 |
/**
|
|
47 |
* Will import the given file.
|
|
48 |
*/
|
628
|
49 |
public void executeOnPreBuild(Project project, String[] targetNames) {
|
|
50 |
log.debug("importdef:prj name" + project.getName() + ". fileName"
|
|
51 |
+ file.toString());
|
587
|
52 |
ImportTask task = new ImportTask();
|
|
53 |
Target target = new Target();
|
|
54 |
target.setName("");
|
628
|
55 |
target.setProject(project);
|
587
|
56 |
task.setOwningTarget(target);
|
|
57 |
task.setLocation(new Location(file.getAbsolutePath()));
|
|
58 |
task.setFile(file.toString());
|
628
|
59 |
task.setProject(project);
|
587
|
60 |
task.execute();
|
|
61 |
}
|
|
62 |
} |