]>
Commit | Line | Data |
---|---|---|
b0282412 | 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 | |
0dc8c589 | 13 | package org.tianocore.migration;\r |
14 | \r | |
15 | import java.io.*;\r | |
16 | import java.util.*;\r | |
0dc8c589 | 17 | \r |
6ef5feb5 | 18 | import org.tianocore.ModuleSurfaceAreaDocument;\r |
19 | \r | |
0dc8c589 | 20 | /*\r |
27e0221a | 21 | Class ModuleInfo is built for scanning the source files, it contains all the needed\r |
0dc8c589 | 22 | information and all the temporary data.\r |
23 | */\r | |
1eac75f9 | 24 | public final class ModuleInfo {\r |
27e0221a | 25 | ModuleInfo(String modulepath) throws Exception {\r |
26 | this.modulepath = modulepath;\r | |
df87de9b | 27 | this.temppath = MigrationTool.getTempDir(this.modulepath);\r |
27e0221a | 28 | }\r |
5ea254f6 | 29 | \r |
27e0221a | 30 | public final String modulepath;\r |
df87de9b | 31 | public final String temppath;\r |
27e0221a | 32 | \r |
6ef5feb5 | 33 | private MsaOwner msaowner = new MsaWriter(this);\r |
34 | public ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.newInstance();\r | |
35 | \r | |
27e0221a | 36 | public String modulename = null;\r |
37 | public String guidvalue = null;\r | |
38 | public String moduletype = null;\r | |
39 | public String entrypoint = null;\r | |
40 | \r | |
41 | public final Set<String> localmodulesources = new HashSet<String>(); //contains both .c and .h\r | |
42 | public final Set<String> preprocessedccodes = new HashSet<String>();\r | |
43 | public final Set<String> msaorinf = new HashSet<String>(); //only a little, hash may be too big for this\r | |
39e5e412 | 44 | public final Set<String> infincludes = new HashSet<String>();\r |
45 | public final Set<String> infsources = new HashSet<String>();\r | |
27e0221a | 46 | \r |
47 | public final Set<String> hashfuncc = new HashSet<String>();\r | |
48 | public final Set<String> hashfuncd = new HashSet<String>();\r | |
49 | public final Set<String> hashnonlocalfunc = new HashSet<String>();\r | |
50 | public final Set<String> hashnonlocalmacro = new HashSet<String>();\r | |
51 | public final Set<String> hashEFIcall = new HashSet<String>();\r | |
52 | public final Set<String> hashr8only = new HashSet<String>();\r | |
9f98dbb7 | 53 | public final Set<String> hashmacro = new HashSet<String>();\r |
27e0221a | 54 | \r |
55 | public final Set<String> hashrequiredr9libs = new HashSet<String>(); // hashrequiredr9libs is now all added in SourceFileReplacer \r | |
56 | public final Set<String> guid = new HashSet<String>();\r | |
57 | public final Set<String> protocol = new HashSet<String>();\r | |
58 | public final Set<String> ppi = new HashSet<String>();\r | |
23e3b888 | 59 | \r |
27e0221a | 60 | public final String getModuleType() {\r |
61 | if (moduletype.contains("PEI")) {\r | |
62 | return "PEIM";\r | |
63 | } else {\r | |
64 | return "DXE_DRIVER";\r | |
65 | }\r | |
66 | }\r | |
67 | \r | |
68 | public final void enroll(String filepath) throws Exception {\r | |
69 | String temp = null;\r | |
70 | if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || \r | |
71 | filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) {\r | |
72 | localmodulesources.add(filepath.replace(modulepath + File.separator, ""));\r | |
73 | } else if (filepath.contains(".inf") || filepath.contains(".msa")) {\r | |
74 | temp = filepath.replace(modulepath + File.separator, "");\r | |
75 | if (!temp.contains(File.separator)) { // .inf in subdirectory is not regarded\r | |
76 | msaorinf.add(temp);\r | |
77 | }\r | |
78 | }\r | |
79 | }\r | |
23e3b888 | 80 | \r |
27e0221a | 81 | public static final boolean isModule(String path) {\r |
82 | String[] list = new File(path).list();\r | |
83 | for (int i = 0 ; i < list.length ; i++) {\r | |
84 | if (!new File(list[i]).isDirectory()) {\r | |
85 | if (list[i].contains(".inf") || list[i].contains(".msa")) {\r | |
86 | return true;\r | |
87 | }\r | |
88 | }\r | |
89 | }\r | |
90 | return false;\r | |
91 | }\r | |
e6a5df3b | 92 | } |