GenBuild = org.tianocore.build.GenBuildTask\r
FrameworkBuild = org.tianocore.build.FrameworkBuildTask\r
OnDependency = org.tianocore.build.global.OnDependency\r
-ToolChainSetup = org.tianocore.build.toolchain.ToolChainTask\r
-OutputDirSetup = org.tianocore.build.OutputDirSetup\r
sourcefiles = org.tianocore.build.global.DpFileList\r
targetfiles = org.tianocore.build.global.DpFileList\r
file = org.tianocore.build.global.DpFile\r
-DefaultBuildFileGenerator = org.tianocore.build.tools.DefaultBuildFileGenerator\r
package org.tianocore.build;\r
\r
import java.io.File;\r
-import java.util.ArrayList;\r
import java.util.Hashtable;\r
import java.util.Iterator;\r
import java.util.LinkedHashSet;\r
return result;\r
}\r
\r
- /**\r
- Generate the flags string with original format. The format is defined by \r
- Java Regulation Expression "[^\\\\]?(\".*?[^\\\\]\")[ \t,]+". </p>\r
- \r
- <p>For example: </p>\r
- \r
- <pre>\r
- "/nologo", "/W3", "/WX"\r
- "/C", "/DSTRING_DEFINES_FILE=\"BdsStrDefs.h\""\r
- </pre>\r
- \r
- @param add the add flags set\r
- @param sub the sub flags set\r
- @return flags with original format\r
- **/\r
- private String getRawFlags(Set<String> add, Set<String> sub) {\r
- String result = null;\r
- add.removeAll(sub);\r
- Iterator iter = add.iterator();\r
- while (iter.hasNext()) {\r
- String str = (String) iter.next();\r
- result += "\"" + str.substring(1, str.length() - 1) + "\", ";\r
- }\r
- return result;\r
- }\r
-\r
- private String parseOptionString(String optionString, Set<String> addSet, Set<String> subSet) {\r
- boolean overrideOption = false;\r
- Pattern pattern = Pattern.compile("ADD\\.\\[(.+)\\]");\r
- Matcher matcher = pattern.matcher(optionString);\r
-\r
- while (matcher.find()) {\r
- overrideOption = true;\r
- String addOption = optionString.substring(matcher.start(1), matcher.end(1)).trim();\r
- putFlagsToSet(addSet, addOption);\r
- \r
- }\r
-\r
- pattern = Pattern.compile("SUB\\.\\[(.+)\\]");\r
- matcher = pattern.matcher(optionString);\r
-\r
- while (matcher.find()) {\r
- overrideOption = true;\r
- String subOption = optionString.substring(matcher.start(1), matcher.end(1)).trim();\r
- putFlagsToSet(subSet, subOption);\r
- }\r
-\r
- if (overrideOption == true) {\r
- return null;\r
- }\r
-\r
- return optionString;\r
- }\r
- \r
private void pushProperties() {\r
backupPropertiesStack.push(getProject().getProperties());\r
}\r
+++ /dev/null
-package org.tianocore.build;\r
-\r
-import java.io.File;\r
-import java.util.Map;\r
-\r
-import org.apache.tools.ant.BuildException;\r
-import org.apache.tools.ant.Task;\r
-import org.apache.xmlbeans.XmlObject;\r
-import org.tianocore.build.fpd.FpdParserTask;\r
-import org.tianocore.build.global.GlobalData;\r
-import org.tianocore.build.global.SurfaceAreaQuery;\r
-import org.tianocore.build.id.ModuleIdentification;\r
-import org.tianocore.build.id.PackageIdentification;\r
-import org.tianocore.build.id.PlatformIdentification;\r
-\r
-public class OutputDirSetup extends Task {\r
- ///\r
- /// Module surface area file.\r
- ///\r
- File msaFile;\r
-\r
- ///\r
- /// Module's Identification.\r
- ///\r
- private ModuleIdentification moduleId;\r
- \r
- ///\r
- /// Module's component type, such as SEC, LIBRARY, BS_DRIVER and so on.\r
- ///\r
- private String componentType;\r
- \r
- private boolean isSingleModuleBuild = false;\r
-// private ToolChainFactory toolChainFactory;\r
- \r
- /**\r
- Public construct method. It is necessary for ANT task.\r
- **/\r
- public OutputDirSetup() {\r
- }\r
- \r
- public void execute() throws BuildException {\r
- //\r
- // Global Data initialization\r
- //\r
-// GlobalData.initInfo("Tools" + File.separatorChar + "Conf" + File.separatorChar + "FrameworkDatabase.db",\r
-// getProject().getProperty("WORKSPACE_DIR"));\r
- \r
- //\r
- // Parse MSA and get the basic information\r
- // Including BaseName, GUID, Version, ComponentType and SupportedArchs\r
- //\r
- Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile);\r
- \r
- SurfaceAreaQuery.setDoc(doc);\r
- \r
- //\r
- // String[]: {BaseName, ModuleType, ComponentType, Guid, Version}\r
- //\r
- moduleId = SurfaceAreaQuery.getMsaHeader();\r
- // REMOVE!!! TBD\r
- componentType = "APPLICATION";\r
- \r
- //\r
- // Judge whether it is single module build or not\r
- //\r
- if (isSingleModuleBuild) {\r
- //\r
- // Single Module build\r
- //\r
- prepareSingleModuleBuild();\r
- }\r
- else {\r
- //\r
- // Platform build\r
- //\r
- String filename = getProject().getProperty("PLATFORM_FILE");\r
- PlatformIdentification platformId = GlobalData.getPlatform(filename);\r
- getProject().setProperty("PLATFORM_DIR", platformId.getFpdFile().getParent().replaceAll("(\\\\)", "/"));\r
- getProject().setProperty("PLATFORM_RELATIVE_DIR", platformId.getPlatformRelativeDir().replaceAll("(\\\\)", "/"));\r
- \r
- String packageName = getProject().getProperty("PACKAGE");\r
- String packageGuid = getProject().getProperty("PACKAGE_GUID");\r
- String packageVersion = getProject().getProperty("PACKAGE_VERSION");\r
- PackageIdentification packageId = new PackageIdentification(packageName, packageGuid, packageVersion);\r
- moduleId.setPackage(packageId);\r
- }\r
- \r
- //\r
- // Tools Definition file parse\r
- //\r
- parseToolsDefinitionFile();\r
- \r
- //\r
- // For Every TOOLCHAIN, TARGET, ARCH\r
- //\r
-// String[] targetList = GlobalData.getTargets();\r
-// for (int i = 0; i < targetList.length; i ++){\r
-// //\r
-// // Prepare for target related common properties\r
-// // TARGET\r
-// //\r
-// getProject().setProperty("TARGET", targetList[i]);\r
-// String[] toolchainList = GlobalData.getToolChains();\r
-// for(int j = 0; j < toolchainList.length; j ++){\r
-// //\r
-// // Prepare for toolchain related common properties\r
-// // TOOLCHAIN\r
-// //\r
-// getProject().setProperty("TOOLCHAIN", toolchainList[j]);\r
-// //\r
-// // If single module : intersection MSA supported ARCHs and tools def!!\r
-// // else, get arch from pass down\r
-// //\r
-// String[] archList = GlobalData.getArchs();\r
-// for (int k = 0; k < archList.length; k++) {\r
-// \r
-// FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, archList[k]);\r
-// \r
-// SurfaceAreaQuery.setDoc(GlobalData.getDoc(fpdModuleId));\r
-// \r
-// //\r
-// // Prepare for all other common properties\r
-// // PACKAGE, PACKAGE_GUID, PACKAGE_VERSION, PACKAGE_DIR, PACKAGE_RELATIVE_DIR\r
-// // MODULE or BASE_NAME, GUID or FILE_GUID, VERSION, COMPONENT_TYPE\r
-// // MODULE_DIR, MODULE_RELATIVE_DIR\r
-// // SUBSYSTEM, ENTRYPOINT, EBC_TOOL_LIB_PATH\r
-// // LIBS, OBJECTS, SDB_FILES\r
-// //\r
-// getProject().setProperty("ARCH", archList[k]);\r
-// setModuleCommonProperties();\r
-// \r
-// //\r
-// // String[0] is build mode. String[1] is user-defined output dir. \r
-// //\r
-// String buildMode = SurfaceAreaQuery.getFpdIntermediateDirectories();\r
-// String userDefinedOutputDir = SurfaceAreaQuery.getFpdOutputDirectory();\r
-// \r
-// //\r
-// // OutputManage prepare for \r
-// // BIN_DIR, DEST_DIR_DEBUG, DEST_DIR_OUTPUT, BUILD_DIR, FV_DIR\r
-// //\r
-// OutputManager.getInstance().update(getProject(), userDefinedOutputDir, buildMode);\r
-// \r
-// }\r
-// }\r
-// }\r
- \r
- }\r
- \r
- private void prepareSingleModuleBuild(){\r
- //\r
- // Find out the package which the module belongs to\r
- // TBD: Enhance it!!!!\r
- //\r
- PackageIdentification packageId = GlobalData.getPackageForModule(moduleId);\r
- \r
- moduleId.setPackage(packageId);\r
- \r
- //\r
- // Read ACTIVE_PLATFORM's FPD file (Call FpdParserTask's method)\r
- //\r
- String filename = getProject().getProperty("PLATFORM_FILE");\r
-\r
- PlatformIdentification platformId = GlobalData.getPlatform(filename);\r
- \r
- //\r
- // Read FPD file\r
- //\r
- FpdParserTask fpdParser = new FpdParserTask();\r
- fpdParser.parseFpdFile(platformId.getFpdFile());\r
- \r
- //\r
- // Prepare for Platform related common properties\r
- // PLATFORM, PLATFORM_DIR, PLATFORM_RELATIVE_DIR\r
- //\r
- getProject().setProperty("PLATFORM", platformId.getName());\r
- getProject().setProperty("PLATFORM_DIR", platformId.getFpdFile().getParent().replaceAll("(\\\\)", "/"));\r
- getProject().setProperty("PLATFORM_RELATIVE_DIR", platformId.getPlatformRelativeDir().replaceAll("(\\\\)", "/"));\r
- }\r
- \r
-\r
-\r
- /**\r
-\r
- **/\r
- private void setModuleCommonProperties() {\r
- //\r
- // Prepare for all other common properties\r
- // PACKAGE, PACKAGE_GUID, PACKAGE_VERSION, PACKAGE_DIR, PACKAGE_RELATIVE_DIR\r
- //\r
- PackageIdentification packageId = moduleId.getPackage();\r
- getProject().setProperty("PACKAGE", packageId.getName());\r
- getProject().setProperty("PACKAGE_GUID", packageId.getGuid());\r
- getProject().setProperty("PACKAGE_VERSION", packageId.getVersion());\r
- GlobalData.log.info("" + packageId);\r
- getProject().setProperty("PACKAGE_DIR", packageId.getPackageDir().replaceAll("(\\\\)", "/"));\r
- getProject().setProperty("PACKAGE_RELATIVE_DIR", packageId.getPackageRelativeDir().replaceAll("(\\\\)", "/"));\r
- \r
- //\r
- // MODULE or BASE_NAME, GUID or FILE_GUID, VERSION, COMPONENT_TYPE\r
- // MODULE_DIR, MODULE_RELATIVE_DIR\r
- //\r
- getProject().setProperty("MODULE", moduleId.getName());\r
- getProject().setProperty("BASE_NAME", moduleId.getName());\r
- getProject().setProperty("GUID", moduleId.getGuid());\r
- getProject().setProperty("FILE_GUID", moduleId.getGuid());\r
- getProject().setProperty("VERSION", moduleId.getVersion());\r
- getProject().setProperty("COMPONENT_TYPE", componentType);\r
- getProject().setProperty("MODULE_DIR", moduleId.getMsaFile().getParent().replaceAll("(\\\\)", "/"));\r
- getProject().setProperty("MODULE_RELATIVE_DIR", moduleId.getModuleRelativePath().replaceAll("(\\\\)", "/"));\r
- }\r
- \r
-\r
- /**\r
- Method is for ANT use to initialize MSA file.\r
- \r
- @param msaFilename MSA file name\r
- **/\r
- public void setMsaFile(String msaFilename) {\r
- String moduleDir = getProject().getProperty("MODULE_DIR");\r
- if (moduleDir == null) {\r
- moduleDir = getProject().getBaseDir().getPath();\r
- }\r
- msaFile = new File(moduleDir + File.separatorChar + msaFilename);\r
- }\r
-\r
- /**\r
- Compile flags setup. \r
- \r
- <p> Take command <code>CC</code> and arch <code>IA32</code> for example, \r
- Those flags are from <code>ToolChainFactory</code>: </p>\r
- <ul>\r
- <li> IA32_CC </li>\r
- <li> IA32_CC_STD_FLAGS </li>\r
- <li> IA32_CC_GLOBAL_FLAGS </li>\r
- <li> IA32_CC_GLOBAL_ADD_FLAGS </li>\r
- <li> IA32_CC_GLOBAL_SUB_FLAGS </li>\r
- </ul>\r
- Those flags can user-define: \r
- <ul>\r
- <li> IA32_CC_PROJ_FLAGS </li>\r
- <li> IA32_CC_PROJ_ADD_FLAGS </li>\r
- <li> IA32_CC_PROJ_SUB_FLAGS </li>\r
- <li> CC_PROJ_FLAGS </li>\r
- <li> CC_PROJ_ADD_FLAGS </li>\r
- <li> CC_PROJ_SUB_FLAGS </li>\r
- <li> CC_FLAGS </li>\r
- <li> IA32_CC_FLAGS </li>\r
- </ul>\r
- \r
- <p> The final flags is composed of STD, GLOBAL and PROJ. If CC_FLAGS or\r
- IA32_CC_FLAGS is specified, STD, GLOBAL and PROJ will not affect. </p>\r
- \r
- Note that the <code>ToolChainFactory</code> executes only once \r
- during whole build process. \r
- **/\r
- private void parseToolsDefinitionFile() {\r
- //\r
- // If ToolChain has been set up before, do nothing.\r
- // CONF dir + tools definition file name\r
- //\r
- String confDir = GlobalData.getWorkspacePath() + File.separatorChar + "Tools" + File.separatorChar + "Conf";\r
- String toolsDefFilename = "tools_def.txt";\r
- if (getProject().getProperty("env.TOOLS_DEF") != null) {\r
- toolsDefFilename = getProject().getProperty("env.TOOLS_DEF");\r
- }\r
-// toolChainFactory = new ToolChainFactory(confDir, toolsDefFilename);\r
-// toolChainFactory.setupToolChain();\r
- }\r
-}\r
import java.util.Map;\r
import java.util.Set;\r
import java.util.Vector;\r
-import java.util.TreeMap;\r
\r
import org.apache.tools.ant.BuildException;\r
import org.apache.tools.ant.Task;\r
///\r
private Map<String, Set<FpdModuleIdentification>> fvs = new HashMap<String, Set<FpdModuleIdentification>>();\r
\r
- ///\r
- /// Mapping from sequence number to FV names\r
- ///\r
- private Map<String, Set<String>> sequences = new TreeMap<String, Set<String>>();\r
-\r
///\r
/// FpdParserTask can specify some ANT properties. \r
///\r
//\r
isUnified = OutputManager.getInstance().prepareBuildDir(getProject());\r
\r
- //\r
- // Generate FDF (Flash Definition File) file\r
- //\r
-\r
//\r
// For every Target and ToolChain\r
//\r
//\r
// Gen build.xml\r
//\r
- PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, fvs, sequences, isUnified);\r
+ PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, isUnified);\r
fileGenerator.genBuildFile();\r
\r
//\r
SurfaceAreaQuery.pop();\r
\r
fpdModuleId.setFvBinding(fvBinding);\r
- String fvSequence = fpdModuleId.getSequence();\r
- updateFvs(fvSequence, fvBinding, fpdModuleId);\r
+ updateFvs(fvBinding, fpdModuleId);\r
\r
//\r
// Prepare for out put file name\r
@param fvName current FV name\r
@param moduleName current module identification\r
**/\r
- private void updateFvs(String fvSequence, String fvName, FpdModuleIdentification fpdModuleId) {\r
+ private void updateFvs(String fvName, FpdModuleIdentification fpdModuleId) {\r
if (fvName == null || fvName.trim().length() == 0) {\r
fvName = "NULL";\r
}\r
set.add(fpdModuleId);\r
fvs.put(fvNameArray[i], set);\r
}\r
- \r
- //\r
- // Put fvName to corresponding fvSequence\r
- //\r
- if (sequences.containsKey(fvSequence)) {\r
- Set<String> set = sequences.get(fvSequence);\r
- set.add(fvNameArray[i]);\r
- }\r
- else {\r
- Set<String> set = new LinkedHashSet<String>();\r
- set.add(fvNameArray[i]);\r
- sequences.put(fvSequence, set);\r
- }\r
}\r
}\r
\r
///\r
private Map<FpdModuleIdentification, String> outfiles;\r
\r
- ///\r
- /// Mapping from FV name to its modules\r
- ///\r
- private Map<String, Set<FpdModuleIdentification>> fvs;\r
-\r
- ///\r
- /// Mapping from sequence number to FV names\r
- ///\r
- private Map<String, Set<String>> sequences;\r
- \r
private boolean isUnified = true;\r
\r
private Project project;\r
+ "Abstract:\n"\r
+ "Auto-generated ANT build file for building of EFI Modules/Platforms\n";\r
\r
- public PlatformBuildFileGenerator(Project project, Map<FpdModuleIdentification, String> outfiles, Map<String, Set<FpdModuleIdentification>> fvs, Map<String, Set<String>> sequences, boolean isUnified){\r
+ public PlatformBuildFileGenerator(Project project, Map<FpdModuleIdentification, String> outfiles, boolean isUnified){\r
this.project = project;\r
this.outfiles = outfiles;\r
- this.fvs = fvs;\r
- this.sequences = sequences;\r
this.isUnified = isUnified;\r
this.platformName = project.getProperty("PLATFORM");\r
}\r
ele.setAttribute("environment", "env");\r
root.appendChild(ele);\r
\r
- Set<String> sequenceKeys = sequences.keySet();\r
- Iterator sequenceIter = sequenceKeys.iterator();\r
- String dependsStr = "prebuild";\r
- while (sequenceIter.hasNext()) {\r
- String num = (String)sequenceIter.next();\r
- if (dependsStr.length() > 0) {\r
- dependsStr += " , ";\r
- }\r
- dependsStr += "modules" + num + ", fvs" + num;\r
- }\r
- \r
//\r
// Default Target\r
//\r
root.appendChild(document.createComment("Default target"));\r
ele = document.createElement("target");\r
ele.setAttribute("name", "all");\r
- ele.setAttribute("depends", dependsStr + ", postbuild");\r
+ ele.setAttribute("depends", "prebuild, modules, fvs, postbuild");\r
root.appendChild(ele);\r
\r
//\r
// Modules and Fvs Target\r
//\r
- sequenceIter = sequenceKeys.iterator();\r
- while (sequenceIter.hasNext()) {\r
- String num = (String)sequenceIter.next();\r
- applyModules(document, root, num);\r
- applyFvs(document, root, num);\r
- }\r
+ applyModules(document, root);\r
+ \r
+ applyFvs(document, root);\r
\r
//\r
// Clean Target\r
}\r
}\r
\r
- private void applyModules(Document document, Node root, String num) {\r
+ private void applyModules(Document document, Node root) {\r
root.appendChild(document.createComment("Modules target"));\r
Element ele = document.createElement("target");\r
- ele.setAttribute("name", "modules" + num);\r
- \r
- Set<String> fvNameSet = sequences.get(num);\r
+ ele.setAttribute("name", "modules");\r
\r
- Iterator fvNameIter = fvNameSet.iterator();\r
- while (fvNameIter.hasNext()) {\r
- String fvName = (String)fvNameIter.next();\r
- Set<FpdModuleIdentification> set = fvs.get(fvName);\r
- Iterator iter = set.iterator();\r
- while (iter.hasNext()) {\r
- FpdModuleIdentification fpdModuleId = (FpdModuleIdentification) iter.next();\r
- ModuleIdentification moduleId = fpdModuleId.getModule();\r
- Element moduleEle = document.createElement("GenBuild");\r
- moduleEle.setAttribute("type", "build");\r
- //\r
- // Inherit Properties.\r
- //{"ARCH", "PACKAGE", "PACKAGE_GUID", "PACKAGE_VERSION", "MODULE_DIR"}\r
- //\r
- \r
- //\r
- // ARCH\r
- //\r
- Element property = document.createElement("property");\r
- property.setAttribute("name", "ARCH");\r
- property.setAttribute("value", fpdModuleId.getArch());\r
- moduleEle.appendChild(property);\r
+ Set<FpdModuleIdentification> set = outfiles.keySet();\r
+ Iterator iter = set.iterator();\r
+ while (iter.hasNext()) {\r
+ FpdModuleIdentification fpdModuleId = (FpdModuleIdentification) iter.next();\r
+ ModuleIdentification moduleId = fpdModuleId.getModule();\r
+ Element moduleEle = document.createElement("GenBuild");\r
+ moduleEle.setAttribute("type", "build");\r
+ //\r
+ // Inherit Properties.\r
+ //{"ARCH", "PACKAGE", "PACKAGE_GUID", "PACKAGE_VERSION", "MODULE_DIR"}\r
+ //\r
+ \r
+ //\r
+ // ARCH\r
+ //\r
+ Element property = document.createElement("property");\r
+ property.setAttribute("name", "ARCH");\r
+ property.setAttribute("value", fpdModuleId.getArch());\r
+ moduleEle.appendChild(property);\r
\r
- //\r
- // MODULE_GUID\r
- //\r
- property = document.createElement("property");\r
- property.setAttribute("name", "MODULE_GUID");\r
- property.setAttribute("value", moduleId.getGuid());\r
- moduleEle.appendChild(property);\r
- \r
- //\r
- // MODULE_VERSION\r
- //\r
- property = document.createElement("property");\r
- property.setAttribute("name", "MODULE_VERSION");\r
- property.setAttribute("value", moduleId.getVersion());\r
- moduleEle.appendChild(property);\r
- \r
- //\r
- // PACKAGE_GUID\r
- //\r
- property = document.createElement("property");\r
- property.setAttribute("name", "PACKAGE_GUID");\r
- property.setAttribute("value", moduleId.getPackage().getGuid());\r
- moduleEle.appendChild(property);\r
- \r
- //\r
- // PACKAGE_VERSION\r
- //\r
- property = document.createElement("property");\r
- property.setAttribute("name", "PACKAGE_VERSION");\r
- property.setAttribute("value", moduleId.getPackage().getVersion());\r
- moduleEle.appendChild(property);\r
- \r
- ele.appendChild(moduleEle);\r
- }\r
+ //\r
+ // MODULE_GUID\r
+ //\r
+ property = document.createElement("property");\r
+ property.setAttribute("name", "MODULE_GUID");\r
+ property.setAttribute("value", moduleId.getGuid());\r
+ moduleEle.appendChild(property);\r
+ \r
+ //\r
+ // MODULE_VERSION\r
+ //\r
+ property = document.createElement("property");\r
+ property.setAttribute("name", "MODULE_VERSION");\r
+ property.setAttribute("value", moduleId.getVersion());\r
+ moduleEle.appendChild(property);\r
+ \r
+ //\r
+ // PACKAGE_GUID\r
+ //\r
+ property = document.createElement("property");\r
+ property.setAttribute("name", "PACKAGE_GUID");\r
+ property.setAttribute("value", moduleId.getPackage().getGuid());\r
+ moduleEle.appendChild(property);\r
+ \r
+ //\r
+ // PACKAGE_VERSION\r
+ //\r
+ property = document.createElement("property");\r
+ property.setAttribute("name", "PACKAGE_VERSION");\r
+ property.setAttribute("value", moduleId.getPackage().getVersion());\r
+ moduleEle.appendChild(property);\r
+ \r
+ ele.appendChild(moduleEle);\r
}\r
root.appendChild(ele);\r
}\r
\r
- private void applyFvs(Document document, Node root, String num) {\r
- Set<String> fvNameSet = sequences.get(num);\r
+ private void applyFvs(Document document, Node root) {\r
//\r
// FVS Target\r
//\r
root.appendChild(document.createComment("FVs target"));\r
Element ele = document.createElement("target");\r
- ele.setAttribute("name", "fvs" + num);\r
+ ele.setAttribute("name", "fvs");\r
\r
//\r
// For every Target and ToolChain\r
+ toolchainList[j] + File.separatorChar + "FV";\r
String[] validFv = SurfaceAreaQuery.getFpdValidImageNames();\r
for (int k = 0; k < validFv.length; k++) {\r
- if (fvNameSet.contains(validFv[k]) || ! isListInSequence(validFv[k])) {\r
- String inputFile = fvOutputDir + "" + File.separatorChar + validFv[k].toUpperCase() + ".inf";\r
- Element fvEle = document.createElement("genfvimage");\r
- fvEle.setAttribute("infFile", inputFile);\r
- fvEle.setAttribute("outputDir", fvOutputDir);\r
- ele.appendChild(fvEle);\r
- }\r
+ String inputFile = fvOutputDir + "" + File.separatorChar + validFv[k].toUpperCase() + ".inf";\r
+ Element fvEle = document.createElement("genfvimage");\r
+ fvEle.setAttribute("infFile", inputFile);\r
+ fvEle.setAttribute("outputDir", fvOutputDir);\r
+ ele.appendChild(fvEle);\r
}\r
}\r
}\r
}\r
return root;\r
}\r
- \r
- private boolean isListInSequence(String fvName) {\r
- Set<String> numbers = sequences.keySet();\r
- Iterator<String> iter = numbers.iterator();\r
- while (iter.hasNext()) {\r
- Set<String> fvNameSet = sequences.get(iter.next());\r
- if (fvNameSet.contains(fvName)) {\r
- return true;\r
- }\r
- }\r
- return false;\r
- }\r
}\r
\r
\r
/**\r
- This class is used to identify a module with BaseName, GUID, Version, PackageName\r
- and ARCH.\r
+ This class is used to identify a module with Module Guid, Module Version, \r
+ Package Guid, Package Version and Arch. \r
\r
@since GenBuild 1.0\r
- **/\r
+**/\r
public class FpdModuleIdentification {\r
\r
private String arch;\r
\r
private String fvBinding = "NULL"; // Optional\r
\r
- private String sequence = "0"; // Optional\r
- \r
private ModuleIdentification module;\r
\r
- private String target; // Optional\r
- \r
- private String toolchain; // Optional\r
- \r
- public FpdModuleIdentification(String arch, String fvBinding, String sequence, ModuleIdentification module){\r
+ /**\r
+ Constructor Method. \r
+ \r
+ @param arch Build Arch\r
+ @param fvBinding Belong to what FVs\r
+ @param module ModuleIdentification\r
+ **/\r
+ public FpdModuleIdentification(String arch, String fvBinding, ModuleIdentification module){\r
this.arch = arch;\r
this.fvBinding = fvBinding;\r
- this.sequence = sequence;\r
this.module = module;\r
}\r
\r
+ /**\r
+ Constructor Method. \r
+ \r
+ @param arch Build Arch\r
+ @param module ModuleIdentification\r
+ **/\r
public FpdModuleIdentification(ModuleIdentification module, String arch){\r
this.arch = arch;\r
this.module = module;\r
}\r
}\r
\r
+ /**\r
+ @param fvBinding\r
+ **/\r
public void setFvBinding(String fvBinding) {\r
this.fvBinding = fvBinding;\r
}\r
\r
- public void setSequence(String sequence) {\r
- this.sequence = sequence;\r
- }\r
-\r
+ /* (non-Javadoc)\r
+ @see java.lang.Object#toString()\r
+ **/\r
public String toString(){\r
return arch + ":" + module;\r
}\r
\r
+ /**\r
+ @return String fvBinding\r
+ **/\r
public String getFvBinding() {\r
return fvBinding;\r
}\r
\r
- public String getSequence() {\r
- return sequence;\r
- }\r
-\r
+ /**\r
+ @return ModuleIdentification module ID\r
+ **/\r
public ModuleIdentification getModule() {\r
return module;\r
}\r
\r
+ /**\r
+ @param module Module Identification\r
+ **/\r
public void setModule(ModuleIdentification module) {\r
this.module = module;\r
}\r
\r
+ /**\r
+ @return String arch\r
+ **/\r
public String getArch() {\r
return arch;\r
}\r
\r
+ /**\r
+ @param arch build ARCH\r
+ **/\r
public void setArch(String arch) {\r
this.arch = arch;\r
}\r
\r
+ /* (non-Javadoc)\r
+ @see java.lang.Object#hashCode()\r
+ **/\r
public int hashCode(){\r
return module.hashCode();\r
}\r
\r
package org.tianocore.build.id;\r
\r
-import org.tianocore.build.global.GlobalData;\r
\r
+/**\r
+ This class is used to identify with its GUID and Version. \r
+\r
+ @since GenBuild 1.0\r
+**/\r
public class Identification {\r
\r
String name;\r
\r
String version;\r
\r
- String type; // Optional\r
- \r
+ /**\r
+ @param name Name\r
+ @param guid Guid\r
+ @param version Version\r
+ **/\r
Identification(String name, String guid, String version){\r
this.name = name;\r
this.guid = guid;\r
this.version = version;\r
}\r
\r
+ /**\r
+ @param guid Guid\r
+ @param version Version\r
+ **/\r
Identification(String guid, String version){\r
this.guid = guid;\r
this.version = version;\r
}\r
\r
+ /* (non-Javadoc)\r
+ @see java.lang.Object#equals(java.lang.Object)\r
+ **/\r
public boolean equals(Object obj) {\r
if (obj instanceof Identification) {\r
Identification id = (Identification)obj;\r
}\r
}\r
\r
+ /**\r
+ @param name Name\r
+ **/\r
public void setName(String name) {\r
this.name = name;\r
}\r
\r
+ /**\r
+ @param guid Guid\r
+ **/\r
public void setGuid(String guid) {\r
this.guid = guid;\r
}\r
\r
+ /**\r
+ @param version Version\r
+ **/\r
public void setVersion(String version) {\r
this.version = version;\r
}\r
return guid;\r
}\r
\r
+ /**\r
+ @return String Name\r
+ **/\r
public String getName() {\r
return name;\r
}\r
\r
+ /**\r
+ @return String Version\r
+ **/\r
public String getVersion() {\r
return version;\r
}\r
\r
+ /* (non-Javadoc)\r
+ @see java.lang.Object#hashCode()\r
+ **/\r
public int hashCode(){\r
return guid.toLowerCase().hashCode();\r
}\r
import java.io.File;\r
\r
import org.tianocore.build.global.GlobalData;\r
+/**\r
+ This class is used to identify a module with Module Guid, Module Version, \r
+ Package Guid, Package Version. \r
\r
+ @since GenBuild 1.0\r
+**/\r
public class ModuleIdentification extends Identification {\r
\r
private PackageIdentification packageId;\r
\r
private boolean isLibrary = false;\r
\r
+ /**\r
+ @param guid Guid\r
+ @param version Version\r
+ **/\r
public ModuleIdentification(String guid, String version){\r
super(guid, version);\r
}\r
\r
+ /**\r
+ @param guid Guid\r
+ @param version Version\r
+ @param packageId Package Identification\r
+ **/\r
public ModuleIdentification(String guid, String version, PackageIdentification packageId){\r
super(guid, version);\r
this.packageId = packageId;\r
}\r
\r
+ /**\r
+ @param name Name\r
+ @param guid Guid\r
+ @param version Version\r
+ **/\r
public ModuleIdentification(String name, String guid, String version){\r
super(name, guid, version);\r
}\r
\r
+ /**\r
+ @param name Name\r
+ @param guid Guid\r
+ @param version Version\r
+ @param packageId PackageIdentification\r
+ **/\r
public ModuleIdentification(String name, String guid, String version, PackageIdentification packageId){\r
super(name, guid, version);\r
this.packageId = packageId;\r
}\r
\r
+ /**\r
+ @return boolean is this module is library\r
+ **/\r
public boolean isLibrary() {\r
return isLibrary;\r
}\r
\r
+ /**\r
+ @param isLibrary \r
+ **/\r
public void setLibrary(boolean isLibrary) {\r
this.isLibrary = isLibrary;\r
}\r
\r
+ /**\r
+ @return MSA File\r
+ **/\r
public File getMsaFile() {\r
prepareMsaFile();\r
return msaFile;\r
}\r
\r
+ /**\r
+ @return Module relative path to package\r
+ **/\r
public String getModuleRelativePath() {\r
prepareMsaFile();\r
if (msaFile.getParent().length() == packageId.getPackageDir().length()) {\r
}\r
}\r
\r
+ /**\r
+ @param msaFile Set Msa File\r
+ **/\r
public void setMsaFile(File msaFile) {\r
this.msaFile = msaFile;\r
}\r
}\r
}\r
\r
+ /**\r
+ @param packageId set package identification\r
+ **/\r
public void setPackage(PackageIdentification packageId) {\r
this.packageId = packageId;\r
}\r
\r
+ /**\r
+ @return get package identification\r
+ **/\r
public PackageIdentification getPackage() {\r
return packageId;\r
}\r
\r
+ /**\r
+ @return get module type\r
+ **/\r
public String getModuleType() {\r
if (moduleType == null) {\r
GlobalData.refreshModuleIdentification(this);\r
return moduleType;\r
}\r
\r
+ /**\r
+ @param moduleType set module type\r
+ **/\r
public void setModuleType(String moduleType) {\r
this.moduleType = moduleType;\r
}\r
\r
import org.tianocore.build.global.GlobalData;\r
\r
+/**\r
+ This class is used to identify a package. \r
+\r
+ @since GenBuild 1.0\r
+**/\r
public class PackageIdentification extends Identification{\r
\r
//\r
- // It is optional\r
+ // SPD file\r
//\r
private File spdFile;\r
\r
+ /**\r
+ @param guid Guid\r
+ @param version Version\r
+ **/\r
public PackageIdentification(String guid, String version){\r
super(guid, version);\r
}\r
\r
+ /**\r
+ @param name Name\r
+ @param guid Guid\r
+ @param version Version\r
+ **/\r
public PackageIdentification(String name, String guid, String version){\r
super(name, guid, version);\r
}\r
\r
+ /**\r
+ @param name Name\r
+ @param guid Guid\r
+ @param version Version\r
+ @param spdFilename SPD file name\r
+ **/\r
public PackageIdentification(String name, String guid, String version, String spdFilename){\r
super(name, guid, version);\r
this.spdFile = new File(spdFilename);\r
}\r
\r
+ /**\r
+ @param name Name\r
+ @param guid Guid\r
+ @param version Version\r
+ @param spdFile SPD file\r
+ **/\r
public PackageIdentification(String name, String guid, String version, File spdFile){\r
super(name, guid, version);\r
this.spdFile = spdFile;\r
}\r
\r
+ /**\r
+ set SPD file.\r
+ @param spdFile SPD file\r
+ **/\r
public void setSpdFile(File spdFile) {\r
this.spdFile = spdFile;\r
}\r
\r
+ /**\r
+ get SPD file\r
+ @return SPD file\r
+ **/\r
public File getSpdFile() {\r
return spdFile;\r
}\r
}\r
}\r
\r
+ /**\r
+ get package directory\r
+ @return Package Directory\r
+ **/\r
public String getPackageDir(){\r
prepareSpdFile();\r
return spdFile.getParent();\r
}\r
\r
+ /**\r
+ get package relative directory. \r
+ @return package relative directory\r
+ **/\r
public String getPackageRelativeDir(){\r
prepareSpdFile();\r
String relativeDir =spdFile.getParent().substring(GlobalData.getWorkspacePath().length());\r
\r
import org.tianocore.build.global.GlobalData;\r
\r
+/**\r
+ This class is used to identify a platform. \r
+\r
+ @since GenBuild 1.0\r
+**/\r
public class PlatformIdentification extends Identification{\r
\r
+ ///\r
+ /// FPD file\r
+ ///\r
private File fpdFile;\r
\r
+ /**\r
+ @param guid Guid\r
+ @param version Version\r
+ **/\r
public PlatformIdentification(String guid, String version){\r
super(guid, version);\r
}\r
\r
+ /**\r
+ @param name Name\r
+ @param guid Guid\r
+ @param version Version\r
+ **/\r
public PlatformIdentification(String name, String guid, String version){\r
super(name, guid, version);\r
}\r
\r
+ /**\r
+ @param name Name\r
+ @param guid Guid\r
+ @param version Version\r
+ @param fpdFilename Fpd File Name\r
+ **/\r
public PlatformIdentification(String name, String guid, String version, String fpdFilename){\r
super(name, guid, version);\r
this.fpdFile = new File(fpdFilename);\r
}\r
\r
+ /**\r
+ @param name Name\r
+ @param guid Guid\r
+ @param version Version\r
+ @param fpdFile Fpd File\r
+ **/\r
public PlatformIdentification(String name, String guid, String version, File fpdFile){\r
super(name, guid, version);\r
this.fpdFile = fpdFile;\r
return "Platform " + name + "["+guid+"]";\r
}\r
\r
+ /**\r
+ Set FPD file. \r
+ @param fpdFile FPD File\r
+ **/\r
public void setFpdFile(File fpdFile) {\r
this.fpdFile = fpdFile;\r
}\r
\r
+ /**\r
+ Get FPD file. \r
+ @return Fpd File\r
+ **/\r
public File getFpdFile() {\r
return fpdFile;\r
}\r
\r
+ /**\r
+ Get FPD relative file to workspace. \r
+ @return Fpd Relative file. \r
+ **/\r
public String getRelativeFpdFile (){\r
String relativeDir = fpdFile.getPath().substring(GlobalData.getWorkspacePath().length());\r
if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r
return relativeDir;\r
}\r
\r
+ /**\r
+ Get Platform relative directory to workspace. \r
+ @return Platform relative directory\r
+ **/\r
public String getPlatformRelativeDir(){\r
String relativeDir = fpdFile.getParent().substring(GlobalData.getWorkspacePath().length());\r
if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r
+++ /dev/null
-/** @file\r
- ToolChainTask class.\r
- \r
- ToolChainTask class's main fucntion is read all tool chain related config files. \r
-\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-**/\r
-package org.tianocore.build.toolchain;\r
-\r
-import org.apache.tools.ant.BuildException;\r
-import org.apache.tools.ant.Task;\r
-\r
-/**\r
- This class is an ANT task. The main function is to read all tool chain related\r
- config files. \r
- \r
- @since GenBuild 1.0\r
-**/\r
-public class ToolChainTask extends Task{\r
- ///\r
- /// environment variable name of toolchain\r
- ///\r
- static private String toolsEnv = "env.TOOLS_DEF";\r
- ///\r
- /// configuration file path\r
- ///\r
- private String confPath = ".";\r
- \r
- /**\r
- Public construct method. It is necessary for ANT task.\r
- **/\r
- public ToolChainTask(){\r
- }\r
- \r
- /**\r
- ANT task's entry point, will be called after init(). Using\r
- <code>ToolChainFactory</code> to parse all config files, and\r
- set TARGET property. \r
- \r
- @throws BuildException\r
- Config files are invalid.\r
- **/\r
- public void execute() throws BuildException {\r
- String toolChain = getProject().getProperty(toolsEnv);\r
- }\r
-\r
- /**\r
- Set the path of config files.\r
- \r
- @param confPath the path of config files\r
- **/\r
- public void setConfPath(String confPath) {\r
- this.confPath = confPath;\r
- }\r
-}\r
+++ /dev/null
-/** @file\r
- This file is an ANT task.\r
- \r
- LibBuildFileGenerator task is used to generate module's build.xml file.\r
-\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-package org.tianocore.build.tools;\r
-\r
-import java.io.File;\r
-import java.util.Iterator;\r
-import java.util.LinkedHashSet;\r
-import java.util.Set;\r
-\r
-import javax.xml.parsers.DocumentBuilder;\r
-import javax.xml.parsers.DocumentBuilderFactory;\r
-import javax.xml.transform.OutputKeys;\r
-import javax.xml.transform.Result;\r
-import javax.xml.transform.Source;\r
-import javax.xml.transform.Transformer;\r
-import javax.xml.transform.TransformerFactory;\r
-import javax.xml.transform.dom.DOMSource;\r
-import javax.xml.transform.stream.StreamResult;\r
-\r
-import org.apache.tools.ant.BuildException;\r
-import org.apache.tools.ant.Task;\r
-import org.tianocore.build.global.GlobalData;\r
-import org.tianocore.build.id.ModuleIdentification;\r
-import org.tianocore.build.id.PackageIdentification;\r
-import org.w3c.dom.Document;\r
-import org.w3c.dom.Element;\r
-\r
-public class DefaultBuildFileGenerator extends Task {\r
-\r
- private Set<ModuleIdentification> modules = new LinkedHashSet<ModuleIdentification>();\r
- \r
- private Set<PackageIdentification> packages = new LinkedHashSet<PackageIdentification>();\r
- \r
- //\r
- // <DefaultBuildFileGenerator mode="WORKSPACE | PACKAGE | MODULE">\r
- // <PackageItem packageName="" packageGuid="" packageVersion="" />\r
- // <ModuleItem moduleName="HelloWorld" moduleGuid="" moduleVersion="" packageName="" packageGuid="" packageVersion="" />\r
- // </DefaultBuildFileGenerator>\r
- //\r
- private String mode = "MODULE";\r
- \r
- private String license = " Copyright (c) 2006, Intel Corporation \n"\r
- + "All rights reserved. This program and the accompanying materials \n"\r
- + "are licensed and made available under the terms and conditions of the BSD License \n"\r
- + "which accompanies this distribution. The full text of the license may be found at \n"\r
- + "http://opensource.org/licenses/bsd-license.php \n"\r
- + "\n"\r
- + "THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN \"AS IS\" BASIS, \n"\r
- + "WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.";\r
- \r
- /**\r
- Public construct method. It is necessary for ANT task.\r
- **/\r
- public DefaultBuildFileGenerator () {\r
- }\r
-\r
- public void execute() throws BuildException {\r
- //\r
- // Global Data initialization\r
- //\r
- GlobalData.initInfo("Tools" + File.separatorChar + "Conf" + File.separatorChar + "FrameworkDatabase.db",\r
- getProject().getProperty("WORKSPACE_DIR"), "tools_def.txt");\r
- \r
- if (mode.equalsIgnoreCase("WORKSPACE")) {\r
- modules.clear();\r
- packages = GlobalData.getPackageList();\r
- } \r
- else if (mode.equalsIgnoreCase("PACKAGE")) {\r
- modules.clear();\r
- }\r
- if (mode.equalsIgnoreCase("WORKSPACE") || mode.equalsIgnoreCase("PACKAGE")) {\r
- Iterator iter = packages.iterator();\r
- while (iter.hasNext()) {\r
- PackageIdentification packageId = (PackageIdentification)iter.next();\r
- modules.addAll(GlobalData.getModules(packageId));\r
- }\r
- }\r
- \r
- Iterator iter = modules.iterator();\r
- while (iter.hasNext()) {\r
- ModuleIdentification moduleId = (ModuleIdentification)iter.next();\r
- genBuildFile (moduleId);\r
- }\r
- }\r
- \r
- private void genBuildFile(ModuleIdentification moduleId) {\r
- DocumentBuilderFactory domfac = DocumentBuilderFactory.newInstance();\r
- try {\r
- DocumentBuilder dombuilder = domfac.newDocumentBuilder();\r
- Document document = dombuilder.newDocument();\r
- //\r
- // create root element and its attributes\r
- //\r
- document.appendChild(document.createComment(license));\r
- Element root = document.createElement("project");\r
- root.setAttribute("default", "all");\r
- root.setAttribute("basedir", ".");\r
- root.setAttribute("name", moduleId.getName());\r
- \r
- //\r
- // element for External ANT tasks\r
- //\r
- root.appendChild(document.createComment("Apply external ANT tasks"));\r
- Element ele = document.createElement("taskdef");\r
- ele.setAttribute("resource", "GenBuild.tasks");\r
- root.appendChild(ele);\r
- \r
- //\r
- // <taskdef resource="net/sf/antcontrib/antlib.xml" />\r
- //\r
- ele = document.createElement("taskdef");\r
- ele.setAttribute("resource", "net/sf/antcontrib/antlib.xml");\r
- root.appendChild(ele);\r
- \r
- ele = document.createElement("property");\r
- ele.setAttribute("environment", "env");\r
- root.appendChild(ele);\r
-\r
- ele = document.createElement("property");\r
- ele.setAttribute("name", "WORKSPACE_DIR");\r
- ele.setAttribute("value", "${env.WORKSPACE}");\r
- root.appendChild(ele);\r
- \r
- ele = document.createElement("property");\r
- ele.setAttribute("name", "MSA_FILENAME");\r
- ele.setAttribute("value", GlobalData.getMsaFile(moduleId).getName());\r
- root.appendChild(ele);\r
- \r
- ele = document.createElement("property");\r
- ele.setAttribute("name", "BASE_NAME");\r
- ele.setAttribute("value", moduleId.getName());\r
- root.appendChild(ele);\r
- \r
- //\r
- // Don't change it!!\r
- //\r
- ele = document.createElement("import");\r
- ele.setAttribute("file", "${WORKSPACE_DIR}/Tools/Conf/BuildMacro.xml");\r
- root.appendChild(ele);\r
- \r
- //\r
- // <target name="all">\r
- // <GenBuild msaFile="HelloWorld.msa"/>\r
- // </target>\r
- //\r
- Element targetEle = document.createElement("target");\r
- targetEle.setAttribute("name", "all");\r
- \r
- ele = document.createElement("GenBuild");\r
- ele.setAttribute("msaFile", "${MSA_FILENAME}");\r
- targetEle.appendChild(ele);\r
- \r
- root.appendChild(targetEle);\r
- \r
- //\r
- // <target name="clean">\r
- // <OutputDirSetup msaFile="HelloWorld.msa"/>\r
- // <if>\r
- // <available file="${DEST_DIR_OUTPUT}/HelloWorld_build.xml"/>\r
- // <then>\r
- // <ant antfile="${DEST_DIR_OUTPUT}/HelloWorld_build.xml" target="clean"/>\r
- // </then>\r
- // </if>\r
- // <delete dir="${DEST_DIR_OUTPUT}" excludes="*.xml"/>\r
- // </target>\r
- //\r
- targetEle = document.createElement("target");\r
- targetEle.setAttribute("name", "clean");\r
- \r
- ele = document.createElement("OutputDirSetup");\r
- ele.setAttribute("msaFile", "${MSA_FILENAME}");\r
- targetEle.appendChild(ele);\r
- \r
- ele = document.createElement("if");\r
- \r
- Element availableEle = document.createElement("available");\r
- availableEle.setAttribute("file", "${DEST_DIR_OUTPUT}/${BASE_NAME}_build.xml");\r
- ele.appendChild(availableEle);\r
- \r
- Element thenEle = document.createElement("then");\r
- Element antEle = document.createElement("ant");\r
- antEle.setAttribute("antfile", "${DEST_DIR_OUTPUT}/${BASE_NAME}_build.xml");\r
- antEle.setAttribute("target", "clean");\r
- thenEle.appendChild(antEle);\r
- ele.appendChild(thenEle);\r
- targetEle.appendChild(ele);\r
- \r
- ele = document.createElement("delete");\r
- ele.setAttribute("dir", "${DEST_DIR_OUTPUT}");\r
- ele.setAttribute("excludes", "*.xml");\r
- targetEle.appendChild(ele);\r
- \r
- root.appendChild(targetEle);\r
- \r
- //\r
- // <target name="cleanall">\r
- // <OutputDirSetup msaFile="HelloWorld.msa"/>\r
- // <if>\r
- // <available file="${DEST_DIR_OUTPUT}/HelloWorld_build.xml"/>\r
- // <then>\r
- // <ant antfile="${DEST_DIR_OUTPUT}/HelloWorld_build.xml" target="cleanall"/>\r
- // </then>\r
- // </if>\r
- // <delete dir="${DEST_DIR_OUTPUT}"/>\r
- // <delete dir="${DEST_DIR_DEBUG}"/>\r
- // <delete>\r
- // <fileset dir="${BIN_DIR}" includes="**HelloWorld*"/>\r
- // </delete>\r
- // </target>\r
- //\r
- targetEle = document.createElement("target");\r
- targetEle.setAttribute("name", "cleanall");\r
- \r
- ele = document.createElement("OutputDirSetup");\r
- ele.setAttribute("msaFile", "${MSA_FILENAME}");\r
- targetEle.appendChild(ele);\r
- \r
- ele = document.createElement("if");\r
- \r
- availableEle = document.createElement("available");\r
- availableEle.setAttribute("file", "${DEST_DIR_OUTPUT}/${BASE_NAME}_build.xml");\r
- ele.appendChild(availableEle);\r
- \r
- thenEle = document.createElement("then");\r
- antEle = document.createElement("ant");\r
- antEle.setAttribute("antfile", "${DEST_DIR_OUTPUT}/${BASE_NAME}_build.xml");\r
- antEle.setAttribute("target", "cleanall");\r
- thenEle.appendChild(antEle);\r
- ele.appendChild(thenEle);\r
- targetEle.appendChild(ele);\r
- \r
- ele = document.createElement("delete");\r
- ele.setAttribute("dir", "${DEST_DIR_OUTPUT}");\r
- targetEle.appendChild(ele);\r
- \r
- ele = document.createElement("delete");\r
- ele.setAttribute("dir", "${DEST_DIR_DEBUG}");\r
- targetEle.appendChild(ele);\r
- \r
- ele = document.createElement("delete");\r
- \r
- Element filesetEle = document.createElement("fileset");\r
- filesetEle.setAttribute("dir", "${BIN_DIR}");\r
- filesetEle.setAttribute("includes", "**${BASE_NAME}*");\r
- ele.appendChild(filesetEle);\r
- \r
- targetEle.appendChild(ele);\r
- \r
- root.appendChild(targetEle);\r
-\r
- \r
- document.appendChild(root);\r
- \r
- //\r
- // Prepare the DOM document for writing\r
- //\r
- Source source = new DOMSource(document);\r
- \r
- //\r
- // Prepare the output file\r
- //\r
- String filename = GlobalData.getMsaFile(moduleId).getParent() + File.separatorChar + "build.xml";\r
- File file = new File(getProject().replaceProperties(filename));\r
- \r
- GlobalData.log.info("File generating - " + filename);\r
- //\r
- // generate all directory path\r
- //\r
- Result result = new StreamResult(file);\r
- \r
- //\r
- // Write the DOM document to the file\r
- //\r
- Transformer xformer = TransformerFactory.newInstance()\r
- .newTransformer();\r
- xformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");\r
- xformer.setOutputProperty(OutputKeys.INDENT, "yes");\r
- xformer.transform(source, result);\r
- } catch (Exception ex) {\r
- System.out.println("##" + ex);\r
- }\r
- \r
- }\r
- \r
- public void addConfiguredModuleItem(ModuleItem moduleItem) {\r
- PackageIdentification packageId = new PackageIdentification(moduleItem.getPackageName(), moduleItem.getPackageGuid(), moduleItem.getPackageVersion());\r
- ModuleIdentification moduleId = new ModuleIdentification(moduleItem.getModuleName(), moduleItem.getModuleGuid(), moduleItem.getModuleVersion());\r
- moduleId.setPackage(packageId);\r
- modules.add(moduleId);\r
- }\r
- \r
- public void addConfiguredPackageItem(PackageItem packageItem) {\r
- PackageIdentification packageId = new PackageIdentification(packageItem.getPackageName(), packageItem.getPackageGuid(), packageItem.getPackageVersion());\r
- packages.add(packageId);\r
- }\r
-\r
- public void setMode(String mode) {\r
- this.mode = mode;\r
- }\r
-}\r
package org.tianocore.build.tools;\r
\r
import org.apache.tools.ant.BuildException;\r
-\r
+/**\r
+ Ant element for module. \r
+ \r
+ @since GenBuild 1.0\r
+**/\r
public class ModuleItem {\r
\r
- private String moduleName;\r
+ private String moduleName = null;\r
\r
- private String moduleGuid;\r
+ private String moduleGuid = null;\r
\r
- private String moduleVersion;\r
+ private String moduleVersion = null;\r
\r
- private String packageName;\r
+ private String packageName = null;\r
\r
- private String packageGuid;\r
+ private String packageGuid = null;\r
\r
- private String packageVersion;\r
+ private String packageVersion = null;\r
\r
public ModuleItem(){\r
\r
\r
}\r
\r
+ /**\r
+ Get module Guid. \r
+ @return Module Guid\r
+ **/\r
public String getModuleGuid() {\r
return moduleGuid;\r
}\r
\r
+ /**\r
+ Set module Guid\r
+ @param moduleGuid Module Guid\r
+ **/\r
public void setModuleGuid(String moduleGuid) {\r
this.moduleGuid = moduleGuid;\r
}\r
\r
+ /**\r
+ Get Module Name. \r
+ @return Module Name\r
+ **/\r
public String getModuleName() {\r
return moduleName;\r
}\r
\r
+ /**\r
+ Set Module Name.\r
+ @param moduleName Module Name\r
+ **/\r
public void setModuleName(String moduleName) {\r
this.moduleName = moduleName;\r
}\r
\r
+ /**\r
+ Get Module Version. \r
+ @return Module Version\r
+ **/\r
public String getModuleVersion() {\r
return moduleVersion;\r
}\r
\r
+ /**\r
+ Set Module Version. \r
+ @param moduleVersion Module version\r
+ **/\r
public void setModuleVersion(String moduleVersion) {\r
this.moduleVersion = moduleVersion;\r
}\r
\r
+ /**\r
+ Get Package Guid. \r
+ @return Package Guid\r
+ **/\r
public String getPackageGuid() {\r
return packageGuid;\r
}\r
\r
+ /**\r
+ Set Package Guid. \r
+ @param packageGuid Package Guid\r
+ **/\r
public void setPackageGuid(String packageGuid) {\r
this.packageGuid = packageGuid;\r
}\r
\r
+ /**\r
+ Get Package Name. \r
+ @return Package Name\r
+ **/\r
public String getPackageName() {\r
return packageName;\r
}\r
\r
+ /**\r
+ Set Package Name. \r
+ @param packageName Package Name\r
+ **/\r
public void setPackageName(String packageName) {\r
this.packageName = packageName;\r
}\r
\r
+ /**\r
+ Get Package Version. \r
+ @return Package Version\r
+ **/\r
public String getPackageVersion() {\r
return packageVersion;\r
}\r
\r
+ /**\r
+ Set Package Version. \r
+ @param packageVersion Package Version\r
+ **/\r
public void setPackageVersion(String packageVersion) {\r
this.packageVersion = packageVersion;\r
}\r
\r
import org.apache.tools.ant.BuildException;\r
\r
+/**\r
+ Ant element for Package. \r
+\r
+ @since GenBuild 1.0\r
+**/\r
public class PackageItem {\r
\r
- private String packageName;\r
+ private String packageName = null;\r
\r
- private String packageGuid;\r
+ private String packageGuid = null;\r
\r
- private String packageVersion;\r
+ private String packageVersion = null;\r
\r
public PackageItem(){\r
\r
public String toString(){\r
return "[" + packageName + packageGuid + "]";\r
}\r
+ /**\r
+ Get Package Guid. \r
+ @return Package Guid\r
+ **/\r
public String getPackageGuid() {\r
return packageGuid;\r
}\r
\r
+ /**\r
+ Set Package Guid. \r
+ @param packageGuid Package Guid\r
+ **/\r
public void setPackageGuid(String packageGuid) {\r
this.packageGuid = packageGuid;\r
}\r
\r
+ /**\r
+ Get Package Name. \r
+ @return Package Name\r
+ **/\r
public String getPackageName() {\r
return packageName;\r
}\r
\r
+ /**\r
+ Set Package Name. \r
+ @param packageName Package Name\r
+ **/\r
public void setPackageName(String packageName) {\r
this.packageName = packageName;\r
}\r
\r
+ /**\r
+ Get Package Version. \r
+ @return Package Version\r
+ **/\r
public String getPackageVersion() {\r
return packageVersion;\r
}\r
\r
+ /**\r
+ Set Package Version. \r
+ @param packageVersion Package Version\r
+ **/\r
public void setPackageVersion(String packageVersion) {\r
this.packageVersion = packageVersion;\r
}\r