Fix EDKT191.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1301 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2006-08-17 03:11:55 +00:00
parent 739c6b04fd
commit daa4663bdd
5 changed files with 64 additions and 66 deletions

View File

@ -934,9 +934,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
ModuleIdentification mi = (ModuleIdentification) ismi.next();
Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);
SurfaceAreaQuery.setDoc(m);
String[] classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED");
for (int i = 0; i < classProduced.length; ++i) {
if (classProduced[i].equals(libClass)) {
Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
for (int i = 0; i < classProduced.size(); ++i) {
if (classProduced.get(i).equals(libClass)) {
libNameGuidMap.put(mi.getName(), mi.getGuid());
}
}

View File

@ -379,7 +379,7 @@ public class FpdFileContents {
Map<String, XmlObject> m = new HashMap<String, XmlObject>();
m.put("ModuleSurfaceArea", msa);
SurfaceAreaQuery.setDoc(m);
PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);
PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, vMi.get(i));
PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);
if (spdPcd == null) {
//
@ -541,7 +541,7 @@ public class FpdFileContents {
Map<String, XmlObject> m = new HashMap<String, XmlObject>();
m.put("ModuleSurfaceArea", msa);
SurfaceAreaQuery.setDoc(m);
PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);
PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);
//
// First look through MSA pcd entries.
//
@ -896,7 +896,7 @@ public class FpdFileContents {
Map<String, XmlObject> m = new HashMap<String, XmlObject>();
m.put("ModuleSurfaceArea", msa);
SurfaceAreaQuery.setDoc(m);
PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);
PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);
//
// Implementing InitializePlatformPcdBuildDefinitions
//

View File

@ -579,6 +579,7 @@ public class FpdFrameworkModules extends IInternalFrame {
if (selectedRow < 0) {
return;
}
docConsole.setSaved(false);
TableSorter sorter = (TableSorter) jTableFpdModules.getModel();
selectedRow = sorter.modelIndex(selectedRow);
@ -606,7 +607,6 @@ public class FpdFrameworkModules extends IInternalFrame {
}
}
docConsole.setSaved(false);
ffc.removeModuleSA(selectedRow);
}
});

View File

