a. Add support arch. filter for library instance selection in FPD file.
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 20 Oct 2006 17:36:45 +0000 (17:36 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 20 Oct 2006 17:36:45 +0000 (17:36 +0000)
b. add sync. operation for modifying dynamic pcd values to set the new value to all pcd entries in ModuleSA.
c. Make line wrap for SPD, FPD header copyright text area.
d. give warning of default section added when user add new Sections under FPD build options.
e. not generating the empty build targets when user creating a new entry for build options.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1804 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java [new file with mode: 0644]
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java

index f0b337b38382ae21d83e98206cc1d0f4ac41485f..ad7783268a0b5c3fa4b8f0b9e10dc006d8876e1d 100644 (file)
@@ -437,6 +437,7 @@ public class SpdHeader extends IInternalFrame {
         if (jCopyrightTextArea == null) {\r
             jCopyrightTextArea = new JTextArea();\r
             jCopyrightTextArea.setWrapStyleWord(true);\r
+            jCopyrightTextArea.setLineWrap(true);\r
             jCopyrightTextArea.addFocusListener(new FocusAdapter() {\r
                 public void focusLost(FocusEvent e) {\r
                     if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {\r
index 8af4bea28ac27255ec4ba0866b6bd3cb834d99d0..ecaf8587a69635074611b066ec05b921da48774d 100644 (file)
@@ -1150,6 +1150,7 @@ public class FpdBuildOptions extends IInternalFrame {
                     String[] row = { "" };\r
                     sectionsTableModel.addRow(row);\r
                     ffc.genBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), "");\r
+                    JOptionPane.showMessageDialog(frame, "Add Default Section Type EFI_SECTION_PE32 into the New Sections Entry.");\r
                 }\r
             });\r
         }\r
@@ -1693,9 +1694,9 @@ public class FpdBuildOptions extends IInternalFrame {
                                   jTextFieldOptionContents.getText() };\r
                     optionsTableModel.addRow(o);\r
                     docConsole.setSaved(false);\r
-                    ffc.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets.getText()),\r
+                    ffc.genBuildOptionsOpt(stringToVector(jTextFieldBuildTargets.getText().trim()),\r
                                            jTextFieldToolChainFamily.getText(), jTextFieldTagName.getText(),\r
-                                           jTextFieldToolCmd.getText(), stringToVector(s),\r
+                                           jTextFieldToolCmd.getText(), stringToVector(s.trim()),\r
                                            jTextFieldOptionContents.getText());\r
                 }\r
             });\r
@@ -1854,7 +1855,7 @@ public class FpdBuildOptions extends IInternalFrame {
     private Vector<Object> stringToVector(String s) {\r
         String[] sArray = s.split(" ");\r
         Vector<Object> v = null;\r
-        if (s.length() > 0) {\r
+        if (s.length() > 0 && !s.trim().equalsIgnoreCase("")) {\r
             v = new Vector<Object>();\r
             for (int i = 0; i < sArray.length; ++i) {\r
                 v.add(sArray[i]);\r
@@ -1883,9 +1884,7 @@ public class FpdBuildOptions extends IInternalFrame {
         if (bool[5]) {\r
             s += "PPC ";\r
         }\r
-        if (s.equals(" ")) {\r
-            s += "IA32";\r
-        }\r
+        \r
         return s.trim();\r
     }\r
 \r
index bbd24f2f79537c42e5e815ec07cd0f171a39e4c1..c846160ca8688455c84cb9ebfb9d2f90a689012a 100644 (file)
@@ -18,12 +18,12 @@ import org.tianocore.frameworkwizard.common.Tools;
 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
 import javax.swing.JCheckBox;\r
-import java.awt.FlowLayout;\r
 import javax.swing.JRadioButton;\r
 import javax.swing.JButton;\r
 import javax.swing.JLabel;\r
 import javax.swing.JTextField;\r
 import java.awt.GridLayout;\r
+import java.util.ArrayList;\r
 \r
 public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {\r
 \r
@@ -62,6 +62,7 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
     private ButtonGroup bg = new ButtonGroup();\r
     private JLabel jLabelPadd = null;\r
     private JLabel jLabelPad1 = null;\r
+    private JScrollPane jScrollPane = null;\r
     /**\r
      * This is the default constructor\r
      */\r
@@ -120,7 +121,6 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
             jContentPane.setLayout(new BorderLayout());\r
             jContentPane.add(getJScrollPaneDynPcd(), java.awt.BorderLayout.NORTH);\r
             jContentPane.add(getJPanelSkuInfo(), java.awt.BorderLayout.CENTER);\r
-            jContentPane.add(getJPanelDynPcdValue(), java.awt.BorderLayout.SOUTH);\r
         }\r
         return jContentPane;\r
     }\r
@@ -133,7 +133,7 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
     private JScrollPane getJScrollPaneDynPcd() {\r
         if (jScrollPaneDynPcd == null) {\r
             jScrollPaneDynPcd = new JScrollPane();\r
-            jScrollPaneDynPcd.setPreferredSize(new java.awt.Dimension(100,300));\r
+            jScrollPaneDynPcd.setPreferredSize(new java.awt.Dimension(100,250));\r
             jScrollPaneDynPcd.setViewportView(getJTableDynPcd());\r
         }\r
         return jScrollPaneDynPcd;\r
@@ -269,15 +269,17 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
      */\r
     private JPanel getJPanelSkuInfo() {\r
         if (jPanelSkuInfo == null) {\r
-            FlowLayout flowLayout = new FlowLayout();\r
-            flowLayout.setAlignment(java.awt.FlowLayout.LEFT);\r
             jPanelSkuInfo = new JPanel();\r
+            jPanelSkuInfo.setLayout(new BorderLayout());\r
             jPanelSkuInfo.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED));\r
-            jPanelSkuInfo.setLayout(flowLayout);\r
-            jPanelSkuInfo.setPreferredSize(new java.awt.Dimension(600,100));\r
-            jPanelSkuInfo.add(getJCheckBoxSkuEnable(), null);\r
-            jPanelSkuInfo.add(getJScrollPaneSkuInfo(), null);\r
-            jPanelSkuInfo.add(getJButtonSkuInfoUpdate(), null);\r
+            jPanelSkuInfo.setPreferredSize(new java.awt.Dimension(600,120));\r
+\r
+//            jPanelSkuInfo.add(getJPanelSkuInfoN(), java.awt.BorderLayout.NORTH);\r
+            jPanelSkuInfo.add(getJScrollPane(), java.awt.BorderLayout.NORTH);\r
+            jPanelSkuInfo.add(getJScrollPaneSkuInfo(), java.awt.BorderLayout.CENTER);\r
+            \r
+            \r
+//            jPanelSkuInfo.add(getJPanelDynPcdValue(), java.awt.BorderLayout.SOUTH);\r
         }\r
         return jPanelSkuInfo;\r
     }\r
@@ -313,8 +315,8 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
             GridLayout gridLayout = new GridLayout();\r
             gridLayout.setColumns(5);\r
             gridLayout.setRows(4);\r
-            gridLayout.setHgap(5);\r
-            gridLayout.setVgap(5);\r
+            gridLayout.setHgap(20);\r
+            gridLayout.setVgap(20);\r
             \r
             jLabelVpdOffset = new JLabel();\r
             jLabelVpdOffset.setPreferredSize(new java.awt.Dimension(80,20));\r
@@ -336,8 +338,8 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
             jLabelVarName.setPreferredSize(new java.awt.Dimension(90,20));\r
             jPanelDynPcdValue = new JPanel();\r
             jPanelDynPcdValue.setBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.LOWERED));\r
+            jPanelDynPcdValue.setPreferredSize(new java.awt.Dimension(1000,150));\r
             jPanelDynPcdValue.setLayout(gridLayout);\r
-            jPanelDynPcdValue.setPreferredSize(new java.awt.Dimension(600,120));\r
             jPanelDynPcdValue.add(getJRadioButtonHii(), null);\r
             jPanelDynPcdValue.add(jLabelVarName, null);\r
             jPanelDynPcdValue.add(getJTextFieldVarName(), null);\r
@@ -362,6 +364,8 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
                        jPanelDynPcdValue.add(jLabelPad1, null);\r
                        jPanelDynPcdValue.add(getJRadioButtonDefaultValue(), null);\r
                        jPanelDynPcdValue.add(getJTextFieldDefaultValue(), null);\r
+            jPanelDynPcdValue.add(getJCheckBoxSkuEnable(), null);\r
+            jPanelDynPcdValue.add(getJButtonSkuInfoUpdate(), null);\r
             bg.add(jRadioButtonHii);\r
             bg.add(jRadioButtonVpd);\r
         }                      \r
