added the support for new schema and old schema at the same time

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@510 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jwang36 2006-06-14 10:44:45 +00:00
parent 21b50a2779
commit 250258de0d
7 changed files with 168 additions and 60 deletions

View File

@ -1063,10 +1063,13 @@ public class GenBuildTask extends Task {
getProject().setProperty("SDB_FILES", ""); getProject().setProperty("SDB_FILES", "");
getProject().setProperty("BASE_NAME", baseName); getProject().setProperty("BASE_NAME", baseName);
if (map.get("MsaHeader") != null) { if (map.get("MsaHeader") != null) {
flag = GlobalData.MSA_AND_MBD; guid = SurfaceAreaQuery.getModuleGuid();//header.getGuid().getStringValue();
MsaHeaderDocument.MsaHeader header = ((MsaHeaderDocument) map.get("MsaHeader")).getMsaHeader(); componentType = SurfaceAreaQuery.getComponentType();//header.getComponentType().toString();
guid = header.getGuid().getStringValue(); if (!componentType.equalsIgnoreCase("LIBRARY")) {
componentType = header.getComponentType().toString(); flag = GlobalData.MSA_AND_MBD;
} else {
flag = GlobalData.LIBMSA_AND_LIBMBD;
}
} }
else if (map.get("MsaLibHeader") != null) { else if (map.get("MsaLibHeader") != null) {

View File

@ -352,6 +352,7 @@ public class FpdParserTask extends Task {
} }
Map<String, XmlObject> msaMap = GlobalData.getNativeMsa(baseName); Map<String, XmlObject> msaMap = GlobalData.getNativeMsa(baseName);
Map<String, XmlObject> mbdMap = GlobalData.getNativeMbd(baseName); Map<String, XmlObject> mbdMap = GlobalData.getNativeMbd(baseName);
Map<String, XmlObject> fpdMap = new HashMap<String, XmlObject>();
Map<String, XmlObject> map = new HashMap<String, XmlObject>(); Map<String, XmlObject> map = new HashMap<String, XmlObject>();
// //
// Whether the Module SA has parsed before or not // Whether the Module SA has parsed before or not
@ -363,9 +364,13 @@ public class FpdParserTask extends Task {
// Here we can also put platform Build override // Here we can also put platform Build override
// //
map = op.override(mbdMap, msaMap); map = op.override(mbdMap, msaMap);
Map<String, XmlObject> overrideMap = op.override( fpdMap = getPlatformOverrideInfo(moduleSAs[i]);
getPlatformOverrideInfo(moduleSAs[i]), XmlObject buildOption = (XmlObject)fpdMap.get("BuildOptions");
OverrideProcess.deal(map)); buildOption = (XmlObject)fpdMap.get("PackageDependencies");
buildOption = (XmlObject)fpdMap.get("BuildOptions");
buildOption = op.override(buildOption, platformBuildOptions);
fpdMap.put("BuildOptions", ((BuildOptionsDocument)buildOption).getBuildOptions());
Map<String, XmlObject> overrideMap = op.override(fpdMap, OverrideProcess.deal(map));
GlobalData.registerModule(baseName, overrideMap); GlobalData.registerModule(baseName, overrideMap);
} else { } else {
map = GlobalData.getDoc(baseName); map = GlobalData.getDoc(baseName);
@ -460,6 +465,7 @@ public class FpdParserTask extends Task {
Map<String, XmlObject> map = new HashMap<String, XmlObject>(); Map<String, XmlObject> map = new HashMap<String, XmlObject>();
map.put("SourceFiles", sa.getSourceFiles()); map.put("SourceFiles", sa.getSourceFiles());
map.put("Includes", sa.getIncludes()); map.put("Includes", sa.getIncludes());
map.put("PackageDependencies", null);
map.put("Libraries", sa.getLibraries()); map.put("Libraries", sa.getLibraries());
map.put("Protocols", sa.getProtocols()); map.put("Protocols", sa.getProtocols());
map.put("Events", sa.getEvents()); map.put("Events", sa.getEvents());
@ -472,7 +478,7 @@ public class FpdParserTask extends Task {
map.put("Formsets", sa.getFormsets()); map.put("Formsets", sa.getFormsets());
map.put("Guids", sa.getGuids()); map.put("Guids", sa.getGuids());
map.put("Externs", sa.getExterns()); map.put("Externs", sa.getExterns());
map.put("BuildOptions", platformBuildOptions); map.put("BuildOptions", sa.getBuildOptions());//platformBuildOptions);
return map; return map;
} }

View File

@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
package org.tianocore.build.global; package org.tianocore.build.global;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@ -26,15 +27,18 @@ import java.util.Set;
import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlObject;
import org.tianocore.FilenameDocument;
import org.tianocore.FilenameDocument.Filename;
import org.tianocore.FrameworkDatabaseDocument; import org.tianocore.FrameworkDatabaseDocument;
import org.tianocore.MsaFilesDocument; import org.tianocore.MsaFilesDocument;
import org.tianocore.PackageListDocument; import org.tianocore.MsaFilesDocument.MsaFiles.MsaFile;
import org.tianocore.PackageSurfaceAreaDocument;
import org.tianocore.MsaHeaderDocument.MsaHeader; import org.tianocore.MsaHeaderDocument.MsaHeader;
import org.tianocore.MsaLibHeaderDocument.MsaLibHeader; import org.tianocore.MsaLibHeaderDocument.MsaLibHeader;
import org.tianocore.build.pcd.entity.MemoryDatabaseManager; import org.tianocore.PackageListDocument;
import org.tianocore.PackageSurfaceAreaDocument;
import org.tianocore.build.autogen.CommonDefinition; import org.tianocore.build.autogen.CommonDefinition;
import org.tianocore.build.fpd.FpdParserTask; import org.tianocore.build.fpd.FpdParserTask;
import org.tianocore.build.pcd.entity.MemoryDatabaseManager;
/** /**
GlobalData provide initializing, instoring, querying and update global data. GlobalData provide initializing, instoring, querying and update global data.
@ -291,27 +295,44 @@ public class GlobalData {
File packageFile = new File(packageFilename); File packageFile = new File(packageFilename);
try { try {
PackageSurfaceAreaDocument spd = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(packageFile); PackageSurfaceAreaDocument spd = (PackageSurfaceAreaDocument) XmlObject.Factory.parse(packageFile);
List<FilenameDocument.Filename> msaFilenameList;
List<MsaFilesDocument.MsaFiles.MsaFile> msasList = spd.getPackageSurfaceArea().getMsaFiles() List<MsaFilesDocument.MsaFiles.MsaFile> msasList = spd.getPackageSurfaceArea().getMsaFiles()
.getMsaFileList(); .getMsaFileList();
Iterator msasIter = msasList.iterator(); if (msasList.size() == 0) {
while (msasIter.hasNext()) { msaFilenameList = spd.getPackageSurfaceArea().getMsaFiles().getFilenameList();
MsaFilesDocument.MsaFiles.MsaFile msas = (MsaFilesDocument.MsaFiles.MsaFile) msasIter.next(); } else {
String msaFilename = msas.getFilename().getStringValue(); msaFilenameList = new ArrayList<FilenameDocument.Filename>(msasList.size());
Iterator msasIter = msasList.iterator();
while (msasIter.hasNext()) {
MsaFilesDocument.MsaFiles.MsaFile msaFile = (MsaFilesDocument.MsaFiles.MsaFile)msasIter.next();
msaFilenameList.add(msaFile.getFilename());
}
}
Iterator msaFilenameIter = msaFilenameList.iterator();
while (msaFilenameIter.hasNext()) {
FilenameDocument.Filename msaFilename = (FilenameDocument.Filename)msaFilenameIter.next();
String filename = msaFilename.getStringValue();
File msaFile = new File(workspaceDir + File.separatorChar + GlobalData.getPackagePath(packageName) File msaFile = new File(workspaceDir + File.separatorChar + GlobalData.getPackagePath(packageName)
+ File.separatorChar + msaFilename); + File.separatorChar + filename);
SurfaceAreaParser surfaceAreaParser = new SurfaceAreaParser(); SurfaceAreaParser surfaceAreaParser = new SurfaceAreaParser();
Map<String, XmlObject> map = surfaceAreaParser.parseFile(msaFile); Map<String, XmlObject> map = surfaceAreaParser.parseFile(msaFile);
String baseName = ""; String baseName = "";
XmlObject header = null; XmlObject header = null;
if ((header = map.get("MsaHeader")) != null) { if ((header = map.get("MsaHeader")) != null) {
baseName = ((MsaHeader) header).getBaseName().getStringValue(); if (((MsaHeader) header).isSetBaseName()) {
baseName = ((MsaHeader) header).getBaseName().getStringValue();
} else {
baseName = ((MsaHeader) header).getModuleName();
}
} else if ((header = map.get("MsaLibHeader")) != null) { } else if ((header = map.get("MsaLibHeader")) != null) {
baseName = ((MsaLibHeader) header).getBaseName().getStringValue(); baseName = ((MsaLibHeader) header).getBaseName().getStringValue();
} else { } else {
continue; continue;
} }
nativeMsa.put(baseName, map); nativeMsa.put(baseName, map);
String[] info = { msaFilename, packageName }; String[] info = { filename, packageName };
moduleInfo.put(baseName, info); moduleInfo.put(baseName, info);
} }
} catch (Exception e) { } catch (Exception e) {
@ -472,7 +493,8 @@ public class GlobalData {
String mbdFilename = getMbdFilename(moduleName); String mbdFilename = getMbdFilename(moduleName);
File mbdFile = new File(mbdFilename); File mbdFile = new File(mbdFilename);
if (!mbdFile.exists()) { if (!mbdFile.exists()) {
throw new BuildException("Info: Surface Area file [" + mbdFile.getPath() + "] can't found."); return null;
//throw new BuildException("Info: Surface Area file [" + mbdFile.getPath() + "] can't found.");
} }
SurfaceAreaParser surfaceAreaParser = new SurfaceAreaParser(); SurfaceAreaParser surfaceAreaParser = new SurfaceAreaParser();
Map<String, XmlObject> map = surfaceAreaParser.parseFile(mbdFile); Map<String, XmlObject> map = surfaceAreaParser.parseFile(mbdFile);

View File

@ -42,6 +42,7 @@ import org.tianocore.ProtocolsDocument;
import org.tianocore.SourceFilesDocument; import org.tianocore.SourceFilesDocument;
import org.tianocore.SystemTablesDocument; import org.tianocore.SystemTablesDocument;
import org.tianocore.VariablesDocument; import org.tianocore.VariablesDocument;
import org.tianocore.PackageDependenciesDocument;
/** /**
This class is used to override surface area information. For example, MBD can This class is used to override surface area information. For example, MBD can
@ -110,7 +111,7 @@ public class OverrideProcess {
/// list of top elements of surface area /// list of top elements of surface area
/// ///
public static String[] topElements = { "LibraryClassDefinitions", public static String[] topElements = { "LibraryClassDefinitions",
"SourceFiles", "Includes", "Libraries", "Protocols", "SourceFiles", "Includes", "PackageDependencies", "Libraries", "Protocols",
"Events", "Hobs", "PPIs", "Variables", "BootModes", "Events", "Hobs", "PPIs", "Variables", "BootModes",
"SystemTables", "DataHubs", "Formsets", "Guids", "Externs", "SystemTables", "DataHubs", "Formsets", "Guids", "Externs",
"PcdCoded", "BuildOptions" }; "PcdCoded", "BuildOptions" };
@ -178,6 +179,10 @@ public class OverrideProcess {
newMap.put("Includes", ((IncludesDocument) map.get("Includes")) newMap.put("Includes", ((IncludesDocument) map.get("Includes"))
.getIncludes()); .getIncludes());
} }
if (map.get("PackageDependencies") != null) {
newMap.put("PackageDependencies", ((PackageDependenciesDocument) map.get("PackageDependencies"))
.getPackageDependencies());
}
if (map.get("Libraries") != null) { if (map.get("Libraries") != null) {
newMap.put("Libraries", ((LibrariesDocument) map.get("Libraries")) newMap.put("Libraries", ((LibrariesDocument) map.get("Libraries"))
.getLibraries()); .getLibraries());
@ -285,8 +290,11 @@ public class OverrideProcess {
result.put("MsaHeader", override(l.get("MsaHeader"), null)); result.put("MsaHeader", override(l.get("MsaHeader"), null));
result.put("MsaLibHeader", override(l.get("MsaLibHeader"), null)); result.put("MsaLibHeader", override(l.get("MsaLibHeader"), null));
for (int i = 0; i < topElements.length; i++) { for (int i = 0; i < topElements.length; i++) {
result.put(topElements[i], override(h.get(topElements[i]), l if (h != null) {
.get(topElements[i]))); result.put(topElements[i], override(h.get(topElements[i]), l.get(topElements[i])));
} else {
result.put(topElements[i], override(l.get(topElements[i]), null));
}
} }
return result; return result;
} }
@ -310,8 +318,7 @@ public class OverrideProcess {
} }
XmlCursor hc = h.newCursor(); XmlCursor hc = h.newCursor();
if (h.getClass() != l.getClass()) { if (h.getClass() != l.getClass()) {
System.out System.out.println("Error: Two XmlObject does not with compliant format.");
.println("Error: Two XmlObject does not with compliant format.");
return null; return null;
} }
if (!hc.toFirstChild()) { if (!hc.toFirstChild()) {

View File

@ -18,14 +18,15 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.tianocore.PackageSurfaceAreaDocument;
import org.tianocore.GuidDeclarationsDocument.GuidDeclarations; import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;
import org.tianocore.IncludeHeaderDocument.IncludeHeader; import org.tianocore.IncludeHeaderDocument.IncludeHeader;
import org.tianocore.LibraryClassDeclarationDocument.LibraryClassDeclaration; import org.tianocore.LibraryClassDeclarationDocument.LibraryClassDeclaration;
import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations; import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations;
import org.tianocore.PackageHeadersDocument.PackageHeaders; import org.tianocore.PackageHeadersDocument.PackageHeaders;
import org.tianocore.PackageSurfaceAreaDocument;
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea; import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;
import org.tianocore.PpiDeclarationsDocument.PpiDeclarations; import org.tianocore.PpiDeclarationsDocument.PpiDeclarations;
import org.tianocore.PpiDeclarationsDocument.PpiDeclarations.Entry;
import org.tianocore.ProtocolDeclarationsDocument.ProtocolDeclarations; import org.tianocore.ProtocolDeclarationsDocument.ProtocolDeclarations;
/** /**
@ -125,15 +126,14 @@ public class Spd {
if (packageHeader != null) { if (packageHeader != null) {
List<IncludeHeader> headerList = packageHeader.getIncludeHeaderList(); List<IncludeHeader> headerList = packageHeader.getIncludeHeaderList();
IncludeHeader header;
for (int i = 0; i < headerList.size(); i++) { for (int i = 0; i < headerList.size(); i++) {
header = (IncludeHeader)headerList.get(i);
try { try {
this.moduleInfo this.moduleInfo.put(header.getModuleType().toString(), header.getStringValue());
.put(headerList.get(i).getModuleType()
.toString(), headerList.get(i)
.getStringValue());
} catch (Exception e) { } catch (Exception e) {
System.out System.out.print("can't find ModuleHeaders ModuleType & includeHeader!\n");
.print("can't find ModuleHeaders ModuleType & includeHeader!\n");
} }
} }
} }
@ -149,19 +149,26 @@ public class Spd {
**/ **/
public void genPpiInfoList(PpiDeclarations ppiInfo) { public void genPpiInfoList(PpiDeclarations ppiInfo) {
String[] cNameGuid = new String[2]; String[] cNameGuid = new String[2];
String guidString;
if (ppiInfo != null) { if (ppiInfo != null) {
List<PpiDeclarations.Entry> ppiEntryList = ppiInfo.getEntryList(); List<PpiDeclarations.Entry> ppiEntryList = ppiInfo.getEntryList();
PpiDeclarations.Entry ppiEntry;
for (int i = 0; i < ppiEntryList.size(); i++) { for (int i = 0; i < ppiEntryList.size(); i++) {
ppiEntry = (PpiDeclarations.Entry)ppiEntryList.get(i);
try { try {
cNameGuid[0] = ppiEntryList.get(i).getCName(); if (ppiEntry.isSetGuidValue()) {
cNameGuid[1] = formatGuidName(ppiEntryList.get(i) guidString = ppiEntry.getGuidValue();
.getGuid().getStringValue()); } else {
this.ppiInfo.put(ppiEntryList.get(i).getName(), new String[] { guidString = ppiEntry.getGuid().getStringValue();
cNameGuid[0], cNameGuid[1] }); }
cNameGuid[0] = ppiEntry.getCName();
cNameGuid[1] = formatGuidName(guidString);
this.ppiInfo.put(ppiEntry.getName(), new String[] { cNameGuid[0], cNameGuid[1] });
} catch (Exception e) { } catch (Exception e) {
System.out System.out.print("can't find GuidDeclarations C_Name & Guid!\n");
.print("can't find GuidDeclarations C_Name & Guid!\n");
} }
} }
} }
@ -177,20 +184,26 @@ public class Spd {
**/ **/
public void genProtocolInfoList(ProtocolDeclarations proInfo) { public void genProtocolInfoList(ProtocolDeclarations proInfo) {
String[] cNameGuid = new String[2]; String[] cNameGuid = new String[2];
String guidString;
if (proInfo != null) { if (proInfo != null) {
List<ProtocolDeclarations.Entry> protocolEntryList = proInfo.getEntryList(); List<ProtocolDeclarations.Entry> protocolEntryList = proInfo.getEntryList();
ProtocolDeclarations.Entry protocolEntry;
for (int i = 0; i < protocolEntryList.size(); i++) { for (int i = 0; i < protocolEntryList.size(); i++) {
protocolEntry = (ProtocolDeclarations.Entry)protocolEntryList.get(i);
try { try {
cNameGuid[0] = protocolEntryList.get(i).getCName(); if (protocolEntry.isSetGuidValue()) {
cNameGuid[1] = formatGuidName(protocolEntryList.get(i) guidString = protocolEntry.getGuidValue();
.getGuid().getStringValue()); } else {
guidString = protocolEntry.getGuid().getStringValue();
}
cNameGuid[0] = protocolEntry.getCName();
cNameGuid[1] = formatGuidName(guidString);
String temp = new String(protocolEntryList.get(i).getName()); String temp = new String(protocolEntry.getName());
this.protocolInfo.put(temp, new String[] { cNameGuid[0], this.protocolInfo.put(temp, new String[] { cNameGuid[0], cNameGuid[1] });
cNameGuid[1] });
} catch (Exception e) { } catch (Exception e) {
System.out System.out.print("can't find ProtocolDeclarations C_Name & Guid!\n");
.print("can't find ProtocolDeclarations C_Name & Guid!\n");
} }
} }
} }
@ -207,15 +220,23 @@ public class Spd {
**/ **/
public void genGuidInfoList(GuidDeclarations guidInfo) { public void genGuidInfoList(GuidDeclarations guidInfo) {
String[] cNameGuid = new String[2]; String[] cNameGuid = new String[2];
String guidString;
if (guidInfo != null) { if (guidInfo != null) {
List<GuidDeclarations.Entry> guidEntryList = guidInfo.getEntryList(); List<GuidDeclarations.Entry> guidEntryList = guidInfo.getEntryList();
GuidDeclarations.Entry guidEntry;
for (int i = 0; i < guidEntryList.size(); i++) { for (int i = 0; i < guidEntryList.size(); i++) {
cNameGuid[0] = guidEntryList.get(i).getCName(); guidEntry = (GuidDeclarations.Entry)guidEntryList.get(i);
cNameGuid[1] = formatGuidName(guidEntryList.get(i) if (guidEntry.isSetGuidValue()) {
.getGuid().getStringValue()); guidString = guidEntry.getGuidValue();
this.guidInfo.put(guidEntryList.get(i).getName(), new String[] { } else {
cNameGuid[0], cNameGuid[1] }); guidString = guidEntry.getGuid().getStringValue();
}
cNameGuid[0] = guidEntry.getCName();
cNameGuid[1] = formatGuidName(guidString);
this.guidInfo.put(guidEntry.getName(), new String[] {cNameGuid[0], cNameGuid[1] });
} }
} }
} }

View File

@ -83,6 +83,7 @@ public class SurfaceAreaParser {
.getLibraryClassDefinitions()); .getLibraryClassDefinitions());
msaMap.put("SourceFiles", doc.getModuleSurfaceArea().getSourceFiles()); msaMap.put("SourceFiles", doc.getModuleSurfaceArea().getSourceFiles());
msaMap.put("Includes", doc.getModuleSurfaceArea().getIncludes()); msaMap.put("Includes", doc.getModuleSurfaceArea().getIncludes());
msaMap.put("PackageDependencies", doc.getModuleSurfaceArea().getPackageDependencies());
msaMap.put("Protocols", doc.getModuleSurfaceArea().getProtocols()); msaMap.put("Protocols", doc.getModuleSurfaceArea().getProtocols());
msaMap.put("Events", doc.getModuleSurfaceArea().getEvents()); msaMap.put("Events", doc.getModuleSurfaceArea().getEvents());

View File

@ -44,6 +44,8 @@ import org.tianocore.PPIsDocument;
import org.tianocore.PackageNameDocument; import org.tianocore.PackageNameDocument;
import org.tianocore.ProtocolsDocument; import org.tianocore.ProtocolsDocument;
import org.tianocore.PcdCodedDocument.PcdCoded; import org.tianocore.PcdCodedDocument.PcdCoded;
import org.tianocore.MsaHeaderDocument;
import org.tianocore.MsaHeaderDocument.MsaHeader;
/** /**
SurfaceAreaQuery class is used to query Surface Area information from msa, mbd, SurfaceAreaQuery class is used to query Surface Area information from msa, mbd,
@ -233,7 +235,8 @@ public class SurfaceAreaQuery {
}; };
} else { } else {
xPath = new String[] { xPath = new String[] {
"/Filename[not(@ArchType) or @ArchType='ALL' or @ArchType='" + arch + "']", "/Filename[not(@SupArchList) and not(@ArchType) or @SupArchList='ALL' or @SupArchList='" + arch + "' or @ArchType='ALL' or @ArchType='" + arch + "']",
"/Filename[not(@SupArchList) and not(@ArchType) or @ArchType='ALL' or @ArchType='" + arch + "']",
"/Arch[@ArchType='ALL' or @ArchType='" + arch + "']/Filename" "/Arch[@ArchType='ALL' or @ArchType='" + arch + "']/Filename"
}; };
} }
@ -300,6 +303,7 @@ public class SurfaceAreaQuery {
} else { } else {
xPath = new String[] { xPath = new String[] {
"/Option", "/Option",
"/Option[@SupArchList='ALL' or @SupArchList='" + arch + "']",
"/Arch[@ArchType='ALL' or @ArchType='" + arch + "']/Option" "/Arch[@ArchType='ALL' or @ArchType='" + arch + "']/Option"
}; };
} }
@ -341,6 +345,17 @@ public class SurfaceAreaQuery {
return result; return result;
} }
public static String getModuleName() {
String[] xPath = new String[] { "/ModuleName", "/BaseName" };
XmlObject[] returns = get(xPath);
if (returns != null && returns.length > 0) {
return returns[0].toString();
}
return null;
}
/** /**
Retrieve <xxxHeader>/ModuleType Retrieve <xxxHeader>/ModuleType
@ -396,13 +411,18 @@ public class SurfaceAreaQuery {
} else { } else {
xPath = new String[] { xPath = new String[] {
"/PackageName", "/PackageName",
"/PackageName[@SupArchList='ALL' or @SupArchList='" + arch + "']",
"/PackageName[@Arch='ALL' or @Arch='" + arch + "']",
"/Arch[@ArchType='ALL' or @ArchType='" + arch + "']/PackageName" "/Arch[@ArchType='ALL' or @ArchType='" + arch + "']/PackageName"
}; };
} }
XmlObject[] returns = get("Includes", xPath); XmlObject[] returns = get("Includes", xPath);
if (returns == null || returns.length == 0) { if (returns == null || returns.length == 0) {
return null; returns = get("PackageDependencies", xPath);
if (returns == null || returns.length == 0) {
return null;
}
} }
List<String> packageNames = new ArrayList<String>(); List<String> packageNames = new ArrayList<String>();
@ -471,12 +491,34 @@ public class SurfaceAreaQuery {
@returns null if nothing is there @returns null if nothing is there
**/ **/
public static String getModuleGuid() { public static String getModuleGuid() {
String[] xPath = new String[] { "/Guid" }; String[] xPath = new String[] { "" };
XmlObject[] returns = get(xPath); XmlObject[] returns = get("MsaHeader", xPath);
if (returns != null && returns.length > 0) { if (returns != null && returns.length > 0) {
GuidDocument.Guid guid = (GuidDocument.Guid) returns[0]; MsaHeaderDocument.MsaHeader moduleHeader = (MsaHeaderDocument.MsaHeader) returns[0];
return guid.getStringValue(); if (moduleHeader.isSetGuid()) {
return moduleHeader.getGuid().getStringValue();
} else if (moduleHeader.isSetGuidValue()) {
return moduleHeader.getGuidValue();
}
}
return null;
}
/**
Retrieve module Guid string
@returns GUILD string if elements are found at the known xpath
@returns null if nothing is there
**/
public static String getModuleGuidValue() {
String[] xPath = new String[] { "" };
XmlObject[] returns = get("MsaHeader", xPath);
if (returns != null && returns.length > 0) {
MsaHeaderDocument.MsaHeader moduleHeader = (MsaHeaderDocument.MsaHeader) returns[0];
return moduleHeader.getGuidValue();
} }
return null; return null;
@ -676,7 +718,8 @@ public class SurfaceAreaQuery {
} }
xPath = new String[] { xPath = new String[] {
"/Library" + usageAttribute, "/Library" + archAttribute, //usageAttribute,
"/Library[not(@SupArchList) or @SupArchList='" + arch + "']",
"/Arch" + archAttribute + "/Library" + usageAttribute "/Arch" + archAttribute + "/Library" + usageAttribute
}; };
@ -832,6 +875,11 @@ public class SurfaceAreaQuery {
XmlObject[] result = get("FrameworkPlatformDescription", xPath); XmlObject[] result = get("FrameworkPlatformDescription", xPath);
if (result == null) { if (result == null) {
xPath = new String[] { "/FrameworkModules/*/ModuleSA" };
result = get("FrameworkPlatformDescription", xPath);
if (result != null) {
return (ModuleSADocument.ModuleSA[]) result;
}
return new ModuleSADocument.ModuleSA[0]; return new ModuleSADocument.ModuleSA[0];
} }