import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.Project;\r
import org.apache.xmlbeans.XmlCursor;\r
-import org.apache.xmlbeans.XmlObject;\r
import org.tianocore.BuildOptionsDocument;\r
import org.tianocore.build.global.GlobalData;\r
import org.tianocore.build.global.SurfaceAreaQuery;\r
import org.tianocore.build.id.FpdModuleIdentification;\r
import org.w3c.dom.Document;\r
import org.w3c.dom.Element;\r
-import org.w3c.dom.Node;\r
\r
/** \r
<p><code>FfsProcess</code> is a class to find the corresponding FFS layout. </p>\r
**/\r
public class FfsProcess {\r
\r
- ///\r
- /// Xml Document Node for corresponding FFS layout\r
- ///\r
- private Node ffs;\r
- \r
private BuildOptionsDocument.BuildOptions.Ffs ffsXmlObject;\r
\r
///\r
**/\r
public boolean initSections(String buildType, Project project, FpdModuleIdentification fpdModuleId) throws BuildException {\r
//\r
- // Firstly, try to find in ModuleSA\r
- //\r
-// BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = SurfaceAreaQuery.getModuleFfs();\r
-// for (int i = 0; i < ffsArray.length; i++) {\r
-// if (isMatch(ffsArray[i].getFfsKey(), buildType)) {\r
-// ffsXmlObject = ffsArray[i];\r
-// return true;\r
-// }\r
-// }\r
- \r
- //\r
- // secondly, try to sections defined in PLATFORM level\r
+ // Try to find Ffs layout from FPD file\r
//\r
SurfaceAreaQuery.push(GlobalData.getFpdBuildOptions());\r
BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = SurfaceAreaQuery.getFpdFfs();\r
//\r
if (buildType == null) {\r
System.out.println("Warning: this module doesn't specify a FfsFormatKey. ");\r
- }\r
- else {\r
+ } else {\r
throw new BuildException("Can't find the FfsFormatKey [" + buildType + "] attribute in the FPD file!"); \r
}\r
\r
- if (ffs == null) {\r
- return false;\r
- } else {\r
- return true;\r
- }\r
+ return false;\r
}\r
\r
/**\r
**/\r
public String[] getGenSectionElements(Document document, String basename, String guid, String targetFilename) {\r
this.basename = basename;\r
- if (ffs == null && ffsXmlObject == null) {\r
+ if (ffsXmlObject == null) {\r
return new String[0];\r
}\r
Vector<String> sectionList = new Vector<String>();\r
XmlCursor cursor = null;\r
try {\r
- if (ffsXmlObject == null) {\r
- cursor = XmlObject.Factory.parse(ffs).newCursor();\r
- }\r
- else {\r
- cursor = ffsXmlObject.newCursor();\r
- }\r
+ cursor = ffsXmlObject.newCursor();\r
} catch (Exception e) {\r
return null;\r
}\r
int mode = MODE_NONE;\r
- Element root = document.createElement("genffsfile");\r
- root.setAttribute("outputDir", "${BIN_DIR}");\r
- root.setAttribute("moduleType", "${MODULE_TYPE}");\r
- root.setAttribute("BaseName", basename);\r
- root.setAttribute("fileGuid", guid);\r
- if (ffsXmlObject == null) {\r
- cursor.toFirstChild();\r
- }\r
+ Element genffsfileEle = document.createElement("genffsfile");\r
+ genffsfileEle.setAttribute("outputDir", "${BIN_DIR}");\r
+ genffsfileEle.setAttribute("moduleType", "${MODULE_TYPE}");\r
+ genffsfileEle.setAttribute("BaseName", basename);\r
+ genffsfileEle.setAttribute("fileGuid", guid);\r
+\r
if (cursor.toFirstChild()) {\r
do {\r
if (cursor.getName().getLocalPart().equalsIgnoreCase("Attribute")) {\r
String name = cursor.getAttributeText(new QName("Name"));\r
String value = cursor.getAttributeText(new QName("Value"));\r
- root.setAttribute(changeAttributeName(name), value);\r
+ genffsfileEle.setAttribute(changeAttributeName(name), value);\r
} else if (cursor.getName().getLocalPart().equalsIgnoreCase("Section")) {\r
cursor.push();\r
- dealSection(mode, document, root, cursor, sectionList);\r
+ dealSection(mode, document, genffsfileEle, cursor, sectionList);\r
cursor.pop();\r
} else if (cursor.getName().getLocalPart().equalsIgnoreCase("Sections")) {\r
cursor.push();\r
- dealSections(mode, document, root, cursor, sectionList);\r
+ dealSections(mode, document, genffsfileEle, cursor, sectionList);\r
cursor.pop();\r
}\r
} while (cursor.toNextSibling());\r
targetEle.appendChild(fileEle);\r
outofdateEle.appendChild(targetEle);\r
Element sequentialEle = document.createElement("sequential");\r
- sequentialEle.appendChild(root);\r
+ sequentialEle.appendChild(genffsfileEle);\r
outofdateEle.appendChild(sequentialEle);\r
ffsNode = outofdateEle;\r
return result;\r
@param root Root node\r
**/\r
public synchronized void parseFile(String filename, Node root) throws BuildException {\r
- boolean flag = false;\r
for (int i = 0; i < fileTypes.length; i++) {\r
if (filename.endsWith(fileTypes[i][0])) {\r
- flag = true;\r
parseFile(filename, fileTypes[i][2], root);\r
+ return ;\r
}\r
}\r
- /*\r
- if (!flag) {\r
- throw new BuildException("File [" + filename + "] is not known from its suffix.");\r
- }\r
- */\r
}\r
\r
/**\r
File buildFile = null;\r
if (msaFiles.size() > 1) {\r
throw new BuildException("Having more than one MSA file in a directory is not allowed!");\r
- }\r
- else if (msaFiles.size() == 1 && activePlatform == null) {\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
- }\r
- else if (msaFiles.size() == 1 && activePlatform != null) {\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
\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("Finding " + 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
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
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
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
///\r
File msaFile;\r
\r
- ///\r
- ///\r
- ///\r
- private String type = "all"; // = "build";\r
-\r
+ private String type = "all"; \r
+ \r
///\r
/// Module's Identification.\r
///\r
GenBuildLogger logger = new GenBuildLogger(getProject());\r
EdkLog.setLogLevel(getProject().getProperty("env.LOGLEVEL"));\r
EdkLog.setLogger(logger);\r
- // remove !!\r
- try {\r
+\r
pushProperties();\r
//\r
// Enable all specified properties\r
Map<String, XmlObject> doc = GlobalData.getNativeMsa(moduleId);\r
SurfaceAreaQuery.setDoc(doc);\r
moduleId = SurfaceAreaQuery.getMsaHeader();\r
- }\r
- else {\r
+ } else {\r
Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile);\r
SurfaceAreaQuery.setDoc(doc);\r
moduleId = SurfaceAreaQuery.getMsaHeader();\r
String[] producedLibraryClasses = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED",null);\r
if (producedLibraryClasses.length == 0) {\r
moduleId.setLibrary(false);\r
- }\r
- else {\r
+ } else {\r
moduleId.setLibrary(true);\r
}\r
\r
// Single Module build\r
//\r
prepareSingleModuleBuild();\r
- }\r
- else {\r
+ } else {\r
//\r
// Platform build. Restore the platform related info\r
//\r
}\r
\r
//\r
- // If single module : intersection MSA supported ARCHs and tools def!!\r
- // else, get arch from pass down\r
+ // If single module : get arch from pass down, otherwise intersection MSA \r
+ // supported ARCHs and tools def\r
//\r
Set<String> archListSupByToolChain = new LinkedHashSet<String>();\r
String[] archs = GlobalData.getToolChainInfo().getArchs();\r
archSet.add(fpdArchList[i]);\r
}\r
}\r
- }\r
- else {\r
- archSet = archListSupByToolChain;\r
+ } else {\r
+ archSet = archListSupByToolChain; \r
}\r
\r
String[] archList = archSet.toArray(new String[archSet.size()]);\r
\r
if (type.equalsIgnoreCase("all") || type.equalsIgnoreCase("build")) {\r
applyBuild(targetList[i], toolchainList[j], fpdModuleId);\r
- }\r
- else if (type.equalsIgnoreCase("clean")) {\r
+ } else if (type.equalsIgnoreCase("clean")) {\r
applyClean(fpdModuleId);\r
- }\r
- else if (type.equalsIgnoreCase("cleanall")) {\r
+ } else if (type.equalsIgnoreCase("cleanall")) {\r
applyCleanall(fpdModuleId);\r
}\r
}\r
}\r
}\r
+ \r
popProperties();\r
- }catch (Exception e){\r
- throw new BuildException(e.getMessage());\r
- }\r
}\r
\r
/**\r
moduleId.setPackage(packageId);\r
\r
//\r
- // Read ACTIVE_PLATFORM's FPD file (Call FpdParserTask's method)\r
+ // Read ACTIVE_PLATFORM's FPD file \r
//\r
String filename = getProject().getProperty("PLATFORM_FILE");\r
\r
PlatformIdentification platformId = GlobalData.getPlatform(filename);\r
\r
//\r
- // Read FPD file\r
+ // Read FPD file (Call FpdParserTask's method)\r
//\r
FpdParserTask fpdParser = new FpdParserTask();\r
fpdParser.setProject(getProject());\r
\r
/**\r
Set Module-Related information to properties.\r
+ \r
+ @param arch current build ARCH\r
**/\r
private void setModuleCommonProperties(String arch) {\r
//\r
String baseName = SurfaceAreaQuery.getModuleOutputFileBasename();\r
if (baseName == null) {\r
getProject().setProperty("BASE_NAME", moduleId.getName());\r
- }\r
- else {\r
+ } else {\r
getProject().setProperty("BASE_NAME", baseName);\r
}\r
getProject().setProperty("GUID", moduleId.getGuid());\r
//\r
if (arch.equalsIgnoreCase("EBC")) {\r
getProject().setProperty("ENTRYPOINT", "EfiStart");\r
- }\r
- else {\r
+ } else {\r
getProject().setProperty("ENTRYPOINT", "_ModuleEntryPoint");\r
}\r
\r
String extName = GlobalData.getCommandSetting(key, fpdModuleId);\r
if ( extName != null && ! extName.equalsIgnoreCase("")) {\r
getProject().setProperty(cmd[m] + "_EXT", extName);\r
- }\r
- else {\r
+ } else {\r
getProject().setProperty(cmd[m] + "_EXT", "");\r
}\r
\r
String spath = GlobalData.getCommandSetting(key, fpdModuleId);\r
if (spath != null) {\r
getProject().setProperty(cmd[m] + "_SPATH", spath.replaceAll("(\\\\)", "/"));\r
- }\r
- else {\r
+ } else {\r
getProject().setProperty(cmd[m] + "_SPATH", "");\r
}\r
\r
String dpath = GlobalData.getCommandSetting(key, fpdModuleId);\r
if (dpath != null) {\r
getProject().setProperty(cmd[m] + "_DPATH", dpath.replaceAll("(\\\\)", "/"));\r
- }\r
- else {\r
+ } else {\r
getProject().setProperty(cmd[m] + "_DPATH", "");\r
}\r
}\r
this.type = type;\r
}\r
\r
- private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws EdkException{\r
+ private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws BuildException{\r
//\r
// AutoGen\r
//\r
//\r
// Get compiler flags\r
//\r
- getCompilerFlags(buildTarget, buildTagname, fpdModuleId);\r
-\r
+ try {\r
+ getCompilerFlags(buildTarget, buildTagname, fpdModuleId);\r
+ }\r
+ catch (EdkException ee) {\r
+ throw new BuildException(ee.getMessage());\r
+ }\r
+ \r
//\r
// Prepare LIBS\r
//\r
//\r
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r
GlobalData.log.info("Call user-defined " + moduleId.getName() + "_build.xml");\r
- Ant ant = new Ant();\r
- ant.setProject(getProject());\r
- ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");\r
- ant.setInheritAll(true);\r
- ant.init();\r
- ant.execute();\r
+ \r
+ String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+ antCall(antFilename, null);\r
+ \r
return ;\r
}\r
\r
//\r
// Ant call ${BASE_NAME}_build.xml\r
//\r
- Ant ant = new Ant();\r
- ant.setProject(getProject());\r
- ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");\r
- ant.setInheritAll(true);\r
- ant.init();\r
- ant.execute();\r
+ String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+ antCall(antFilename, null);\r
}\r
\r
private void applyClean(FpdModuleIdentification fpdModuleId){\r
//\r
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r
GlobalData.log.info("Calling user-defined " + moduleId.getName() + "_build.xml");\r
- Ant ant = new Ant();\r
- ant.setProject(getProject());\r
- ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");\r
- ant.setTarget("clean");\r
- ant.setInheritAll(true);\r
- ant.init();\r
- ant.execute();\r
+ \r
+ String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+ antCall(antFilename, "clean");\r
+ \r
return ;\r
}\r
\r
- Ant ant = new Ant();\r
- ant.setProject(getProject());\r
- ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");\r
- ant.setTarget("clean");\r
- ant.setInheritAll(true);\r
- ant.init();\r
- ant.execute();\r
-\r
- //\r
- // Delete current module's DEST_DIR_OUTPUT\r
- // TBD\r
+ String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+ antCall(antFilename, "clean");\r
}\r
\r
private void applyCleanall(FpdModuleIdentification fpdModuleId){\r
//\r
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {\r
GlobalData.log.info("Calling user-defined " + moduleId.getName() + "_build.xml");\r
- Ant ant = new Ant();\r
- ant.setProject(getProject());\r
- ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");\r
- ant.setTarget("cleanall");\r
- ant.setInheritAll(true);\r
- ant.init();\r
- ant.execute();\r
+\r
+ String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+ antCall(antFilename, "cleanall");\r
+ \r
return ;\r
}\r
+ \r
+ String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";\r
+ antCall(antFilename, "cleanall");\r
+ }\r
\r
+ private void antCall(String antFilename, String target) {\r
Ant ant = new Ant();\r
ant.setProject(getProject());\r
- ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");\r
- ant.setTarget("cleanall");\r
+ ant.setAntfile(antFilename);\r
+ if (target != null) {\r
+ ant.setTarget(target);\r
+ }\r
ant.setInheritAll(true);\r
ant.init();\r
ant.execute();\r
-\r
- //\r
- // Delete current module's DEST_DIR_OUTPUT\r
- // TBD\r
}\r
\r
\r
-\r
-\r
/**\r
Separate the string and instore in set.\r
\r
\r
private PlatformIdentification platformId;\r
\r
- ///\r
- ///\r
- ///\r
private String type;\r
\r
///\r
Surface area is not valid.\r
**/\r
public void execute() throws BuildException {\r
- // Remove !!\r
+ //\r
+ // If fpdFile is not specified, \r
+ // then try to get FPD file by platformName\r
+ //\r
if ( fpdFile == null) {\r
if (platformName == null) {\r
throw new BuildException("FpdParserTask parameter error. Please specify either the platform name or FPD file!");\r
// For every Target and ToolChain\r
//\r
String[] targetList = GlobalData.getToolChainInfo().getTargets();\r
- for (int i = 0; i < targetList.length; i++){\r
+ for (int i = 0; i < targetList.length; i++) {\r
String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();\r
- for(int j = 0; j < toolchainList.length; j++){\r
+ for(int j = 0; j < toolchainList.length; j++) {\r
//\r
// Prepare FV_DIR\r
//\r
ant.setInheritAll(true);\r
ant.init();\r
ant.execute();\r
-\r
-// GlobalData.log.info("Fpd build end. ");\r
}\r
\r
/**\r
//\r
SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));\r
String fvBinding = SurfaceAreaQuery.getModuleFvBindingKeyword();\r
- SurfaceAreaQuery.pop();\r
\r
fpdModuleId.setFvBinding(fvBinding);\r
updateFvs(fvBinding, fpdModuleId);\r
// Prepare for out put file name\r
//\r
ModuleIdentification moduleId = fpdModuleId.getModule();\r
- SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));\r
+\r
String baseName = SurfaceAreaQuery.getModuleOutputFileBasename();\r
- SurfaceAreaQuery.pop();\r
+ \r
if (baseName == null) {\r
baseName = moduleId.getName();\r
}\r
//\r
// parse module build options, if any\r
//\r
- SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));\r
GlobalData.addModuleToolChainOption(fpdModuleId, parseModuleBuildOptions(false));\r
GlobalData.addModuleToolChainFamilyOption(fpdModuleId, parseModuleBuildOptions(true));\r
SurfaceAreaQuery.pop();\r
if (fvs.containsKey(fvNameArray[i])) {\r
Set<FpdModuleIdentification> set = fvs.get(fvNameArray[i]);\r
set.add(fpdModuleId);\r
- }\r
- else {\r
+ } else {\r
Set<FpdModuleIdentification> set = new LinkedHashSet<FpdModuleIdentification>();\r
set.add(fpdModuleId);\r
fvs.put(fvNameArray[i], set);\r
public void setType(String type) {\r
this.type = type;\r
}\r
-\r
-\r
}\r
import org.w3c.dom.Node;\r
import org.w3c.dom.NodeList;\r
\r
+/**\r
+ class PlatformBuildFileGenerator is used to generate ${PLATFORM}_build.xml file. \r
+\r
+ @since GenBuild 1.0\r
+**/\r
public class PlatformBuildFileGenerator {\r
\r
private String platformName;\r
//\r
// validate FrameworkDatabaseFile\r
//\r
- if (! db.validate()) {\r
+ if (!db.validate()) {\r
throw new BuildException("Framework Database file [" + dbFile.getPath() + "] format is invalid!");\r
}\r
//\r
while (iter.hasNext()) {\r
String fileName = iter.next().getStringValue();\r
File fpdFile = new File(workspaceDir + File.separatorChar + fileName);\r
- if ( ! fpdFile.exists() ) {\r
+ if ( !fpdFile.exists() ) {\r
throw new BuildException("Platform file [" + fpdFile.getPath() + "] not exists. ");\r
}\r
XmlObject fpdDoc = XmlObject.Factory.parse(fpdFile);\r
//\r
// Verify FPD file, if is invalid, throw Exception\r
//\r
- if (! fpdDoc.validate()) {\r
+ if (!fpdDoc.validate()) {\r
throw new BuildException("Framework Platform Surface Area file [" + fpdFile.getPath() + "] format is invalid!");\r
}\r
//\r
}\r
if (msaFile == null){\r
throw new BuildException("Can't find Module [" + moduleId.getName() + "] in any SPD package!");\r
- }\r
- else {\r
+ } else {\r
return msaFile;\r
}\r
}\r
}\r
if (packageId == null){\r
throw new BuildException("Can't find Module [" + moduleId.getName() + "] in any SPD package!");\r
- }\r
- else {\r
+ } else {\r
return packageId;\r
}\r
}\r
}\r
\r
/**\r
- Query overrided module surface area information. If current is Package\r
- or Platform build, also include the information from FPD file.\r
+ Query module surface area information.\r
\r
<p>Note that surface area parsing is incremental. That means the method will\r
- only parse the MSA and MBD files if necessary. </p>\r
-\r
- @param moduleName the base name of the module\r
- @return the overrided module surface area information\r
- @throws BuildException\r
- MSA or MBD is not valid\r
+ only parse the MSA files if necessary. </p>\r
+ \r
+ @param fpdModuleId Module ID with arch\r
+ @return ModuleSA info and MSA info for fpdModuleId\r
+ @throws BuildException Can't find MSA\r
**/\r
public synchronized static Map<String, XmlObject> getDoc(FpdModuleIdentification fpdModuleId) throws BuildException {\r
if (parsedModules.containsKey(fpdModuleId)) {\r
}\r
\r
public synchronized static Map<String, XmlObject> getNativeMsa(File msaFile) throws BuildException {\r
- if (! msaFile.exists()) {\r
+ if (!msaFile.exists()) {\r
throw new BuildException("Module Surface Area file [" + msaFile.getPath() + "] can't be found!");\r
}\r
try {\r
//\r
// Validate File if they accord with XML Schema\r
//\r
- if ( ! doc.validate()){\r
+ if ( !doc.validate()){\r
throw new BuildException("Module Surface Area file [" + msaFile.getPath() + "] format is invalid!");\r
}\r
//\r
GlobalData.fpdDynamicPcds = fpdDynamicPcds;\r
}\r
\r
- //////////////////////////////////////////////\r
- //////////////////////////////////////////////\r
-\r
public static Set<ModuleIdentification> getModules(PackageIdentification packageId){\r
Spd spd = spdTable.get(packageId);\r
if (spd == null ) {\r
Set<ModuleIdentification> dummy = new HashSet<ModuleIdentification>();\r
return dummy;\r
- }\r
- else {\r
+ } else {\r
return spd.getModules();\r
}\r
}\r
}\r
\r
public synchronized static ModuleIdentification refreshModuleIdentification(ModuleIdentification moduleId) throws BuildException {\r
-// System.out.println("1");\r
-// System.out.println("##" + moduleId.getGuid());\r
PackageIdentification packageId = getPackageForModule(moduleId);\r
-// System.out.println("" + packageId.getGuid());\r
moduleId.setPackage(packageId);\r
Spd spd = spdTable.get(packageId);\r
if (spd == null) {\r
public synchronized static Set<PackageIdentification> getPackageList(){\r
return packageList;\r
}\r
- ///// remove!!\r
+\r
+ /**\r
+ BUGBUG: It is a walk around method. If do not clone, can't query info with\r
+ XPath correctly. \r
+ \r
+ @param object XmlObject\r
+ @param deep flag for deep clone\r
+ @return XmlObject after clone\r
+ @throws BuildException parse original XmlObject error. \r
+ **/\r
private static XmlObject cloneXmlObject(XmlObject object, boolean deep) throws BuildException {\r
if ( object == null) {\r
return null;\r
@param type the module build type (MODULE or UNIFIED)\r
**/\r
public void update(Project project) {\r
-// GlobalData.log.info("" + userdir + ":" + type);\r
//\r
// Default mode is UNIFIED. \r
//\r
buildDir = GlobalData.getWorkspacePath() + File.separatorChar + userdir;\r
}\r
}\r
+ \r
//\r
// Set to property\r
//\r