@@ -424,7 +428,7 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
     private JScrollPane getJScrollPaneSkuInfo() {\r
         if (jScrollPaneSkuInfo == null) {\r
             jScrollPaneSkuInfo = new JScrollPane();\r
-            jScrollPaneSkuInfo.setPreferredSize(new java.awt.Dimension(300,80));\r
+            jScrollPaneSkuInfo.setPreferredSize(new java.awt.Dimension(300,50));\r
             jScrollPaneSkuInfo.setViewportView(getJTableSkuInfo());\r
         }\r
         return jScrollPaneSkuInfo;\r
@@ -498,6 +502,8 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
     \r
     private void updateSkuInfo (int pcdSelected) {\r
         int skuCount = ffc.getDynamicPcdSkuInfoCount(pcdSelected);\r
+        String cName = modelPcd.getValueAt(pcdSelected, 0)+"";\r
+        String tsGuid = modelPcd.getValueAt(pcdSelected, 2)+"";\r
         \r
         String varName = null;\r
         String varGuid = null;\r
@@ -549,12 +555,27 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
                 ffc.removeDynamicPcdBuildDataSkuInfo(pcdSelected);\r
                 if (jRadioButtonHii.isSelected()) {\r
                     ffc.genDynamicPcdBuildDataSkuInfo("0", varName, varGuid, varOffset, hiiDefault, null, null, pcdSelected);\r
+                    ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);\r
+                    for (int i = 0; i < al.size(); ++i) {\r
+                        String mKey = moduleInfo (al.get(i));\r
+                        ffc.updatePcdData(mKey, cName, tsGuid, null, null, hiiDefault);\r
+                    }\r
                 }\r
                 else if (jRadioButtonVpd.isSelected()){\r
                     ffc.genDynamicPcdBuildDataSkuInfo("0", null, null, null, null, vpdOffset, null, pcdSelected);\r
+                    ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);\r
+                    for (int i = 0; i < al.size(); ++i) {\r
+                        String mKey = moduleInfo (al.get(i));\r
+                        ffc.updatePcdData(mKey, cName, tsGuid, null, null, vpdOffset);\r
+                    }\r
                 }\r
                 else{\r
                     ffc.genDynamicPcdBuildDataSkuInfo("0", null, null, null, null, null, value, pcdSelected);\r
+                    ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);\r
+                    for (int i = 0; i < al.size(); ++i) {\r
+                        String mKey = moduleInfo (al.get(i));\r
+                        ffc.updatePcdData(mKey, cName, tsGuid, null, null, value);\r
+                    }\r
                 }\r
             }\r
         }\r
@@ -577,6 +598,11 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
             }\r
         }\r
     }\r
