From bf5abaffcce13bb8e0a1a652541f49d5b5f7a7b0 Mon Sep 17 00:00:00 2001 From: jlin16 Date: Wed, 19 Jul 2006 10:03:37 +0000 Subject: [PATCH] 1. only show ModuleName, version, PackageName, version, supported Arch, path in table of FrameworkModules. 2. adding multiple entries per module for different archs. 3. show ModuleSaOptions. 4. change "library Class consumed" to "library Class uninstantiated" git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1046 6f19259b-4bc3-4df7-8a09-765794883524 --- .../platform/ui/FpdFileContents.java | 133 ++++++++----- .../platform/ui/FpdFrameworkModules.java | 177 ++++++++++++----- .../platform/ui/FpdModuleSA.java | 74 +++---- .../platform/ui/FpdPlatformDefs.java | 28 +++ .../platform/ui/global/GlobalData.java | 181 ++---------------- 5 files changed, 299 insertions(+), 294 deletions(-) diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index 4783a74a25..0e1f4ccf89 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -104,7 +104,7 @@ public class FpdFileContents { continue; } String ModuleInfo = msa.getModuleGuid() + " " + msa.getModuleVersion() + - " " + msa.getPackageGuid() + " " + msa.getPackageVersion(); + " " + msa.getPackageGuid() + " " + msa.getPackageVersion() + " " + listToString(msa.getSupArchList()); List lp = msa.getPcdBuildDefinition().getPcdDataList(); ListIterator lpi = lp.listIterator(); while (lpi.hasNext()) { @@ -194,16 +194,28 @@ public class FpdFileContents { int i = 0; while(li.hasNext()) { ModuleSADocument.ModuleSA msa = (ModuleSADocument.ModuleSA)li.next(); - saa[i][1] = msa.getModuleGuid(); - saa[i][2] = msa.getModuleVersion(); + saa[i][0] = msa.getModuleGuid(); + saa[i][1] = msa.getModuleVersion(); - saa[i][3] = msa.getPackageGuid(); - saa[i][4] = msa.getPackageVersion(); -// saa[i][4] = listToString(msa.getSupArchList()); + saa[i][2] = msa.getPackageGuid(); + saa[i][3] = msa.getPackageVersion(); + saa[i][4] = listToString(msa.getSupArchList()); ++i; } } + public void getFrameworkModuleInfo(int i, String[] sa) { + ModuleSADocument.ModuleSA msa = getModuleSA(i); + if (msa == null) { + return; + } + sa[0] = msa.getModuleGuid(); + sa[1] = msa.getModuleVersion(); + sa[2] = msa.getPackageGuid(); + sa[3] = msa.getPackageVersion(); + sa[4] = listToString(msa.getSupArchList()); + } + public ModuleSADocument.ModuleSA getModuleSA(String key) { String[] s = key.split(" "); if (getfpdFrameworkModules().getModuleSAList() == null) { @@ -223,11 +235,31 @@ public class FpdFileContents { continue; } } + //ToDo add arch check for s[4] + if (msa.getSupArchList() != null) { + if (!listToString(msa.getSupArchList()).equals(s[4])) { + continue; + } + } return msa; } } return null; } + + private ModuleSADocument.ModuleSA getModuleSA(int i) { + ModuleSADocument.ModuleSA msa = null; + XmlCursor cursor = getfpdFrameworkModules().newCursor(); + if (cursor.toFirstChild()) { + for (int j = 0; j < i; ++j) { + cursor.toNextSibling(); + } + msa = (ModuleSADocument.ModuleSA)cursor.getObject(); + } + cursor.dispose(); + return msa; + } + public void removeModuleSA(int i) { XmlObject o = getfpdFrameworkModules(); if (o == null) { @@ -244,7 +276,7 @@ public class FpdFileContents { // ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject(); String moduleInfo = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() + " " + - moduleSa.getPackageGuid()+ " " + moduleSa.getPackageVersion(); + moduleSa.getPackageGuid()+ " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList()); PcdBuildDefinitionDocument.PcdBuildDefinition pcdBuildDef = moduleSa.getPcdBuildDefinition(); if (pcdBuildDef != null && pcdBuildDef.getPcdDataList() != null) { ListIterator li = pcdBuildDef.getPcdDataList().listIterator(); @@ -272,6 +304,10 @@ public class FpdFileContents { for(int i = 0; i < al.size(); ++i){ String consumer = al.get(i); if (consumer.contains(s[0]) && consumer.contains(s[2])){ + String[] consumerPart = consumer.split(" "); + if (!consumerPart[4].equals(s[4])) { + continue; + } al.remove(consumer); break; } @@ -285,22 +321,10 @@ public class FpdFileContents { } // - // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer" + // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch" // public int getPcdDataCount(int i){ - if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) { - return 0; - } - - XmlCursor cursor = getfpdFrameworkModules().newCursor(); - ModuleSADocument.ModuleSA msa = null; - if (cursor.toFirstChild()) { - for (int j = 0; j < i; ++j) { - cursor.toNextSibling(); - } - msa = (ModuleSADocument.ModuleSA)cursor.getObject(); - } - cursor.dispose(); + ModuleSADocument.ModuleSA msa = getModuleSA(i); if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){ return 0; @@ -310,19 +334,7 @@ public class FpdFileContents { } public void getPcdData(int i, String[][] saa) { - if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) { - return; - } - - XmlCursor cursor = getfpdFrameworkModules().newCursor(); - ModuleSADocument.ModuleSA msa = null; - if (cursor.toFirstChild()) { - for (int j = 0; j < i; ++j) { - cursor.toNextSibling(); - } - msa = (ModuleSADocument.ModuleSA)cursor.getObject(); - } - cursor.dispose(); + ModuleSADocument.ModuleSA msa = getModuleSA(i); if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){ return; @@ -463,7 +475,7 @@ public class FpdFileContents { } } // - // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer" + // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch" // public int getLibraryInstancesCount(String key) { ModuleSADocument.ModuleSA msa = getModuleSA(key); @@ -581,7 +593,7 @@ public class FpdFileContents { msa.addNewModuleSaBuildOptions().setFfsFormatKey(ffsKey); return; } - msa.getModuleSaBuildOptions().setFvBinding(ffsKey); + msa.getModuleSaBuildOptions().setFfsFormatKey(ffsKey); } public void getModuleSAOptions(String moduleKey, String[][] saa) { @@ -600,12 +612,14 @@ public class FpdFileContents { saa[i][0] = listToString(opt.getBuildTargets()); } saa[i][1] = opt.getToolChainFamily(); + saa[i][2] = opt.getTagName(); + saa[i][3] = opt.getToolCode(); + if (opt.getSupArchList() != null){ - saa[i][2] = listToString(opt.getSupArchList()); + saa[i][4] = listToString(opt.getSupArchList()); } - saa[i][3] = opt.getToolCode(); - saa[i][4] = opt.getTagName(); + saa[i][5] = opt.getStringValue(); ++i; @@ -670,12 +684,12 @@ public class FpdFileContents { * @param mi * @param moduleSa if null, generate a new ModuleSA. */ - public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi, ModuleSADocument.ModuleSA moduleSa) throws Exception { + public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi, String arch, ModuleSADocument.ModuleSA moduleSa) throws Exception { //ToDo add Arch filter try { if (moduleSa == null) { - moduleSa = genModuleSA(mi); + moduleSa = genModuleSA(mi, arch); } ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi); @@ -747,13 +761,18 @@ public class FpdFileContents { return null; } - private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi) { + private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) { PackageIdentification pi = GlobalData.getPackageForModule(mi); ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA(); msa.setModuleGuid(mi.getGuid()); msa.setModuleVersion(mi.getVersion()); msa.setPackageGuid(pi.getGuid()); msa.setPackageVersion(pi.getVersion()); + if (arch != null) { + Vector v = new Vector(); + v.add(arch); + msa.setSupArchList(v); + } return msa; } @@ -772,7 +791,7 @@ public class FpdFileContents { pcdConsumer = new ArrayList(); } String listValue = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() - + " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + + " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList()) + " " + itemType; pcdConsumer.add(listValue); dynPcdMap.put(cName + " " + tsGuid, pcdConsumer); @@ -1259,12 +1278,20 @@ public class FpdFileContents { private void setBuildOptionsUserDefAntTask(String id, String fileName, String execOrder, AntTaskDocument.AntTask at) { at.setId(new Integer(id)); + XmlCursor cursor = at.newCursor(); if (fileName != null){ at.setFilename(fileName); } + else if (cursor.toChild(xmlNs, "Filename")) { + cursor.removeXml(); + } if (execOrder != null) { at.setAntCmdOptions(execOrder); } + else if (cursor.toChild(xmlNs, "AntCmdOptions")) { + cursor.removeXml(); + } + cursor.dispose(); } public void removeBuildOptionsUserDefAntTask(int i) { @@ -1350,7 +1377,14 @@ public class FpdFileContents { opt.setTagName(tagName); opt.setToolCode(toolCmd); - opt.setSupArchList(archList); + if (archList != null) { + opt.setSupArchList(archList); + } + else { + if (opt.isSetSupArchList()) { + opt.unsetSupArchList(); + } + } } public void removeBuildOptionsOpt(int i){ @@ -1783,7 +1817,16 @@ public class FpdFileContents { } public void setPlatformDefsSupportedArchs(Vector archs) { - getfpdPlatformDefs().setSupportedArchitectures(archs); + if (archs != null) { + getfpdPlatformDefs().setSupportedArchitectures(archs); + } +// else { +// XmlCursor cursor = getfpdPlatformDefs().newCursor(); +// if (cursor.toChild(xmlNs, "SupportedArchitectures")) { +// cursor.removeXml(); +// } +// cursor.dispose(); +// } } public void getPlatformDefsBuildTargets(Vector targets) { diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index 27faa3644f..53a3396c93 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -27,6 +27,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; +import java.util.Vector; public class FpdFrameworkModules extends IInternalFrame { @@ -56,7 +57,7 @@ public class FpdFrameworkModules extends IInternalFrame { private FpdFileContents ffc = null; private OpeningPlatformType docConsole = null; - private Map fpdMsa = null; + private Map> fpdMsa = null; private ArrayList miList = null; @@ -137,10 +138,10 @@ public class FpdFrameworkModules extends IInternalFrame { jTable = new JTable(model); jTable.setRowHeight(20); model.addColumn("ModuleName"); - model.addColumn("ModuleGUID"); model.addColumn("ModuleVersion"); - model.addColumn("PackageGUID"); + model.addColumn("PackageName"); model.addColumn("PackageVersion"); + model.addColumn("Path"); jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } @@ -180,34 +181,68 @@ public class FpdFrameworkModules extends IInternalFrame { return; } - String mg = (String)model.getValueAt(selectedRow, 1); - String mv = (String)model.getValueAt(selectedRow, 2); - String pg = (String)model.getValueAt(selectedRow, 3); - String pv = (String)model.getValueAt(selectedRow, 4); - if (fpdMsa.containsKey(mg + mv + pg + pv)) { + String path = model.getValueAt(selectedRow, 4)+""; + ModuleIdentification mi = miList.get(selectedRow); + Vector vArchs = null; + try { + vArchs = GlobalData.getModuleSupArchs(mi); + } + catch (Exception exp) { + JOptionPane.showMessageDialog(frame, exp.getMessage()); + } + + if (vArchs == null) { + JOptionPane.showMessageDialog(frame, "No supported Archs specified in MSA file."); + return; + } + + String archsAdded = ""; + String mg = mi.getGuid(); + String mv = mi.getVersion(); + String pg = mi.getPackage().getGuid(); + String pv = mi.getPackage().getVersion(); + + ArrayList al = fpdMsa.get(mg + mv + pg + pv); + if (al == null) { + al = new ArrayList(); + fpdMsa.put(mg + mv + pg + pv, al); + } + for (int i = 0; i < al.size(); ++i) { + vArchs.remove(al.get(i)); + } + // + // Archs this Module supported have already been added. + // + if (vArchs.size() == 0) { JOptionPane.showMessageDialog(frame, "This Module Already Added."); return; } //ToDo put Arch instead of null - fpdMsa.put(mg + mv + pg + pv, null); + for (int i = 0; i < vArchs.size(); ++i) { + String arch = vArchs.get(i); + al.add(arch); + archsAdded += arch + " "; + String[] row = {"", mv, "", pv, arch, path}; + + if (mi != null) { + row[0] = mi.getName(); + row[2] = mi.getPackage().getName(); + + } + model1.addRow(row); + + docConsole.setSaved(false); + try{ + //ToDo : specify archs need to add. + ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null); + } + catch (Exception exception) { + JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage()); + } + } - String[] row = {" ", mg, mv, pg, pv}; - ModuleIdentification mi = getModuleId(mg + " " + mv + " " + pg + " " + pv); - if (mi != null) { - row[0] = mi.getName(); - row[2] = mi.getVersion(); - row[4] = mi.getPackage().getVersion(); - } - model1.addRow(row); - docConsole.setSaved(false); - try{ - ffc.addFrameworkModulesPcdBuildDefs(mi, null); - } - catch (Exception exception) { - JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage()); - } - JOptionPane.showMessageDialog(frame, "This Module Added Successfully."); + JOptionPane.showMessageDialog(frame, "This Module with Arch "+ archsAdded +" Added Successfully."); jTable1.changeSelection(model1.getRowCount()-1, 0, false, false); } }); @@ -257,11 +292,11 @@ public class FpdFrameworkModules extends IInternalFrame { jTable1 = new JTable(model1); jTable1.setRowHeight(20); model1.addColumn("ModuleName"); - model1.addColumn("ModuleGUID"); model1.addColumn("ModuleVersion"); - model1.addColumn("PackageGUID"); + model1.addColumn("PackageName"); model1.addColumn("PackageVersion"); -// model1.addColumn("SupportedArch"); + model1.addColumn("SupportedArch"); + model1.addColumn("Path"); jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); } @@ -288,11 +323,14 @@ public class FpdFrameworkModules extends IInternalFrame { settingDlg = new FpdModuleSA(ffc); } docConsole.setSaved(false); - String mg = model1.getValueAt(selectedRow, 1)+""; - String mv = model1.getValueAt(selectedRow, 2)+""; - String pg = model1.getValueAt(selectedRow, 3)+""; - String pv = model1.getValueAt(selectedRow, 4)+""; - settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv, selectedRow); + String[] sa = new String[5]; + ffc.getFrameworkModuleInfo(selectedRow, sa); + String mg = sa[0]; + String mv = sa[1]; + String pg = sa[2]; + String pv = sa[3]; + String arch = sa[4]; + settingDlg.setKey(mg + " " + mv + " " + pg + " " + pv + " " + arch, selectedRow); settingDlg.setVisible(true); } }); @@ -316,12 +354,30 @@ public class FpdFrameworkModules extends IInternalFrame { if (selectedRow < 0){ return; } - String mg = model1.getValueAt(selectedRow, 1).toString(); - String mv = model1.getValueAt(selectedRow, 2).toString(); - String pg = model1.getValueAt(selectedRow, 3).toString(); - String pv = model1.getValueAt(selectedRow, 4).toString(); + String[] sa = new String[5]; + ffc.getFrameworkModuleInfo(selectedRow, sa); + String mg = sa[0]; + String mv = sa[1]; + String pg = sa[2]; + String pv = sa[3]; + String arch = sa[4]; + ModuleIdentification mi = getModuleId(sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3] + " " + sa[4]); + mv = mi.getVersion(); + pv = mi.getPackage().getVersion(); model1.removeRow(selectedRow); - fpdMsa.remove(mg+mv+pg+pv); + if (arch == null) { + // if no arch specified in ModuleSA + fpdMsa.remove(mg+mv+pg+pv); + } + else { + ArrayList al = fpdMsa.get(mg+mv+pg+pv); + al.remove(arch); + if (al.size() == 0) { + fpdMsa.remove(mg+mv+pg+pv); + } + } + + docConsole.setSaved(false); ffc.removeModuleSA(selectedRow); } @@ -371,21 +427,36 @@ public class FpdFrameworkModules extends IInternalFrame { } if (fpdMsa == null) { - fpdMsa = new HashMap(); + fpdMsa = new HashMap>(); } if (ffc.getFrameworkModulesCount() > 0) { String[][] saa = new String[ffc.getFrameworkModulesCount()][5]; ffc.getFrameworkModulesInfo(saa); 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 = getModuleId(saa[i][0]+ " "+saa[i][1]+" "+saa[i][2]+" "+saa[i][3]); + String[] row = {"", "", "", "", "", ""}; if (mi != null) { - saa[i][0] = mi.getName(); - saa[i][2] = mi.getVersion(); - saa[i][4] = mi.getPackage().getVersion(); + row[0] = mi.getName(); + row[1] = mi.getVersion(); + row[2] = mi.getPackage().getName(); + row[3] = mi.getPackage().getVersion(); + row[4] = saa[i][4]; + try{ + row[5] = GlobalData.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1); + } + catch (Exception e) { + JOptionPane.showMessageDialog(frame, "ShowFPDModules:" + e.getMessage()); + } } - model1.addRow(saa[i]); - fpdMsa.put(saa[i][1]+saa[i][2]+saa[i][3]+saa[i][4], saa[i][0]); + model1.addRow(row); + ArrayList al = fpdMsa.get(saa[i][0]+row[1]+saa[i][2]+row[3]); + if (al == null) { + al = new ArrayList(); + fpdMsa.put(saa[i][0]+row[1]+saa[i][2]+row[3], al); + } + al.add(saa[i][4]); + } } @@ -404,15 +475,21 @@ public class FpdFrameworkModules extends IInternalFrame { while(ispi.hasNext()) { PackageIdentification pi = (PackageIdentification)ispi.next(); String[] s = {"", "", "", "", ""}; - s[3] = pi.getGuid(); - s[4] = pi.getVersion(); + Set smi = GlobalData.getModules(pi); Iterator ismi = smi.iterator(); while(ismi.hasNext()) { ModuleIdentification mi = (ModuleIdentification)ismi.next(); s[0] = mi.getName(); - s[1] = mi.getGuid(); - s[2] = mi.getVersion(); + s[1] = mi.getVersion(); + s[2] = pi.getName(); + s[3] = pi.getVersion(); + try { + s[4] = GlobalData.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1); + } + catch (Exception e) { + JOptionPane.showMessageDialog(frame, "ShowAllModules:" + e.getMessage()); + } model.addRow(s); miList.add(mi); } @@ -433,7 +510,7 @@ public class FpdFrameworkModules extends IInternalFrame { private ModuleIdentification getModuleId(String key){ // - // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion into string array. + // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array. // String[] keyPart = key.split(" "); Set spi = GlobalData.getPackageList(); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java index 7fd914adcc..80369a09a1 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java @@ -131,6 +131,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { public void setKey(String k, int i){ this.moduleKey = k; + jTabbedPane.setSelectedIndex(0); initPcdBuildDefinition(i); } @@ -158,7 +159,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { // // display library classes that need to be resolved. also potential instances for them. // - resolveLibraryInstances(key); + resolveLibraryInstances(moduleKey); // // display lib instances already selected for key // @@ -201,6 +202,13 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (ffsKey != null) { jTextField2.setText(ffsKey); } + + optionsTableModel.setRowCount(0); + String[][] saa = new String[ffc.getModuleSAOptionsCount(key)][6]; + ffc.getModuleSAOptions(key, saa); + for (int i = 0; i < saa.length; ++i) { + optionsTableModel.addRow(saa[i]); + } } private void resolveLibraryInstances(String key) { @@ -316,7 +324,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { // // remove pcd information of instance from current ModuleSA // - ffc.removePcdData(moduleKey, mi); + ffc.removePcdData(key, mi); // // remove class produced by this instance and add back these produced class to be bound. // @@ -349,7 +357,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { private ModuleIdentification getModuleId(String key){ // - // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion into string array. + // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array. // String[] keyPart = key.split(" "); Set spi = GlobalData.getPackageList(); @@ -357,16 +365,26 @@ public class FpdModuleSA extends JDialog implements ActionListener { while(ispi.hasNext()) { PackageIdentification pi = (PackageIdentification)ispi.next(); - if ( !pi.getGuid().equals(keyPart[2])){ -// || !pi.getVersion().equals(keyPart[3])){ + 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 smi = GlobalData.getModules(pi); Iterator ismi = smi.iterator(); while(ismi.hasNext()) { ModuleIdentification mi = (ModuleIdentification)ismi.next(); if (mi.getGuid().equals(keyPart[0])){ -// && mi.getVersion().equals(keyPart[1])){ + if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){ + if(!mi.getVersion().equals(keyPart[1])){ + continue; + } + } + return mi; } } @@ -745,7 +763,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { private JPanel getJPanel4() { if (jPanel4 == null) { jLabel1 = new JLabel(); - jLabel1.setText("Library Classes Consumed"); + jLabel1.setText("Library Classes Uninstantiated"); jPanel4 = new JPanel(); jPanel4.add(jLabel1, null); jPanel4.add(getJScrollPane3(), null); @@ -1000,7 +1018,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { // Add pcd information of selected instance to current moduleSA // try{ - ffc.addFrameworkModulesPcdBuildDefs(getModuleId(instanceValue), ffc.getModuleSA(moduleKey)); + ffc.addFrameworkModulesPcdBuildDefs(getModuleId(instanceValue), null, ffc.getModuleSA(moduleKey)); } catch (Exception exception) { JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage()); @@ -1073,14 +1091,12 @@ public class FpdModuleSA extends JDialog implements ActionListener { public void actionPerformed(ActionEvent arg0) { if (arg0.getSource() == jButton2) { -// ffc.removeLibraryInstances(moduleKey); -// for (int i = 0; i < model1.getRowCount(); ++i) { -// String mg = model1.getValueAt(i, 1)+""; -// String mv = model1.getValueAt(i, 2)+""; -// String pg = model1.getValueAt(i, 3)+""; -// String pv = model1.getValueAt(i, 4)+""; -// ffc.genLibraryInstance(mg, mv, pg, pv, moduleKey); -// } + if (jTable4.isEditing()) { + jTable4.getCellEditor().stopCellEditing(); + } + ffc.setFvBinding(moduleKey, jTextField.getText()); + ffc.setFfsFileNameGuid(moduleKey, jTextField1.getText()); + ffc.setFfsFormatKey(moduleKey, jTextField2.getText()); this.setVisible(false); } } @@ -1124,11 +1140,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (jTextField == null) { jTextField = new JTextField(); jTextField.setPreferredSize(new java.awt.Dimension(100,20)); - jTextField.addFocusListener(new java.awt.event.FocusAdapter() { - public void focusLost(java.awt.event.FocusEvent e) { - ffc.setFvBinding(moduleKey, jTextField.getText()); - } - }); + } return jTextField; } @@ -1141,11 +1153,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (jTextField1 == null) { jTextField1 = new JTextField(); jTextField1.setPreferredSize(new java.awt.Dimension(100,20)); - jTextField1.addFocusListener(new java.awt.event.FocusAdapter() { - public void focusLost(java.awt.event.FocusEvent e) { - ffc.setFfsFileNameGuid(moduleKey, jTextField1.getText()); - } - }); + } return jTextField1; } @@ -1158,11 +1166,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (jTextField2 == null) { jTextField2 = new JTextField(); jTextField2.setPreferredSize(new java.awt.Dimension(100,20)); - jTextField2.addFocusListener(new java.awt.event.FocusAdapter() { - public void focusLost(java.awt.event.FocusEvent e) { - ffc.setFfsFormatKey(moduleKey, jTextField2.getText()); - } - }); + } return jTextField2; } @@ -1257,11 +1261,11 @@ public class FpdModuleSA extends JDialog implements ActionListener { jButton4.setText("New"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { - String[] row = {"", "", "", "", "IA32", ""}; + String[] row = {"", "", "", "", "", ""}; optionsTableModel.addRow(row); Vector v = new Vector(); - Vector v1 = new Vector(); - v1.add("IA32"); + Vector v1 = null; + ffc.genModuleSAOptionsOpt(moduleKey, v, "", "", "", v1, ""); } }); @@ -1443,7 +1447,7 @@ private void pcdNonDynamicToDynamic(String cName, String tsGuid) { ArrayList al = ffc.getDynPcdMapValue(cName + " " + tsGuid); for (int i = 0; i < al.size(); ++i) { String[] s = al.get(i).split(" "); - String mKey = s[0] + s[1] + s[2] + s[3]; + String mKey = s[0] + " " + s[1]+ " " + s[2] + " " + s[3]; ffc.updatePcdData(mKey, cName, tsGuid, jComboBox.getSelectedItem()+"", jTextField3.getText(), jTextField4.isVisible() ? jTextField4.getText() : jComboBox1.getSelectedItem()+""); s[4] = jComboBox.getSelectedItem()+""; al.set(i, s[0]+" "+s[1]+" "+s[2]+" "+s[3]+" "+s[4]); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java index c9538b7fd2..e6f18d17f3 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java @@ -29,6 +29,7 @@ import java.awt.FlowLayout; import javax.swing.JCheckBox; +import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JScrollPane; @@ -332,6 +333,7 @@ public class FpdPlatformDefs extends IInternalFrame { if (jCheckBox6.isSelected()) { v.add("PPC"); } + } /** @@ -406,6 +408,10 @@ public class FpdPlatformDefs extends IInternalFrame { public void itemStateChanged(java.awt.event.ItemEvent e) { Vector v = new Vector(); getToolChain(v); + if (v.size() == 0) { + JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch."); + return; + } ffc.setPlatformDefsSupportedArchs(v); } }); @@ -426,6 +432,10 @@ public class FpdPlatformDefs extends IInternalFrame { public void itemStateChanged(java.awt.event.ItemEvent e) { Vector v = new Vector(); getToolChain(v); + if (v.size() == 0) { + JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch."); + return; + } ffc.setPlatformDefsSupportedArchs(v); } }); @@ -446,6 +456,10 @@ public class FpdPlatformDefs extends IInternalFrame { public void itemStateChanged(java.awt.event.ItemEvent e) { Vector v = new Vector(); getToolChain(v); + if (v.size() == 0) { + JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch."); + return; + } ffc.setPlatformDefsSupportedArchs(v); } }); @@ -700,6 +714,10 @@ public class FpdPlatformDefs extends IInternalFrame { public void itemStateChanged(java.awt.event.ItemEvent e) { Vector v = new Vector(); getToolChain(v); + if (v.size() == 0) { + JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch."); + return; + } ffc.setPlatformDefsSupportedArchs(v); } }); @@ -717,10 +735,15 @@ public class FpdPlatformDefs extends IInternalFrame { jCheckBox5 = new JCheckBox(); jCheckBox5.setPreferredSize(new java.awt.Dimension(52,20)); jCheckBox5.setText("ARM"); + jCheckBox5.setVisible(false); jCheckBox5.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { Vector v = new Vector(); getToolChain(v); + if (v.size() == 0) { + JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch."); + return; + } ffc.setPlatformDefsSupportedArchs(v); } }); @@ -738,10 +761,15 @@ public class FpdPlatformDefs extends IInternalFrame { jCheckBox6 = new JCheckBox(); jCheckBox6.setPreferredSize(new Dimension(50, 20)); jCheckBox6.setText("PPC"); + jCheckBox6.setVisible(false); jCheckBox6.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent e) { Vector v = new Vector(); getToolChain(v); + if (v.size() == 0) { + JOptionPane.showMessageDialog(frame, "Platform must contain at least ONE supported Arch."); + return; + } ffc.setPlatformDefsSupportedArchs(v); } }); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java index 21e706bb43..4a325c21ff 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java @@ -32,8 +32,10 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.ListIterator; import java.util.Map; import java.util.Set; +import java.util.Vector; import java.util.logging.Logger; /** @@ -96,45 +98,6 @@ public class GlobalData { /// private static Set builtModules = new HashSet(); - /// - /// PCD memory database stored all PCD information which collected from FPD,MSA and SPD. - /// -// private static final MemoryDatabaseManager pcdDbManager = new MemoryDatabaseManager(); - - /// - /// build target + tool chain family/tag name + arch + command types + command options - /// - private static Map toolChainOptions; - private static Map toolChainFamilyOptions; - private static Map toolChainDefinitions; - /// - /// - /// - private static Set targets; - /// - /// - /// - private static Set toolChainFamilies; - /// - /// - /// - private static Set toolChains; - /// - /// keep track which toolchain family a toolchain tag belongs to - /// - private static Map> toolChainFamilyMap; - private static Map> toolChainCommandMap; - - /// - /// list of Arch: EBC, ARM, IA32, X64, IPF, PPC - /// - private static Set archs; - - /// - /// list of Command Type: CC, LIB, LINK, ASL, ASM, ASMLINK, PP - /// - private static Set commandTypes; - /** Parse framework database (DB) and all SPD files listed in DB to initialize the environment for next build. This method will only be executed only once @@ -465,134 +428,24 @@ public class GlobalData { return result; } - ////// Tool Chain Related, try to refine and put some logic process to ToolChainFactory - public static void setBuildToolChainFamilyOptions(Map map) { - toolChainFamilyOptions = map; - } - - public static Map getToolChainFamilyOptions() { - return toolChainFamilyOptions; - } - - public static void setBuildToolChainOptions(Map map) { - toolChainOptions = map; - } - - public static Map getToolChainOptions() { - return toolChainOptions; - } - - public static void setTargets(Set targetSet) { - GlobalData.log.info("TargetSet: " + targetSet); - targets = targetSet; - } - - public static String[] getTargets() { - return (String[])targets.toArray(new String[targets.size()]); - } - - public static void setToolChains(Set toolChainSet) { - toolChains = toolChainSet; - } - - public static String[] getToolChains() { - String[] toolChainList = new String[toolChains.size()]; - return (String[])toolChains.toArray(toolChainList); - } - - public static void setToolChainFamilies(Set toolChainFamilySet) { - toolChainFamilies = toolChainFamilySet; - } - - public static void setToolChainFamiliyMap(Map> map) { - /* - Set keys = map.keySet(); - Iterator it = keys.iterator(); - while (it.hasNext()) { - String toolchain = (String)it.next(); - Set familyMap = (Set)map.get(toolchain); - Iterator fit = familyMap.iterator(); - System.out.print(toolchain + ": "); - while (fit.hasNext()) { - System.out.print((String)fit.next() + " "); + + public static Vector getModuleSupArchs(ModuleIdentification mi) throws Exception{ + Vector vArchs = null; + ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi); + if (msa.getModuleDefinitions() == null || msa.getModuleDefinitions().getSupportedArchitectures() == null) { + return vArchs; + } + ListIterator li = msa.getModuleDefinitions().getSupportedArchitectures().listIterator(); + while (li.hasNext()) { + if (vArchs == null) { + vArchs = new Vector(); } - System.out.println(""); + vArchs.add((String)li.next()); } - */ - toolChainFamilyMap = map; + + return vArchs; } - - public static String[] getToolChainFamilies() { - String[] toolChainFamilyList = new String[toolChainFamilies.size()]; - return (String[])toolChainFamilies.toArray(toolChainFamilyList); - } - - public static String[] getToolChainFamilies(String toolChain) { - Set familySet = (Set)toolChainFamilyMap.get(toolChain); - String[] toolChainFamilyList = new String[familySet.size()]; - return (String[])familySet.toArray(toolChainFamilyList); - } - - public static Set getToolChainFamilySet(String toolChain) { - return (Set)toolChainFamilyMap.get(toolChain); - } - - public static void setArchs(Set archSet) { - archs = archSet; - } - - public static String[] getArchs() { - String[] archList = new String[archs.size()]; - return (String[])archs.toArray(archList); - } - /* - - */ - public static void SetCommandTypes(Set commandTypeSet) { - commandTypes = commandTypeSet; - } - /* - - */ - public static void SetCommandTypes(Map> commandTypeMap) { - toolChainCommandMap = commandTypeMap; - } - /* - - */ - public static String[] getCommandTypes() { - String[] commandList = new String[commandTypes.size()]; - return (String[])commandTypes.toArray(commandList); - } - /* - - */ - public static String[] getCommandTypes(String toolChain) { - Set commands = (Set)toolChainCommandMap.get(toolChain); - if (commands == null) { - return new String[0]; - } - - String[] commandList = new String[commands.size()]; - return (String[])commands.toArray(commandList); - } - /* - - */ - public static String getCommandSetting(String commandDescString) { - return (String)toolChainDefinitions.get(commandDescString); - } - /* - - */ - public static void setToolChainDefinitions(Map def) { - toolChainDefinitions = def; - } - - public static Map getToolChainDefinitions() { - return toolChainDefinitions; - } - + } final class KeyComparator implements Comparator {