diff options
author | wuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-05 12:06:06 +0000 |
---|---|---|
committer | wuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-05 12:06:06 +0000 |
commit | 8031d48db372d6af87de8dbd96586709674b04d6 (patch) | |
tree | 347d61e5ae3ef65dd6fd1f4b9f5bd786d82f5cc6 /Tools | |
parent | 47f2f01190e8aae3943331840d18a91a1dc579d9 (diff) | |
download | edk2-platforms-8031d48db372d6af87de8dbd96586709674b04d6.tar.xz |
Support UserExtension in FPD.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@769 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools')
3 files changed, 66 insertions, 10 deletions
diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java index b61ad065f1..b102ecfee1 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java @@ -345,7 +345,7 @@ public class FpdParserTask extends Task { Map<String, XmlObject> map = new HashMap<String, XmlObject>();
map.put("PlatformSurfaceArea", doc);
SurfaceAreaQuery.setDoc(map);
- SurfaceAreaQuery.getFpdUserExtension();
+
//
// Initialize
//
diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java index fa94403b6b..65872eb629 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java +++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java @@ -35,7 +35,9 @@ import org.tianocore.build.id.ModuleIdentification; import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
public class PlatformBuildFileGenerator {
@@ -183,6 +185,7 @@ public class PlatformBuildFileGenerator { throw new BuildException("Generate " + platformName + "_build.xml failed. \n" + ex.getMessage());
}
}
+
private void applyModules(Document document, Node root, String num) {
root.appendChild(document.createComment("Modules target"));
Element ele = document.createElement("target");
@@ -464,9 +467,63 @@ public class PlatformBuildFileGenerator { Element ele = document.createElement("target");
ele.setAttribute("name", "userextensions");
+ Node node = SurfaceAreaQuery.getFpdUserExtension();
+ 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 Element recursiveNode(Node node, Document document) {
+ Element root = document.createElement(node.getNodeName());
+ NamedNodeMap attr = node.getAttributes();
+ for (int i = 0; i < attr.getLength(); i++) {
+ Node attrItem = attr.item(i);
+ root.setAttribute(attrItem.getNodeName(), attrItem.getNodeValue());
+ }
+ NodeList childNodes = node.getChildNodes();
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ Node childItem = childNodes.item(i);
+ if (childItem.getNodeType() == Node.ELEMENT_NODE) {
+ root.appendChild(recursiveNode(childItem, document));
+ }
+ else if (childItem.getNodeType() == Node.TEXT_NODE){
+ if ( ! childItem.getNodeValue().trim().equalsIgnoreCase("")) {
+ root.setTextContent(childItem.getNodeValue());
+ }
+ }
+ }
+ return root;
+ }
private boolean isListInSequence(String fvName) {
Set<String> numbers = sequences.keySet();
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java index eb38600b3b..39384c45ba 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java @@ -23,17 +23,14 @@ import java.util.Stack; import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.xmlbeans.XmlNormalizedString;
+import org.apache.xmlbeans.XmlCursor;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlString;
import org.tianocore.BuildOptionsDocument;
import org.tianocore.CNameType;
-import org.tianocore.DataIdDocument;
import org.tianocore.ExternsDocument;
import org.tianocore.FileNameConvention;
-import org.tianocore.FvAttributeDocument;
import org.tianocore.FvImagesDocument;
-import org.tianocore.FvOptionDocument;
import org.tianocore.GuidDeclarationsDocument;
import org.tianocore.GuidsDocument;
import org.tianocore.LibrariesDocument;
@@ -56,18 +53,18 @@ import org.tianocore.PpiDeclarationsDocument; import org.tianocore.ProtocolDeclarationsDocument;
import org.tianocore.Sentence;
import org.tianocore.SpdHeaderDocument;
-import org.tianocore.SupportedArchitectures;
+import org.tianocore.UserExtensionsDocument;
import org.tianocore.FilenameDocument.Filename;
import org.tianocore.MsaHeaderDocument.MsaHeader;
import org.tianocore.ProtocolsDocument.Protocols.Protocol;
import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
-import org.tianocore.SupportedArchitectures.Enum;
import org.tianocore.build.id.FpdModuleIdentification;
import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.build.id.PackageIdentification;
import org.tianocore.build.id.PlatformIdentification;
import org.tianocore.build.toolchain.ToolChainInfo;
import org.tianocore.logger.EdkLog;
+import org.w3c.dom.Node;
/**
* SurfaceAreaQuery class is used to query Surface Area information from msa,
@@ -1381,14 +1378,16 @@ public class SurfaceAreaQuery { return result;
}
- public static XmlObject getFpdUserExtension() {
+ public static Node getFpdUserExtension() {
String[] xPath = new String[] { "/UserExtensions" };
Object[] queryResult = get("PlatformSurfaceArea", xPath);
- if (queryResult == null) {
+ if (queryResult == null && queryResult.length == 0) {
return null;
}
- return null;
+ UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0];
+
+ return a.getDomNode();
}
/**
|