mirror of https://github.com/acidanthera/audk.git
1. Fix EDKT303: Give warning if no library instances that support the required the library class
2. Fix a bug in Find function: Missing library classes which has same name but different usage. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1736 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
f4ead3ba43
commit
a721f5c47e
|
@ -834,7 +834,7 @@ public class Find {
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the sting "PackageName.ModuleName"
|
// Get the string "PackageName.ModuleName"
|
||||||
//
|
//
|
||||||
String tmp = lcvId.getBelongModule().getPackageId().getName() + SEPERATOR
|
String tmp = lcvId.getBelongModule().getPackageId().getName() + SEPERATOR
|
||||||
+ lcvId.getBelongModule().getName();
|
+ lcvId.getBelongModule().getName();
|
||||||
|
|
|
@ -16,14 +16,19 @@ package org.tianocore.frameworkwizard.module.Identifications.LibraryClass;
|
||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
|
||||||
public class LibraryClassVector {
|
public class LibraryClassVector {
|
||||||
private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();
|
private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();
|
||||||
|
|
||||||
public int findLibraryClass(LibraryClassIdentification lib) {
|
public int findLibraryClass(LibraryClassIdentification lib) {
|
||||||
return findLibraryClass(lib.getLibraryClassName());
|
for (int index = 0; index < vLibraryClass.size(); index++) {
|
||||||
|
if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())
|
||||||
|
&& vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int findLibraryClass(String name) {
|
public int findLibraryClass(String name) {
|
||||||
for (int index = 0; index < vLibraryClass.size(); index++) {
|
for (int index = 0; index < vLibraryClass.size(); index++) {
|
||||||
if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {
|
if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {
|
||||||
|
@ -32,7 +37,7 @@ public class LibraryClassVector {
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LibraryClassIdentification getLibraryClass(int index) {
|
public LibraryClassIdentification getLibraryClass(int index) {
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
return vLibraryClass.elementAt(index);
|
return vLibraryClass.elementAt(index);
|
||||||
|
@ -40,24 +45,24 @@ public class LibraryClassVector {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLibraryClass(LibraryClassIdentification lib) {
|
public void addLibraryClass(LibraryClassIdentification lib) {
|
||||||
if (findLibraryClass(lib) == -1) {
|
if (findLibraryClass(lib) == -1) {
|
||||||
vLibraryClass.addElement(lib);
|
vLibraryClass.addElement(lib);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLibraryClass(LibraryClassIdentification lib, int index) {
|
public void setLibraryClass(LibraryClassIdentification lib, int index) {
|
||||||
vLibraryClass.setElementAt(lib, index);
|
vLibraryClass.setElementAt(lib, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeLibraryClass(LibraryClassIdentification lib) {
|
public void removeLibraryClass(LibraryClassIdentification lib) {
|
||||||
int index = findLibraryClass(lib);
|
int index = findLibraryClass(lib);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
vLibraryClass.removeElementAt(index);
|
vLibraryClass.removeElementAt(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeLibraryClass(int index) {
|
public void removeLibraryClass(int index) {
|
||||||
if (index > -1 && index < this.size()) {
|
if (index > -1 && index < this.size()) {
|
||||||
vLibraryClass.removeElementAt(index);
|
vLibraryClass.removeElementAt(index);
|
||||||
|
@ -71,7 +76,7 @@ public class LibraryClassVector {
|
||||||
public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {
|
public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {
|
||||||
vLibraryClass = libraryClass;
|
vLibraryClass = libraryClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector<String> getLibraryClassName() {
|
public Vector<String> getLibraryClassName() {
|
||||||
Vector<String> v = new Vector<String>();
|
Vector<String> v = new Vector<String>();
|
||||||
for (int index = 0; index < this.vLibraryClass.size(); index++) {
|
for (int index = 0; index < this.vLibraryClass.size(); index++) {
|
||||||
|
@ -79,11 +84,11 @@ public class LibraryClassVector {
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int size() {
|
public int size() {
|
||||||
return this.vLibraryClass.size();
|
return this.vLibraryClass.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector<String> toStringVector(int index) {
|
public Vector<String> toStringVector(int index) {
|
||||||
Vector<String> v = new Vector<String>();
|
Vector<String> v = new Vector<String>();
|
||||||
v.addElement(getLibraryClass(index).getLibraryClassName());
|
v.addElement(getLibraryClass(index).getLibraryClassName());
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.tianocore.frameworkwizard.common.DataValidation;
|
||||||
import org.tianocore.frameworkwizard.common.EnumerationData;
|
import org.tianocore.frameworkwizard.common.EnumerationData;
|
||||||
import org.tianocore.frameworkwizard.common.Log;
|
import org.tianocore.frameworkwizard.common.Log;
|
||||||
import org.tianocore.frameworkwizard.common.Tools;
|
import org.tianocore.frameworkwizard.common.Tools;
|
||||||
|
import org.tianocore.frameworkwizard.common.find.Find;
|
||||||
import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
|
import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;
|
||||||
import org.tianocore.frameworkwizard.common.ui.IDialog;
|
import org.tianocore.frameworkwizard.common.ui.IDialog;
|
||||||
import org.tianocore.frameworkwizard.common.ui.IFrame;
|
import org.tianocore.frameworkwizard.common.ui.IFrame;
|
||||||
|
@ -37,6 +38,7 @@ import org.tianocore.frameworkwizard.common.ui.StarLabel;
|
||||||
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
|
import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;
|
||||||
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;
|
||||||
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
|
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;
|
||||||
|
import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;
|
||||||
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
import org.tianocore.frameworkwizard.packaging.PackageIdentification;
|
||||||
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
|
||||||
|
|
||||||
|
@ -213,7 +215,7 @@ public class LibraryClassDefsDlg extends IDialog {
|
||||||
private JTextField getJTextFieldFeatureFlag() {
|
private JTextField getJTextFieldFeatureFlag() {
|
||||||
if (jTextFieldFeatureFlag == null) {
|
if (jTextFieldFeatureFlag == null) {
|
||||||
jTextFieldFeatureFlag = new JTextField();
|
jTextFieldFeatureFlag = new JTextField();
|
||||||
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168,197,320,20));
|
jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 197, 320, 20));
|
||||||
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
|
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));
|
||||||
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
|
jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");
|
||||||
jTextFieldFeatureFlag.setEnabled(false);
|
jTextFieldFeatureFlag.setEnabled(false);
|
||||||
|
@ -304,7 +306,8 @@ public class LibraryClassDefsDlg extends IDialog {
|
||||||
This is the default constructor
|
This is the default constructor
|
||||||
|
|
||||||
**/
|
**/
|
||||||
public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame, ModuleIdentification mid) {
|
public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame,
|
||||||
|
ModuleIdentification mid) {
|
||||||
super(iFrame, true);
|
super(iFrame, true);
|
||||||
init(inLibraryClassIdentification, mid);
|
init(inLibraryClassIdentification, mid);
|
||||||
}
|
}
|
||||||
|
@ -329,22 +332,27 @@ public class LibraryClassDefsDlg extends IDialog {
|
||||||
private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) {
|
private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) {
|
||||||
init();
|
init();
|
||||||
this.lcid = inLibraryClassIdentification;
|
this.lcid = inLibraryClassIdentification;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init arch with module's arch
|
// Init arch with module's arch
|
||||||
//
|
//
|
||||||
this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
|
this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get defined library classes from dependent packages
|
// Get defined library classes from dependent packages
|
||||||
//
|
//
|
||||||
Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
|
Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);
|
||||||
if (vpid.size() <= 0) {
|
if (vpid.size() <= 0) {
|
||||||
Log.wrn("Init Library Class", "This module hasn't defined any package dependency, so there is no library class can be added");
|
Log.wrn("Init Library Class",
|
||||||
|
"This module hasn't defined any package dependency, so there is no library class can be added");
|
||||||
}
|
}
|
||||||
|
|
||||||
Tools.generateComboBoxByVector(this.jComboBoxLibraryClassName,
|
Tools
|
||||||
wt.getAllLibraryClassDefinitionsFromPackages(wt.getPackageDependenciesOfModule(mid)));
|
.generateComboBoxByVector(
|
||||||
|
this.jComboBoxLibraryClassName,
|
||||||
|
wt
|
||||||
|
.getAllLibraryClassDefinitionsFromPackages(wt
|
||||||
|
.getPackageDependenciesOfModule(mid)));
|
||||||
|
|
||||||
if (lcid != null) {
|
if (lcid != null) {
|
||||||
this.jComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName());
|
this.jComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName());
|
||||||
|
@ -393,7 +401,7 @@ public class LibraryClassDefsDlg extends IDialog {
|
||||||
jLabelArch.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
|
jLabelArch.setBounds(new java.awt.Rectangle(12, 87, 168, 20));
|
||||||
jLabelArch.setText("Supported Architectures");
|
jLabelArch.setText("Supported Architectures");
|
||||||
jLabelFeatureFlag = new JLabel();
|
jLabelFeatureFlag = new JLabel();
|
||||||
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12,197,168,20));
|
jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 197, 168, 20));
|
||||||
jLabelFeatureFlag.setText("Feature Flag Expression");
|
jLabelFeatureFlag.setText("Feature Flag Expression");
|
||||||
jLabelFeatureFlag.setEnabled(false);
|
jLabelFeatureFlag.setEnabled(false);
|
||||||
jLabelRecommendedInstanceGuid = new JLabel();
|
jLabelRecommendedInstanceGuid = new JLabel();
|
||||||
|
@ -498,6 +506,32 @@ public class LibraryClassDefsDlg extends IDialog {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check if the library is produced
|
||||||
|
//
|
||||||
|
String strUsage = this.jComboBoxUsage.getSelectedItem().toString();
|
||||||
|
//
|
||||||
|
// Check only when the library class is consumed
|
||||||
|
//
|
||||||
|
if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {
|
||||||
|
LibraryClassVector v = Find.getAllLibraryClassVector();
|
||||||
|
boolean isFind = false;
|
||||||
|
for (int index = 0; index < v.size(); index++) {
|
||||||
|
LibraryClassIdentification lid = v.getLibraryClass(index);
|
||||||
|
if (lid.getLibraryClassName().equals(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {
|
||||||
|
if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)
|
||||||
|
|| lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {
|
||||||
|
isFind = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isFind) {
|
||||||
|
Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check RecommendedInstanceVersion
|
// Check RecommendedInstanceVersion
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue