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.global.PropertyManager;\r
import org.tianocore.build.id.FpdModuleIdentification;\r
import org.tianocore.build.id.ModuleIdentification;\r
import org.tianocore.build.id.PackageIdentification;\r
/// The information at the header of <em>build.xml</em>.\r
///\r
private String info = "DO NOT EDIT \n"\r
- + "File auto-generated by build utility\n"\r
+ + "This file is auto-generated by the build utility\n"\r
+ "\n"\r
+ "Abstract:\n"\r
- + "Auto-generated ANT build file for building of EFI Modules/Platforms\n";\r
+ + "Auto-generated ANT build file for build EFI Modules and Platforms\n";\r
\r
private FpdModuleIdentification fpdModuleId;\r
\r
xformer.setOutputProperty(OutputKeys.INDENT, "yes");\r
xformer.transform(source, result);\r
} catch (Exception ex) {\r
- throw new BuildException("Module [" + fpdModuleId.getModule().getName() + "] generating build file failed.\n" + ex.getMessage());\r
+ throw new BuildException("Generating the module [" + fpdModuleId.getModule().getName() + "] build.xml file failed!.\n" + ex.getMessage());\r
}\r
}\r
\r
@param root Root element for current\r
**/\r
private void applyCleanElement(Document document, Node root) {\r
- ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
- for (int i = 0; i < libinstances.length; i++) {\r
- //\r
- // Put package file path to module identification\r
- //\r
- PackageIdentification packageId = libinstances[i].getPackage();\r
- \r
- //\r
- // Generate ANT script to clean\r
- //\r
- Element ele = document.createElement("GenBuild");\r
- ele.setAttribute("type", "clean");\r
- \r
- //\r
- // Prepare pass down information\r
- //\r
- Map<String, String> passDownMap = new LinkedHashMap<String, String>();\r
- for (int j = 0; j < inheritProperties.length; j ++){\r
- passDownMap.put(inheritProperties[j], "${" + inheritProperties[j] + "}");\r
- }\r
- passDownMap.put("MODULE_GUID", libinstances[i].getGuid());\r
- passDownMap.put("MODULE_VERSION", libinstances[i].getVersion());\r
- \r
- passDownMap.put("PACKAGE_GUID", packageId.getGuid());\r
- passDownMap.put("PACKAGE_VERSION", packageId.getVersion());\r
- \r
- for (int j = 0; j < inheritProperties.length; j ++){\r
- Element property = document.createElement("property");\r
- property.setAttribute("name", inheritProperties[j]);\r
- property.setAttribute("value", passDownMap.get(inheritProperties[j]));\r
- ele.appendChild(property);\r
- }\r
-\r
- root.appendChild(ele);\r
- }\r
//\r
// <delete includeemptydirs="true">\r
// <fileset dir="${DEST_DIR_OUTPUT}" includes="" excludes="" />\r
@param root Root element for current\r
**/\r
private void applyDeepcleanElement(Document document, Node root) {\r
- ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
- for (int i = 0; i < libinstances.length; i++) {\r
- //\r
- // Put package file path to module identification\r
- //\r
- PackageIdentification packageId = libinstances[i].getPackage();\r
- \r
- //\r
- // Generate ANT script to clean\r
- //\r
- Element ele = document.createElement("GenBuild");\r
- ele.setAttribute("type", "cleanall");\r
- \r
- //\r
- // Prepare pass down information\r
- //\r
- Map<String, String> passDownMap = new LinkedHashMap<String, String>();\r
- for (int j = 0; j < inheritProperties.length; j ++){\r
- passDownMap.put(inheritProperties[j], "${" + inheritProperties[j] + "}");\r
- }\r
- \r
- passDownMap.put("MODULE_GUID", libinstances[i].getGuid());\r
- passDownMap.put("MODULE_VERSION", libinstances[i].getVersion());\r
- \r
- passDownMap.put("PACKAGE_GUID", packageId.getGuid());\r
- passDownMap.put("PACKAGE_VERSION", packageId.getVersion());\r
- \r
- for (int j = 0; j < inheritProperties.length; j ++){\r
- Element property = document.createElement("property");\r
- property.setAttribute("name", inheritProperties[j]);\r
- property.setAttribute("value", passDownMap.get(inheritProperties[j]));\r
- ele.appendChild(property);\r
- }\r
-\r
- root.appendChild(ele);\r
- }\r
//\r
// <delete includeemptydirs="true">\r
// <fileset dir="${DEST_DIR_OUTPUT}" includes="" excludes="" />\r
**/\r
private void applyLibraryInstance(Document document, Node root) {\r
ModuleIdentification[] libinstances = SurfaceAreaQuery.getLibraryInstance(fpdModuleId.getArch());\r
-// String propertyLibs = "";\r
for (int i = 0; i < libinstances.length; i++) {\r
//\r
// Put package file path to module identification\r
//\r
Element ele = document.createElement("GenBuild");\r
ele.setAttribute("type", "build");\r
-// ele.setAttribute("inheritAll", "false");\r
\r
//\r
// Prepare pass down information\r
}\r
\r
root.appendChild(ele);\r
-// propertyLibs += " " + project.getProperty("BIN_DIR") + File.separatorChar + libinstances[i].getName() + ".lib";\r
}\r
-// project.setProperty("LIBS", propertyLibs.replaceAll("(\\\\)", "/"));\r
}\r
\r
/**\r
//\r
// WORKSPACE\r
//\r
- includes.add("${WORKSPACE_DIR}");\r
+ includes.add("${WORKSPACE_DIR}" + File.separatorChar);\r
\r
//\r
// Module iteself\r
\r
FileProcess fileProcess = new FileProcess();\r
fileProcess.init(project, includes, document);\r
+ \r
+ //\r
+ // Initialize some properties by user\r
+ //\r
+ Element initEle = document.createElement("Build_Init");\r
+ root.appendChild(initEle);\r
\r
String moduleDir = project.getProperty("MODULE_DIR");\r
//\r
for (int i = 0; i < sourceFiles.length; i++) {\r
str += " " + sourceFiles[i][1];\r
}\r
- project.setProperty("SOURCE_FILES", str.replaceAll("(\\\\)", "/"));\r
+ PropertyManager.setProperty(project, "SOURCE_FILES", str.replaceAll("(\\\\)", "/"));\r
}\r
\r
/**\r