mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-30 00:54:06 +02:00
keep from generating empty DynamicPcdBuildDefinitions
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1119 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
342810920f
commit
e232295ec8
@ -96,6 +96,8 @@ public class FpdFileContents {
|
|||||||
dynPcdMap = new HashMap<String, ArrayList<String>>();
|
dynPcdMap = new HashMap<String, ArrayList<String>>();
|
||||||
List<ModuleSADocument.ModuleSA> l = getfpdFrameworkModules().getModuleSAList();
|
List<ModuleSADocument.ModuleSA> l = getfpdFrameworkModules().getModuleSAList();
|
||||||
if (l == null) {
|
if (l == null) {
|
||||||
|
removeElement(getfpdFrameworkModules());
|
||||||
|
fpdFrameworkModules = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ListIterator<ModuleSADocument.ModuleSA> li = l.listIterator();
|
ListIterator<ModuleSADocument.ModuleSA> li = l.listIterator();
|
||||||
@ -181,6 +183,8 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
public int getFrameworkModulesCount() {
|
public int getFrameworkModulesCount() {
|
||||||
if (getfpdFrameworkModules().getModuleSAList() == null){
|
if (getfpdFrameworkModules().getModuleSAList() == null){
|
||||||
|
removeElement(getfpdFrameworkModules());
|
||||||
|
fpdFrameworkModules = null;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return getfpdFrameworkModules().getModuleSAList().size();
|
return getfpdFrameworkModules().getModuleSAList().size();
|
||||||
@ -220,6 +224,8 @@ public class FpdFileContents {
|
|||||||
public ModuleSADocument.ModuleSA getModuleSA(String key) {
|
public ModuleSADocument.ModuleSA getModuleSA(String key) {
|
||||||
String[] s = key.split(" ");
|
String[] s = key.split(" ");
|
||||||
if (getfpdFrameworkModules().getModuleSAList() == null) {
|
if (getfpdFrameworkModules().getModuleSAList() == null) {
|
||||||
|
removeElement(getfpdFrameworkModules());
|
||||||
|
fpdFrameworkModules = null;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
|
ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();
|
||||||
@ -250,7 +256,10 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
private ModuleSADocument.ModuleSA getModuleSA(int i) {
|
private ModuleSADocument.ModuleSA getModuleSA(int i) {
|
||||||
ModuleSADocument.ModuleSA msa = null;
|
ModuleSADocument.ModuleSA msa = null;
|
||||||
XmlCursor cursor = getfpdFrameworkModules().newCursor();
|
if (fpdRoot.getFrameworkModules() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
XmlCursor cursor = fpdRoot.getFrameworkModules().newCursor();
|
||||||
if (cursor.toFirstChild()) {
|
if (cursor.toFirstChild()) {
|
||||||
for (int j = 0; j < i; ++j) {
|
for (int j = 0; j < i; ++j) {
|
||||||
cursor.toNextSibling();
|
cursor.toNextSibling();
|
||||||
@ -262,7 +271,7 @@ public class FpdFileContents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeModuleSA(int i) {
|
public void removeModuleSA(int i) {
|
||||||
XmlObject o = getfpdFrameworkModules();
|
XmlObject o = fpdRoot.getFrameworkModules();
|
||||||
if (o == null) {
|
if (o == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -431,7 +440,7 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -652,7 +661,7 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
public void getModuleSAOptions(String moduleKey, String[][] saa) {
|
public void getModuleSAOptions(String moduleKey, String[][] saa) {
|
||||||
ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
|
ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
|
||||||
if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null
|
if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null
|
||||||
|| msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {
|
|| msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
@ -682,7 +691,7 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
public int getModuleSAOptionsCount(String moduleKey){
|
public int getModuleSAOptionsCount(String moduleKey){
|
||||||
ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
|
ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);
|
||||||
if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null
|
if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null
|
||||||
|| msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {
|
|| msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -779,7 +788,7 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1026,6 +1035,8 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
public int getDynamicPcdBuildDataCount() {
|
public int getDynamicPcdBuildDataCount() {
|
||||||
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {
|
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {
|
||||||
|
removeElement(getfpdDynPcdBuildDefs());
|
||||||
|
fpdDynPcdBuildDefs = null;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return getfpdDynPcdBuildDefs().getPcdBuildDataList().size();
|
return getfpdDynPcdBuildDefs().getPcdBuildDataList().size();
|
||||||
@ -1033,6 +1044,8 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
public void getDynamicPcdBuildData(String[][] saa) {
|
public void getDynamicPcdBuildData(String[][] saa) {
|
||||||
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {
|
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {
|
||||||
|
removeElement(getfpdDynPcdBuildDefs());
|
||||||
|
fpdDynPcdBuildDefs = null;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
List<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> l = getfpdDynPcdBuildDefs().getPcdBuildDataList();
|
List<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> l = getfpdDynPcdBuildDefs().getPcdBuildDataList();
|
||||||
@ -1107,7 +1120,10 @@ public class FpdFileContents {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeDynamicPcdBuildData(String cName, String tsGuid) {
|
public void removeDynamicPcdBuildData(String cName, String tsGuid) {
|
||||||
XmlObject o = getfpdDynPcdBuildDefs();
|
XmlObject o = fpdRoot.getDynamicPcdBuildDefinitions();
|
||||||
|
if (o == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
XmlCursor cursor = o.newCursor();
|
XmlCursor cursor = o.newCursor();
|
||||||
if (cursor.toFirstChild()) {
|
if (cursor.toFirstChild()) {
|
||||||
@ -1132,7 +1148,8 @@ public class FpdFileContents {
|
|||||||
// Get the Sku Info count of ith dyn pcd element.
|
// Get the Sku Info count of ith dyn pcd element.
|
||||||
//
|
//
|
||||||
public int getDynamicPcdSkuInfoCount(int i){
|
public int getDynamicPcdSkuInfoCount(int i){
|
||||||
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
if (fpdRoot.getDynamicPcdBuildDefinitions() == null || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList() == null
|
||||||
|
|| fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList().size() == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1156,6 +1173,8 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
public void getDynamicPcdSkuInfos(int i, String[][] saa){
|
public void getDynamicPcdSkuInfos(int i, String[][] saa){
|
||||||
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
||||||
|
removeElement(getfpdDynPcdBuildDefs());
|
||||||
|
fpdDynPcdBuildDefs = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1193,6 +1212,8 @@ public class FpdFileContents {
|
|||||||
public String getDynamicPcdBuildDataValue(int i){
|
public String getDynamicPcdBuildDataValue(int i){
|
||||||
String value = null;
|
String value = null;
|
||||||
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
||||||
|
removeElement(getfpdDynPcdBuildDefs());
|
||||||
|
fpdDynPcdBuildDefs = null;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1216,6 +1237,8 @@ public class FpdFileContents {
|
|||||||
public String getDynamicPcdBuildDataVpdOffset(int i){
|
public String getDynamicPcdBuildDataVpdOffset(int i){
|
||||||
String vpdOffset = null;
|
String vpdOffset = null;
|
||||||
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
||||||
|
removeElement(getfpdDynPcdBuildDefs());
|
||||||
|
fpdDynPcdBuildDefs = null;
|
||||||
return vpdOffset;
|
return vpdOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1238,6 +1261,8 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
public void removeDynamicPcdBuildDataSkuInfo(int i) {
|
public void removeDynamicPcdBuildDataSkuInfo(int i) {
|
||||||
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
||||||
|
removeElement(getfpdDynPcdBuildDefs());
|
||||||
|
fpdDynPcdBuildDefs = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1264,9 +1289,9 @@ public class FpdFileContents {
|
|||||||
//
|
//
|
||||||
public void genDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset,
|
public void genDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset,
|
||||||
String hiiDefault, String vpdOffset, String value, int i) {
|
String hiiDefault, String vpdOffset, String value, int i) {
|
||||||
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
// if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
|
XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
|
||||||
if (cursor.toFirstChild()) {
|
if (cursor.toFirstChild()) {
|
||||||
@ -1293,9 +1318,9 @@ public class FpdFileContents {
|
|||||||
|
|
||||||
public void updateDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset,
|
public void updateDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset,
|
||||||
String hiiDefault, String vpdOffset, String value, int i){
|
String hiiDefault, String vpdOffset, String value, int i){
|
||||||
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
// if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
|
XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();
|
||||||
if (cursor.toFirstChild()) {
|
if (cursor.toFirstChild()) {
|
||||||
@ -2419,6 +2444,12 @@ public class FpdFileContents {
|
|||||||
}
|
}
|
||||||
return s.trim();
|
return s.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void removeElement(XmlObject o) {
|
||||||
|
XmlCursor cursor = o.newCursor();
|
||||||
|
cursor.removeXml();
|
||||||
|
cursor.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PcdItemTypeConflictException extends Exception {
|
class PcdItemTypeConflictException extends Exception {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user