mirror of https://github.com/acidanthera/audk.git
Support UserExtension in FPD.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@769 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
47f2f01190
commit
8031d48db3
13612
EdkNt32Pkg/Nt32.fpd
13612
EdkNt32Pkg/Nt32.fpd
File diff suppressed because it is too large
Load Diff
|
@ -345,7 +345,7 @@ public class FpdParserTask extends Task {
|
||||||
Map<String, XmlObject> map = new HashMap<String, XmlObject>();
|
Map<String, XmlObject> map = new HashMap<String, XmlObject>();
|
||||||
map.put("PlatformSurfaceArea", doc);
|
map.put("PlatformSurfaceArea", doc);
|
||||||
SurfaceAreaQuery.setDoc(map);
|
SurfaceAreaQuery.setDoc(map);
|
||||||
SurfaceAreaQuery.getFpdUserExtension();
|
|
||||||
//
|
//
|
||||||
// Initialize
|
// Initialize
|
||||||
//
|
//
|
||||||
|
|
|
@ -35,7 +35,9 @@ import org.tianocore.build.id.ModuleIdentification;
|
||||||
import org.w3c.dom.Comment;
|
import org.w3c.dom.Comment;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.NamedNodeMap;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
public class PlatformBuildFileGenerator {
|
public class PlatformBuildFileGenerator {
|
||||||
|
|
||||||
|
@ -183,6 +185,7 @@ public class PlatformBuildFileGenerator {
|
||||||
throw new BuildException("Generate " + platformName + "_build.xml failed. \n" + ex.getMessage());
|
throw new BuildException("Generate " + platformName + "_build.xml failed. \n" + ex.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyModules(Document document, Node root, String num) {
|
private void applyModules(Document document, Node root, String num) {
|
||||||
root.appendChild(document.createComment("Modules target"));
|
root.appendChild(document.createComment("Modules target"));
|
||||||
Element ele = document.createElement("target");
|
Element ele = document.createElement("target");
|
||||||
|
@ -464,9 +467,63 @@ public class PlatformBuildFileGenerator {
|
||||||
Element ele = document.createElement("target");
|
Element ele = document.createElement("target");
|
||||||
ele.setAttribute("name", "userextensions");
|
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);
|
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) {
|
private boolean isListInSequence(String fvName) {
|
||||||
Set<String> numbers = sequences.keySet();
|
Set<String> numbers = sequences.keySet();
|
||||||
|
|
|
@ -23,17 +23,14 @@ import java.util.Stack;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.xmlbeans.XmlNormalizedString;
|
import org.apache.xmlbeans.XmlCursor;
|
||||||
import org.apache.xmlbeans.XmlObject;
|
import org.apache.xmlbeans.XmlObject;
|
||||||
import org.apache.xmlbeans.XmlString;
|
import org.apache.xmlbeans.XmlString;
|
||||||
import org.tianocore.BuildOptionsDocument;
|
import org.tianocore.BuildOptionsDocument;
|
||||||
import org.tianocore.CNameType;
|
import org.tianocore.CNameType;
|
||||||
import org.tianocore.DataIdDocument;
|
|
||||||
import org.tianocore.ExternsDocument;
|
import org.tianocore.ExternsDocument;
|
||||||
import org.tianocore.FileNameConvention;
|
import org.tianocore.FileNameConvention;
|
||||||
import org.tianocore.FvAttributeDocument;
|
|
||||||
import org.tianocore.FvImagesDocument;
|
import org.tianocore.FvImagesDocument;
|
||||||
import org.tianocore.FvOptionDocument;
|
|
||||||
import org.tianocore.GuidDeclarationsDocument;
|
import org.tianocore.GuidDeclarationsDocument;
|
||||||
import org.tianocore.GuidsDocument;
|
import org.tianocore.GuidsDocument;
|
||||||
import org.tianocore.LibrariesDocument;
|
import org.tianocore.LibrariesDocument;
|
||||||
|
@ -56,18 +53,18 @@ import org.tianocore.PpiDeclarationsDocument;
|
||||||
import org.tianocore.ProtocolDeclarationsDocument;
|
import org.tianocore.ProtocolDeclarationsDocument;
|
||||||
import org.tianocore.Sentence;
|
import org.tianocore.Sentence;
|
||||||
import org.tianocore.SpdHeaderDocument;
|
import org.tianocore.SpdHeaderDocument;
|
||||||
import org.tianocore.SupportedArchitectures;
|
import org.tianocore.UserExtensionsDocument;
|
||||||
import org.tianocore.FilenameDocument.Filename;
|
import org.tianocore.FilenameDocument.Filename;
|
||||||
import org.tianocore.MsaHeaderDocument.MsaHeader;
|
import org.tianocore.MsaHeaderDocument.MsaHeader;
|
||||||
import org.tianocore.ProtocolsDocument.Protocols.Protocol;
|
import org.tianocore.ProtocolsDocument.Protocols.Protocol;
|
||||||
import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
|
import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
|
||||||
import org.tianocore.SupportedArchitectures.Enum;
|
|
||||||
import org.tianocore.build.id.FpdModuleIdentification;
|
import org.tianocore.build.id.FpdModuleIdentification;
|
||||||
import org.tianocore.build.id.ModuleIdentification;
|
import org.tianocore.build.id.ModuleIdentification;
|
||||||
import org.tianocore.build.id.PackageIdentification;
|
import org.tianocore.build.id.PackageIdentification;
|
||||||
import org.tianocore.build.id.PlatformIdentification;
|
import org.tianocore.build.id.PlatformIdentification;
|
||||||
import org.tianocore.build.toolchain.ToolChainInfo;
|
import org.tianocore.build.toolchain.ToolChainInfo;
|
||||||
import org.tianocore.logger.EdkLog;
|
import org.tianocore.logger.EdkLog;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SurfaceAreaQuery class is used to query Surface Area information from msa,
|
* SurfaceAreaQuery class is used to query Surface Area information from msa,
|
||||||
|
@ -1381,14 +1378,16 @@ public class SurfaceAreaQuery {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static XmlObject getFpdUserExtension() {
|
public static Node getFpdUserExtension() {
|
||||||
String[] xPath = new String[] { "/UserExtensions" };
|
String[] xPath = new String[] { "/UserExtensions" };
|
||||||
|
|
||||||
Object[] queryResult = get("PlatformSurfaceArea", xPath);
|
Object[] queryResult = get("PlatformSurfaceArea", xPath);
|
||||||
if (queryResult == null) {
|
if (queryResult == null && queryResult.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
UserExtensionsDocument.UserExtensions a = (UserExtensionsDocument.UserExtensions)queryResult[0];
|
||||||
|
|
||||||
|
return a.getDomNode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue