1 /* |
1 /* |
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of the License "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
|
18 |
17 |
19 package com.nokia.helium.core.ant.types; |
18 package com.nokia.helium.core.ant.types; |
20 |
19 |
|
20 import java.io.File; |
|
21 |
21 import org.apache.log4j.Logger; |
22 import org.apache.log4j.Logger; |
22 import org.apache.tools.ant.taskdefs.ImportTask; |
|
23 import org.apache.tools.ant.Target; |
|
24 import org.apache.tools.ant.Location; |
23 import org.apache.tools.ant.Location; |
25 import org.apache.tools.ant.Project; |
24 import org.apache.tools.ant.Project; |
|
25 import org.apache.tools.ant.Target; |
|
26 import org.apache.tools.ant.taskdefs.ImportTask; |
|
27 import org.apache.tools.ant.types.DataType; |
26 |
28 |
27 import java.io.File; |
29 import com.nokia.helium.core.ant.PreBuildAction; |
28 |
30 |
29 /** |
31 /** |
30 * This class implements an Executor importer pre-action. |
32 * This class implements an Executor importer pre-action. |
31 * |
33 * |
32 * @ant.type name="importdef" category="Core" |
34 * @ant.type name="importdef" category="Core" |
33 */ |
35 */ |
34 public class HlmImportDef extends HlmPreDefImpl { |
36 public class HlmImportDef extends DataType implements PreBuildAction { |
35 |
37 |
36 private static Logger log = Logger.getLogger(HlmImportDef.class); |
38 private static Logger log = Logger.getLogger(HlmImportDef.class); |
37 |
39 |
38 private File file ; |
40 private File file; |
39 |
41 |
40 public void setFile(File file) { |
42 public void setFile(File file) { |
41 this.file = file; |
43 this.file = file; |
42 } |
44 } |
43 |
45 |
44 /** |
46 /** |
45 * Will import the given file. |
47 * Will import the given file. |
46 */ |
48 */ |
47 public void execute(Project prj, String module, String[] targetNames) { |
49 public void executeOnPreBuild(Project project, String[] targetNames) { |
48 log.debug("importdef:prj name" + prj.getName() + ". fileName" + file.toString()); |
50 log.debug("importdef:prj name" + project.getName() + ". fileName" |
|
51 + file.toString()); |
49 ImportTask task = new ImportTask(); |
52 ImportTask task = new ImportTask(); |
50 Target target = new Target(); |
53 Target target = new Target(); |
51 target.setName(""); |
54 target.setName(""); |
52 target.setProject(prj); |
55 target.setProject(project); |
53 task.setOwningTarget(target); |
56 task.setOwningTarget(target); |
54 task.setLocation(new Location(file.getAbsolutePath())); |
57 task.setLocation(new Location(file.getAbsolutePath())); |
55 task.setFile(file.toString()); |
58 task.setFile(file.toString()); |
56 task.setProject(prj); |
59 task.setProject(project); |
57 task.execute(); |
60 task.execute(); |
58 } |
61 } |
59 } |
62 } |