From f3b0ed9a12ec287bb336b9672a0937667f1958ec Mon Sep 17 00:00:00 2001 From: jlin16 Date: Thu, 6 Jul 2006 01:09:38 +0000 Subject: [PATCH] some bug fixing for FpdFrameworkModules git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@779 6f19259b-4bc3-4df7-8a09-765794883524 --- .../platform/ui/FpdBuildOptions.java | 7 +- .../ui/FpdDynamicPcdBuildDefinitions.java | 2 +- .../platform/ui/FpdFileContents.java | 24 +- .../platform/ui/FpdFrameworkModules.java | 31 +- .../platform/ui/FpdHeader.java | 1 + .../platform/ui/FpdModuleSA.java | 65 +++- .../platform/ui/global/GlobalData.java | 300 ------------------ .../platform/ui/global/SurfaceAreaQuery.java | 109 +------ .../ui/id/FpdModuleIdentification.java | 4 - 9 files changed, 102 insertions(+), 441 deletions(-) diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java index b94e695ecc..af0c95cadd 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java @@ -390,6 +390,7 @@ public class FpdBuildOptions extends IInternalFrame { if (jTable2 == null) { antTaskTableModel = new DefaultTableModel(); jTable2 = new JTable(antTaskTableModel); + jTable2.setRowHeight(20); antTaskTableModel.addColumn("ID"); antTaskTableModel.addColumn("Filename"); antTaskTableModel.addColumn("ANT Command Options"); @@ -635,6 +636,7 @@ public class FpdBuildOptions extends IInternalFrame { ffsAttributesTableModel = new DefaultTableModel(); jTable4 = new JTable(ffsAttributesTableModel); jTable4.setPreferredSize(new java.awt.Dimension(400,80)); + jTable4.setRowHeight(20); ffsAttributesTableModel.addColumn("Name"); ffsAttributesTableModel.addColumn("Value"); @@ -809,6 +811,7 @@ public class FpdBuildOptions extends IInternalFrame { if (jTable5 == null) { optionsTableModel = new DefaultTableModel(); jTable5 = new JTable(optionsTableModel); + jTable5.setRowHeight(20); optionsTableModel.addColumn("BuildTargets"); optionsTableModel.addColumn("ToolChainFamily"); optionsTableModel.addColumn("SupportedArch"); @@ -1271,6 +1274,7 @@ public class FpdBuildOptions extends IInternalFrame { sectionTableModel.addColumn("SectionType"); jTable1 = new JTable(sectionTableModel); + jTable1.setRowHeight(20); JComboBox cb = new JComboBox(); cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID"); cb.addItem("EFI_SECTION_VERSION"); @@ -1333,6 +1337,7 @@ public class FpdBuildOptions extends IInternalFrame { subsectionsTableModel = new DefaultTableModel(); subsectionsTableModel.addColumn("SectionType"); jTable3 = new JTable(subsectionsTableModel); + jTable3.setRowHeight(20); JComboBox cb = new JComboBox(); cb.addItem("EFI_SECTION_FREEFORM_SUBTYPE_GUID"); cb.addItem("EFI_SECTION_VERSION"); @@ -1572,7 +1577,7 @@ public class FpdBuildOptions extends IInternalFrame { sectionsTableModel = new DefaultTableModel(); sectionsTableModel.addColumn("EncapsulationType"); jTable6 = new JTable(sectionsTableModel); - + jTable6.setRowHeight(20); jTable6.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable6.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent e) { diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java index 5c1393de58..58bdeb606d 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java @@ -183,7 +183,7 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame { model.addColumn("MaxDatumSize"); model.addColumn("DatumType"); jTable = new JTable(model); - + jTable.setRowHeight(20); jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent e) { 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 21e0a5b25b..a8191aba5f 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 @@ -208,9 +208,27 @@ public class FpdFileContents { ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator(); while(li.hasNext()) { ModuleSADocument.ModuleSA msa = (ModuleSADocument.ModuleSA)li.next(); - if (msa.getModuleGuid().equals(s[0]) && msa.getModuleVersion().equals(s[1]) - && msa.getPackageGuid().equals(s[2]) && msa.getPackageVersion().equals(s[3])) { - + if (msa.getModuleGuid().equals(s[0]) && msa.getPackageGuid().equals(s[2])) { + if (msa.getModuleVersion() != null) { + if (!msa.getModuleVersion().equals(s[1])) { + continue; + } + } + else{ + if (s[1] != null) { + continue; + } + } + if (msa.getPackageVersion() != null) { + if (!msa.getPackageVersion().equals(s[3])) { + continue; + } + } + else{ + if (s[3] != null) { + continue; + } + } return msa; } } 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 929e1647e0..2ab4d65d2b 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 @@ -134,6 +134,7 @@ public class FpdFrameworkModules extends IInternalFrame { if (jTable == null) { model = new NonEditableTableModel(); jTable = new JTable(model); + jTable.setRowHeight(20); model.addColumn("ModuleName"); model.addColumn("ModuleGUID"); model.addColumn("ModuleVersion"); @@ -190,8 +191,11 @@ public class FpdFrameworkModules extends IInternalFrame { fpdMsa.put(mg + mv + pg + pv, null); String[] row = {" ", mg, mv, pg, pv}; - if (getModuleId(mg + " " + mv + " " + pg + " " + pv) != null) { - row[0] = getModuleId(mg + " " + mv + " " + pg + " " + pv).getName(); + 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); ffc.addFrameworkModulesPcdBuildDefs(miList.get(selectedRow), null); @@ -241,6 +245,7 @@ public class FpdFrameworkModules extends IInternalFrame { if (jTable1 == null) { model1 = new NonEditableTableModel(); jTable1 = new JTable(model1); + jTable1.setRowHeight(20); model1.addColumn("ModuleName"); model1.addColumn("ModuleGUID"); model1.addColumn("ModuleVersion"); @@ -273,10 +278,10 @@ public class FpdFrameworkModules extends IInternalFrame { settingDlg = new FpdModuleSA(ffc); } - 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 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); settingDlg.setVisible(true); } @@ -357,8 +362,11 @@ public class FpdFrameworkModules extends IInternalFrame { String[][] saa = new String[ffc.getFrameworkModulesCount()][5]; ffc.getFrameworkModulesInfo(saa); for (int i = 0; i < saa.length; ++i) { - if (getModuleId(saa[i][1]+ " "+saa[i][2]+" "+saa[i][3]+" "+saa[i][4]) != null) { - saa[i][0] = getModuleId(saa[i][1]+ " "+saa[i][2]+" "+saa[i][3]+" "+saa[i][4]).getName(); + ModuleIdentification mi = getModuleId(saa[i][1]+ " "+saa[i][2]+" "+saa[i][3]+" "+saa[i][4]); + if (mi != null) { + saa[i][0] = mi.getName(); + saa[i][2] = mi.getVersion(); + saa[i][4] = mi.getPackage().getVersion(); } model1.addRow(saa[i]); fpdMsa.put(saa[i][1]+saa[i][2]+saa[i][3]+saa[i][4], saa[i][0]); @@ -417,14 +425,17 @@ public class FpdFrameworkModules extends IInternalFrame { 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])){ +// || !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 (mi.getGuid().equals(keyPart[0])){ +// && mi.getVersion().equals(keyPart[1])){ + return mi; } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java index d897959aea..3f50fb6862 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java @@ -674,6 +674,7 @@ public class FpdHeader extends IInternalFrame { resizeComponentWidth(this.jTextFieldBaseName, this.getWidth(), intPreferredWidth); resizeComponentWidth(this.jTextFieldGuid, this.getWidth(), intPreferredWidth); resizeComponentWidth(this.jTextFieldVersion, this.getWidth(), intPreferredWidth); + resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth); resizeComponentWidth(this.jScrollPaneLicense, this.getWidth(), intPreferredWidth); resizeComponentWidth(this.jTextFieldCopyright, this.getWidth(), intPreferredWidth); resizeComponentWidth(this.jScrollPaneDescription, this.getWidth(), intPreferredWidth); 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 58c181dcd3..daca39c657 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 @@ -1,6 +1,8 @@ package org.tianocore.frameworkwizard.platform.ui; import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JOptionPane; @@ -398,6 +400,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { */ private void initialize() { this.setSize(664, 515); + this.centerWindow(); this.setModal(true); this.setTitle("Module Settings"); this.setContentPane(getJContentPane()); @@ -499,6 +502,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (jTable == null) { model = new PartialEditableTableModel(); jTable = new JTable(model); + jTable.setRowHeight(20); model.addColumn("CName"); model.addColumn("TokenSpaceGUID"); model.addColumn("ItemType"); @@ -682,7 +686,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { model1.addColumn("PackageGUID"); model1.addColumn("PackageVersion"); jTable1 = new JTable(model1); - + jTable1.setRowHeight(20); jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable1.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent e) { @@ -731,7 +735,8 @@ public class FpdModuleSA extends JDialog implements ActionListener { model2 = new LibraryTableModel(); model2.addColumn("LibraryClass"); jTable2 = new JTable(model2); - + jTable2.setRowHeight(20); + jTable2.setShowGrid(false); jTable2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable2.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent e) { @@ -803,7 +808,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { model3.addColumn("PackageGUID"); model3.addColumn("PackageVersion"); jTable3 = new JTable(model3); - + jTable3.setRowHeight(20); jTable3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable3.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ public void valueChanged(ListSelectionEvent e) { @@ -1099,6 +1104,15 @@ public class FpdModuleSA extends JDialog implements ActionListener { optionsTableModel.addColumn("SupportedArchs"); optionsTableModel.addColumn("Contents"); jTable4 = new JTable(optionsTableModel); + jTable4.setRowHeight(20); + Vector vArch = new Vector(); + vArch.add("IA32"); + vArch.add("X64"); + vArch.add("IPF"); + vArch.add("EBC"); + vArch.add("ARM"); + vArch.add("PPC"); + jTable4.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch)); jTable4.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable4.getModel().addTableModelListener(new TableModelListener() { public void tableChanged(TableModelEvent arg0) { @@ -1109,23 +1123,28 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (arg0.getType() == TableModelEvent.UPDATE){ //ToDo Data Validition check. String targets = m.getValueAt(row, 0) + ""; - Vector targetName = new Vector(); - String[] sArray = targets.split(" "); - for (int i = 0; i < sArray.length; ++i) { - targetName.add(sArray[i]); + Vector targetName = null; + if (targets.length() > 0) { + targetName = new Vector(); + String[] sArray = targets.split(" "); + for (int i = 0; i < sArray.length; ++i) { + targetName.add(sArray[i]); + } } + String toolChain = m.getValueAt(row, 1) + ""; String tagName = m.getValueAt(row, 2) + ""; String toolCode = m.getValueAt(row, 3) + ""; String archs = m.getValueAt(row, 4) + ""; - Vector supArch = new Vector(); - String[] sArray1 = archs.split(" "); - for (int i = 0; i < sArray1.length; ++i) { - supArch.add(sArray1[i]); - } - if (supArch.size() == 0) { - supArch.add("IA32"); + Vector supArch = null; + if (archs.length() > 0) { + supArch = new Vector(); + String[] sArray1 = archs.split(" "); + for (int i = 0; i < sArray1.length; ++i) { + supArch.add(sArray1[i]); + } } + String contents = m.getValueAt(row, 5) + ""; ffc.updateModuleSAOptionsOpt(moduleKey, row, targetName, toolChain, tagName, toolCode, supArch, contents); @@ -1181,6 +1200,24 @@ public class FpdModuleSA extends JDialog implements ActionListener { } return jButton5; } + + /** + Start the window at the center of screen + + **/ + protected void centerWindow(int intWidth, int intHeight) { + Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); + this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2); + } + + /** + Start the window at the center of screen + + **/ + protected void centerWindow() { + centerWindow(this.getSize().width, this.getSize().height); + } + } // @jve:decl-index=0:visual-constraint="10,10" 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 e74644fa75..fe565d97ed 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 @@ -31,16 +31,10 @@ import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.Stack; -import java.util.TreeMap; -import java.util.TreeSet; import java.util.logging.Logger; -import java.util.regex.Matcher; -import java.util.regex.Pattern; /** GlobalData provide initializing, instoring, querying and update global data. @@ -113,8 +107,6 @@ public class GlobalData { private static Map toolChainOptions; private static Map toolChainFamilyOptions; private static Map toolChainDefinitions; - private static Map> moduleToolChainOptions = new HashMap>();; - private static Map> moduleToolChainFamilyOptions = new HashMap>();; /// /// /// @@ -705,124 +697,12 @@ public class GlobalData { String[] commandList = new String[commands.size()]; return (String[])commands.toArray(commandList); } - /* - - */ - public static String getCommandSetting(String target, String toolChain, - String arch, String command, String attribute, FpdModuleIdentification fpdModuleId) { - String[] commandDescription = new String[] {target, toolChain, arch, command, attribute}; - return getCommandSetting(commandDescription, fpdModuleId); - } - /* - - */ - public static String getCommandSetting(String[] commandDescription, FpdModuleIdentification fpdModuleId) { - if (commandDescription[4].equals("FLAGS")) { - return getCommandFlags(commandDescription, fpdModuleId); - } - - StringBuffer commandDescString = new StringBuffer(32); - - int i = 0; - while (true) { - commandDescString.append(commandDescription[i++]); - if (i >= commandDescription.length) { - break; - } - commandDescString.append("_"); - } - - return getCommandSetting(commandDescString.toString()); - } /* */ public static String getCommandSetting(String commandDescString) { return (String)toolChainDefinitions.get(commandDescString); } - /* - - */ - public static String getCommandFlags(String[] commandDescription, FpdModuleIdentification fpdModuleId) { - String setting = getSetting(toolChainOptions, commandDescription, fpdModuleId, false); - - if (setting == null) { - String commandDesc = commandDescription[4]; - commandDescription[4] = "FAMILY"; - String toolChainFamily = getCommandSetting(commandDescription, fpdModuleId); - commandDescription[4] = commandDesc; - - commandDesc = commandDescription[1]; - commandDescription[1] = toolChainFamily; - setting = getSetting(toolChainFamilyOptions, commandDescription, fpdModuleId, true); - commandDescription[1] = commandDesc; - } - - if (setting == null) { - setting = ""; - } - - - Set addFlagsSet = new LinkedHashSet(); - Set subFlagsSet = new LinkedHashSet(); - putFlagsToSet(addFlagsSet, setting); - - return getFlags(addFlagsSet, subFlagsSet); - } - /* - - */ - private static String getSetting(Map optionMap, String[] commandDescription, - FpdModuleIdentification fpdModuleId, boolean toolChainFamilyFlag) { - - String setting = (String)getOption(optionMap, commandDescription); - if (fpdModuleId == null) { - return setting; - } - // - // module overrides - // - // - // get module xml doc - // - Map fpdModule = (Map)fpdModuleSA.get(fpdModuleId); - if (fpdModuleId == null) { - return setting; - } - SurfaceAreaQuery.push(fpdModule); - // - // check if the module has been parsed - // - Map moduleOptions = (Map)moduleToolChainOptions.get(fpdModuleId); - if (moduleOptions == null) { - // - // get all the build options of this module - // - moduleOptions = new TreeMap(comparator); - parseBuildOptions(moduleOptions, SurfaceAreaQuery.getOptions(toolChainFamilyFlag)); - } - // - // get setting for current qualified command - // - Set addSet = new TreeSet(); - Set subSet = new TreeSet(); - putFlagsToSet(addSet, setting); - String moduleSetting = getOption(moduleOptions, commandDescription); - if (moduleSetting != null) { - moduleSetting = parseOptionString(moduleSetting, addSet, subSet); - } - // - // do necessary setting override - // - if (moduleSetting == null) { - setting = getRawFlags(addSet, subSet); - } else { - setting = moduleSetting; - } - - SurfaceAreaQuery.pop(); - return setting; - } /* */ @@ -834,186 +714,6 @@ public class GlobalData { return toolChainDefinitions; } - /** - Separate the string and instore in set. - -

String is separated by Java Regulation Expression - "[^\\\\]?(\".*?[^\\\\]\")[ \t,]+".

- -

For example:

- -
-        "/nologo", "/W3", "/WX"
-        "/C", "/DSTRING_DEFINES_FILE=\"BdsStrDefs.h\""
-      
- - @param set store the separated string - @param str string to separate - **/ - private static void putFlagsToSet(Set set, String str) { - if (str == null || str.length() == 0) { - return; - } - - Pattern myPattern = Pattern.compile("[^\\\\]?(\".*?[^\\\\]\")[ \t,]+"); - Matcher matcher = myPattern.matcher(str + " "); - while (matcher.find()) { - String item = str.substring(matcher.start(1), matcher.end(1)); - set.add(item); - } - } - - /** - Generate the final flags string will be used by compile command. - - @param add the add flags set - @param sub the sub flags set - @return final flags after add set substract sub set - **/ - private static String getFlags(Set add, Set sub) { - String result = ""; - add.removeAll(sub); - Iterator iter = add.iterator(); - while (iter.hasNext()) { - String str = (String) iter.next(); - result += str.substring(1, str.length() - 1) + " "; - } - return result; - } - - /** - Generate the flags string with original format. The format is defined by - Java Regulation Expression "[^\\\\]?(\".*?[^\\\\]\")[ \t,]+".

- -

For example:

- -
-        "/nologo", "/W3", "/WX"
-        "/C", "/DSTRING_DEFINES_FILE=\"BdsStrDefs.h\""
-      
- - @param add the add flags set - @param sub the sub flags set - @return flags with original format - **/ - private static String getRawFlags(Set add, Set sub) { - String result = null; - add.removeAll(sub); - Iterator iter = add.iterator(); - while (iter.hasNext()) { - String str = (String) iter.next(); - result += "\"" + str.substring(1, str.length() - 1) + "\", "; - } - return result; - } - - private static String parseOptionString(String optionString, Set addSet, Set subSet) { - boolean overrideOption = false; - Pattern pattern = Pattern.compile("ADD\\.\\[(.+)\\]"); - Matcher matcher = pattern.matcher(optionString); - - while (matcher.find()) { - overrideOption = true; - String addOption = optionString.substring(matcher.start(1), matcher.end(1)).trim(); - putFlagsToSet(addSet, addOption); - - } - - pattern = Pattern.compile("SUB\\.\\[(.+)\\]"); - matcher = pattern.matcher(optionString); - - while (matcher.find()) { - overrideOption = true; - String subOption = optionString.substring(matcher.start(1), matcher.end(1)).trim(); - putFlagsToSet(subSet, subOption); - } - - if (overrideOption == true) { - return null; - } - - return optionString; - } - - public static String getOption(Map options, String[] toolDefString) { - Stack> stack = new Stack>(); - Map map = options; - Map lastMap; - String option = null; - int length = toolDefString.length - 2; - - int i = 0; - String key = null; - boolean backtrack = false; - while (true) { - if (map == null) { - if (stack.empty()) { - break; - } - map = (Map)stack.pop(); - if (backtrack) { - --i; - } - key = "*"; - backtrack = true; - } else { - if (i >= length) { - break; - } - key = toolDefString[i]; - stack.push(map); - ++i; - backtrack = false; - } - lastMap = map; - map = (Map)lastMap.get(key); - } - - if (map != null) { - option = (String)map.get(toolDefString[i]); - } - - return option; - } - - private static void parseBuildOptions(Map optionMap, String[][] options) { - Map map; - Map nextMap; - - for (int i = 0; i < options.length; ++i) { - map = optionMap; - - int flagIndex = options[i].length - 1; - int cmdIndex = flagIndex - 1; - int archIndex = cmdIndex - 1; - for (int j = 0; j < cmdIndex; ++j) { - String s = options[i][j]; - if (s == null || s.trim().length() == 0) { - s = "*"; - } - s = s.trim().toUpperCase(); - - nextMap = (Map)map.get(s); - if (nextMap == null) { - nextMap = new HashMap(); - map.put(s, nextMap); - } - - map = nextMap; - } - - String cmd = options[i][cmdIndex]; - String flag = options[i][flagIndex]; - if (cmd == null || cmd.trim().length() == 0) { - cmd = "*"; - } - if (flag == null) { - flag = ""; - } - map.put(cmd.trim().toUpperCase(), flag.trim().toUpperCase()); - } - } - } final class KeyComparator implements Comparator { diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java index 544263fac9..8ecc71bcec 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java @@ -27,17 +27,12 @@ import java.util.regex.Pattern; import org.apache.xmlbeans.XmlNormalizedString; import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlString; -import org.tianocore.BuildOptionsDocument; import org.tianocore.BuildTargetList; import org.tianocore.DataIdDocument; import org.tianocore.ExternsDocument; import org.tianocore.FileNameConvention; -import org.tianocore.FvAttributeDocument; //import org.tianocore.FvImageDocument; -import org.tianocore.FvImagesDocument; -import org.tianocore.FvOptionDocument; import org.tianocore.GuidDeclarationsDocument; -import org.tianocore.GuidsDocument; import org.tianocore.LibrariesDocument; import org.tianocore.LibraryClassDeclarationsDocument; import org.tianocore.LibraryClassDocument; @@ -45,18 +40,13 @@ import org.tianocore.ModuleSADocument; import org.tianocore.ModuleTypeDef; import org.tianocore.MsaFilesDocument; import org.tianocore.MsaHeaderDocument; -import org.tianocore.OptionDocument; -import org.tianocore.PPIsDocument; import org.tianocore.PackageDependenciesDocument; import org.tianocore.PackageHeadersDocument; -import org.tianocore.PlatformDefinitionsDocument; import org.tianocore.PpiDeclarationsDocument; import org.tianocore.ProtocolDeclarationsDocument; import org.tianocore.SpdHeaderDocument; import org.tianocore.FilenameDocument.Filename; import org.tianocore.MsaHeaderDocument.MsaHeader; -import org.tianocore.ProtocolsDocument.Protocols.Protocol; -import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify; import org.tianocore.PlatformHeaderDocument; import org.tianocore.frameworkwizard.platform.ui.id.FpdModuleIdentification; import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification; @@ -313,102 +303,6 @@ public class SurfaceAreaQuery { return "UNIFIED"; } - /** - * Retrieve BuildOptions/Option or Arch/Option - * - * @param toolChainFamilyFlag - * if true, retrieve options for toolchain family; otherwise for - * toolchain - * - * @returns String[][5] name, target, toolchain, arch, coommand of options - * if elements are found at the known xpath. String[0][] if dont - * find element. - * - * @returns Empty array if nothing is there - */ - public static String[][] getOptions(boolean toolChainFamilyFlag) { - String[] xPath; - String target = null; - String toolchain = null; - String toolchainFamily = null; - List archList = null; - String cmd = null; - String targetName = null; - String optionName = null; - - if (toolChainFamilyFlag == true) { - xPath = new String[] { - "/BuildOptions/Options/Option[not(@ToolChainFamily) and not(@ToolChainTag)]", - "/BuildOptions/Options/Option[@ToolChainFamily]", }; - } else { - xPath = new String[] { - "/BuildOptions/Options/Option[not(@ToolChainFamily) and not(@ToolChainTag)]", - "/BuildOptions/Options/Option[@TagName]", }; - } - - XmlObject[] returns = get("FrameworkPlatformDescription", xPath); - if (returns == null) { - return new String[0][5]; - } - - List optionList = new ArrayList(); - OptionDocument.Option option; - - for (int i = 0; i < returns.length; i++) { - option = (OptionDocument.Option) returns[i]; - - // - // Get Target, ToolChain(Family), Arch, Cmd, and Option from Option, - // then - // put to result[][5] array in above order. - // - String[] targetList; - target = null;//Auber option.getBuildTargets(); - if (target != null) { - targetList = target.split(" "); - } else { - targetList = new String[1]; - targetList[0] = null; - } - - if (toolChainFamilyFlag) { - toolchainFamily = option.getToolChainFamily(); - if (toolchainFamily != null) { - toolchain = toolchainFamily.toString(); - } else { - toolchain = null; - } - } else { - toolchain = option.getTagName(); - } - - archList = option.getSupArchList(); - if (archList == null) { - archList.add(null); - } - - cmd = option.getToolCode(); - - optionName = option.getStringValue(); - for (int t = 0; t < targetList.length; t++) { - for (int j = 0; j < archList.size(); j++) { - optionList.add(new String[] { optionName, targetList[i], - toolchain, archList.get(j), cmd }); - } - } - } - - String[][] result = new String[optionList.size()][5]; - for (int i = 0; i < optionList.size(); i++) { - result[i][0] = optionList.get(i)[0]; - result[i][1] = optionList.get(i)[1]; - result[i][2] = optionList.get(i)[2]; - result[i][3] = optionList.get(i)[3]; - result[i][4] = optionList.get(i)[4]; - } - return result; - } - public static String getBuildTarget() { String[] xPath = new String[] { "/PlatformDefinitions/BuildTargets" }; @@ -885,7 +779,7 @@ public class SurfaceAreaQuery { return result; } - + public static XmlObject getFpdBuildOptions() { String[] xPath = new String[] { "/BuildOptions" }; @@ -1352,7 +1246,6 @@ public class SurfaceAreaQuery { * . */ public String getToolChainFamily() { - String toolChainFamily; String[] xPath = new String[] { "/BuildOptions" }; XmlObject[] result = get("FrameworkPlatformDescription", xPath); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/id/FpdModuleIdentification.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/id/FpdModuleIdentification.java index b9bb9e5ff3..b30c322648 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/id/FpdModuleIdentification.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/id/FpdModuleIdentification.java @@ -30,10 +30,6 @@ public class FpdModuleIdentification { private ModuleIdentification module; - private String target; // Optional - - private String toolchain; // Optional - public FpdModuleIdentification(String arch, String fvBinding, String sequence, ModuleIdentification module){ this.arch = arch; this.fvBinding = fvBinding; -- 2.39.2