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