X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2Fglobal%2FGlobalData.java;h=afa4c31e0b9fa95355bf2cebd00430f640ffab0b;hp=fe565d97edbd0fcb15d2f21596dbdf02794e4c3f;hb=34c614e1b78989a51b24b9bb35c2dc4c96fb4660;hpb=f3b0ed9a12ec287bb336b9672a0937667f1958ec diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java index fe565d97ed..afa4c31e0b 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java @@ -32,8 +32,10 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.ListIterator; import java.util.Map; import java.util.Set; +import java.util.Vector; import java.util.logging.Logger; /** @@ -59,7 +61,7 @@ public class GlobalData { /// /// Be used to ensure Global data will be initialized only once. /// - private static boolean globalFlag = false; +// private static boolean globalFlag = false; /// /// Framework Database information: package list and platform list @@ -96,45 +98,6 @@ public class GlobalData { /// private static Set builtModules = new HashSet(); - /// - /// PCD memory database stored all PCD information which collected from FPD,MSA and SPD. - /// -// private static final MemoryDatabaseManager pcdDbManager = new MemoryDatabaseManager(); - - /// - /// build target + tool chain family/tag name + arch + command types + command options - /// - private static Map toolChainOptions; - private static Map toolChainFamilyOptions; - private static Map toolChainDefinitions; - /// - /// - /// - private static Set targets; - /// - /// - /// - private static Set toolChainFamilies; - /// - /// - /// - private static Set toolChains; - /// - /// keep track which toolchain family a toolchain tag belongs to - /// - private static Map> toolChainFamilyMap; - private static Map> toolChainCommandMap; - - /// - /// list of Arch: EBC, ARM, IA32, X64, IPF, PPC - /// - private static Set archs; - - /// - /// list of Command Type: CC, LIB, LINK, ASL, ASM, ASMLINK, PP - /// - private static Set commandTypes; - /** Parse framework database (DB) and all SPD files listed in DB to initialize the environment for next build. This method will only be executed only once @@ -146,13 +109,6 @@ public class GlobalData { Framework Dababase or SPD or MSA file is not valid **/ public synchronized static void initInfo(String workspaceDatabaseFile, String workspaceDir) throws Exception { - // - // ensure this method will be revoked only once - // - if (globalFlag) { - return; - } - globalFlag = true; // // Backup workspace directory. It will be used by other method @@ -177,7 +133,9 @@ public class GlobalData { DbPathAndFilename dbPath = (DbPathAndFilename)iter.next(); String fileName = dbPath.getStringValue(); Spd spd = new Spd(new File(workspaceDir + File.separatorChar + fileName)); - packageList.add(spd.getPackageId()); + if (!packageList.contains(spd.getPackageId())) { + packageList.add(spd.getPackageId()); + } spdTable.put(spd.getPackageId(), spd); } @@ -342,9 +300,7 @@ public class GlobalData { } public synchronized static Map getNativeMsa(File msaFile) throws Exception { - if (! msaFile.exists()) { - throw new Exception("Surface Area file [" + msaFile.getPath() + "] can't found."); - } + try { ModuleSurfaceAreaDocument doc = (ModuleSurfaceAreaDocument)XmlObject.Factory.parse(msaFile); // @@ -406,120 +362,6 @@ public class GlobalData { } } - /** - The header file path is relative to workspace dir - **/ - public static String[] getLibraryClassHeaderFiles(PackageIdentification[] packages, String name) { - if (packages == null ){ - // throw Exception or not???? - return new String[0]; - } - String[] result = null; - for (int i = 0; i < packages.length; i++){ - Spd spd = spdTable.get(packages[i]); - // - // If find one package defined the library class - // - if( (result = spd.getLibClassIncluder(name)) != null){ - return result; - } - } - return null; - - } - - /** - The header file path is relative to workspace dir - **/ - public static String getPackageHeaderFiles(PackageIdentification packages, String moduleType) throws Exception { - if (packages == null ){ - return new String(""); - } - Spd spd = spdTable.get(packages); - // - // If can't find package header file, skip it - // - String temp = null; - if (spd != null){ - if( (temp = spd.getPackageIncluder(moduleType)) != null){ - return temp; - }else { - temp = ""; - return temp; - } - }else { - return null; - } - } - - /** - return two values: {cName, GuidValue} - **/ - public static String[] getGuid(PackageIdentification[] packages, String name) throws Exception { - if (packages == null ){ - // throw Exception or not???? - return new String[0]; - } - String[] result = null; - for (int i = 0; i < packages.length; i++){ - Spd spd = spdTable.get(packages[i]); - // - // If find one package defined the GUID - // - if( (result = spd.getGuid(name)) != null){ - return result; - } - } - return null; - } - - /** - return two values: {cName, GuidValue} - **/ - public static String[] getPpiGuid(PackageIdentification[] packages, String name) throws Exception { - if (packages == null ){ - return new String[0]; - } - String[] result = null; - for (int i = 0; i < packages.length; i++){ - Spd spd = spdTable.get(packages[i]); - // - // If find one package defined the Ppi GUID - // - if( (result = spd.getPpi(name)) != null){ - return result; - } - } - return null; - - } - - /** - return two values: {cName, GuidValue} - **/ - public static String[] getProtocolGuid(PackageIdentification[] packages, String name) throws Exception { - if (packages == null ){ - return new String[0]; - } - String[] result = null; - for (int i = 0; i < packages.length; i++){ - Spd spd = spdTable.get(packages[i]); - // - // If find one package defined the protocol GUID - // - if( (result = spd.getProtocol(name)) != null){ - return result; - } - } - return null; - - } - - /////////////////////////// Update!! Update!! Update!! -// public synchronized static MemoryDatabaseManager getPCDMemoryDBManager() { -// return pcdDbManager; -// } - /////////////////////////// public synchronized static PlatformIdentification getPlatform(String name) throws Exception { Iterator iter = platformList.iterator(); while(iter.hasNext()){ @@ -586,134 +428,60 @@ public class GlobalData { return result; } - ////// Tool Chain Related, try to refine and put some logic process to ToolChainFactory - public static void setBuildToolChainFamilyOptions(Map map) { - toolChainFamilyOptions = map; - } - - public static Map getToolChainFamilyOptions() { - return toolChainFamilyOptions; - } - - public static void setBuildToolChainOptions(Map map) { - toolChainOptions = map; - } - - public static Map getToolChainOptions() { - return toolChainOptions; - } - - public static void setTargets(Set targetSet) { - GlobalData.log.info("TargetSet: " + targetSet); - targets = targetSet; - } - - public static String[] getTargets() { - return (String[])targets.toArray(new String[targets.size()]); - } - - public static void setToolChains(Set toolChainSet) { - toolChains = toolChainSet; - } - - public static String[] getToolChains() { - String[] toolChainList = new String[toolChains.size()]; - return (String[])toolChains.toArray(toolChainList); - } - - public static void setToolChainFamilies(Set toolChainFamilySet) { - toolChainFamilies = toolChainFamilySet; - } + public static ModuleIdentification getModuleId(String key){ + // + // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array. + // + String[] keyPart = key.split(" "); + Set spi = GlobalData.getPackageList(); + Iterator ispi = spi.iterator(); + + while(ispi.hasNext()) { + PackageIdentification pi = (PackageIdentification)ispi.next(); + if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){ - public static void setToolChainFamiliyMap(Map> map) { - /* - Set keys = map.keySet(); - Iterator it = keys.iterator(); - while (it.hasNext()) { - String toolchain = (String)it.next(); - Set familyMap = (Set)map.get(toolchain); - Iterator fit = familyMap.iterator(); - System.out.print(toolchain + ": "); - while (fit.hasNext()) { - System.out.print((String)fit.next() + " "); + continue; + } + if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){ + if(!pi.getVersion().equals(keyPart[3])){ + continue; + } + } + Set smi = GlobalData.getModules(pi); + Iterator ismi = smi.iterator(); + while(ismi.hasNext()) { + ModuleIdentification mi = (ModuleIdentification)ismi.next(); + if (mi.getGuid().equalsIgnoreCase(keyPart[0])){ + if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){ + if(!mi.getVersion().equals(keyPart[1])){ + continue; + } + } + + return mi; + } } - System.out.println(""); } - */ - toolChainFamilyMap = map; - } - - public static String[] getToolChainFamilies() { - String[] toolChainFamilyList = new String[toolChainFamilies.size()]; - return (String[])toolChainFamilies.toArray(toolChainFamilyList); - } - - public static String[] getToolChainFamilies(String toolChain) { - Set familySet = (Set)toolChainFamilyMap.get(toolChain); - String[] toolChainFamilyList = new String[familySet.size()]; - return (String[])familySet.toArray(toolChainFamilyList); - } - - public static Set getToolChainFamilySet(String toolChain) { - return (Set)toolChainFamilyMap.get(toolChain); - } - - public static void setArchs(Set archSet) { - archs = archSet; - } - - public static String[] getArchs() { - String[] archList = new String[archs.size()]; - return (String[])archs.toArray(archList); - } - /* - - */ - public static void SetCommandTypes(Set commandTypeSet) { - commandTypes = commandTypeSet; - } - /* - - */ - public static void SetCommandTypes(Map> commandTypeMap) { - toolChainCommandMap = commandTypeMap; - } - /* - - */ - public static String[] getCommandTypes() { - String[] commandList = new String[commandTypes.size()]; - return (String[])commandTypes.toArray(commandList); + return null; } - /* - - */ - public static String[] getCommandTypes(String toolChain) { - Set commands = (Set)toolChainCommandMap.get(toolChain); - if (commands == null) { - return new String[0]; + + public static Vector getModuleSupArchs(ModuleIdentification mi) throws Exception{ + Vector vArchs = null; + ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi); + if (msa.getModuleDefinitions() == null || msa.getModuleDefinitions().getSupportedArchitectures() == null) { + return vArchs; + } + ListIterator li = msa.getModuleDefinitions().getSupportedArchitectures().listIterator(); + while (li.hasNext()) { + if (vArchs == null) { + vArchs = new Vector(); + } + vArchs.add((String)li.next()); } - - String[] commandList = new String[commands.size()]; - return (String[])commands.toArray(commandList); - } - /* - - */ - public static String getCommandSetting(String commandDescString) { - return (String)toolChainDefinitions.get(commandDescString); - } - /* - - */ - public static void setToolChainDefinitions(Map def) { - toolChainDefinitions = def; - } - - public static Map getToolChainDefinitions() { - return toolChainDefinitions; + + return vArchs; } - + } final class KeyComparator implements Comparator {