1. Fix the problem of adding PCD for different Arch.

2. enhanced exception messages.
3. pick out getModuleId method to GlobalData class.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1164 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2006-08-01 05:59:51 +00:00
parent 2f23473f16
commit 34c614e1b7
4 changed files with 68 additions and 96 deletions

View File

@ -776,7 +776,7 @@ public class FpdFileContents {
// //
// ToDo Error // ToDo Error
// //
throw new PcdDeclNotFound(mi.getName() + " " + msaPcd.getCName()); throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module " + mi.getName());
} }
// //
// AddItem to ModuleSA PcdBuildDefinitions // AddItem to ModuleSA PcdBuildDefinitions
@ -788,7 +788,7 @@ public class FpdFileContents {
} }
catch (Exception e){ catch (Exception e){
e.printStackTrace();
throw e; throw e;
} }
@ -879,10 +879,10 @@ public class FpdFileContents {
while(li.hasNext()) { while(li.hasNext()) {
String value = li.next().toString(); String value = li.next().toString();
String[] valuePart= value.split(" "); String[] valuePart= value.split(" ");
if (!valuePart[4].equals("DYNAMIC")) { if (!valuePart[5].equals("DYNAMIC")) {
//ToDo error for same pcd, other type than dynamic //ToDo error for same pcd, other type than dynamic
pcdConsumer.remove(listValue); pcdConsumer.remove(listValue);
throw new PcdItemTypeConflictException(value); throw new PcdItemTypeConflictException(cName, value);
} }
} }
} }
@ -891,10 +891,10 @@ public class FpdFileContents {
while(li.hasNext()) { while(li.hasNext()) {
String value = li.next().toString(); String value = li.next().toString();
String[] valuePart= value.split(" "); String[] valuePart= value.split(" ");
if (valuePart[4].equals("DYNAMIC")) { if (valuePart[5].equals("DYNAMIC")) {
//ToDo error for same pcd, other type than non-dynamic //ToDo error for same pcd, other type than non-dynamic
pcdConsumer.remove(listValue); pcdConsumer.remove(listValue);
throw new PcdItemTypeConflictException(value); throw new PcdItemTypeConflictException(cName, value);
} }
} }
} }
@ -1030,7 +1030,7 @@ public class FpdFileContents {
private ArrayList<String> LookupPlatformPcdData(String pcdKey) { private ArrayList<String> LookupPlatformPcdData(String pcdKey) {
return dynPcdMap.get("pcdKey"); return dynPcdMap.get(pcdKey);
} }
public int getDynamicPcdBuildDataCount() { public int getDynamicPcdBuildDataCount() {
@ -2464,8 +2464,9 @@ class PcdItemTypeConflictException extends Exception {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String details = null; private String details = null;
PcdItemTypeConflictException(String info){ PcdItemTypeConflictException(String pcdName, String info){
details = "ItemTypeConflict: " + info; ModuleIdentification mi = GlobalData.getModuleId(info);
details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackage().getName();
} }
public String getMessage() { public String getMessage() {

View File

@ -218,6 +218,7 @@ public class FpdFrameworkModules extends IInternalFrame {
return; return;
} }
//ToDo put Arch instead of null //ToDo put Arch instead of null
boolean errorOccurred = false;
for (int i = 0; i < vArchs.size(); ++i) { for (int i = 0; i < vArchs.size(); ++i) {
String arch = vArchs.get(i); String arch = vArchs.get(i);
al.add(arch); al.add(arch);
@ -237,12 +238,19 @@ public class FpdFrameworkModules extends IInternalFrame {
ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null); ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null);
} }
catch (Exception exception) { catch (Exception exception) {
JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage()); JOptionPane.showMessageDialog(frame, "Adding " + row[0] + " with SupArch " + arch + ": "+ exception.getMessage());
errorOccurred = true;
} }
} }
String s = "This Module with Arch "+ archsAdded;
JOptionPane.showMessageDialog(frame, "This Module with Arch "+ archsAdded +" Added Successfully."); if (errorOccurred) {
s += " Added with Error. Platform may NOT Be Built.";
}
else {
s += " Added Successfully.";
}
JOptionPane.showMessageDialog(frame, s);
jTableFpdModules.changeSelection(modelFpdModules.getRowCount()-1, 0, false, false); jTableFpdModules.changeSelection(modelFpdModules.getRowCount()-1, 0, false, false);
} }
}); });
@ -361,7 +369,7 @@ public class FpdFrameworkModules extends IInternalFrame {
String pg = sa[2]; String pg = sa[2];
String pv = sa[3]; String pv = sa[3];
String arch = sa[4]; String arch = sa[4];
ModuleIdentification mi = getModuleId(sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3] + " " + sa[4]); ModuleIdentification mi = GlobalData.getModuleId(sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3] + " " + sa[4]);
mv = mi.getVersion(); mv = mi.getVersion();
pv = mi.getPackage().getVersion(); pv = mi.getPackage().getVersion();
modelFpdModules.removeRow(selectedRow); modelFpdModules.removeRow(selectedRow);
@ -434,7 +442,7 @@ public class FpdFrameworkModules extends IInternalFrame {
String[][] saa = new String[ffc.getFrameworkModulesCount()][5]; String[][] saa = new String[ffc.getFrameworkModulesCount()][5];
ffc.getFrameworkModulesInfo(saa); ffc.getFrameworkModulesInfo(saa);
for (int i = 0; i < saa.length; ++i) { for (int i = 0; i < saa.length; ++i) {
ModuleIdentification mi = getModuleId(saa[i][0]+ " "+saa[i][1]+" "+saa[i][2]+" "+saa[i][3]); ModuleIdentification mi = GlobalData.getModuleId(saa[i][0]+ " "+saa[i][1]+" "+saa[i][2]+" "+saa[i][3]);
String[] row = {"", "", "", "", "", ""}; String[] row = {"", "", "", "", "", ""};
if (mi != null) { if (mi != null) {
row[0] = mi.getName(); row[0] = mi.getName();
@ -507,43 +515,6 @@ public class FpdFrameworkModules extends IInternalFrame {
this.setVisible(true); this.setVisible(true);
} }
private ModuleIdentification getModuleId(String key){
//
// Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.
//
String[] keyPart = key.split(" ");
Set<PackageIdentification> spi = GlobalData.getPackageList();
Iterator ispi = spi.iterator();
while(ispi.hasNext()) {
PackageIdentification pi = (PackageIdentification)ispi.next();
if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){
continue;
}
if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){
if(!pi.getVersion().equals(keyPart[3])){
continue;
}
}
Set<ModuleIdentification> smi = GlobalData.getModules(pi);
Iterator ismi = smi.iterator();
while(ismi.hasNext()) {
ModuleIdentification mi = (ModuleIdentification)ismi.next();
if (mi.getGuid().equalsIgnoreCase(keyPart[0])){
if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){
if(!mi.getVersion().equals(keyPart[1])){
continue;
}
}
return mi;
}
}
}
return null;
}
} // @jve:decl-index=0:visual-constraint="10,10" } // @jve:decl-index=0:visual-constraint="10,10"

