Fixed EDKT482. Added support for multiple msa files in the same directory.
[mirror_edk2.git] / Tools / Java / Source / GenBuild / org / tianocore / build / FrameworkBuildTask.java
index 3d17bef..84e799d 100644 (file)
@@ -207,11 +207,10 @@ public class FrameworkBuildTask extends Task{
         // If find more than one FPD files, report error.  \r
         //\r
         File buildFile = null;\r
-        if (msaFiles.size() > 1) {\r
-            throw new BuildException("Found " + msaFiles.size() + " MSA files in current dir. ");\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 [" + targetFilename + "]. ");\r
-        } else if (msaFiles.size() == 1 && activePlatform != null) {\r
+        if (msaFiles.size() > 0) {\r
+            if (activePlatform == null) {\r
+                throw new BuildException("If trying to build a single module, please set ACTIVE_PLATFORM in file [" + targetFilename + "]. ");\r
+            }\r
             //\r
             // Build the single module\r
             //\r
@@ -278,17 +277,21 @@ public class FrameworkBuildTask extends Task{
             }\r
             File tmpFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform);\r
             EdkLog.log(this, "Using the FPD file [" + tmpFile.getPath() + "] for the active platform. ");\r
-            EdkLog.log(this, "Processing the MSA file [" + buildFile.getPath() + "] ..>> ");\r
-            GenBuildTask genBuildTask = new GenBuildTask();\r
-            genBuildTask.setSingleModuleBuild(true);\r
-            genBuildTask.setType(type);\r
-            getProject().setProperty("PLATFORM_FILE", activePlatform);\r
-            if( !multithread) {\r
-                originalProperties.put("PLATFORM_FILE", activePlatform);\r
+\r
+            File[] moduleFiles = msaFiles.toArray(new File[msaFiles.size()]);\r
+            for (int i = 0; i < moduleFiles.length; ++i) {\r
+                EdkLog.log(this, "Processing the MSA file [" + moduleFiles[i].getPath() + "] ..>> ");\r
+                GenBuildTask genBuildTask = new GenBuildTask();\r
+                genBuildTask.setSingleModuleBuild(true);\r
+                genBuildTask.setType(type);\r
+                getProject().setProperty("PLATFORM_FILE", activePlatform);\r
+                if( !multithread) {\r
+                    originalProperties.put("PLATFORM_FILE", activePlatform);\r
+                }\r
+                genBuildTask.setProject(getProject());\r
+                genBuildTask.setMsaFile(moduleFiles[i]);\r
+                genBuildTask.perform();\r
             }\r
-            genBuildTask.setProject(getProject());\r
-            genBuildTask.setMsaFile(buildFile);\r
-            genBuildTask.perform();\r
         }\r
     }\r
     \r