]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FileParser.java
Modify GenFfsTask to make it don't create ORG file.
[mirror_edk2.git] / Tools / Source / FrameworkTasks / org / tianocore / framework / tasks / FileParser.java
CommitLineData
878ddf1f 1/** @file\r
2 FileParser class.\r
3\r
4 FileParser class is to parse file which contains the list of file name and \r
5 add those files to list.\r
6 \r
7 \r
8 Copyright (c) 2006, Intel Corporation\r
9 All rights reserved. This program and the accompanying materials\r
10 are licensed and made available under the terms and conditions of the BSD License\r
11 which accompanies this distribution. The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php\r
13 \r
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
16\r
17 **/\r
18package org.tianocore.framework.tasks;\r
19import java.io.*;\r
20import java.util.List;\r
21\r
22import org.apache.tools.ant.BuildException;\r
23import org.apache.tools.ant.Project;\r
24\r
25/**\r
26 FileParser class.\r
27\r
28 FileParser class is to parse file which contains the list of file name and \r
29 add those files to list.\r
30**/\r
31public class FileParser {\r
32 /**\r
33 loadFile\r
34 \r
35 This function is to add files to array from input file which contains the \r
36 files list.\r
37 @param project The current project.\r
38 @param list File array.\r
39 @param file File which contains the file list.\r
40 @param tag Target of architecture.\r
41 @throws BuildException\r
42 **/\r
43 public static synchronized void loadFile(Project project, List<Object> list, File file, String tag) throws BuildException{\r
44 FileReader fileReader;\r
45 BufferedReader in;\r
46 String str;\r
47 \r
48 if (!file.exists()) {\r
3f7b510e 49 throw new BuildException("The file, " + file + " does not exist!"); \r
878ddf1f 50 } \r
51 try {\r
52 fileReader = new FileReader(file);\r
53 in = new BufferedReader(fileReader);\r
54 while((str=in.readLine())!= null){\r
55 if (str.trim()==""){\r
56 continue;\r
57 }\r
58 str = project.replaceProperties(str);\r
59 if (str.trim().substring(0,2).equalsIgnoreCase(tag)) {\r
60 list.add(str.trim());\r
61 } else {\r
62 list.add(tag + " " + str.trim());\r
63 }\r
64 \r
65 }\r
66 } catch (Exception e){\r
67 System.out.println(e.getMessage());\r
68 \r
69 }\r
70 }\r
71 \r
3f7b510e 72}\r