diff options
author | wuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-10 08:43:23 +0000 |
---|---|---|
committer | wuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-10 08:43:23 +0000 |
commit | 8cf5da75ce5bf66f1ef5a495a41fdcc0a51f7138 (patch) | |
tree | 018ce429678dd11111e7472d0557631548613238 | |
parent | 5b1b9d8bf4565b194ac16294c58993c62bcae315 (diff) | |
download | edk2-8cf5da75ce5bf66f1ef5a495a41fdcc0a51f7138.zip edk2-8cf5da75ce5bf66f1ef5a495a41fdcc0a51f7138.tar.gz edk2-8cf5da75ce5bf66f1ef5a495a41fdcc0a51f7138.tar.bz2 |
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
7 files changed, 71 insertions, 23 deletions
diff --git a/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java index 88e1a20..624b07d 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java @@ -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{
diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java index 87593a6..929ddea 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java +++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java @@ -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("Pre Build Processing"));
+ Element ele = document.createElement("target");
+ ele.setAttribute("name", "prebuild");
+
+ 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("User Extensions"));
+ root.appendChild(document.createComment("Post Build Processing"));
Element ele = document.createElement("target");
- ele.setAttribute("name", "userextensions");
+ ele.setAttribute("name", "postbuild");
- Node node = SurfaceAreaQuery.getFpdUserExtension();
+ Node node = SurfaceAreaQuery.getFpdUserExtensionPostBuild();
if (node != null) {
//
// For every Target and ToolChain
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java index 321a87a..149b30d 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java @@ -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) {
diff --git a/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainKey.java b/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainKey.java index 60e698f..5504e54 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainKey.java +++ b/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainKey.java @@ -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> {
diff --git a/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainMap.java b/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainMap.java index 51cbf85..baddd95 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainMap.java +++ b/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainMap.java @@ -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;
diff --git a/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainTask.java b/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainTask.java index 4b0577b..974be51 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/toolchain/ToolChainTask.java @@ -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;
diff --git a/Tools/Source/GenBuild/org/tianocore/build/tools/PackageItem.java b/Tools/Source/GenBuild/org/tianocore/build/tools/PackageItem.java index af824b1..abe40b7 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/tools/PackageItem.java +++ b/Tools/Source/GenBuild/org/tianocore/build/tools/PackageItem.java @@ -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 {
|