From 03b1a72da7fbda3f1e11a08557da9a9e8a6e3b8b Mon Sep 17 00:00:00 2001 From: klu2 Date: Thu, 22 Jun 2006 08:17:35 +0000 Subject: In before, module type is judged by the sub element value in , it is not totally correct. Now the module type will be retrieved from GlobalData after pre-process all MSA document. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@595 6f19259b-4bc3-4df7-8a09-765794883524 --- .../tianocore/build/global/SurfaceAreaQuery.java | 16 +++++ .../build/pcd/action/CollectPCDAction.java | 75 ++++------------------ .../tianocore/build/pcd/entity/UsageInstance.java | 15 ++--- 3 files changed, 33 insertions(+), 73 deletions(-) diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java index 50345c8a68..35fd77833a 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java @@ -886,6 +886,22 @@ public class SurfaceAreaQuery { return (ModuleSADocument.ModuleSA[]) result; } + /** + Retrieve all documents from FPD file. + + @returns ModuleSA objects list if elements are found at the known xpath + @returns Empty ModuleSA list if nothing is there + **/ + public static ModuleSADocument.ModuleSA[] getFpdModuleSAs() { + String[] xPath = new String[] { "/FrameworkModules/*/ModuleSA" }; + + XmlObject[] result = get("FrameworkPlatformDescription", xPath); + if (result != null) { + return (ModuleSADocument.ModuleSA[]) result; + } + return new ModuleSADocument.ModuleSA[0]; + } + /** Retrieve variables for FV images diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java index dc60cc6eb7..3edadc6959 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java +++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java @@ -52,6 +52,7 @@ import org.tianocore.build.pcd.entity.SkuInstance; import org.tianocore.build.pcd.entity.Token; import org.tianocore.build.pcd.entity.UsageInstance; import org.tianocore.build.pcd.exception.EntityException; +import org.tianocore.ModuleTypeDef; class StringTable { private ArrayList al; @@ -1185,9 +1186,9 @@ class PcdDatabase { class ModuleInfo { public ModuleSADocument.ModuleSA module; - public UsageInstance.MODULE_TYPE type; + public ModuleTypeDef.Enum type; - public ModuleInfo (ModuleSADocument.ModuleSA module, UsageInstance.MODULE_TYPE type) { + public ModuleInfo (ModuleSADocument.ModuleSA module, ModuleTypeDef.Enum type) { this.module = module; this.type = type; } @@ -1345,14 +1346,13 @@ public class CollectPCDAction { */ private List getComponentsFromFPD() throws EntityException { - HashMap map = new HashMap(); List allModules = new ArrayList(); ModuleInfo current = null; int index = 0; org.tianocore.Components components = null; FrameworkModulesDocument.FrameworkModules fModules = null; - java.util.List modules = null; - + ModuleSADocument.ModuleSA[] modules = null; + HashMap map = new HashMap(); if (fpdDocInstance == null) { try { @@ -1365,64 +1365,13 @@ public class CollectPCDAction { } - // - // Check whether FPD contians - // - fModules = fpdDocInstance.getFrameworkPlatformDescription().getFrameworkModules(); - if (fModules == null) { - return null; - } - - // - // BUGBUG: The following is work around code, the final component type should be get from - // GlobalData class. - // - components = fModules.getSEC(); - if (components != null) { - modules = components.getModuleSAList(); - for (index = 0; index < modules.size(); index ++) { - allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.SEC)); - } - } - - components = fModules.getPEICORE(); - if (components != null) { - modules = components.getModuleSAList(); - for (index = 0; index < modules.size(); index ++) { - allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.PEI_CORE)); - } - } - - components = fModules.getPEIM(); - if (components != null) { - modules = components.getModuleSAList(); - for (index = 0; index < modules.size(); index ++) { - allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.PEIM)); - } - } - - components = fModules.getDXECORE(); - if (components != null) { - modules = components.getModuleSAList(); - for (index = 0; index < modules.size(); index ++) { - allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.DXE_CORE)); - } - } - - components = fModules.getDXEDRIVERS(); - if (components != null) { - modules = components.getModuleSAList(); - for (index = 0; index < modules.size(); index ++) { - allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.DXE_DRIVERS)); - } - } - - components = fModules.getOTHERCOMPONENTS(); - if (components != null) { - modules = components.getModuleSAList(); - for (index = 0; index < modules.size(); index ++) { - allModules.add(new ModuleInfo(modules.get(index), UsageInstance.MODULE_TYPE.OTHER_COMPONENTS)); - } + map.put("FrameworkPlatformDescription", fpdDocInstance); + SurfaceAreaQuery.setDoc(map); + modules = SurfaceAreaQuery.getFpdModuleSAs(); + for (index = 0; index < modules.length; index ++) { + SurfaceAreaQuery.setDoc(GlobalData.getDoc(modules[index].getModuleName())); + allModules.add(new ModuleInfo(modules[index], + ModuleTypeDef.Enum.forString(SurfaceAreaQuery.getModuleType()))); } return allModules; diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java index 2769d497f7..3bebc45829 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java +++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java @@ -19,7 +19,7 @@ package org.tianocore.build.pcd.entity; import java.util.UUID; - +import org.tianocore.ModuleTypeDef; import org.tianocore.build.autogen.CommonDefinition; import org.tianocore.build.pcd.action.ActionMessage; import org.tianocore.build.pcd.exception.EntityException; @@ -30,11 +30,6 @@ import org.tianocore.build.pcd.exception.EntityException; is an usage instance for this PCD token. **/ public class UsageInstance { - /// - /// The module type of usage instance. - /// - public enum MODULE_TYPE {SEC, PEI_CORE, PEIM, DXE_CORE, DXE_DRIVERS, OTHER_COMPONENTS} - /// /// This parent that this usage instance belongs to. /// @@ -78,7 +73,7 @@ public class UsageInstance { /// /// The module type for this usage instance. /// - public MODULE_TYPE moduleType; + public ModuleTypeDef.Enum moduleType; /// /// The value of the PCD in this usage instance. @@ -122,7 +117,7 @@ public class UsageInstance { UUID moduleGUID, String packageName, UUID packageGUID, - MODULE_TYPE moduleType, + ModuleTypeDef.Enum moduleType, Token.PCD_TYPE modulePcdType, String arch, String version, @@ -185,8 +180,8 @@ public class UsageInstance { @return boolean */ public boolean isPeiPhaseComponent() { - if ((moduleType == MODULE_TYPE.PEI_CORE) || - (moduleType == MODULE_TYPE.PEIM)) { + if ((moduleType == ModuleTypeDef.PEI_CORE) || + (moduleType == ModuleTypeDef.PEIM)) { return true; } return false; -- cgit v1.2.3