// If ToolChain has been set up before, do nothing.\r
// CONF dir + tools definition file name\r
//\r
- String confDir = GlobalData.workspaceDir + File.separatorChar + "Tools" + File.separatorChar + "Conf";\r
- File toolsDefFile = new File(confDir + File.separatorChar + toolsDefFilename);\r
+ File toolsDefFile = new File(workspaceDir + File.separatorChar + toolsDefFilename);\r
System.out.println("Using file [" + toolsDefFile.getPath() + "] as tools definition file. ");\r
toolsDef = new ToolChainConfig(toolsDefFile);\r
\r
}\r
}\r
} catch (Exception e) {\r
- e.printStackTrace();\r
throw new BuildException("Parse workspace Database [" + dbFile.getPath() + "] Error.\n" + e.getMessage());\r
}\r
}\r
\r
}\r
\r
- /////////////////////////// Update!! Update!! Update!!\r
-// public synchronized static MemoryDatabaseManager getPCDMemoryDBManager() {\r
-// return pcdDbManager;\r
-// }\r
- ///////////////////////////\r
- public synchronized static PlatformIdentification getPlatform(String name) throws BuildException {\r
+ public synchronized static PlatformIdentification getPlatformByName(String name) throws BuildException {\r
Iterator iter = platformList.iterator();\r
while(iter.hasNext()){\r
PlatformIdentification platformId = (PlatformIdentification)iter.next();\r
if (platformId.getName().equalsIgnoreCase(name)) {\r
-// GlobalData.log.info("Platform: " + platformId + platformId.getFpdFile());\r
return platformId;\r
}\r
}\r
- throw new BuildException("Can't find platform [" + name + "] in current workspace. ");\r
+ throw new BuildException("Can't find platform [" + name + "] in current workspace database. ");\r
+ }\r
+ \r
+ public synchronized static PlatformIdentification getPlatform(String filename) throws BuildException {\r
+ File file = new File(workspaceDir + File.separatorChar + filename);\r
+ Iterator iter = platformList.iterator();\r
+ while(iter.hasNext()){\r
+ PlatformIdentification platformId = (PlatformIdentification)iter.next();\r
+ if (platformId.getFpdFile().getPath().equalsIgnoreCase(file.getPath())) {\r
+ return platformId;\r
+ }\r
+ }\r
+ throw new BuildException("Can't find platform file [" + filename + "] in current workspace database. ");\r
}\r
\r
public synchronized static PackageIdentification refreshPackageIdentification(PackageIdentification packageId) throws BuildException {\r
moduleToolChainFamilyOption.put(fpdModuleId, toolChainOption);\r
}\r
\r
+ public static boolean isCommandSet(String target, String toolchain, String arch) {\r
+ String[] commands = getToolChainInfo().getCommands();\r
+\r
+ for (int i = 0; i < commands.length; ++i) {\r
+ String cmdName = toolsDef.getConfig().get(new String[] {target, toolchain, arch, commands[i], ToolChainAttribute.NAME.toString()});\r
+ if (cmdName != null && cmdName.length() != 0) {\r
+ return true;\r
+ }\r
+ }\r
+\r
+ return false;\r
+ }\r
+\r
public static String getCommandSetting(String[] commandDescription, FpdModuleIdentification fpdModuleId) throws EdkException {\r
ToolChainKey toolChainKey = new ToolChainKey(commandDescription);\r
ToolChainMap toolChainConfig = toolsDef.getConfig(); \r
String guid = null;\r
Set set = spdTable.keySet();\r
Iterator iter = set.iterator();\r
- \r
+\r
+ if (iter == null) {\r
+ return null;\r
+ }\r
+\r
while (iter.hasNext()){\r
Spd spd = (Spd) spdTable.get(iter.next());\r
guid = spd.getGuidFromCname(cName);\r
if (guid != null){\r
- cNameGuid[0] = new String(cName);\r
- cNameGuid[1] = new String(guid);\r
+ cNameGuid = new String[2];\r
+ cNameGuid[0] = cName;\r
+ cNameGuid[1] = guid;\r
break;\r
}\r
}\r