mirror of https://github.com/acidanthera/audk.git
Adjust some code format and clear some unused codes.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1273 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
5a6cd58892
commit
8251688793
|
@ -21,14 +21,12 @@ import javax.xml.namespace.QName;
|
|||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.xmlbeans.XmlCursor;
|
||||
import org.apache.xmlbeans.XmlObject;
|
||||
import org.tianocore.BuildOptionsDocument;
|
||||
import org.tianocore.build.global.GlobalData;
|
||||
import org.tianocore.build.global.SurfaceAreaQuery;
|
||||
import org.tianocore.build.id.FpdModuleIdentification;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
/**
|
||||
<p><code>FfsProcess</code> is a class to find the corresponding FFS layout. </p>
|
||||
|
@ -54,11 +52,6 @@ import org.w3c.dom.Node;
|
|||
**/
|
||||
public class FfsProcess {
|
||||
|
||||
///
|
||||
/// Xml Document Node for corresponding FFS layout
|
||||
///
|
||||
private Node ffs;
|
||||
|
||||
private BuildOptionsDocument.BuildOptions.Ffs ffsXmlObject;
|
||||
|
||||
///
|
||||
|
@ -133,18 +126,7 @@ public class FfsProcess {
|
|||
**/
|
||||
public boolean initSections(String buildType, Project project, FpdModuleIdentification fpdModuleId) throws BuildException {
|
||||
//
|
||||
// Firstly, try to find in ModuleSA
|
||||
//
|
||||
// BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = SurfaceAreaQuery.getModuleFfs();
|
||||
// for (int i = 0; i < ffsArray.length; i++) {
|
||||
// if (isMatch(ffsArray[i].getFfsKey(), buildType)) {
|
||||
// ffsXmlObject = ffsArray[i];
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
//
|
||||
// secondly, try to sections defined in PLATFORM level
|
||||
// Try to find Ffs layout from FPD file
|
||||
//
|
||||
SurfaceAreaQuery.push(GlobalData.getFpdBuildOptions());
|
||||
BuildOptionsDocument.BuildOptions.Ffs[] ffsArray = SurfaceAreaQuery.getFpdFfs();
|
||||
|
@ -162,16 +144,11 @@ public class FfsProcess {
|
|||
//
|
||||
if (buildType == null) {
|
||||
System.out.println("Warning: this module doesn't specify a FfsFormatKey. ");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw new BuildException("Can't find the FfsFormatKey [" + buildType + "] attribute in the FPD file!");
|
||||
}
|
||||
|
||||
if (ffs == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,43 +162,36 @@ public class FfsProcess {
|
|||
**/
|
||||
public String[] getGenSectionElements(Document document, String basename, String guid, String targetFilename) {
|
||||
this.basename = basename;
|
||||
if (ffs == null && ffsXmlObject == null) {
|
||||
if (ffsXmlObject == null) {
|
||||
return new String[0];
|
||||
}
|
||||
Vector<String> sectionList = new Vector<String>();
|
||||
XmlCursor cursor = null;
|
||||
try {
|
||||
if (ffsXmlObject == null) {
|
||||
cursor = XmlObject.Factory.parse(ffs).newCursor();
|
||||
}
|
||||
else {
|
||||
cursor = ffsXmlObject.newCursor();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
int mode = MODE_NONE;
|
||||
Element root = document.createElement("genffsfile");
|
||||
root.setAttribute("outputDir", "${BIN_DIR}");
|
||||
root.setAttribute("moduleType", "${MODULE_TYPE}");
|
||||
root.setAttribute("BaseName", basename);
|
||||
root.setAttribute("fileGuid", guid);
|
||||
if (ffsXmlObject == null) {
|
||||
cursor.toFirstChild();
|
||||
}
|
||||
Element genffsfileEle = document.createElement("genffsfile");
|
||||
genffsfileEle.setAttribute("outputDir", "${BIN_DIR}");
|
||||
genffsfileEle.setAttribute("moduleType", "${MODULE_TYPE}");
|
||||
genffsfileEle.setAttribute("BaseName", basename);
|
||||
genffsfileEle.setAttribute("fileGuid", guid);
|
||||
|
||||
if (cursor.toFirstChild()) {
|
||||
do {
|
||||
if (cursor.getName().getLocalPart().equalsIgnoreCase("Attribute")) {
|
||||
String name = cursor.getAttributeText(new QName("Name"));
|
||||
String value = cursor.getAttributeText(new QName("Value"));
|
||||
root.setAttribute(changeAttributeName(name), value);
|
||||
genffsfileEle.setAttribute(changeAttributeName(name), value);
|
||||
} else if (cursor.getName().getLocalPart().equalsIgnoreCase("Section")) {
|
||||
cursor.push();
|
||||
dealSection(mode, document, root, cursor, sectionList);
|
||||
dealSection(mode, document, genffsfileEle, cursor, sectionList);
|
||||
cursor.pop();
|
||||
} else if (cursor.getName().getLocalPart().equalsIgnoreCase("Sections")) {
|
||||
cursor.push();
|
||||
dealSections(mode, document, root, cursor, sectionList);
|
||||
dealSections(mode, document, genffsfileEle, cursor, sectionList);
|
||||
cursor.pop();
|
||||
}
|
||||
} while (cursor.toNextSibling());
|
||||
|
@ -246,7 +216,7 @@ public class FfsProcess {
|
|||
targetEle.appendChild(fileEle);
|
||||
outofdateEle.appendChild(targetEle);
|
||||
Element sequentialEle = document.createElement("sequential");
|
||||
sequentialEle.appendChild(root);
|
||||
sequentialEle.appendChild(genffsfileEle);
|
||||
outofdateEle.appendChild(sequentialEle);
|
||||
ffsNode = outofdateEle;
|
||||
return result;
|
||||
|
|
|
@ -156,18 +156,12 @@ public class FileProcess {
|
|||
@param root Root node
|
||||
**/
|
||||
public synchronized void parseFile(String filename, Node root) throws BuildException {
|
||||
boolean flag = false;
|
||||
for (int i = 0; i < fileTypes.length; i++) {
|
||||
if (filename.endsWith(fileTypes[i][0])) {
|
||||
flag = true;
|
||||
parseFile(filename, fileTypes[i][2], root);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
/*
|
||||
if (!flag) {
|
||||
throw new BuildException("File [" + filename + "] is not known from its suffix.");
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -113,23 +113,18 @@ public class FrameworkBuildTask extends Task{
|
|||
File buildFile = null;
|
||||
if (msaFiles.size() > 1) {
|
||||
throw new BuildException("Having more than one MSA file in a directory is not allowed!");
|
||||
}
|
||||
else if (msaFiles.size() == 1 && activePlatform == null) {
|
||||
} else if (msaFiles.size() == 1 && activePlatform == null) {
|
||||
throw new BuildException("If trying to build a single module, please set ACTIVE_PLATFORM in file [Tool/Conf/target.txt]. ");
|
||||
}
|
||||
else if (msaFiles.size() == 1 && activePlatform != null) {
|
||||
} else if (msaFiles.size() == 1 && activePlatform != null) {
|
||||
//
|
||||
// Build the single module
|
||||
//
|
||||
buildFile = msaFiles.toArray(new File[1])[0];
|
||||
}
|
||||
else if (activePlatform != null) {
|
||||
} else if (activePlatform != null) {
|
||||
buildFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform);
|
||||
}
|
||||
else if (fpdFiles.size() == 1) {
|
||||
} else if (fpdFiles.size() == 1) {
|
||||
buildFile = fpdFiles.toArray(new File[1])[0];
|
||||
}
|
||||
else if (fpdFiles.size() > 1) {
|
||||
} else if (fpdFiles.size() > 1) {
|
||||
buildFile = intercommuniteWithUser();
|
||||
}
|
||||
//
|
||||
|
@ -191,20 +186,16 @@ public class FrameworkBuildTask extends Task{
|
|||
|
||||
private File intercommuniteWithUser(){
|
||||
File file = null;
|
||||
if (fpdFiles.size() + msaFiles.size() > 1) {
|
||||
File[] allFiles = new File[fpdFiles.size() + msaFiles.size()];
|
||||
if (fpdFiles.size() > 1) {
|
||||
File[] allFiles = new File[fpdFiles.size()];
|
||||
int index = 0;
|
||||
Iterator<File> iter = fpdFiles.iterator();
|
||||
while (iter.hasNext()) {
|
||||
allFiles[index] = iter.next();
|
||||
index++;
|
||||
}
|
||||
iter = msaFiles.iterator();
|
||||
while (iter.hasNext()) {
|
||||
allFiles[index] = iter.next();
|
||||
index++;
|
||||
}
|
||||
System.out.println("Finding " + allFiles.length + " FPD and MSA files: ");
|
||||
|
||||
System.out.println("Finding " + allFiles.length + " FPD files: ");
|
||||
for (int i = 0; i < allFiles.length; i++) {
|
||||
System.out.println("[" + (i + 1) + "]: " + allFiles[i].getName());
|
||||
}
|
||||
|
@ -234,13 +225,9 @@ public class FrameworkBuildTask extends Task{
|
|||
flag = true;
|
||||
}
|
||||
} while (flag);
|
||||
}
|
||||
else if (fpdFiles.size() == 1) {
|
||||
} else if (fpdFiles.size() == 1) {
|
||||
file = fpdFiles.toArray(new File[1])[0];
|
||||
}
|
||||
else if (msaFiles.size() == 1) {
|
||||
file = msaFiles.toArray(new File[1])[0];
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -248,8 +235,7 @@ public class FrameworkBuildTask extends Task{
|
|||
public void setType(String type) {
|
||||
if (type.equalsIgnoreCase("clean") || type.equalsIgnoreCase("cleanall")) {
|
||||
this.type = type.toLowerCase();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.type = "all";
|
||||
}
|
||||
}
|
||||
|
@ -265,22 +251,19 @@ public class FrameworkBuildTask extends Task{
|
|||
String str = getValue("TARGET", targetFileInfo);
|
||||
if (str == null || str.trim().equals("")) {
|
||||
envToolChainInfo.addTargets("*");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
envToolChainInfo.addTargets(str);
|
||||
}
|
||||
str = getValue("TOOL_CHAIN_TAG", targetFileInfo);
|
||||
if (str == null || str.trim().equals("")) {
|
||||
envToolChainInfo.addTagnames("*");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
envToolChainInfo.addTagnames(str);
|
||||
}
|
||||
str = getValue("TARGET_ARCH", targetFileInfo);
|
||||
if (str == null || str.trim().equals("")) {
|
||||
envToolChainInfo.addArchs("*");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
envToolChainInfo.addArchs(str);
|
||||
}
|
||||
GlobalData.setToolChainEnvInfo(envToolChainInfo);
|
||||
|
|
|
@ -89,10 +89,7 @@ public class GenBuildTask extends Ant {
|
|||
///
|
||||
File msaFile;
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
private String type = "all"; // = "build";
|
||||
private String type = "all";
|
||||
|
||||
///
|
||||
/// Module's Identification.
|
||||
|
@ -123,8 +120,7 @@ public class GenBuildTask extends Ant {
|
|||
GenBuildLogger logger = new GenBuildLogger(getProject());
|
||||
EdkLog.setLogLevel(getProject().getProperty("env.LOGLEVEL"));
|
||||
EdkLog.setLogger(logger);
|
||||
// remove !!
|
||||
try {
|
||||
|
||||
pushProperties();
|
||||
//
|
||||
// Enable all specified properties
|
||||
|
@ -152,8 +148,7 @@ public class GenBuildTask extends Ant {
|
|||
Map<String, XmlObject> doc = GlobalData.getNativeMsa(moduleId);
|
||||
SurfaceAreaQuery.setDoc(doc);
|
||||
moduleId = SurfaceAreaQuery.getMsaHeader();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Map<String, XmlObject> doc = GlobalData.getNativeMsa(msaFile);
|
||||
SurfaceAreaQuery.setDoc(doc);
|
||||
moduleId = SurfaceAreaQuery.getMsaHeader();
|
||||
|
@ -161,8 +156,7 @@ public class GenBuildTask extends Ant {
|
|||
String[] producedLibraryClasses = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED",null);
|
||||
if (producedLibraryClasses.length == 0) {
|
||||
moduleId.setLibrary(false);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
moduleId.setLibrary(true);
|
||||
}
|
||||
|
||||
|
@ -174,8 +168,7 @@ public class GenBuildTask extends Ant {
|
|||
// Single Module build
|
||||
//
|
||||
prepareSingleModuleBuild();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//
|
||||
// Platform build. Restore the platform related info
|
||||
//
|
||||
|
@ -191,8 +184,8 @@ public class GenBuildTask extends Ant {
|
|||
}
|
||||
|
||||
//
|
||||
// If single module : intersection MSA supported ARCHs and tools def!!
|
||||
// else, get arch from pass down
|
||||
// If single module : get arch from pass down, otherwise intersection MSA
|
||||
// supported ARCHs and tools def
|
||||
//
|
||||
Set<String> archListSupByToolChain = new LinkedHashSet<String>();
|
||||
String[] archs = GlobalData.getToolChainInfo().getArchs();
|
||||
|
@ -211,8 +204,7 @@ public class GenBuildTask extends Ant {
|
|||
archSet.add(fpdArchList[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
archSet = archListSupByToolChain;
|
||||
}
|
||||
|
||||
|
@ -296,20 +288,16 @@ public class GenBuildTask extends Ant {
|
|||
|
||||
if (type.equalsIgnoreCase("all") || type.equalsIgnoreCase("build")) {
|
||||
applyBuild(targetList[i], toolchainList[j], fpdModuleId);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("clean")) {
|
||||
} else if (type.equalsIgnoreCase("clean")) {
|
||||
applyClean(fpdModuleId);
|
||||
}
|
||||
else if (type.equalsIgnoreCase("cleanall")) {
|
||||
} else if (type.equalsIgnoreCase("cleanall")) {
|
||||
applyCleanall(fpdModuleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
popProperties();
|
||||
}catch (Exception e){
|
||||
throw new BuildException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -331,7 +319,7 @@ public class GenBuildTask extends Ant {
|
|||
moduleId.setPackage(packageId);
|
||||
|
||||
//
|
||||
// Read ACTIVE_PLATFORM's FPD file (Call FpdParserTask's method)
|
||||
// Read ACTIVE_PLATFORM's FPD file
|
||||
//
|
||||
String filename = getProject().getProperty("PLATFORM_FILE");
|
||||
|
||||
|
@ -342,7 +330,7 @@ public class GenBuildTask extends Ant {
|
|||
PlatformIdentification platformId = GlobalData.getPlatform(filename);
|
||||
|
||||
//
|
||||
// Read FPD file
|
||||
// Read FPD file (Call FpdParserTask's method)
|
||||
//
|
||||
FpdParserTask fpdParser = new FpdParserTask();
|
||||
fpdParser.setProject(getProject());
|
||||
|
@ -360,6 +348,8 @@ public class GenBuildTask extends Ant {
|
|||
|
||||
/**
|
||||
Set Module-Related information to properties.
|
||||
|
||||
@param arch current build ARCH
|
||||
**/
|
||||
private void setModuleCommonProperties(String arch) {
|
||||
//
|
||||
|
@ -381,8 +371,7 @@ public class GenBuildTask extends Ant {
|
|||
String baseName = SurfaceAreaQuery.getModuleOutputFileBasename();
|
||||
if (baseName == null) {
|
||||
getProject().setProperty("BASE_NAME", moduleId.getName());
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
getProject().setProperty("BASE_NAME", baseName);
|
||||
}
|
||||
getProject().setProperty("GUID", moduleId.getGuid());
|
||||
|
@ -423,8 +412,7 @@ public class GenBuildTask extends Ant {
|
|||
//
|
||||
if (arch.equalsIgnoreCase("EBC")) {
|
||||
getProject().setProperty("ENTRYPOINT", "EfiStart");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
getProject().setProperty("ENTRYPOINT", "_ModuleEntryPoint");
|
||||
}
|
||||
|
||||
|
@ -462,8 +450,7 @@ public class GenBuildTask extends Ant {
|
|||
String extName = GlobalData.getCommandSetting(key, fpdModuleId);
|
||||
if ( extName != null && ! extName.equalsIgnoreCase("")) {
|
||||
getProject().setProperty(cmd[m] + "_EXT", extName);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
getProject().setProperty(cmd[m] + "_EXT", "");
|
||||
}
|
||||
|
||||
|
@ -483,8 +470,7 @@ public class GenBuildTask extends Ant {
|
|||
String spath = GlobalData.getCommandSetting(key, fpdModuleId);
|
||||
if (spath != null) {
|
||||
getProject().setProperty(cmd[m] + "_SPATH", spath.replaceAll("(\\\\)", "/"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
getProject().setProperty(cmd[m] + "_SPATH", "");
|
||||
}
|
||||
|
||||
|
@ -495,8 +481,7 @@ public class GenBuildTask extends Ant {
|
|||
String dpath = GlobalData.getCommandSetting(key, fpdModuleId);
|
||||
if (dpath != null) {
|
||||
getProject().setProperty(cmd[m] + "_DPATH", dpath.replaceAll("(\\\\)", "/"));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
getProject().setProperty(cmd[m] + "_DPATH", "");
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +528,7 @@ public class GenBuildTask extends Ant {
|
|||
this.type = type;
|
||||
}
|
||||
|
||||
private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws EdkException{
|
||||
private void applyBuild(String buildTarget, String buildTagname, FpdModuleIdentification fpdModuleId) throws BuildException{
|
||||
//
|
||||
// AutoGen
|
||||
//
|
||||
|
@ -555,7 +540,12 @@ public class GenBuildTask extends Ant {
|
|||
//
|
||||
// Get compiler flags
|
||||
//
|
||||
try {
|
||||
getCompilerFlags(buildTarget, buildTagname, fpdModuleId);
|
||||
}
|
||||
catch (EdkException ee) {
|
||||
throw new BuildException(ee.getMessage());
|
||||
}
|
||||
|
||||
//
|
||||
// Prepare LIBS
|
||||
|
@ -573,12 +563,10 @@ public class GenBuildTask extends Ant {
|
|||
//
|
||||
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
|
||||
GlobalData.log.info("Call user-defined " + moduleId.getName() + "_build.xml");
|
||||
Ant ant = new Ant();
|
||||
ant.setProject(getProject());
|
||||
ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");
|
||||
ant.setInheritAll(true);
|
||||
ant.init();
|
||||
ant.execute();
|
||||
|
||||
String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
|
||||
antCall(antFilename, null);
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
|
@ -594,12 +582,8 @@ public class GenBuildTask extends Ant {
|
|||
//
|
||||
// Ant call ${BASE_NAME}_build.xml
|
||||
//
|
||||
Ant ant = new Ant();
|
||||
ant.setProject(getProject());
|
||||
ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");
|
||||
ant.setInheritAll(true);
|
||||
ant.init();
|
||||
ant.execute();
|
||||
String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
|
||||
antCall(antFilename, null);
|
||||
}
|
||||
|
||||
private void applyClean(FpdModuleIdentification fpdModuleId){
|
||||
|
@ -609,27 +593,15 @@ public class GenBuildTask extends Ant {
|
|||
//
|
||||
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
|
||||
GlobalData.log.info("Calling user-defined " + moduleId.getName() + "_build.xml");
|
||||
Ant ant = new Ant();
|
||||
ant.setProject(getProject());
|
||||
ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");
|
||||
ant.setTarget("clean");
|
||||
ant.setInheritAll(true);
|
||||
ant.init();
|
||||
ant.execute();
|
||||
|
||||
String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
|
||||
antCall(antFilename, "clean");
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
Ant ant = new Ant();
|
||||
ant.setProject(getProject());
|
||||
ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");
|
||||
ant.setTarget("clean");
|
||||
ant.setInheritAll(true);
|
||||
ant.init();
|
||||
ant.execute();
|
||||
|
||||
//
|
||||
// Delete current module's DEST_DIR_OUTPUT
|
||||
// TBD
|
||||
String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
|
||||
antCall(antFilename, "clean");
|
||||
}
|
||||
|
||||
private void applyCleanall(FpdModuleIdentification fpdModuleId){
|
||||
|
@ -639,32 +611,30 @@ public class GenBuildTask extends Ant {
|
|||
//
|
||||
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
|
||||
GlobalData.log.info("Calling user-defined " + moduleId.getName() + "_build.xml");
|
||||
Ant ant = new Ant();
|
||||
ant.setProject(getProject());
|
||||
ant.setAntfile(getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml");
|
||||
ant.setTarget("cleanall");
|
||||
ant.setInheritAll(true);
|
||||
ant.init();
|
||||
ant.execute();
|
||||
|
||||
String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
|
||||
antCall(antFilename, "cleanall");
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
String antFilename = getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml";
|
||||
antCall(antFilename, "cleanall");
|
||||
}
|
||||
|
||||
private void antCall(String antFilename, String target) {
|
||||
Ant ant = new Ant();
|
||||
ant.setProject(getProject());
|
||||
ant.setAntfile(getProject().getProperty("DEST_DIR_OUTPUT") + File.separatorChar + moduleId.getName() + "_build.xml");
|
||||
ant.setTarget("cleanall");
|
||||
ant.setAntfile(antFilename);
|
||||
if (target != null) {
|
||||
ant.setTarget(target);
|
||||
}
|
||||
ant.setInheritAll(true);
|
||||
ant.init();
|
||||
ant.execute();
|
||||
|
||||
//
|
||||
// Delete current module's DEST_DIR_OUTPUT
|
||||
// TBD
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Separate the string and instore in set.
|
||||
|
||||
|
|
|
@ -82,9 +82,6 @@ public class FpdParserTask extends Task {
|
|||
|
||||
private PlatformIdentification platformId;
|
||||
|
||||
///
|
||||
///
|
||||
///
|
||||
private String type;
|
||||
|
||||
///
|
||||
|
@ -127,7 +124,10 @@ public class FpdParserTask extends Task {
|
|||
Surface area is not valid.
|
||||
**/
|
||||
public void execute() throws BuildException {
|
||||
// Remove !!
|
||||
//
|
||||
// If fpdFile is not specified,
|
||||
// then try to get FPD file by platformName
|
||||
//
|
||||
if ( fpdFile == null) {
|
||||
if (platformName == null) {
|
||||
throw new BuildException("FpdParserTask parameter error. Please specify either the platform name or FPD file!");
|
||||
|
@ -187,8 +187,6 @@ public class FpdParserTask extends Task {
|
|||
ant.setInheritAll(true);
|
||||
ant.init();
|
||||
ant.execute();
|
||||
|
||||
// GlobalData.log.info("Fpd build end. ");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -409,7 +407,6 @@ public class FpdParserTask extends Task {
|
|||
//
|
||||
SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));
|
||||
String fvBinding = SurfaceAreaQuery.getModuleFvBindingKeyword();
|
||||
SurfaceAreaQuery.pop();
|
||||
|
||||
fpdModuleId.setFvBinding(fvBinding);
|
||||
updateFvs(fvBinding, fpdModuleId);
|
||||
|
@ -418,9 +415,9 @@ public class FpdParserTask extends Task {
|
|||
// Prepare for out put file name
|
||||
//
|
||||
ModuleIdentification moduleId = fpdModuleId.getModule();
|
||||
SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));
|
||||
|
||||
String baseName = SurfaceAreaQuery.getModuleOutputFileBasename();
|
||||
SurfaceAreaQuery.pop();
|
||||
|
||||
if (baseName == null) {
|
||||
baseName = moduleId.getName();
|
||||
}
|
||||
|
@ -431,7 +428,6 @@ public class FpdParserTask extends Task {
|
|||
//
|
||||
// parse module build options, if any
|
||||
//
|
||||
SurfaceAreaQuery.push(GlobalData.getDoc(fpdModuleId));
|
||||
GlobalData.addModuleToolChainOption(fpdModuleId, parseModuleBuildOptions(false));
|
||||
GlobalData.addModuleToolChainFamilyOption(fpdModuleId, parseModuleBuildOptions(true));
|
||||
SurfaceAreaQuery.pop();
|
||||
|
@ -496,8 +492,7 @@ public class FpdParserTask extends Task {
|
|||
if (fvs.containsKey(fvNameArray[i])) {
|
||||
Set<FpdModuleIdentification> set = fvs.get(fvNameArray[i]);
|
||||
set.add(fpdModuleId);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
Set<FpdModuleIdentification> set = new LinkedHashSet<FpdModuleIdentification>();
|
||||
set.add(fpdModuleId);
|
||||
fvs.put(fvNameArray[i], set);
|
||||
|
@ -573,6 +568,4 @@ public class FpdParserTask extends Task {
|
|||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -39,6 +39,11 @@ import org.w3c.dom.NamedNodeMap;
|
|||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
/**
|
||||
class PlatformBuildFileGenerator is used to generate ${PLATFORM}_build.xml file.
|
||||
|
||||
@since GenBuild 1.0
|
||||
**/
|
||||
public class PlatformBuildFileGenerator {
|
||||
|
||||
private String platformName;
|
||||
|
|
|
@ -259,8 +259,7 @@ public class GlobalData {
|
|||
}
|
||||
if (msaFile == null){
|
||||
throw new BuildException("Can't find Module [" + moduleId.getName() + "] in any SPD package!");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return msaFile;
|
||||
}
|
||||
}
|
||||
|
@ -285,8 +284,7 @@ public class GlobalData {
|
|||
}
|
||||
if (packageId == null){
|
||||
throw new BuildException("Can't find Module [" + moduleId.getName() + "] in any SPD package!");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return packageId;
|
||||
}
|
||||
}
|
||||
|
@ -320,16 +318,14 @@ public class GlobalData {
|
|||
}
|
||||
|
||||
/**
|
||||
Query overrided module surface area information. If current is Package
|
||||
or Platform build, also include the information from FPD file.
|
||||
Query module surface area information.
|
||||
|
||||
<p>Note that surface area parsing is incremental. That means the method will
|
||||
only parse the MSA and MBD files if necessary. </p>
|
||||
only parse the MSA files if necessary. </p>
|
||||
|
||||
@param moduleName the base name of the module
|
||||
@return the overrided module surface area information
|
||||
@throws BuildException
|
||||
MSA or MBD is not valid
|
||||
@param fpdModuleId Module ID with arch
|
||||
@return ModuleSA info and MSA info for fpdModuleId
|
||||
@throws BuildException Can't find MSA
|
||||
**/
|
||||
public synchronized static Map<String, XmlObject> getDoc(FpdModuleIdentification fpdModuleId) throws BuildException {
|
||||
if (parsedModules.containsKey(fpdModuleId)) {
|
||||
|
@ -438,16 +434,12 @@ public class GlobalData {
|
|||
GlobalData.fpdDynamicPcds = fpdDynamicPcds;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
//////////////////////////////////////////////
|
||||
|
||||
public static Set<ModuleIdentification> getModules(PackageIdentification packageId){
|
||||
Spd spd = spdTable.get(packageId);
|
||||
if (spd == null ) {
|
||||
Set<ModuleIdentification> dummy = new HashSet<ModuleIdentification>();
|
||||
return dummy;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return spd.getModules();
|
||||
}
|
||||
}
|
||||
|
@ -611,10 +603,7 @@ public class GlobalData {
|
|||
}
|
||||
|
||||
public synchronized static ModuleIdentification refreshModuleIdentification(ModuleIdentification moduleId) throws BuildException {
|
||||
// System.out.println("1");
|
||||
// System.out.println("##" + moduleId.getGuid());
|
||||
PackageIdentification packageId = getPackageForModule(moduleId);
|
||||
// System.out.println("" + packageId.getGuid());
|
||||
moduleId.setPackage(packageId);
|
||||
Spd spd = spdTable.get(packageId);
|
||||
if (spd == null) {
|
||||
|
@ -637,7 +626,16 @@ public class GlobalData {
|
|||
public synchronized static Set<PackageIdentification> getPackageList(){
|
||||
return packageList;
|
||||
}
|
||||
///// remove!!
|
||||
|
||||
/**
|
||||
BUGBUG: It is a walk around method. If do not clone, can't query info with
|
||||
XPath correctly.
|
||||
|
||||
@param object XmlObject
|
||||
@param deep flag for deep clone
|
||||
@return XmlObject after clone
|
||||
@throws BuildException parse original XmlObject error.
|
||||
**/
|
||||
private static XmlObject cloneXmlObject(XmlObject object, boolean deep) throws BuildException {
|
||||
if ( object == null) {
|
||||
return null;
|
||||
|
|
|
@ -86,7 +86,6 @@ public class OutputManager {
|
|||
@param type the module build type (MODULE or UNIFIED)
|
||||
**/
|
||||
public void update(Project project) {
|
||||
// GlobalData.log.info("" + userdir + ":" + type);
|
||||
//
|
||||
// Default mode is UNIFIED.
|
||||
//
|
||||
|
@ -183,6 +182,7 @@ public class OutputManager {
|
|||
buildDir = GlobalData.getWorkspacePath() + File.separatorChar + userdir;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Set to property
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue