]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | This file is used to nest elements corresponding to DpFile\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | package org.tianocore.build.global;\r | |
15 | \r | |
16 | import java.util.ArrayList;\r | |
17 | import java.util.List;\r | |
18 | \r | |
19 | import org.apache.tools.ant.DirectoryScanner;\r | |
20 | import org.apache.tools.ant.types.DataType;\r | |
21 | import org.apache.tools.ant.types.FileSet;\r | |
22 | \r | |
23 | /**\r | |
24 | DpFileList is a container of Dpfile at the point of ANT task/datatype\r | |
25 | **/\r | |
26 | public class DpFileList extends DataType {\r | |
27 | ///\r | |
28 | /// Keep all the file names from all nested DpFile\r | |
29 | ///\r | |
30 | List<String> nameList = new ArrayList<String>();\r | |
31 | \r | |
32 | /**\r | |
33 | Empty constructor just in case\r | |
34 | **/\r | |
35 | public DpFileList() {\r | |
36 | }\r | |
37 | \r | |
38 | /**\r | |
39 | Empty execute method of ANT task. ANT will call it even we don't need it.\r | |
40 | **/\r | |
41 | public void execute() {\r | |
42 | }\r | |
43 | \r | |
44 | /**\r | |
45 | Standard add method of ANT task, for nested DpFile type of elements. It just\r | |
46 | simply fetch the files list from DpFile and put them in its own nameList.\r | |
47 | \r | |
48 | @param f a DpFile object which will be instantiated by ANT\r | |
49 | **/\r | |
50 | public void addConfiguredFile(DpFile f) {\r | |
51 | this.nameList.addAll(f.getList());\r | |
52 | }\r | |
53 | \r | |
54 | public void addConfiguredFileSet(FileSet fileSet) {\r | |
55 | DirectoryScanner ds = fileSet.getDirectoryScanner(getProject());\r | |
56 | String dir = fileSet.getDir(getProject()).getAbsolutePath();\r | |
57 | String[] files = ds.getIncludedFiles();\r | |
58 | \r | |
59 | for (int i = 0; i < files.length; ++i) {\r | |
60 | nameList.add(dir + "/" + files[i]);\r | |
61 | }\r | |
62 | }\r | |
63 | }\r | |
64 | \r |