]>
git.proxmox.com Git - mirror_edk2.git/blob - Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 package org
.tianocore
.migration
;
16 import java
.util
.HashSet
;
19 import org
.tianocore
.UsageTypes
;
20 import org
.tianocore
.SupportedArchitectures
.Enum
;
23 * Class ModuleInfo is built for scanning the source files, it contains all the
24 * needed information and all the temporary data.
26 public final class ModuleInfo
{
27 ModuleInfo(String modulepath
) throws Exception
{
28 this.modulepath
= modulepath
;
29 this.temppath
= MigrationTool
.getTempDir(this.modulepath
);
32 public final String modulepath
;
34 public final String temppath
;
36 private MsaOwner msaowner
= MsaOwner
.initNewMsaOwner();
38 public String modulename
= null;
40 public String guidvalue
= null;
42 public String moduletype
= null;
44 public String entrypoint
= null;
46 public String license
= null;
48 public final Set
<String
> localmodulesources
= new HashSet
<String
>(); // contains
54 public final Set
<String
> preprocessedccodes
= new HashSet
<String
>();
56 public final Set
<String
> msaorinf
= new HashSet
<String
>(); // only a
61 public final Set
<String
> infincludes
= new HashSet
<String
>();
63 public final Set
<String
> infsources
= new HashSet
<String
>();
65 public final Set
<String
> hashfuncc
= new HashSet
<String
>();
67 public final Set
<String
> hashfuncd
= new HashSet
<String
>();
69 public final Set
<String
> hashnonlocalfunc
= new HashSet
<String
>();
71 public final Set
<String
> hashnonlocalmacro
= new HashSet
<String
>();
73 public final Set
<String
> hashEFIcall
= new HashSet
<String
>();
75 public final Set
<String
> hashr8only
= new HashSet
<String
>();
77 public final Set
<String
> hashmacro
= new HashSet
<String
>();
79 public final Set
<String
> hashrequiredr9libs
= new HashSet
<String
>(); // hashrequiredr9libs
87 public final Set
<String
> guids
= new HashSet
<String
>();
89 public final Set
<String
> protocols
= new HashSet
<String
>();
91 public final Set
<String
> ppis
= new HashSet
<String
>();
93 // -----------------------------------------------------------------------------------//
99 public final boolean addSourceFile(String filename
, Enum en
) {
100 localmodulesources
.add(filename
);
101 return msaowner
.addSourceFile(filename
, en
);
104 public final boolean addProtocol(String proname
, UsageTypes
.Enum usage
) {
105 protocols
.add(proname
);
106 return msaowner
.addProtocol(proname
, usage
);
109 public final boolean addPpi(String ppiname
, UsageTypes
.Enum usage
) {
111 return msaowner
.addPpi(ppiname
, usage
);
114 public final boolean addGuid(String guidname
, UsageTypes
.Enum usage
) {
116 return msaowner
.addGuid(guidname
, usage
);
119 public final boolean addLibraryClass(String name
, UsageTypes
.Enum usage
) {
121 // This section is only for adding library classes, this functionality
122 // should be inside MsaOwner!!!
124 // if (!hashrequiredr9libs.contains(name)) {
125 msaowner
.addLibraryClass(name
, usage
);
128 hashrequiredr9libs
.add(name
);
132 // -----------------------------------------------------------------------------------//
134 public final String
getModuleType() {
135 if (moduletype
.contains("PEI")) {
142 public final void enroll(String filepath
) throws Exception
{
144 if (filepath
.contains(".inf") || filepath
.contains(".msa")) {
145 temp
= filepath
.replace(modulepath
+ File
.separator
, "");
146 if (!temp
.contains(File
.separator
)) { // .inf in subdirectory is
150 } else if (filepath
.contains(".c") || filepath
.contains(".C")
151 || filepath
.contains(".h") || filepath
.contains(".H")
152 || filepath
.contains(".dxs") || filepath
.contains(".uni")
153 || filepath
.contains(".s") || filepath
.contains(".S")
154 || filepath
.contains(".i") || filepath
.contains(".asm")) {
155 addSourceFile(filepath
.replace(modulepath
+ File
.separator
, ""),
160 public static final boolean isModule(String path
) {
161 String
[] list
= new File(path
).list();
162 for (int i
= 0; i
< list
.length
; i
++) {
163 if (!new File(list
[i
]).isDirectory()) {
164 if (list
[i
].contains(".inf") || list
[i
].contains(".msa")) {
172 public final MsaOwner
getMsaOwner() {