+    \r
+    private String moduleInfo (String pcdInfo) {\r
+        \r
+        return pcdInfo.substring(0, pcdInfo.lastIndexOf(" "));\r
+    }\r
     /**\r
      * This method initializes jTextField      \r
      *         \r
@@ -681,6 +707,20 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
         return jRadioButtonDefaultValue;\r
     }\r
 \r
+    /**\r
+     * This method initializes jScrollPane     \r
+     *         \r
+     * @return javax.swing.JScrollPane \r
+     */\r
+    private JScrollPane getJScrollPane() {\r
+        if (jScrollPane == null) {\r
+            jScrollPane = new JScrollPane();\r
+            jScrollPane.setPreferredSize(new java.awt.Dimension(1003,180));\r
+            jScrollPane.setViewportView(getJPanelDynPcdValue());\r
+        }\r
+        return jScrollPane;\r
+    }\r
+\r
 }  //  @jve:decl-index=0:visual-constraint="10,10"\r
 \r
 class DynPcdTableModel extends DefaultTableModel {\r
index 3903f97de03b7df718ba024a9640397f4d94c693..fc49cd4151faf641964d3a1e920b9e3a3cdc344f 100644 (file)
@@ -578,12 +578,21 @@ public class FpdFileContents {
                     //\r
                     // change item type while not updating dynPcdData????\r
                     //\r
-                    pcdData.setItemType(PcdItemTypes.Enum.forString(itemType));\r
-                    if(pcdData.getDatumType().equals("VOID*")) {\r
+                    if (itemType != null) {\r
+                        pcdData.setItemType(PcdItemTypes.Enum.forString(itemType));\r
+                    }\r
+                    \r
+                    if(pcdData.getDatumType().equals("VOID*") && maxSize != null) {\r
                         pcdData.setMaxDatumSize(new Integer(maxSize));\r
                     }\r
-                    pcdData.setValue(value);\r
-                    defaultPcdValue.put(cName + " " + tsGuid, value);\r
+                    //\r
+                    // if value input is null, keep old value untouched.\r
+                    //\r
+                    if (value != null) {\r
+                        pcdData.setValue(value);\r
+                        defaultPcdValue.put(cName + " " + tsGuid, value);\r
+                    }\r
+                    \r
                     break;\r
                 }\r
             }\r
index a422ba2cfc425d9d70a11c2a5bbf58da822e3f80..bcb0e6f5c99084e3028a965710db0432cf9e0e93 100644 (file)
@@ -463,6 +463,7 @@ public class FpdHeader extends IInternalFrame {
         if (jCopyrightTextArea == null) {\r
             jCopyrightTextArea = new JTextArea();\r
             jCopyrightTextArea.setWrapStyleWord(true);\r
+            jCopyrightTextArea.setLineWrap(true);\r
             jCopyrightTextArea.addFocusListener(new FocusAdapter(){\r
                 public void focusLost(FocusEvent e) {\r
                     if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) {\r
index 27a52b66cd6e12a3179b3e9f8432b50b790425ae..ac8841c7907ffa893a83895fbb0868f9ae93a033 100644 (file)
@@ -21,12 +21,14 @@ import javax.swing.event.ListSelectionListener;
 import javax.swing.event.TableModelEvent;\r
 import javax.swing.event.TableModelListener;\r
 import javax.swing.table.DefaultTableModel;\r
+import javax.swing.table.TableColumn;\r
 import javax.swing.table.TableModel;\r
 \r
 import org.tianocore.frameworkwizard.common.DataValidation;\r
 import org.tianocore.frameworkwizard.common.GlobalData;\r
 import org.tianocore.frameworkwizard.common.IDefaultTableModel;\r
 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
+import org.tianocore.frameworkwizard.platform.ui.global.LibraryClassDescriptor;\r
 import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
 import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
 import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
@@ -93,9 +95,13 @@ public class FpdModuleSA extends JDialog implements ActionListener {
     private FpdFileContents ffc = null;\r
     private String moduleKey = null;\r
     private int moduleSaNum = -1;\r
-    private HashMap<String, ArrayList<String>> classInstanceMap = null;\r
-    private ArrayList<String> classProduced = null;\r
-    private HashMap<String, ArrayList<String>> classConsumed = null;\r
+    private HashMap<LibraryClassDescriptor, ArrayList<String>> classInstanceMap = null;\r
+    //\r
+    // map of <{libName, supArch, supMod}, list of Module information>\r
+    //\r
+    private HashMap<LibraryClassDescriptor, ArrayList<String>> classConsumed = null;\r
+    private HashMap<LibraryClassDescriptor, ArrayList<String>> classProduced = null;\r
+    \r
     private JPanel jPanelModuleSaOpts = null;\r
     private JLabel jLabelFvBinding = null;\r
     private JTextField jTextFieldFvBinding = null;\r
@@ -148,10 +154,19 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         this.moduleKey = k;\r
         moduleSaNum = i;\r
         this.docConsole = dc;\r
+        classInstanceMap = null;\r
         classProduced = null;\r
         classConsumed = null;\r
         jTabbedPane.setSelectedIndex(0);\r
         initPcdBuildDefinition(i);\r
+        ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);\r
+        int tabIndex = jTabbedPane.indexOfTab("Libraries");\r
+        if (mi.isLibrary()) {\r
+            jTabbedPane.setEnabledAt(tabIndex, false);\r
+        }\r
+        else {\r
+            jTabbedPane.setEnabledAt(tabIndex, true);\r
+        }\r
     }\r
 \r
     /**\r
@@ -178,10 +193,14 @@ public class FpdModuleSA extends JDialog implements ActionListener {
     }\r
     \r
     public void initLibraries(String key) {\r
-        //\r
-        // display library classes that need to be resolved. also potential instances for them.\r
-        //\r
-        resolveLibraryInstances(moduleKey);\r
+        try {\r
+            //\r
+            // display library classes that need to be resolved. also potential instances for them.\r
+            //\r
+            resolveLibraryInstances(moduleKey);\r
+        } catch (Exception e) {\r
+            JOptionPane.showMessageDialog(frame, e.getMessage());\r
+        }\r
         //\r
         // display lib instances already selected for key\r
         //\r
@@ -191,7 +210,8 @@ public class FpdModuleSA extends JDialog implements ActionListener {
             String[][] saa = new String[instanceCount][5];\r
             ffc.getLibraryInstances(key, saa);\r
             for (int i = 0; i < saa.length; ++i) {\r
-                ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);\r
+                ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3]\r
+                                                                       + " " + saa[i][4]);\r
                 if (mi != null) {\r
                     //\r
                     // ToDo: verify this instance first.\r
@@ -202,11 +222,16 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                     //\r
                     // re-evaluate lib instance usage when adding a already-selected lib instance.\r
                     //\r
-                    resolveLibraryInstances(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);\r
+                    try {\r
+                        resolveLibraryInstances(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);\r
+                    } catch (Exception e) {\r
+                        JOptionPane.showMessageDialog(frame, e.getMessage());\r
+                    }\r
                     selectedInstancesTableModel.addRow(saa[i]);\r
                 }\r
             }\r
         }\r
+\r
         showClassToResolved();\r
     }\r
     \r
@@ -241,71 +266,165 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         }\r
     }\r
     \r
-    private void resolveLibraryInstances(String key) {\r
-        ModuleIdentification mi = WorkspaceProfile.getModuleId(key);\r
-        PackageIdentification[] depPkgList = null;\r
-        try{\r
+    private void filterClassConsumedByArch (Vector<LibraryClassDescriptor> v) {\r
+        String[] moduleInfo = moduleKey.split(" ");\r
+        Vector<String> vModuleArchs = new Vector<String>();\r
+        //\r
+        // Skip guid, version information, get archs to check.\r
+        //\r
+        for (int i = 4; i < moduleInfo.length; ++i) {\r
+            vModuleArchs.add(moduleInfo[i]);\r
+        }\r
+        //\r
+        // if module will be built on all platforms, no filter needed for lib classes.\r
+        //\r
+        if (vModuleArchs.size() == 0) {\r
+            return;\r
+        }\r
+        \r
+        for (int j = 0; j < v.size(); ++j) {\r
+            LibraryClassDescriptor libInfo = v.get(j);\r
+\r
+            Vector<String> vSupArchs = libInfo.getVectorFromString(libInfo.supArchs);\r
+            \r
+            if (vSupArchs.size() == 0 || (vSupArchs.size() == 1 && vSupArchs.get(0).equalsIgnoreCase(""))) {\r
+                //\r
+                // update lib info to module archs only.\r
+                //\r
+                libInfo.supArchs = "";\r
+                for (int i = 0; i < vModuleArchs.size(); ++i) {\r
+                    libInfo.supArchs += vModuleArchs.get(i);\r
+                    libInfo.supArchs += " ";\r
+                }\r
+                libInfo.supArchs.trim();\r
+                continue;\r
+            }\r
             //\r
-            // Get dependency pkg list into which we will search lib instances.\r
+            // only retain those lib class used by module archs.\r
             //\r
-            depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);\r
+            vSupArchs.retainAll(vModuleArchs);\r
+            if (vSupArchs.size() > 0) {\r
+                //\r
+                // update lib info to reflect which kind of arch need to select instance.\r
+                //\r
+                libInfo.supArchs = "";\r
+                for (int i = 0; i < vSupArchs.size(); ++i) {\r
+                    libInfo.supArchs += vSupArchs.get(i);\r
+                    libInfo.supArchs += " ";\r
+                }\r
+                libInfo.supArchs.trim();\r
+                continue;\r
+            }\r
             //\r
-            // Get the lib class consumed, produced by this module itself.\r
+            // remove this lib definition if it supports no archs module will be built under.\r
             //\r
-            Vector<String> vClassConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);\r
-            \r
-            if (this.classConsumed == null) {\r
-                this.classConsumed = new HashMap<String, ArrayList<String>>();\r
+            v.iterator().remove();\r
+        }\r
+    }\r
+    \r
+    private void resolveLibraryInstances(String key) throws MultipleInstanceException, NoInstanceException{\r
+        ModuleIdentification mi = WorkspaceProfile.getModuleId(key);\r
+        PackageIdentification[] depPkgList = null;\r
+        \r
+        //\r
+        // Get dependency pkg list into which we will search lib instances.\r
+        //\r
+        depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);\r
+        //\r
+        // Get the lib class consumed, produced by this module itself.\r
+        //\r
+        Vector<LibraryClassDescriptor> vClassConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);\r
+        filterClassConsumedByArch(vClassConsumed);\r
+        if (this.classConsumed == null) {\r
+            this.classConsumed = new HashMap<LibraryClassDescriptor, ArrayList<String>>();\r
+        }\r
+\r
+        for (int i = 0; i < vClassConsumed.size(); ++i) {\r
+            ArrayList<String> consumedBy = this.classConsumed.get(vClassConsumed.get(i));\r
+            if (consumedBy == null) {\r
+                consumedBy = new ArrayList<String>();\r
             }\r
-            \r
-            for(int i = 0; i < vClassConsumed.size(); ++i){\r
-                ArrayList<String> consumedBy = this.classConsumed.get(vClassConsumed.get(i));\r
-                if (consumedBy == null) {\r
-                    consumedBy = new ArrayList<String>();\r
-                }\r
-                consumedBy.add(key);\r
-                this.classConsumed.put(vClassConsumed.get(i), consumedBy);\r
+            consumedBy.add(key);\r
+            this.classConsumed.put(vClassConsumed.get(i), consumedBy);\r
+        }\r
+\r
+        Vector<LibraryClassDescriptor> vClassProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
+        if (this.classProduced == null) {\r
+            this.classProduced = new HashMap<LibraryClassDescriptor, ArrayList<String>>();\r
+        }\r
+        for (int i = 0; i < vClassProduced.size(); ++i) {\r
+            ArrayList<String> producedBy = this.classProduced.get(vClassProduced.get(i));\r
+            if (producedBy == null) {\r
+                producedBy = new ArrayList<String>();\r
             }\r
-            \r
-            Vector<String> vClassProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
-            if (this.classProduced == null) {\r
-                this.classProduced = new ArrayList<String>();\r
+            //\r
+            // class already produced by previous module (lib instance).\r
+            /*\r
+            if (producedBy.size() == 1) {\r
+                String instanceKey = producedBy.get(0);\r
+                ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);\r
+                throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());\r
             }\r
-            for(int i = 0; i < vClassProduced.size(); ++i){\r
-                if (!this.classProduced.contains(vClassProduced.get(i))){\r
-                    this.classProduced.add(vClassProduced.get(i));\r
+            Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();\r
+            while (lcdi.hasNext()) {\r
+                LibraryClassDescriptor lcd = lcdi.next();\r
+                if (vClassProduced.get(i).hasInterSectionWith(lcd)) {\r
+                    ArrayList<String> alreadyProducedBy = this.classProduced.get(lcd);\r
+                    String instanceKey = alreadyProducedBy.get(0);\r
+                    ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceKey);\r
+                    throw new MultipleInstanceException (vClassProduced.get(i).className, libMi.getName(), mi.getName());\r
                 }\r
             }\r
-            \r
-            //\r
-            // find potential instances in all pkgs for classes still in classConsumed.\r
+            */\r
+            // normal case.\r
             //\r
-            if (classInstanceMap == null){\r
-                classInstanceMap = new HashMap<String, ArrayList<String>>();\r
+            producedBy.add(key);\r
+            this.classProduced.put(vClassProduced.get(i), producedBy);\r
+            \r
+        }\r
+\r
+        //\r
+        // find potential instances in all pkgs for classes still in classConsumed.\r
+        //\r
+        if (classInstanceMap == null) {\r
+            classInstanceMap = new HashMap<LibraryClassDescriptor, ArrayList<String>>();\r
+        }\r
+        Iterator<LibraryClassDescriptor> lic = this.classConsumed.keySet().iterator();\r
+        while (lic.hasNext()) {\r
+            LibraryClassDescriptor cls = lic.next();\r
+            if (isBoundedClass(cls)) {\r
+                continue;\r
             }\r
-            Iterator<String> lic = this.classConsumed.keySet().iterator();\r
-            while(lic.hasNext()){\r
-                String cls = lic.next();\r
-                if (this.classProduced.contains(cls) || classInstanceMap.containsKey(cls)) {\r
-                    continue;\r
-                }\r
-                ArrayList<String> instances = getInstancesForClass(cls, depPkgList);\r
-                if (instances.size() == 0){\r
-                    JOptionPane.showMessageDialog(frame, "No Applicable Instance for Library Class " + \r
-                                                  cls + ", Platform Build will Fail.");\r
-                }\r
-                classInstanceMap.put(cls, instances);\r
-                \r
+            ArrayList<String> instances = getInstancesForClass(cls, depPkgList);\r
+            if (instances.size() == 0) {\r
+                throw new NoInstanceException (cls.className);\r
             }\r
-            \r
+            classInstanceMap.put(cls, instances);\r
+\r
+        }\r
 //            showClassToResolved();\r
+    }\r
+\r
+    /**Search classProduced map to see if this class has been produced by some instance (module).\r
+     * @param cls\r
+     * @return\r
+     */\r
+    private boolean isBoundedClass (LibraryClassDescriptor cls) {\r
+        if (this.classProduced.containsKey(cls)) {\r
+            return true;\r
         }\r
-        catch(Exception e) {\r
-            e.printStackTrace();\r
+        Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();\r
+        while (lcdi.hasNext()) {\r
+            LibraryClassDescriptor lcd = lcdi.next();\r
+            if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)) {\r
+                return true;\r
+            }\r
         }\r
+        \r
+        return false;\r
     }\r
     \r
-    private ArrayList<String> getInstancesForClass(String cls, PackageIdentification[] depPkgList) throws Exception{\r
+    private ArrayList<String> getInstancesForClass(LibraryClassDescriptor cls, PackageIdentification[] depPkgList){\r
         ArrayList<String> al = new ArrayList<String>();\r
         \r
 //        for (int i = 0; i < depPkgList.length; ++i) {\r
@@ -315,17 +434,17 @@ public class FpdModuleSA extends JDialog implements ActionListener {
 //                if (!mi.getPackageId().getGuid().equalsIgnoreCase(depPkgList[i].getGuid())) {\r
 //                    continue;\r
 //                }\r
-                String[] clsProduced = getClassProduced(mi);\r
+                Vector<LibraryClassDescriptor> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
                 \r
                 boolean isPotential = false;\r
-                for (int j = 0; j < clsProduced.length; ++j) {\r
-                    if (clsProduced[j] == null) {\r
-                        continue;\r
-                    }\r
-                    if (clsProduced[j].equals(cls)){\r
+                Iterator<LibraryClassDescriptor> lcdi = clsProduced.iterator();\r
+                while (lcdi.hasNext()) {\r
+                    LibraryClassDescriptor lcd = lcdi.next();\r
+                    if (cls.isSubSetByArchs(lcd) && cls.isSubSetByModTypes(lcd)){\r
                         isPotential = true;\r
                     }\r
-                    if (classProduced.contains(clsProduced[j])) {\r
+                    \r
+                    if (hasBeenProduced(lcd)) {\r
                         isPotential = false;\r
                         break;\r
                     }\r
@@ -340,6 +459,28 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         return al;\r
     }\r
     \r
+    private boolean hasBeenProduced (LibraryClassDescriptor cls) {\r
+        Iterator<LibraryClassDescriptor> lcdi = this.classProduced.keySet().iterator();\r
+        while (lcdi.hasNext()) {\r
+            LibraryClassDescriptor lcd = lcdi.next();\r
+            if (cls.hasInterSectionWith(lcd)) {\r
+                return true;\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+    \r
+    private ArrayList<String> getConsumedBy (String className) {\r
+        Iterator<LibraryClassDescriptor> lcdi = this.classConsumed.keySet().iterator();\r
+        while (lcdi.hasNext()) {\r
+            LibraryClassDescriptor lcd = lcdi.next();\r
+            if (lcd.className.equals(className)) {\r
+                return this.classConsumed.get(lcd);\r
+            }\r
+        }\r
+        return null;\r
+    }\r
+    \r
     private void removeInstance(String key) {\r
         ModuleIdentification mi = WorkspaceProfile.getModuleId(key); \r
         //\r
@@ -349,82 +490,65 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         //\r
         // remove class produced by this instance and add back these produced class to be bound.\r
         //\r
-        String[] clsProduced = getClassProduced(mi);\r
-        for (int i = 0; i < clsProduced.length; ++i) {\r
+        Vector<LibraryClassDescriptor> clsProduced = getClassProduced(mi);\r
+        for (int i = 0; i < clsProduced.size(); ++i) {\r
             \r
-            classProduced.remove(clsProduced[i]);\r
+            classProduced.remove(clsProduced.get(i));\r
         }\r
         //\r
         // remove class consumed by this instance. we do not need to bound it now.\r
         //\r
         String[] clsConsumed = getClassConsumed(mi);\r
         for (int i = 0; i < clsConsumed.length; ++i) {\r
-            ArrayList<String> al = classConsumed.get(clsConsumed[i]);\r
+            ArrayList<String> al = getConsumedBy (clsConsumed[i]);\r
             \r
             if (al == null ) {\r
-                classConsumed.remove(clsConsumed[i]);\r
                 continue;\r
             }\r
             al.remove(key);\r
-            if (al.size() == 0) {\r
-                classConsumed.remove(clsConsumed[i]);\r
-            }\r
-           \r
+            \r
         }\r
-\r
+        \r
         showClassToResolved();\r
         \r
     }\r
     \r
     \r
-    private String[] getClassProduced(ModuleIdentification mi){\r
-        \r
-        try{\r
-            Vector<String> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
-            String[] sClassProduced = new String[clsProduced.size()];\r
-            for (int i = 0; i < clsProduced.size(); ++i) {\r
-                sClassProduced[i] = clsProduced.get(i);\r
-            }\r
-            return sClassProduced;\r
-            \r
-        }catch (Exception e) {\r
-            e.printStackTrace();\r
-        }\r
-        return new String[0];\r
+    private Vector<LibraryClassDescriptor> getClassProduced(ModuleIdentification mi){\r
         \r
+        Vector<LibraryClassDescriptor> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
+        return clsProduced;\r
+//        String[] sClassProduced = new String[clsProduced.size()];\r
+//        for (int i = 0; i < clsProduced.size(); ++i) {\r
+//            sClassProduced[i] = clsProduced.get(i).className;\r
+//        }\r
+//        return sClassProduced;\r
     }\r
     \r
     private String[] getClassConsumed(ModuleIdentification mi){\r
         \r
-        try{\r
-            Vector<String> clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);\r
-            String[] sClassConsumed = new String[clsConsumed.size()];\r
-            for (int i = 0; i < clsConsumed.size(); ++i) {\r
-                sClassConsumed[i] = clsConsumed.get(i);\r
-            }\r
-            return sClassConsumed;\r
-        }catch (Exception e) {\r
-            e.printStackTrace();\r
+        Vector<LibraryClassDescriptor> clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);\r
+        String[] sClassConsumed = new String[clsConsumed.size()];\r
+        for (int i = 0; i < clsConsumed.size(); ++i) {\r
+            sClassConsumed[i] = clsConsumed.get(i).className;\r
         }\r
-        return new String[0];\r
+        return sClassConsumed;\r
     }\r
     \r
     private void showClassToResolved(){\r
         libClassTableModel.setRowCount(0);\r
-        if (classConsumed.size() == 0) {\r
+        if (classConsumed == null || classConsumed.size() == 0) {\r
             return;\r
         }\r
-        Iterator<String> li = classConsumed.keySet().iterator();\r
+        Iterator<LibraryClassDescriptor> li = classConsumed.keySet().iterator();\r
         while(li.hasNext()){\r
+            LibraryClassDescriptor lcd = li.next();\r
+            String[] s = {lcd.className, lcd.supArchs, lcd.supModTypes};\r
+            if (classConsumed.get(lcd) == null || classConsumed.get(lcd).size() == 0) {\r
+                continue;\r
+            }\r
             \r
-            String[] s = {li.next()};\r
-//            if (classConsumed.get(s[0]) == null) {\r
-//                continue;\r
-//            }\r
-//            if (classConsumed.get(s[0]).size() == 0) {\r
-//                continue;\r
-//            }\r
-            if (!classProduced.contains(s[0])){\r
+            if (!isBoundedClass(lcd)){\r
                 libClassTableModel.addRow(s);\r
             }\r
         }\r
@@ -850,10 +974,18 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         if (jTableLibClass == null) {\r
             libClassTableModel = new IDefaultTableModel();\r
             libClassTableModel.addColumn("LibraryClass");\r
+            libClassTableModel.addColumn("Arch");\r
+            libClassTableModel.addColumn("ModType");\r
             jTableLibClass = new JTable(libClassTableModel);\r
             jTableLibClass.setRowHeight(20);\r
             jTableLibClass.setShowGrid(false);\r
             jTableLibClass.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+            \r
+            TableColumn column = jTableLibClass.getColumnModel().getColumn(1);\r
+            jTableLibClass.getColumnModel().removeColumn(column);\r
+            column = jTableLibClass.getColumnModel().getColumn(1);\r
+            jTableLibClass.getColumnModel().removeColumn(column);\r
+            \r
             jTableLibClass.getSelectionModel().addListSelectionListener(new ListSelectionListener(){\r
                 public void valueChanged(ListSelectionEvent e) {\r
                     if (e.getValueIsAdjusting()){\r
@@ -873,7 +1005,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                         //\r
                         libInstanceTableModel.setRowCount(0);\r
                         String cls = libClassTableModel.getValueAt(selectedRow2, 0).toString();\r
-                        ArrayList<String> al = classInstanceMap.get(cls);\r
+                        String arch = libClassTableModel.getValueAt(selectedRow2, 1).toString();\r
+                        String modType = libClassTableModel.getValueAt(selectedRow2, 2).toString();\r
+                        ArrayList<String> al = classInstanceMap.get(new LibraryClassDescriptor(cls, arch, modType));\r
+                        if (al == null) {\r
+                            return;\r
+                        }\r
                         ListIterator<String> li = al.listIterator();\r
                         while(li.hasNext()) {\r
                             String instance = li.next();\r
@@ -1029,7 +1166,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                                   libInstanceTableModel.getValueAt(row, 2), libInstanceTableModel.getValueAt(row, 3),\r
                                   libInstanceTableModel.getValueAt(row, 4)};\r
                     selectedInstancesTableModel.addRow(s);\r
-                    resolveLibraryInstances(instanceValue);\r
+                    try {\r
+                        resolveLibraryInstances(instanceValue);\r
+                    }\r
+                    catch (Exception exp) {\r
+                        JOptionPane.showMessageDialog(frame, exp.getMessage());\r
+                    }\r
                     showClassToResolved();\r
                 }\r
             });\r
@@ -1076,7 +1218,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         if (jButtonOk == null) {\r
             jButtonOk = new JButton();\r
             jButtonOk.setPreferredSize(new java.awt.Dimension(80,20));\r
-            jButtonOk.setText("Ok");\r
+            jButtonOk.setText("Close");\r
             jButtonOk.addActionListener(this);\r
         }\r
         return jButtonOk;\r
@@ -1351,7 +1493,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                 public void actionPerformed(java.awt.event.ActionEvent e) {\r
                     String[] row = {"", "", "", "", "", ""};\r
                     optionsTableModel.addRow(row);\r
-                    Vector<Object> v = new Vector<Object>();\r
+                    Vector<Object> v = null;\r
                     Vector<Object> v1 = null;\r
                     docConsole.setSaved(false);\r
                     ffc.genModuleSAOptionsOpt(moduleKey, v, "", "", "", v1, "");\r
@@ -1526,6 +1668,7 @@ private void pcdDynamicToNonDynamic(String cName, String tsGuid) {
     ArrayList<String> al = ffc.getDynPcdMapValue(cName + " " + tsGuid);\r
     for (int i = 0; i < al.size(); ++i) {\r
         String mKey = moduleInfo (al.get(i));\r
+        value = null;\r
         ffc.updatePcdData(mKey, cName, tsGuid, jComboBoxItemType.getSelectedItem()+"", maxSize, value);\r
         String itemType = jComboBoxItemType.getSelectedItem()+"";\r
         al.set(i, mKey + " " + itemType);\r
@@ -1709,3 +1852,51 @@ private JPanel getJPanelLibraryCenterC() {
 \r
 \r
 }  //  @jve:decl-index=0:visual-constraint="10,10"\r
+\r
+class MultipleInstanceException extends Exception {\r
+\r
+    /**\r
+     * \r
+     */\r
+    private static final long serialVersionUID = -9148463005930920297L;\r
+    private String className = null;\r
+    private String libInstance1 = null;\r
+    private String libInstance2 = null;\r
+    \r
+    MultipleInstanceException (String libClass, String instance1, String instance2) {\r
+        super();\r
+        className = libClass;\r
+        libInstance1 = instance1;\r
+        libInstance2 = instance2;\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.lang.Throwable#getMessage()\r
+     */\r
+    @Override\r
+    public String getMessage() {\r
+        // TODO Auto-generated method stub\r
+        return "Library Class " + className + "is Produced by Two Instances: " \r
+            + libInstance1 + " and " + libInstance2 + ". Platform Build will Fail.";\r
+    }\r
+    \r
+}\r
+\r
+class NoInstanceException extends Exception {\r
+\r
+    /**\r
+     * \r
+     */\r
+    private static final long serialVersionUID = 1987122786598970598L;\r
+    \r
+    private String className = null;\r
+    \r
+    NoInstanceException (String libClass) {\r
+        className = libClass;\r
+    }\r
+    \r
+    public String getMessage() {\r
+        return "No Applicable Instance for Library Class " + className\r
+            + ", Platform Build will Fail.";\r
+    }\r
+}\r
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/LibraryClassDescriptor.java
new file mode 100644 (file)
index 0000000..df689c6
--- /dev/null
@@ -0,0 +1,132 @@
+/** @file\r
+ This file is for surface area information retrieval.\r
+\r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution.  The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.frameworkwizard.platform.ui.global;\r
+\r
+import java.util.Vector;\r
+\r
+public class LibraryClassDescriptor {\r
+    public String className = "";\r
+    public String supArchs = "";\r
+    public String supModTypes = "";\r
+    \r
+    public LibraryClassDescriptor (String s1, String s2, String s3) {\r
+        className = s1;\r
+        if (s2 != null) {\r
+            supArchs = s2;    \r
+        }\r
+        if (s3 != null) {\r
+            supModTypes = s3;    \r
+        }\r
+        \r
+    }\r
+    \r
+    public boolean equals(Object obj) {\r
+        if (obj instanceof LibraryClassDescriptor) {\r
+            LibraryClassDescriptor id = (LibraryClassDescriptor)obj;\r
+            if (className.equals(id.className) && sameArchs (supArchs, id.supArchs) && sameModTypes(supModTypes, id.supModTypes)) {\r
+                return true;\r
+            }\r
+            return false;\r
+        }\r
+        else {\r
+            return super.equals(obj);\r
+        }\r
+    }\r
+    \r
+    public int hashCode(){\r
+        return (className + supArchs + supModTypes).toLowerCase().hashCode();\r
+    }\r
+    \r
+    public String toString() {\r
+        return "Library Class "+ className + " [SupArchs: " + supArchs + " SupModTypes: " + supModTypes + "]";\r
+    }\r
+    \r
+    public boolean isSubSetByArchs (LibraryClassDescriptor lcd) {\r
+        if (className.equals(lcd.className)) {\r
+            Vector<String> vArchs1 = getVectorFromString(supArchs);\r
+            Vector<String> vArchs2 = getVectorFromString(lcd.supArchs);\r
+            \r
+            if (isSubSet(vArchs1, vArchs2)) {\r
+                return true;\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+    \r
+    public boolean isSubSetByModTypes (LibraryClassDescriptor lcd) {\r
+        if (className.equals(lcd.className)) {\r
+            Vector<String> vModTypes1 = getVectorFromString(supModTypes);\r
+            Vector<String> vModTypes2 = getVectorFromString(lcd.supModTypes);\r
+            \r
+            if (isSubSet(vModTypes1, vModTypes2)) {\r
+                return true;\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+    \r
+    public boolean hasInterSectionWith (LibraryClassDescriptor lcd) {\r
+        if (className.equals(lcd.className)) {\r
+            Vector<String> vArchs1 = getVectorFromString(supArchs);\r
+            Vector<String> vArchs2 = getVectorFromString(lcd.supArchs);\r
+            if (vArchs1.size() == 0 || (vArchs1.size() == 1 && vArchs1.get(0).equalsIgnoreCase(""))) {\r
+                return true;\r
+            }\r
+            if (vArchs2.size() == 0 || (vArchs2.size() == 1 && vArchs2.get(0).equalsIgnoreCase(""))) {\r
+                return true;\r
+            }\r
+            vArchs1.retainAll(vArchs2);\r
+            if (vArchs1.size() > 0) {\r
+                return true;\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+    \r
+    private boolean isSubSet (Vector<String> v1, Vector<String> v2) {\r
+        if (v2.size() == 0 || (v2.size() == 1 && v2.get(0).equalsIgnoreCase(""))) {\r
+            return true;\r
+        }\r
+        if (v2.containsAll(v1)) {\r
+            return true;\r
+        }\r
+        return false;\r
+    }\r
+    \r
+    public Vector<String> getVectorFromString (String s) {\r
+        if (s == null || s.equals("null")) {\r
+            s = "";\r
+        }\r
+        String[] sa1 = s.split(" ");\r
+        Vector<String> v = new Vector<String>();\r
+        for (int i = 0; i < sa1.length; ++i) {\r
+            v.add(sa1[i]);\r
+        }\r
+        return v;\r
+    }\r
+    \r
+    private boolean sameArchs (String archs1, String archs2) {\r
+        Vector<String> vArchs1 = getVectorFromString(archs1);\r
+        Vector<String> vArchs2 = getVectorFromString(archs2);\r
+        \r
+        if (vArchs1.containsAll(vArchs2) && vArchs2.containsAll(vArchs1)) {\r
+            return true;\r
+        }\r
+        return false;\r
+    }\r
+    \r
+    private boolean sameModTypes (String modTypes1, String modTypes2) {\r
+        return sameArchs(modTypes1, modTypes2);\r
+    }\r
+}
\ No newline at end of file
index 85b406621c47f8f3cf2dd3250d9387d0034c86c0..ad0e82ca3ff0d88e0da8832ffce10f80dddd3965 100644 (file)
@@ -317,7 +317,7 @@ public class SurfaceAreaQuery {
         * @returns null if nothing is there\r
         */\r
 \r
-       public static PackageIdentification[] getDependencePkg(String arch, ModuleIdentification mi) throws Exception{\r
+       public static PackageIdentification[] getDependencePkg(String arch, ModuleIdentification mi){\r
                \r
                String packageGuid = null;\r
                String packageVersion = null;\r
@@ -375,11 +375,11 @@ public class SurfaceAreaQuery {
         *          xpath\r
         * @returns null if nothing is there\r
         */\r
-       public static Vector<String> getLibraryClasses(String usage, ModuleIdentification mi) throws Exception{\r
+       public static Vector<LibraryClassDescriptor> getLibraryClasses(String usage, ModuleIdentification mi){\r
         ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(mi);\r
-        Vector<String> libraryClassName = new Vector<String>();\r
+        Vector<LibraryClassDescriptor> libraryClassInfo = new Vector<LibraryClassDescriptor>();\r
         if (msa.getLibraryClassDefinitions() == null) {\r
-            return libraryClassName;\r
+            return libraryClassInfo;\r
         }\r
         \r
         int size = msa.getLibraryClassDefinitions().getLibraryClassList().size();\r
@@ -387,11 +387,12 @@ public class SurfaceAreaQuery {
                for (int i = 0; i < size; i++) {\r
             LibraryClassDocument.LibraryClass libClass = msa.getLibraryClassDefinitions().getLibraryClassList().get(i);\r
             if (usage.equals(libClass.getUsage().toString())) {\r
-                libraryClassName.add(libClass.getKeyword());\r
+\r
+                libraryClassInfo.add(new LibraryClassDescriptor(libClass.getKeyword(), libClass.getSupArchList()+"", libClass.getSupModuleList()+""));\r
             }\r
                }\r
         \r
-               return libraryClassName;\r
+               return libraryClassInfo;\r
        }\r
 \r
     public static XmlObject[] getSpdPcdDeclarations(PackageIdentification pi) {\r
@@ -408,4 +409,5 @@ public class SurfaceAreaQuery {
         return returns;\r
     }\r
 \r
-}      
\ No newline at end of file
+}\r
+\r