X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FMigrationTools%2Forg%2Ftianocore%2Fmigration%2FModuleInfo.java;h=aa19522e02d1dd2af8e75ef9187c9a8485678495;hp=d53c7b93f746ce4092c7cf4417a2e1a880ee1ac3;hb=190293ab4ef0ce3a66de1fdadd51d123cd5bc1bd;hpb=16b7eeef5489a5e16da1574c13df53990ffac2cf diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java index d53c7b93f7..aa19522e02 100644 --- a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java +++ b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java @@ -15,68 +15,105 @@ package org.tianocore.migration; import java.io.*; import java.util.*; +import org.tianocore.UsageTypes; + /* - Class ModuleInfo is built for scanning the source files, it contains all the needed + Class ModuleInfo is built for scanning the source files, it contains all the needed information and all the temporary data. */ public final class ModuleInfo { - ModuleInfo(String modulepath) throws Exception { - this.modulepath = modulepath; - } + ModuleInfo(String modulepath) throws Exception { + this.modulepath = modulepath; + this.temppath = MigrationTool.getTempDir(this.modulepath); + } + + public final String modulepath; + public final String temppath; + + private MsaOwner msaowner = MsaOwner.initNewMsaOwner(); + + public String modulename = null; + public String guidvalue = null; + public String moduletype = null; + public String entrypoint = null; + + public final Set localmodulesources = new HashSet(); //contains both .c and .h + public final Set preprocessedccodes = new HashSet(); + public final Set msaorinf = new HashSet(); //only a little, hash may be too big for this + public final Set infincludes = new HashSet(); + public final Set infsources = new HashSet(); + + public final Set hashfuncc = new HashSet(); + public final Set hashfuncd = new HashSet(); + public final Set hashnonlocalfunc = new HashSet(); + public final Set hashnonlocalmacro = new HashSet(); + public final Set hashEFIcall = new HashSet(); + public final Set hashr8only = new HashSet(); + public final Set hashmacro = new HashSet(); + + public final Set hashrequiredr9libs = new HashSet(); // hashrequiredr9libs is now all added in SourceFileReplacer + public final Set guids = new HashSet(); + public final Set protocols = new HashSet(); + public final Set ppis = new HashSet(); - public final String modulepath; - - public String modulename = null; - public String guidvalue = null; - public String moduletype = null; - public String entrypoint = null; - - public final Set localmodulesources = new HashSet(); //contains both .c and .h - public final Set preprocessedccodes = new HashSet(); - public final Set msaorinf = new HashSet(); //only a little, hash may be too big for this - - public final Set hashfuncc = new HashSet(); - public final Set hashfuncd = new HashSet(); - public final Set hashnonlocalfunc = new HashSet(); - public final Set hashnonlocalmacro = new HashSet(); - public final Set hashEFIcall = new HashSet(); - public final Set hashr8only = new HashSet(); - - public final Set hashrequiredr9libs = new HashSet(); // hashrequiredr9libs is now all added in SourceFileReplacer - public final Set guid = new HashSet(); - public final Set protocol = new HashSet(); - public final Set ppi = new HashSet(); + //-----------------------------------------------------------------------------------// - public final String getModuleType() { - if (moduletype.contains("PEI")) { - return "PEIM"; - } else { - return "DXE_DRIVER"; - } - } - - public final void enroll(String filepath) throws Exception { - String temp = null; - if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || - filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) { - localmodulesources.add(filepath.replace(modulepath + File.separator, "")); - } else if (filepath.contains(".inf") || filepath.contains(".msa")) { - temp = filepath.replace(modulepath + File.separator, ""); - if (!temp.contains(File.separator)) { // .inf in subdirectory is not regarded - msaorinf.add(temp); - } - } - } + public final boolean addProtocol (String proname, UsageTypes.Enum usage) { + //protocols.add(proname); + return msaowner.addProtocol(proname, usage); + } + + public final boolean addPpi (String ppiname, UsageTypes.Enum usage) { + //ppis.add(ppiname); + return msaowner.addPpi(ppiname, usage); + } + + public final boolean addGuid (String guidname, UsageTypes.Enum usage) { + //guids.add(guidname); + return msaowner.addGuid(guidname, usage); + } + + public final boolean addLibraryClass(String name, UsageTypes.Enum usage) { + //hashrequiredr9libs.add(name); + return msaowner.addLibraryClass(name, usage); + } + + //-----------------------------------------------------------------------------------// + + public final String getModuleType() { + if (moduletype.contains("PEI")) { + return "PEIM"; + } else { + return "DXE_DRIVER"; + } + } + + public final void enroll(String filepath) throws Exception { + String temp = null; + if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") || + filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) { + localmodulesources.add(filepath.replace(modulepath + File.separator, "")); + } else if (filepath.contains(".inf") || filepath.contains(".msa")) { + temp = filepath.replace(modulepath + File.separator, ""); + if (!temp.contains(File.separator)) { // .inf in subdirectory is not regarded + msaorinf.add(temp); + } + } + } - public static final boolean isModule(String path) { - String[] list = new File(path).list(); - for (int i = 0 ; i < list.length ; i++) { - if (!new File(list[i]).isDirectory()) { - if (list[i].contains(".inf") || list[i].contains(".msa")) { - return true; - } - } - } - return false; - } + public static final boolean isModule(String path) { + String[] list = new File(path).list(); + for (int i = 0 ; i < list.length ; i++) { + if (!new File(list[i]).isDirectory()) { + if (list[i].contains(".inf") || list[i].contains(".msa")) { + return true; + } + } + } + return false; + } + + public final MsaOwner getMsaOwner() { + return msaowner; + } } \ No newline at end of file