]>
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 boolean isLibrary
= false;
40 public String modulename
= null;
42 public String guidvalue
= null;
44 public String moduletype
= null;
46 public String entrypoint
= null;
48 public String license
= null;
50 public final Set
<String
> localmodulesources
= new HashSet
<String
>(); // contains
56 public final Set
<String
> preprocessedccodes
= new HashSet
<String
>();
58 public final Set
<String
> msaorinf
= new HashSet
<String
>(); // only a
63 public final Set
<String
> infincludes
= new HashSet
<String
>();
65 public final Set
<String
> infsources
= new HashSet
<String
>();
67 public final Set
<String
> hashfuncc
= new HashSet
<String
>();
69 public final Set
<String
> hashfuncd
= new HashSet
<String
>();
71 public final Set
<String
> hashnonlocalfunc
= new HashSet
<String
>();
73 public final Set
<String
> hashnonlocalmacro
= new HashSet
<String
>();
75 public final Set
<String
> hashEFIcall
= new HashSet
<String
>();
77 public final Set
<String
> hashr8only
= new HashSet
<String
>();
79 public final Set
<String
> hashmacro
= new HashSet
<String
>();
81 public final Set
<String
> hashrequiredr9libs
= new HashSet
<String
>(); // hashrequiredr9libs
89 public final Set
<String
> guids
= new HashSet
<String
>();
91 public final Set
<String
> protocols
= new HashSet
<String
>();
93 public final Set
<String
> ppis
= new HashSet
<String
>();
95 // -----------------------------------------------------------------------------------//
101 public final boolean addSourceFile(String filename
, Enum en
) {
102 localmodulesources
.add(filename
);
103 return msaowner
.addSourceFile(filename
, en
);
106 public final boolean addProtocol(String proname
, UsageTypes
.Enum usage
) {
107 protocols
.add(proname
);
108 return msaowner
.addProtocol(proname
, usage
);
111 public final boolean addPpi(String ppiname
, UsageTypes
.Enum usage
) {
113 return msaowner
.addPpi(ppiname
, usage
);
116 public final boolean addGuid(String guidname
, UsageTypes
.Enum usage
) {
118 return msaowner
.addGuid(guidname
, usage
);
121 public final boolean addLibraryClass(String name
, UsageTypes
.Enum usage
) {
123 // This section is only for adding library classes, this functionality
124 // should be inside MsaOwner!!!
126 // if (!hashrequiredr9libs.contains(name)) {
127 msaowner
.addLibraryClass(name
, usage
);
130 hashrequiredr9libs
.add(name
);
134 // -----------------------------------------------------------------------------------//
136 public final String
getModuleType() {
137 if (moduletype
.contains("PEI")) {
144 public final void enroll(String filepath
) throws Exception
{
146 if (filepath
.contains(".inf") || filepath
.contains(".msa")) {
147 temp
= filepath
.replace(modulepath
+ File
.separator
, "");
148 if (!temp
.contains(File
.separator
)) { // .inf in subdirectory is
152 } else if (filepath
.contains(".c") || filepath
.contains(".C")
153 || filepath
.contains(".h") || filepath
.contains(".H")
154 || filepath
.contains(".dxs") || filepath
.contains(".uni")
155 || filepath
.contains(".s") || filepath
.contains(".S")
156 || filepath
.contains(".i") || filepath
.contains(".asm")) {
157 addSourceFile(filepath
.replace(modulepath
+ File
.separator
, ""),
162 public static final boolean isModule(String path
) {
163 String
[] list
= new File(path
).list();
164 for (int i
= 0; i
< list
.length
; i
++) {
165 if (!new File(list
[i
]).isDirectory()) {
166 if (list
[i
].contains(".inf") || list
[i
].contains(".msa")) {
174 public final MsaOwner
getMsaOwner() {