]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
Removed the printStackTrace() which is used only for debug purpose.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / global / GlobalData.java
index e843362c290266e95a76acc0348752daa26b06b0..51f198571a9241a11999f017d2697e3a75cdb242 100644 (file)
@@ -166,8 +166,7 @@ public class GlobalData {
         // 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
@@ -231,7 +230,6 @@ public class GlobalData {
                 }\r
             }\r
         } catch (Exception e) {\r
-            e.printStackTrace();\r
             throw new BuildException("Parse workspace Database [" + dbFile.getPath() + "] Error.\n" + e.getMessage());\r
         }\r
     }\r
@@ -576,21 +574,27 @@ public class GlobalData {
 \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
@@ -684,6 +688,19 @@ public class GlobalData {
         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
@@ -768,13 +785,18 @@ public class GlobalData {
         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