@ -23,7 +23,6 @@ import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import org.apache.xmlbeans.XmlObject;
import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;
import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;
@ -38,7 +37,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
@ -226,37 +224,35 @@ public class FpdModuleSA extends JDialog implements ActionListener {
ModuleIdentification mi = GlobalData.getModuleId(key);
PackageIdentification[] depPkgList = null;
try{
Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);
SurfaceAreaQuery.setDoc(m);
//
// Get dependency pkg list into which we will search lib instances.
//
depPkgList = SurfaceAreaQuery.getDependencePkg(null);
depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);
//
// Get the lib class consumed, produced by this module itself.
//
String[] classConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED");
Vector<String> vClassConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
if (this.classConsumed == null) {
this.classConsumed = new HashMap<String, ArrayList<String>>();
}
for(int i = 0; i < classConsumed.length; ++i){
ArrayList<String> consumedBy = this.classConsumed.get(classConsumed[i]);
for(int i = 0; i < vClassConsumed.size(); ++i){
ArrayList<String> consumedBy = this.classConsumed.get(vClassConsumed.get(i));
if (consumedBy == null) {
consumedBy = new ArrayList<String>();
}
consumedBy.add(key);
this.classConsumed.put(classConsumed[i], consumedBy);
this.classConsumed.put(vClassConsumed.get(i), consumedBy);
}
String[] classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED");
Vector<String> vClassProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
if (this.classProduced == null) {
this.classProduced = new ArrayList<String>();
}
for(int i = 0; i < classProduced.length; ++i){
if (!this.classProduced.contains(classProduced[i])){
this.classProduced.add(classProduced[i]);
for(int i = 0; i < vClassProduced.size(); ++i){
if (!this.classProduced.contains(vClassProduced.get(i))){
this.classProduced.add(vClassProduced.get(i));
}
}
@ -362,10 +358,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
private String[] getClassProduced(ModuleIdentification mi){
try{
Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);
SurfaceAreaQuery.setDoc(m);
String[] clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED");
return clsProduced;
Vector<String> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);
String[] sClassProduced = new String[clsProduced.size()];
for (int i = 0; i < clsProduced.size(); ++i) {
sClassProduced[i] = clsProduced.get(i);
}
return sClassProduced;
}catch (Exception e) {
e.printStackTrace();
@ -376,16 +374,17 @@ public class FpdModuleSA extends JDialog implements ActionListener {
private String[] getClassConsumed(ModuleIdentification mi){
String[] clsConsumed = null;
try{
Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);
SurfaceAreaQuery.setDoc(m);
clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED");
Vector<String> clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);
String[] sClassConsumed = new String[clsConsumed.size()];
for (int i = 0; i < clsConsumed.size(); ++i) {
sClassConsumed[i] = clsConsumed.get(i);
}
return sClassConsumed;
}catch (Exception e) {
e.printStackTrace();
}
return clsConsumed;
return new String[0];
}
private void showClassToResolved(){
@ -397,12 +396,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
while(li.hasNext()){
String[] s = {li.next()};
if (classConsumed.get(s[0]) == null) {
continue;
}
if (classConsumed.get(s[0]).size() == 0) {
continue;
}
// if (classConsumed.get(s[0]) == null) {
// continue;
// }
// if (classConsumed.get(s[0]).size() == 0) {
// continue;
// }
if (!classProduced.contains(s[0])){
libClassTableModel.addRow(s);
}

View File

@ -21,6 +21,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -37,6 +38,7 @@ import org.tianocore.LibrariesDocument;
import org.tianocore.LibraryClassDeclarationsDocument;
import org.tianocore.LibraryClassDocument;
import org.tianocore.ModuleSADocument;
import org.tianocore.ModuleSurfaceAreaDocument;
import org.tianocore.ModuleTypeDef;
import org.tianocore.MsaFilesDocument;
import org.tianocore.MsaHeaderDocument;
@ -341,22 +343,22 @@ public class SurfaceAreaQuery {
* @returns package name list if elements are found at the known xpath
* @returns null if nothing is there
*/
public static PackageIdentification[] getDependencePkg(String arch) {
String[] xPath;
public static PackageIdentification[] getDependencePkg(String arch, ModuleIdentification mi) throws Exception{
String packageGuid = null;
String packageVersion = null;
if (arch == null || arch.equals("")) {
xPath = new String[] { "/PackageDependencies/Package" };
} else {
xPath = new String[] { "/PackageDependencies/Package[not(@SupArchList) or @SupArchList='"
+ arch + "']" };
}
ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) GlobalData.getModuleXmlObject(mi);
if (msa.getPackageDependencies() == null) {
return new PackageIdentification[0];
}
int size = msa.getPackageDependencies().getPackageList().size();
XmlObject[] returns = new XmlObject[size];
for (int i = 0; i < size; ++i) {
returns[i] = msa.getPackageDependencies().getPackageList().get(i);
}
XmlObject[] returns = get("ModuleSurfaceArea", xPath);
if (returns == null) {
return new PackageIdentification[0];
}
PackageIdentification[] packageIdList = new PackageIdentification[returns.length];
for (int i = 0; i < returns.length; i++) {
PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];
@ -401,25 +403,22 @@ public class SurfaceAreaQuery {
* xpath
* @returns null if nothing is there
*/
public static String[] getLibraryClasses(String usage) {
String[] xPath;
if (usage == null || usage.equals("")) {
xPath = new String[] { "/LibraryClass" };
} else {
xPath = new String[] { "/LibraryClass[@Usage='" + usage + "']" };
}
XmlObject[] returns = get("LibraryClassDefinitions", xPath);
if (returns == null || returns.length == 0) {
return new String[0];
}
LibraryClassDocument.LibraryClass[] libraryClassList = (LibraryClassDocument.LibraryClass[]) returns;
String[] libraryClassName = new String[libraryClassList.length];
for (int i = 0; i < libraryClassList.length; i++) {
libraryClassName[i] = libraryClassList[i].getKeyword();
public static Vector<String> getLibraryClasses(String usage, ModuleIdentification mi) throws Exception{
ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);
Vector<String> libraryClassName = new Vector<String>();
if (msa.getLibraryClassDefinitions() == null) {
return libraryClassName;
}
int size = msa.getLibraryClassDefinitions().getLibraryClassList().size();
for (int i = 0; i < size; i++) {
LibraryClassDocument.LibraryClass libClass = msa.getLibraryClassDefinitions().getLibraryClassList().get(i);
if (usage.equals(libClass.getUsage().toString())) {
libraryClassName.add(libClass.getKeyword());
}
}
return libraryClassName;
}