]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java
Fix the bug that using hardcode driver name to judge whether current driver is PCD...
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / FrameworkBuildTask.java
index 286fd69490d5b4bb46d42358552a9cf78e131f0c..d236c5b5bb586df335950045a0554e798e9dfae6 100644 (file)
@@ -96,8 +96,10 @@ public class FrameworkBuildTask extends Task{
         //\r
         // Global Data initialization\r
         //\r
+        File workspacePath = new File(getProject().getProperty("WORKSPACE"));\r
+        getProject().setProperty("WORKSPACE_DIR", workspacePath.getPath().replaceAll("(\\\\)", "/"));\r
         GlobalData.initInfo("Tools" + File.separatorChar + "Conf" + File.separatorChar + "FrameworkDatabase.db",\r
-                            getProject().getProperty("WORKSPACE_DIR"), toolsDefFilename);\r
+                workspacePath.getPath(), toolsDefFilename);\r
         \r
 \r
         \r
@@ -110,38 +112,33 @@ public class FrameworkBuildTask extends Task{
         //\r
         File buildFile = null;\r
         if (msaFiles.size() > 1) {\r
-            throw new BuildException("More than one MSA file under current directory. It is not allowd. ");\r
-        }\r
-        else if (msaFiles.size() == 1 && activePlatform == null) {\r
-            throw new BuildException("If try to build a single module, please set ACTIVE_PLATFORM in file [Tool/Conf/target.txt]. ");\r
-        }\r
-        else if (msaFiles.size() == 1 && activePlatform != null) {\r
+            throw new BuildException("Having more than one MSA file in a directory is not allowed!");\r
+        } else if (msaFiles.size() == 1 && activePlatform == null) {\r
+            throw new BuildException("If trying to build a single module, please set ACTIVE_PLATFORM in file [Tool/Conf/target.txt]. ");\r
+        } else if (msaFiles.size() == 1 && activePlatform != null) {\r
             //\r
             // Build the single module\r
             //\r
             buildFile = msaFiles.toArray(new File[1])[0];\r
-        }\r
-        else if (activePlatform != null) {\r
+        } else if (activePlatform != null) {\r
             buildFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform);\r
-        }\r
-        else if (fpdFiles.size() == 1) {\r
+        } else if (fpdFiles.size() == 1) {\r
             buildFile = fpdFiles.toArray(new File[1])[0];\r
-        }\r
-        else if (fpdFiles.size() > 1) {\r
+        } else if (fpdFiles.size() > 1) {\r
             buildFile = intercommuniteWithUser();\r
         }\r
         //\r
         // If there is no build files or FPD files or MSA files, stop build\r
         //\r
         else {\r
-            throw new BuildException("Can't find any FPD files or MSA files in current directory. ");\r
+            throw new BuildException("Can't find any FPD or MSA files in the current directory. ");\r
         }\r
 \r
         //\r
         // Build every FPD files (PLATFORM build)\r
         //\r
         if (buildFile.getName().endsWith(".fpd")) {\r
-            System.out.println("Start to build FPD file [" + buildFile.getPath() + "] ..>> ");\r
+            System.out.println("Processing the FPD file [" + buildFile.getPath() + "] ..>> ");\r
             FpdParserTask fpdParserTask = new FpdParserTask();\r
             fpdParserTask.setType(type);\r
             fpdParserTask.setProject(getProject());\r
@@ -153,7 +150,9 @@ public class FrameworkBuildTask extends Task{
         // Build every MSA files (SINGLE MODULE BUILD)\r
         //\r
         else if (buildFile.getName().endsWith(".msa")) {\r
-            System.out.println("Start to build MSA file [" + buildFile.getPath() + "] ..>> ");\r
+            File tmpFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform);\r
+            System.out.println("Using the FPD file [" + tmpFile.getPath() + "] for the active platform. ");\r
+            System.out.println("Processing the MSA file [" + buildFile.getPath() + "] ..>> ");\r
             GenBuildTask genBuildTask = new GenBuildTask();\r
             genBuildTask.setSingleModuleBuild(true);\r
             genBuildTask.setType(type);\r
@@ -187,26 +186,22 @@ public class FrameworkBuildTask extends Task{
 \r
     private File intercommuniteWithUser(){\r
         File file = null;\r
-        if (fpdFiles.size() + msaFiles.size() > 1) {\r
-            File[] allFiles = new File[fpdFiles.size() + msaFiles.size()];\r
+        if (fpdFiles.size() > 1) {\r
+            File[] allFiles = new File[fpdFiles.size()];\r
             int index = 0;\r
             Iterator<File> iter = fpdFiles.iterator();\r
             while (iter.hasNext()) {\r
                 allFiles[index] = iter.next();\r
                 index++;\r
             }\r
-            iter = msaFiles.iterator();\r
-            while (iter.hasNext()) {\r
-                allFiles[index] = iter.next();\r
-                index++;\r
-            }\r
-            System.out.println("Find " + allFiles.length + " FPD and MSA files: ");\r
+\r
+            System.out.println("Finding " + allFiles.length + " FPD files: ");\r
             for (int i = 0; i < allFiles.length; i++) {\r
                 System.out.println("[" + (i + 1) + "]: " + allFiles[i].getName());\r
             }\r
             \r
             boolean flag = true;\r
-            System.out.print("Please select one file to build:[1] ");\r
+            System.out.print("Please select one of the following FPD files to build:[1] ");\r
             do{\r
                 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r
                 try {\r
@@ -230,13 +225,9 @@ public class FrameworkBuildTask extends Task{
                     flag = true;\r
                 }\r
             } while (flag);\r
-        }\r
-        else if (fpdFiles.size() == 1) {\r
+        } else if (fpdFiles.size() == 1) {\r
             file = fpdFiles.toArray(new File[1])[0];\r
         }\r
-        else if (msaFiles.size() == 1) {\r
-            file = msaFiles.toArray(new File[1])[0];\r
-        }\r
         return file;\r
     }\r
     \r
@@ -244,8 +235,7 @@ public class FrameworkBuildTask extends Task{
     public void setType(String type) {\r
         if (type.equalsIgnoreCase("clean") || type.equalsIgnoreCase("cleanall")) {\r
             this.type = type.toLowerCase();\r
-        }\r
-        else {\r
+        } else {\r
             this.type = "all";\r
         }\r
     }\r
@@ -261,22 +251,19 @@ public class FrameworkBuildTask extends Task{
             String str = getValue("TARGET", targetFileInfo);\r
             if (str == null || str.trim().equals("")) {\r
                 envToolChainInfo.addTargets("*");\r
-            }\r
-            else {\r
+            } else {\r
                 envToolChainInfo.addTargets(str);\r
             }\r
             str = getValue("TOOL_CHAIN_TAG", targetFileInfo);\r
             if (str == null || str.trim().equals("")) {\r
                 envToolChainInfo.addTagnames("*");\r
-            }\r
-            else {\r
+            } else {\r
                 envToolChainInfo.addTagnames(str);\r
             }\r
             str = getValue("TARGET_ARCH", targetFileInfo);\r
             if (str == null || str.trim().equals("")) {\r
                 envToolChainInfo.addArchs("*");\r
-            }\r
-            else {\r
+            } else {\r
                 envToolChainInfo.addArchs(str);\r
             }\r
             GlobalData.setToolChainEnvInfo(envToolChainInfo);\r
@@ -289,7 +276,7 @@ public class FrameworkBuildTask extends Task{
             str = getValue("ACTIVE_PLATFORM", targetFileInfo);\r
             if (str != null && ! str.trim().equals("")) {\r
                 if ( ! str.endsWith(".fpd")) {\r
-                    throw new BuildException("FPD file's file extension must be \".fpd\"");\r
+                    throw new BuildException("FPD file's extension must be \".fpd\"!");\r
                 }\r
                 activePlatform = str;\r
             }\r