View File

@ -175,7 +175,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
String[][] saa = new String[instanceCount][5]; String[][] saa = new String[instanceCount][5];
ffc.getLibraryInstances(key, saa); ffc.getLibraryInstances(key, saa);
for (int i = 0; i < saa.length; ++i) { for (int i = 0; i < saa.length; ++i) {
ModuleIdentification mi = getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]); ModuleIdentification mi = GlobalData.getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);
if (mi != null) { if (mi != null) {
saa[i][0] = mi.getName(); saa[i][0] = mi.getName();
saa[i][2] = mi.getVersion(); saa[i][2] = mi.getVersion();
@ -218,7 +218,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
} }
private void resolveLibraryInstances(String key) { private void resolveLibraryInstances(String key) {
ModuleIdentification mi = getModuleId(key); ModuleIdentification mi = GlobalData.getModuleId(key);
PackageIdentification[] depPkgList = null; PackageIdentification[] depPkgList = null;
try{ try{
Map<String, XmlObject> m = GlobalData.getNativeMsa(mi); Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);
@ -326,7 +326,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
} }
private void removeInstance(String key) { private void removeInstance(String key) {
ModuleIdentification mi = getModuleId(key); ModuleIdentification mi = GlobalData.getModuleId(key);
// //
// remove pcd information of instance from current ModuleSA // remove pcd information of instance from current ModuleSA
// //
@ -361,42 +361,6 @@ public class FpdModuleSA extends JDialog implements ActionListener {
} }
private ModuleIdentification getModuleId(String key){
//
// Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.
//
String[] keyPart = key.split(" ");
Set<PackageIdentification> spi = GlobalData.getPackageList();
Iterator ispi = spi.iterator();
while(ispi.hasNext()) {
PackageIdentification pi = (PackageIdentification)ispi.next();
if ( !pi.getGuid().equals(keyPart[2])){
continue;
}
if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){
if(!pi.getVersion().equals(keyPart[3])){
continue;
}
}
Set<ModuleIdentification> smi = GlobalData.getModules(pi);
Iterator ismi = smi.iterator();
while(ismi.hasNext()) {
ModuleIdentification mi = (ModuleIdentification)ismi.next();
if (mi.getGuid().equals(keyPart[0])){
if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){
if(!mi.getVersion().equals(keyPart[1])){
continue;
}
}
return mi;
}
}
}
return null;
}
private String[] getClassProduced(ModuleIdentification mi){ private String[] getClassProduced(ModuleIdentification mi){
@ -668,11 +632,11 @@ public class FpdModuleSA extends JDialog implements ActionListener {
ffc.getLibraryInstances(moduleKey, saa); ffc.getLibraryInstances(moduleKey, saa);
try{ try{
if (ffc.getPcdBuildDataInfo(getModuleId(moduleKey), cName, sa)) { if (ffc.getPcdBuildDataInfo(GlobalData.getModuleId(moduleKey), cName, sa)) {
return; return;
} }
for (int j = 0; j < saa.length; ++j) { for (int j = 0; j < saa.length; ++j) {
if (ffc.getPcdBuildDataInfo(getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]), if (ffc.getPcdBuildDataInfo(GlobalData.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]),
cName, sa)) { cName, sa)) {
return; return;
} }
@ -880,8 +844,8 @@ public class FpdModuleSA extends JDialog implements ActionListener {
while(li.hasNext()) { while(li.hasNext()) {
String instance = li.next(); String instance = li.next();
String[] s = {"", "", "", "", ""}; String[] s = {"", "", "", "", ""};
if (getModuleId(instance) != null) { if (GlobalData.getModuleId(instance) != null) {
s[0] = getModuleId(instance).getName(); s[0] = GlobalData.getModuleId(instance).getName();
} }
String[] instancePart = instance.split(" "); String[] instancePart = instance.split(" ");
@ -1020,7 +984,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
libInstanceTableModel.getValueAt(row, 2) + " " + libInstanceTableModel.getValueAt(row, 2) + " " +
libInstanceTableModel.getValueAt(row, 3) + " " + libInstanceTableModel.getValueAt(row, 3) + " " +
libInstanceTableModel.getValueAt(row, 4); libInstanceTableModel.getValueAt(row, 4);
ModuleIdentification libMi = getModuleId(instanceValue); ModuleIdentification libMi = GlobalData.getModuleId(instanceValue);
ffc.genLibraryInstance(libMi, moduleKey); ffc.genLibraryInstance(libMi, moduleKey);
// //
// Add pcd information of selected instance to current moduleSA // Add pcd information of selected instance to current moduleSA
@ -1029,7 +993,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey)); ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey));
} }
catch (Exception exception) { catch (Exception exception) {
JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage()); JOptionPane.showMessageDialog(frame, "Adding Instance" + s[0] + ": "+ exception.getMessage());
} }
resolveLibraryInstances(instanceValue); resolveLibraryInstances(instanceValue);
} }

View File

@ -428,6 +428,42 @@ public class GlobalData {
return result; return result;
} }
public static ModuleIdentification getModuleId(String key){
//
// Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.
//
String[] keyPart = key.split(" ");
Set<PackageIdentification> spi = GlobalData.getPackageList();
Iterator ispi = spi.iterator();
while(ispi.hasNext()) {
PackageIdentification pi = (PackageIdentification)ispi.next();
if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){
continue;
}
if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){
if(!pi.getVersion().equals(keyPart[3])){
continue;
}
}
Set<ModuleIdentification> smi = GlobalData.getModules(pi);
Iterator ismi = smi.iterator();
while(ismi.hasNext()) {
ModuleIdentification mi = (ModuleIdentification)ismi.next();
if (mi.getGuid().equalsIgnoreCase(keyPart[0])){
if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){
if(!mi.getVersion().equals(keyPart[1])){
continue;
}
}
return mi;
}
}
}
return null;
}
public static Vector<String> getModuleSupArchs(ModuleIdentification mi) throws Exception{ public static Vector<String> getModuleSupArchs(ModuleIdentification mi) throws Exception{
Vector<String> vArchs = null; Vector<String> vArchs = null;