X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2Fglobal%2FGlobalData.java;h=51f198571a9241a11999f017d2697e3a75cdb242;hp=e843362c290266e95a76acc0348752daa26b06b0;hb=23583a8891e878633a430212502dfa97fd143573;hpb=136adffc5cd7efb21a38a980ff361edaa29629b3 diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java index e843362c29..51f198571a 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java @@ -166,8 +166,7 @@ public class GlobalData { // If ToolChain has been set up before, do nothing. // CONF dir + tools definition file name // - String confDir = GlobalData.workspaceDir + File.separatorChar + "Tools" + File.separatorChar + "Conf"; - File toolsDefFile = new File(confDir + File.separatorChar + toolsDefFilename); + File toolsDefFile = new File(workspaceDir + File.separatorChar + toolsDefFilename); System.out.println("Using file [" + toolsDefFile.getPath() + "] as tools definition file. "); toolsDef = new ToolChainConfig(toolsDefFile); @@ -231,7 +230,6 @@ public class GlobalData { } } } catch (Exception e) { - e.printStackTrace(); throw new BuildException("Parse workspace Database [" + dbFile.getPath() + "] Error.\n" + e.getMessage()); } } @@ -576,21 +574,27 @@ public class GlobalData { } - /////////////////////////// Update!! Update!! Update!! -// public synchronized static MemoryDatabaseManager getPCDMemoryDBManager() { -// return pcdDbManager; -// } - /////////////////////////// - public synchronized static PlatformIdentification getPlatform(String name) throws BuildException { + public synchronized static PlatformIdentification getPlatformByName(String name) throws BuildException { Iterator iter = platformList.iterator(); while(iter.hasNext()){ PlatformIdentification platformId = (PlatformIdentification)iter.next(); if (platformId.getName().equalsIgnoreCase(name)) { -// GlobalData.log.info("Platform: " + platformId + platformId.getFpdFile()); return platformId; } } - throw new BuildException("Can't find platform [" + name + "] in current workspace. "); + throw new BuildException("Can't find platform [" + name + "] in current workspace database. "); + } + + public synchronized static PlatformIdentification getPlatform(String filename) throws BuildException { + File file = new File(workspaceDir + File.separatorChar + filename); + Iterator iter = platformList.iterator(); + while(iter.hasNext()){ + PlatformIdentification platformId = (PlatformIdentification)iter.next(); + if (platformId.getFpdFile().getPath().equalsIgnoreCase(file.getPath())) { + return platformId; + } + } + throw new BuildException("Can't find platform file [" + filename + "] in current workspace database. "); } public synchronized static PackageIdentification refreshPackageIdentification(PackageIdentification packageId) throws BuildException { @@ -684,6 +688,19 @@ public class GlobalData { moduleToolChainFamilyOption.put(fpdModuleId, toolChainOption); } + public static boolean isCommandSet(String target, String toolchain, String arch) { + String[] commands = getToolChainInfo().getCommands(); + + for (int i = 0; i < commands.length; ++i) { + String cmdName = toolsDef.getConfig().get(new String[] {target, toolchain, arch, commands[i], ToolChainAttribute.NAME.toString()}); + if (cmdName != null && cmdName.length() != 0) { + return true; + } + } + + return false; + } + public static String getCommandSetting(String[] commandDescription, FpdModuleIdentification fpdModuleId) throws EdkException { ToolChainKey toolChainKey = new ToolChainKey(commandDescription); ToolChainMap toolChainConfig = toolsDef.getConfig(); @@ -768,13 +785,18 @@ public class GlobalData { String guid = null; Set set = spdTable.keySet(); Iterator iter = set.iterator(); - + + if (iter == null) { + return null; + } + while (iter.hasNext()){ Spd spd = (Spd) spdTable.get(iter.next()); guid = spd.getGuidFromCname(cName); if (guid != null){ - cNameGuid[0] = new String(cName); - cNameGuid[1] = new String(guid); + cNameGuid = new String[2]; + cNameGuid[0] = cName; + cNameGuid[1] = guid; break; } }