mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-07 19:45:07 +02:00
add multi-source pcd check before adding/deleting lib instance for ModuleSA in platform.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1574 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
495849b7cf
commit
1b69863ad8
@ -70,7 +70,7 @@ import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||
public class FpdFileContents {
|
||||
|
||||
static final String xmlNs = "http://www.TianoCore.org/2006/Edk2.0";
|
||||
static final String regNewLineAndSpaces = "((\n)|(\r\n)|(\r)|(\u0085)|(\u2028)|(\u2029))(\\s)*";
|
||||
static final String regExpNewLineAndSpaces = "((\n)|(\r\n)|(\r)|(\u0085)|(\u2028)|(\u2029))(\\s)*";
|
||||
|
||||
private PlatformSurfaceAreaDocument fpdd = null;
|
||||
|
||||
@ -352,7 +352,7 @@ public class FpdFileContents {
|
||||
break;
|
||||
}
|
||||
String s = cursor.getTextValue();
|
||||
if (s.matches(regNewLineAndSpaces)) {
|
||||
if (s.matches(regExpNewLineAndSpaces)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -401,7 +401,6 @@ public class FpdFileContents {
|
||||
vMi.add(libMi);
|
||||
}
|
||||
|
||||
try {
|
||||
nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {
|
||||
|
||||
for (int j = 0; j < vMi.size(); ++j) {
|
||||
@ -413,16 +412,10 @@ public class FpdFileContents {
|
||||
removePcdData(seqModuleSa, saaModuleSaPcd[i][0], saaModuleSaPcd[i][1]);
|
||||
dataModified = true;
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
//
|
||||
// add new Pcd from MSA file to ModuleSA.
|
||||
//
|
||||
try {
|
||||
|
||||
for (int i = 0; i < vMi.size(); ++i) {
|
||||
for (int i = 0; i < vMi.size(); ++i) {
|
||||
ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile
|
||||
.getModuleXmlObject(vMi
|
||||
.get(i));
|
||||
@ -462,10 +455,6 @@ public class FpdFileContents {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception e){
|
||||
throw e;
|
||||
}
|
||||
|
||||
return dataModified;
|
||||
}
|
||||
@ -648,12 +637,44 @@ public class FpdFileContents {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean multiSourcePcd (String cName, String tsGuidCName, String moduleKey) {
|
||||
int libCount = getLibraryInstancesCount(moduleKey);
|
||||
String[][] saaLib = new String[libCount][5];
|
||||
getLibraryInstances(moduleKey, saaLib);
|
||||
ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);
|
||||
Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();
|
||||
//
|
||||
// create vector for module & library instance MIs.
|
||||
//
|
||||
vMi.add(mi);
|
||||
for (int j = 0; j < saaLib.length; ++j) {
|
||||
String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];
|
||||
ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);
|
||||
vMi.add(libMi);
|
||||
}
|
||||
|
||||
int pcdSourceCount = 0;
|
||||
for (int i = 0; i < vMi.size(); ++i) {
|
||||
if (WorkspaceProfile.pcdInMsa(cName, tsGuidCName, vMi.get(i))) {
|
||||
pcdSourceCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if (pcdSourceCount < 2) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**Remove PCDBuildDefinition entries from ModuleSA
|
||||
* @param moduleKey identifier of ModuleSA.
|
||||
* @param consumer where these entries come from.
|
||||
*/
|
||||
public void removePcdData(String moduleKey, ModuleIdentification consumer) {
|
||||
try {
|
||||
|
||||
ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(consumer);
|
||||
if (msa.getPcdCoded() == null) {
|
||||
return;
|
||||
@ -672,8 +693,10 @@ public class FpdFileContents {
|
||||
do {
|
||||
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor
|
||||
.getObject();
|
||||
if (msaPcd.getCName().equals(pcdData.getCName())
|
||||
&& msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {
|
||||
String cName = msaPcd.getCName();
|
||||
String tsGuidCName = msaPcd.getTokenSpaceGuidCName();
|
||||
if (cName.equals(pcdData.getCName())
|
||||
&& tsGuidCName.equals(pcdData.getTokenSpaceGuidCName()) && !multiSourcePcd(cName, tsGuidCName, moduleKey)) {
|
||||
|
||||
maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(),
|
||||
moduleKey);
|
||||
@ -690,12 +713,7 @@ public class FpdFileContents {
|
||||
cursor.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
// key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"
|
||||
@ -742,7 +760,7 @@ public class FpdFileContents {
|
||||
break;
|
||||
}
|
||||
String s = cursor.getTextValue();
|
||||
if (s.matches(regNewLineAndSpaces)) {
|
||||
if (s.matches(regExpNewLineAndSpaces)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1227,15 +1245,24 @@ public class FpdFileContents {
|
||||
pcdConsumer = new ArrayList<String>();
|
||||
}
|
||||
//
|
||||
// Check whether this PCD has already added to ModuleSA, if so, just return.
|
||||
//
|
||||
String moduleInfo = moduleSa.getModuleGuid().toLowerCase() + " " + moduleSa.getModuleVersion()
|
||||
+ " " + moduleSa.getPackageGuid().toLowerCase() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());
|
||||
for (int i = 0; i < pcdConsumer.size(); ++i) {
|
||||
String pcdInfo = pcdConsumer.get(i);
|
||||
if (moduleInfo.equals(pcdInfo.substring(0, pcdInfo.lastIndexOf(" ")))){
|
||||
return;
|
||||
}
|
||||
}
|
||||
//
|
||||
// Using existing Pcd type, if this pcd already exists in other ModuleSA
|
||||
//
|
||||
if (pcdConsumer.size() > 0) {
|
||||
|
||||
itemType = itemType (pcdConsumer.get(0));
|
||||
}
|
||||
String listValue = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion()
|
||||
+ " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList())
|
||||
+ " " + itemType;
|
||||
String listValue = moduleInfo + " " + itemType;
|
||||
pcdConsumer.add(listValue);
|
||||
dynPcdMap.put(cName + " " + tsGuid, pcdConsumer);
|
||||
|
||||
|
@ -207,7 +207,7 @@ public class FpdFrameworkModules extends IInternalFrame {
|
||||
private JPanel getJPanelTop() {
|
||||
if (jPanelTop == null) {
|
||||
jLabel = new JLabel();
|
||||
jLabel.setText("Modules in Workspace");
|
||||
jLabel.setText(" Modules in Workspace");
|
||||
jPanelTop = new JPanel();
|
||||
jPanelTop.setLayout(new BorderLayout());
|
||||
jPanelTop.add(jLabel, java.awt.BorderLayout.NORTH);
|
||||
@ -227,7 +227,7 @@ public class FpdFrameworkModules extends IInternalFrame {
|
||||
private JPanel getJPanelBottom() {
|
||||
if (jPanelBottom == null) {
|
||||
jLabelModulesAdded = new JLabel();
|
||||
jLabelModulesAdded.setText("Modules Added");
|
||||
jLabelModulesAdded.setText(" Modules Added into Platform");
|
||||
jPanelBottom = new JPanel();
|
||||
jPanelBottom.setLayout(new BorderLayout());
|
||||
jPanelBottom.add(jLabelModulesAdded, java.awt.BorderLayout.NORTH);
|
||||
|
@ -124,6 +124,8 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||
private JPanel jPanelCustomToolChain = null;
|
||||
private JPanel jPanelToolchainS = null;
|
||||
private JPanel jPanelToolchainC = null;
|
||||
private JPanel jPanelLibraryCenterN = null;
|
||||
private JPanel jPanelLibraryCenterC = null; // @jve:decl-index=0:visual-constraint="20,224"
|
||||
/**
|
||||
* This is the default constructor
|
||||
*/
|
||||
@ -420,19 +422,14 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||
libInstanceTableModel.setRowCount(0);
|
||||
}
|
||||
|
||||
private void addLibInstance (ModuleIdentification libMi) {
|
||||
private void addLibInstance (ModuleIdentification libMi) throws Exception{
|
||||
|
||||
ffc.genLibraryInstance(libMi, moduleKey);
|
||||
//
|
||||
// Add pcd information of selected instance to current moduleSA
|
||||
//
|
||||
try{
|
||||
ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey));
|
||||
}
|
||||
catch (Exception exception) {
|
||||
JOptionPane.showMessageDialog(frame, "Adding Instance" + libMi.getName() + ": "+ exception.getMessage());
|
||||
}
|
||||
ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey));
|
||||
|
||||
ffc.genLibraryInstance(libMi, moduleKey);
|
||||
}
|
||||
/**
|
||||
* This method initializes this
|
||||
@ -440,7 +437,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||
* @return void
|
||||
*/
|
||||
private void initialize() {
|
||||
this.setSize(664, 515);
|
||||
this.setSize(877, 555);
|
||||
this.setResizable(false);
|
||||
this.centerWindow();
|
||||
this.setModal(true);
|
||||
@ -488,7 +485,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||
private JPanel getJPanelPcd() {
|
||||
if (jPanelPcd == null) {
|
||||
jLabelPcdData = new JLabel();
|
||||
jLabelPcdData.setText("PcdData");
|
||||
jLabelPcdData.setText(" PCD Data");
|
||||
jPanelPcd = new JPanel();
|
||||
jPanelPcd.setLayout(new BorderLayout());
|
||||
jPanelPcd.add(jLabelPcdData, java.awt.BorderLayout.NORTH);
|
||||
@ -548,7 +545,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||
model = new IDefaultTableModel();
|
||||
jTablePcd = new JTable(model);
|
||||
jTablePcd.setRowHeight(20);
|
||||
jTablePcd.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);
|
||||
jTablePcd.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS);
|
||||
model.addColumn("CName");
|
||||
model.addColumn("TokenSpaceGUID");
|
||||
model.addColumn("ItemType");
|
||||
@ -783,7 +780,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||
private JScrollPane getJScrollPaneSelectedInstances() {
|
||||
if (jScrollPaneSelectedInstances == null) {
|
||||
jScrollPaneSelectedInstances = new JScrollPane();
|
||||
jScrollPaneSelectedInstances.setPreferredSize(new java.awt.Dimension(453,150));
|
||||
jScrollPaneSelectedInstances.setPreferredSize(new java.awt.Dimension(600,150));
|
||||
jScrollPaneSelectedInstances.setViewportView(getJTableSelectedInstances());
|
||||
}
|
||||
return jScrollPaneSelectedInstances;
|
||||
@ -888,7 +885,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||
private JScrollPane getJScrollPaneQualifiedInstance() {
|
||||
if (jScrollPaneQualifiedInstance == null) {
|
||||
jScrollPaneQualifiedInstance = new JScrollPane();
|
||||
jScrollPaneQualifiedInstance.setPreferredSize(new java.awt.Dimension(430,170));
|
||||
jScrollPaneQualifiedInstance.setPreferredSize(new java.awt.Dimension(600,170));
|
||||
jScrollPaneQualifiedInstance.setViewportView(getJTableLibInstances());
|
||||
}
|
||||
return jScrollPaneQualifiedInstance;
|
||||
@ -940,12 +937,11 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||
jLabelSelectedInstances = new JLabel();
|
||||
jLabelSelectedInstances.setText("Selected Instances");
|
||||
jPanelLibraryCenter = new JPanel();
|
||||
jPanelLibraryCenter.add(jLabelInstanceHelp, null);
|
||||
jPanelLibraryCenter.add(getJScrollPaneInstanceHelp(), null);
|
||||
jPanelLibraryCenter.add(getJButtonAdd(), null);
|
||||
jPanelLibraryCenter.add(getJButtonDeleteInstance(), null);
|
||||
jPanelLibraryCenter.add(jLabelSelectedInstances, null);
|
||||
jPanelLibraryCenter.add(getJScrollPaneSelectedInstances(), null);
|
||||
jPanelLibraryCenter.setLayout(new BorderLayout());
|
||||
|
||||
jPanelLibraryCenter.add(getJPanelLibraryCenterC(), java.awt.BorderLayout.CENTER);
|
||||
jPanelLibraryCenter.add(getJPanelLibraryCenterN(), java.awt.BorderLayout.NORTH);
|
||||
|
||||
}
|
||||
return jPanelLibraryCenter;
|
||||
}
|
||||
@ -958,7 +954,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||
private JScrollPane getJScrollPaneInstanceHelp() {
|
||||
if (jScrollPaneInstanceHelp == null) {
|
||||
jScrollPaneInstanceHelp = new JScrollPane();
|
||||
jScrollPaneInstanceHelp.setPreferredSize(new java.awt.Dimension(300,50));
|
||||
jScrollPaneInstanceHelp.setPreferredSize(new java.awt.Dimension(400,50));
|
||||
jScrollPaneInstanceHelp.setViewportView(getJTextAreaInstanceHelp());
|
||||
}
|
||||
return jScrollPaneInstanceHelp;
|
||||
@ -993,17 +989,24 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||
if (row < 0) {
|
||||
return;
|
||||
}
|
||||
docConsole.setSaved(false);
|
||||
Object[] s = {libInstanceTableModel.getValueAt(row, 0), libInstanceTableModel.getValueAt(row, 1),
|
||||
libInstanceTableModel.getValueAt(row, 2), libInstanceTableModel.getValueAt(row, 3),
|
||||
libInstanceTableModel.getValueAt(row, 4)};
|
||||
selectedInstancesTableModel.addRow(s);
|
||||
|
||||
String instanceValue = libInstanceTableModel.getValueAt(row, 1) + " " +
|
||||
libInstanceTableModel.getValueAt(row, 2) + " " +
|
||||
libInstanceTableModel.getValueAt(row, 3) + " " +
|
||||
libInstanceTableModel.getValueAt(row, 4);
|
||||
ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceValue);
|
||||
addLibInstance (libMi);
|
||||
try {
|
||||
addLibInstance (libMi);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
JOptionPane.showMessageDialog(frame, "Adding Instance" + libMi.getName() + ": "+ exception.getMessage());
|
||||
return;
|
||||
}
|
||||
docConsole.setSaved(false);
|
||||
Object[] s = {libInstanceTableModel.getValueAt(row, 0), libInstanceTableModel.getValueAt(row, 1),
|
||||
libInstanceTableModel.getValueAt(row, 2), libInstanceTableModel.getValueAt(row, 3),
|
||||
libInstanceTableModel.getValueAt(row, 4)};
|
||||
selectedInstancesTableModel.addRow(s);
|
||||
resolveLibraryInstances(instanceValue);
|
||||
showClassToResolved();
|
||||
}
|
||||
@ -1634,6 +1637,38 @@ private JPanel getJPanelToolchainC() {
|
||||
}
|
||||
return jPanelToolchainC;
|
||||
}
|
||||
/**
|
||||
* This method initializes jPanelLibraryCenterN
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelLibraryCenterN() {
|
||||
if (jPanelLibraryCenterN == null) {
|
||||
FlowLayout flowLayout5 = new FlowLayout();
|
||||
flowLayout5.setAlignment(java.awt.FlowLayout.CENTER);
|
||||
flowLayout5.setHgap(10);
|
||||
jPanelLibraryCenterN = new JPanel();
|
||||
jPanelLibraryCenterN.setLayout(flowLayout5);
|
||||
jPanelLibraryCenterN.add(jLabelInstanceHelp, null);
|
||||
jPanelLibraryCenterN.add(getJScrollPaneInstanceHelp(), null);
|
||||
jPanelLibraryCenterN.add(getJButtonAdd(), null);
|
||||
jPanelLibraryCenterN.add(getJButtonDeleteInstance(), null);
|
||||
}
|
||||
return jPanelLibraryCenterN;
|
||||
}
|
||||
/**
|
||||
* This method initializes jPanelLibraryCenterC
|
||||
*
|
||||
* @return javax.swing.JPanel
|
||||
*/
|
||||
private JPanel getJPanelLibraryCenterC() {
|
||||
if (jPanelLibraryCenterC == null) {
|
||||
jPanelLibraryCenterC = new JPanel();
|
||||
jPanelLibraryCenterC.add(jLabelSelectedInstances, null);
|
||||
jPanelLibraryCenterC.add(getJScrollPaneSelectedInstances(), null);
|
||||
}
|
||||
return jPanelLibraryCenterC;
|
||||
}
|
||||
|
||||
|
||||
} // @jve:decl-index=0:visual-constraint="10,10"
|
||||
|
@ -130,7 +130,7 @@ public class WorkspaceProfile {
|
||||
return msa.getModuleDefinitions().getOutputFileBasename();
|
||||
}
|
||||
|
||||
public static boolean pcdInMsa (String cName, String tsGuid, ModuleIdentification mi) throws Exception {
|
||||
public static boolean pcdInMsa (String cName, String tsGuid, ModuleIdentification mi) {
|
||||
ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi);
|
||||
if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user