]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | \r | |
3 | Copyright (c) 2006, Intel Corporation\r | |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | \r | |
12 | **/\r | |
13 | package org.tianocore.migration;\r | |
14 | \r | |
15 | import java.io.*;\r | |
16 | import java.util.*;\r | |
17 | \r | |
18 | /*\r | |
19 | Class ModuleInfo is built for scanning the source files, it contains all the needed\r | |
20 | information and all the temporary data.\r | |
21 | */\r | |
22 | public final class ModuleInfo {\r | |
23 | ModuleInfo(String modulepath) throws Exception {\r | |
24 | this.modulepath = modulepath;\r | |
25 | }\r | |
26 | \r | |
27 | public final String modulepath;\r | |
28 | \r | |
29 | public String modulename = null;\r | |
30 | public String guidvalue = null;\r | |
31 | public String moduletype = null;\r | |
32 | public String entrypoint = null;\r | |
33 | \r | |
34 | public final Set<String> localmodulesources = new HashSet<String>(); //contains both .c and .h\r | |
35 | public final Set<String> preprocessedccodes = new HashSet<String>();\r | |
36 | public final Set<String> msaorinf = new HashSet<String>(); //only a little, hash may be too big for this\r | |
37 | \r | |
38 | public final Set<String> hashfuncc = new HashSet<String>();\r | |
39 | public final Set<String> hashfuncd = new HashSet<String>();\r | |
40 | public final Set<String> hashnonlocalfunc = new HashSet<String>();\r | |
41 | public final Set<String> hashnonlocalmacro = new HashSet<String>();\r | |
42 | public final Set<String> hashEFIcall = new HashSet<String>();\r | |
43 | public final Set<String> hashr8only = new HashSet<String>();\r | |
44 | \r | |
45 | public final Set<String> hashrequiredr9libs = new HashSet<String>(); // hashrequiredr9libs is now all added in SourceFileReplacer \r | |
46 | public final Set<String> guid = new HashSet<String>();\r | |
47 | public final Set<String> protocol = new HashSet<String>();\r | |
48 | public final Set<String> ppi = new HashSet<String>();\r | |
49 | \r | |
50 | public final String getModuleType() {\r | |
51 | if (moduletype.contains("PEI")) {\r | |
52 | return "PEIM";\r | |
53 | } else {\r | |
54 | return "DXE_DRIVER";\r | |
55 | }\r | |
56 | }\r | |
57 | \r | |
58 | public final void enroll(String filepath) throws Exception {\r | |
59 | String temp = null;\r | |
60 | if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || \r | |
61 | filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) {\r | |
62 | localmodulesources.add(filepath.replace(modulepath + File.separator, ""));\r | |
63 | } else if (filepath.contains(".inf") || filepath.contains(".msa")) {\r | |
64 | temp = filepath.replace(modulepath + File.separator, "");\r | |
65 | if (!temp.contains(File.separator)) { // .inf in subdirectory is not regarded\r | |
66 | msaorinf.add(temp);\r | |
67 | }\r | |
68 | }\r | |
69 | }\r | |
70 | \r | |
71 | public static final boolean isModule(String path) {\r | |
72 | String[] list = new File(path).list();\r | |
73 | for (int i = 0 ; i < list.length ; i++) {\r | |
74 | if (!new File(list[i]).isDirectory()) {\r | |
75 | if (list[i].contains(".inf") || list[i].contains(".msa")) {\r | |
76 | return true;\r | |
77 | }\r | |
78 | }\r | |
79 | }\r | |
80 | return false;\r | |
81 | }\r | |
82 | } |