Support prebuild and postbuild for UserExtension for Platform build. If UserExtension's Identifier equals "0", which means prebuild, while Identifier equals "1", which means post build. UserExtension's UserId is still "TianoCore".

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@860 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
wuyizhong 2006-07-10 08:43:23 +00:00
parent 5b1b9d8bf4
commit 8cf5da75ce
7 changed files with 71 additions and 23 deletions

View File

@ -26,7 +26,6 @@ import org.apache.tools.ant.Task;
import org.tianocore.build.fpd.FpdParserTask;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.toolchain.ConfigReader;
import org.tianocore.build.toolchain.ToolChainConfig;
import org.tianocore.build.toolchain.ToolChainInfo;
public class FrameworkBuildTask extends Task{

View File

@ -119,7 +119,7 @@ public class PlatformBuildFileGenerator {
Set<String> sequenceKeys = sequences.keySet();
Iterator sequenceIter = sequenceKeys.iterator();
String dependsStr = "";
String dependsStr = "prebuild";
while (sequenceIter.hasNext()) {
String num = (String)sequenceIter.next();
if (dependsStr.length() > 0) {
@ -134,7 +134,7 @@ public class PlatformBuildFileGenerator {
root.appendChild(document.createComment("Default target"));
ele = document.createElement("target");
ele.setAttribute("name", "all");
ele.setAttribute("depends", dependsStr + ", userextensions");
ele.setAttribute("depends", dependsStr + ", postbuild");
root.appendChild(ele);
//
@ -158,9 +158,14 @@ public class PlatformBuildFileGenerator {
applyCleanall(document, root);
//
// User Extension
// User Extension pre build
//
applyUserExtensions(document, root);
applyUserExtensionsPreBuild(document, root);
//
// User Extension Post build
//
applyUserExtensionsPostBuild(document, root);
document.appendChild(rootComment);
document.appendChild(root);
@ -463,15 +468,59 @@ public class PlatformBuildFileGenerator {
root.appendChild(ele);
}
private void applyUserExtensions(Document document, Node root) {
private void applyUserExtensionsPreBuild(Document document, Node root) {
//
// User Extensions
//
root.appendChild(document.createComment("User Extensions"));
root.appendChild(document.createComment("Pre Build Processing"));
Element ele = document.createElement("target");
ele.setAttribute("name", "userextensions");
ele.setAttribute("name", "prebuild");
Node node = SurfaceAreaQuery.getFpdUserExtension();
Node node = SurfaceAreaQuery.getFpdUserExtensionPreBuild();
if (node != null) {
//
// For every Target and ToolChain
//
String[] targetList = GlobalData.getToolChainInfo().getTargets();
for (int i = 0; i < targetList.length; i++){
String[] toolchainList = GlobalData.getToolChainInfo().getTagnames();
for(int j = 0; j < toolchainList.length; j++){
//
// Prepare FV_DIR
//
String ffsCommonDir = project.getProperty("BUILD_DIR") + File.separatorChar
+ targetList[i] + File.separatorChar
+ toolchainList[j];
File fvDir = new File(ffsCommonDir + File.separatorChar + "FV");
Element fvEle = document.createElement("var");
fvEle.setAttribute("name", "FV_DIR");
fvEle.setAttribute("value", fvDir.getPath().replaceAll("(\\\\)", "/"));
ele.appendChild(fvEle);
NodeList childNodes = node.getChildNodes();
for (int k = 0; k < childNodes.getLength(); k++) {
Node childItem = childNodes.item(k);
if (childItem.getNodeType() == Node.ELEMENT_NODE) {
ele.appendChild(recursiveNode(childItem, document));
}
}
}
}
}
root.appendChild(ele);
}
private void applyUserExtensionsPostBuild(Document document, Node root) {
//
// User Extensions
//
root.appendChild(document.createComment("Post Build Processing"));
Element ele = document.createElement("target");
ele.setAttribute("name", "postbuild");
Node node = SurfaceAreaQuery.getFpdUserExtensionPostBuild();
if (node != null) {
//
// For every Target and ToolChain

View File

@ -397,7 +397,6 @@ public class SurfaceAreaQuery {
String toolchainFamily = null;
List<String> archList = null;
String cmd = null;
String targetName = null;
String optionName = null;
Object[] returns = get(from, xPath);
@ -1385,8 +1384,20 @@ public class SurfaceAreaQuery {
return result;
}
public static Node getFpdUserExtension() {
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore']" };
public static Node getFpdUserExtensionPreBuild() {
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='0']" };
Object[] queryResult = get("PlatformSurfaceArea", xPath);
if (queryResult == null || queryResult.length == 0) {
return null;
}
UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0];
return a.getDomNode();
}
public static Node getFpdUserExtensionPostBuild() {
String[] xPath = new String[] { "/UserExtensions[@UserID='TianoCore' and @Identifier='1']" };
Object[] queryResult = get("PlatformSurfaceArea", xPath);
if (queryResult == null || queryResult.length == 0) {

View File

@ -18,12 +18,6 @@ Abstract:
package org.tianocore.build.toolchain;
import java.io.Serializable;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeMap;
import org.tianocore.exception.EdkException;
public class ToolChainKey implements java.io.Serializable, Comparable<ToolChainKey> {

View File

@ -22,8 +22,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.tianocore.exception.EdkException;
public class ToolChainMap {
private int matchLevel = ToolChainKey.keyLength - 2;

View File

@ -15,8 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.build.toolchain;
import java.io.File;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;

View File

@ -13,7 +13,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
package org.tianocore.build.tools;
import org.apache.tools.ant.BuildException;
import org.tianocore.build.global.SurfaceAreaQuery;
public class PackageItem {