import org.tianocore.IntermediateOutputType;\r
import org.tianocore.LibrariesDocument;\r
import org.tianocore.ModuleSADocument;\r
+import org.tianocore.ModuleSaBuildOptionsDocument;\r
import org.tianocore.ModuleSurfaceAreaDocument;\r
import org.tianocore.OptionDocument;\r
import org.tianocore.OptionsDocument;\r
import org.tianocore.PlatformHeaderDocument;\r
import org.tianocore.SkuInfoDocument;\r
import org.tianocore.UserDefinedAntTasksDocument;\r
-import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
+import org.tianocore.UserExtensionsDocument;\r
+import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
-import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
\r
/**\r
This class processes fpd file contents such as add remove xml elements. \r
public class FpdFileContents {\r
\r
static final String xmlNs = "http://www.TianoCore.org/2006/Edk2.0";\r
+ static final String regExpNewLineAndSpaces = "((\n)|(\r\n)|(\r)|(\u0085)|(\u2028)|(\u2029))(\\s)*";\r
\r
private PlatformSurfaceAreaDocument fpdd = null;\r
\r
\r
private HashMap<String, ArrayList<String>> dynPcdMap = null;\r
\r
+ private HashMap<String, String> defaultPcdValue = new HashMap<String, String>();\r
+ \r
+ private String itemType (String pcdInfo) {\r
+ \r
+ return pcdInfo.substring(pcdInfo.lastIndexOf(" ") + 1);\r
+ }\r
+ \r
/**\r
* look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings.\r
*/\r
dynPcdMap = new HashMap<String, ArrayList<String>>();\r
List<ModuleSADocument.ModuleSA> l = getfpdFrameworkModules().getModuleSAList();\r
if (l == null) {\r
+ removeElement(getfpdFrameworkModules());\r
+ fpdFrameworkModules = null;\r
return;\r
}\r
ListIterator<ModuleSADocument.ModuleSA> li = l.listIterator();\r
while (li.hasNext()) {\r
- ModuleSADocument.ModuleSA msa = li.next();\r
- if (msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null) {\r
+ ModuleSADocument.ModuleSA moduleSa = li.next();\r
+ if (moduleSa.getPcdBuildDefinition() == null || moduleSa.getPcdBuildDefinition().getPcdDataList() == null) {\r
continue;\r
}\r
- String ModuleInfo = msa.getModuleGuid() + " " + msa.getModuleVersion() +\r
- " " + msa.getPackageGuid() + " " + msa.getPackageVersion();\r
- List<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lp = msa.getPcdBuildDefinition().getPcdDataList();\r
+ String ModuleInfo = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() +\r
+ " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());\r
+ List<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lp = moduleSa.getPcdBuildDefinition().getPcdDataList();\r
ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> lpi = lp.listIterator();\r
while (lpi.hasNext()) {\r
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = lpi.next();\r
return fpdFrameworkModules;\r
}\r
\r
+ public void getFrameworkModuleSAByFvBinding (String fvName, Vector<String[]> vGuid) {\r
+ if (getFrameworkModulesCount() == 0){\r
+ return;\r
+ }\r
+ \r
+ ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();\r
+ while(li.hasNext()) {\r
+ ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();\r
+ if (moduleSa.getModuleSaBuildOptions() == null) {\r
+ continue;\r
+ }\r
+ String fvBinding = moduleSa.getModuleSaBuildOptions().getFvBinding();\r
+ if (fvBinding == null) {\r
+ continue;\r
+ }\r
+ \r
+ String[] fvNames = fvBinding.split(" ");\r
+ for (int i = 0; i < fvNames.length; ++i) {\r
+ //\r
+ // BugBug : underscore "_" should not be replaced!!! \r
+ // But Fv name FVMAIN from fdf file not consist with FV_MAIN in fpd file.\r
+ //\r
+ if (fvNames[i].equals(fvName) || fvNames[i].replaceAll("_", "").equals(fvName)) {\r
+ String[] sa = new String[] {moduleSa.getModuleGuid(), moduleSa.getModuleVersion(),\r
+ moduleSa.getPackageGuid(), moduleSa.getPackageVersion(), \r
+ listToString(moduleSa.getSupArchList())};\r
+ vGuid.add(sa);\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
public int getFrameworkModulesCount() {\r
- if (getfpdFrameworkModules().getModuleSAList() == null){\r
+ if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){\r
+ removeElement(getfpdFrameworkModules());\r
+ fpdFrameworkModules = null;\r
return 0;\r
}\r
return getfpdFrameworkModules().getModuleSAList().size();\r
ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();\r
int i = 0;\r
while(li.hasNext()) {\r
- ModuleSADocument.ModuleSA msa = (ModuleSADocument.ModuleSA)li.next();\r
- saa[i][1] = msa.getModuleGuid();\r
- saa[i][2] = msa.getModuleVersion();\r
+ ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();\r
+ saa[i][0] = moduleSa.getModuleGuid();\r
+ saa[i][1] = moduleSa.getModuleVersion();\r
\r
- saa[i][3] = msa.getPackageGuid();\r
- saa[i][4] = msa.getPackageVersion();\r
-// saa[i][4] = listToString(msa.getSupArchList());\r
+ saa[i][2] = moduleSa.getPackageGuid();\r
+ saa[i][3] = moduleSa.getPackageVersion();\r
+ saa[i][4] = listToString(moduleSa.getSupArchList());\r
++i;\r
}\r
}\r
\r
+ public void getFrameworkModuleInfo(int i, String[] sa) {\r
+ ModuleSADocument.ModuleSA msa = getModuleSA(i);\r
+ if (msa == null) {\r
+ return;\r
+ }\r
+ sa[0] = msa.getModuleGuid();\r
+ sa[1] = msa.getModuleVersion();\r
+ sa[2] = msa.getPackageGuid();\r
+ sa[3] = msa.getPackageVersion();\r
+ sa[4] = listToString(msa.getSupArchList());\r
+ }\r
+ \r
public ModuleSADocument.ModuleSA getModuleSA(String key) {\r
- String[] s = key.split(" ");\r
- if (getfpdFrameworkModules().getModuleSAList() == null) {\r
+ \r
+ if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0) {\r
+ removeElement(getfpdFrameworkModules());\r
+ fpdFrameworkModules = null;\r
return null;\r
}\r
+ String[] s = key.split(" ");\r
+ String archsInKey = "";\r
+ if (s.length > 4) {\r
+ for (int i = 4; i < s.length; ++i) {\r
+ archsInKey += s[i];\r
+ archsInKey += " ";\r
+ }\r
+ archsInKey = archsInKey.trim();\r
+ }\r
+ \r
ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator();\r
while(li.hasNext()) {\r
- ModuleSADocument.ModuleSA msa = (ModuleSADocument.ModuleSA)li.next();\r
- if (msa.getModuleGuid().equals(s[0]) && msa.getPackageGuid().equals(s[2])) {\r
- if (msa.getModuleVersion() != null) {\r
- if (!msa.getModuleVersion().equals(s[1])) {\r
+ ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next();\r
+ if (moduleSa.getModuleGuid().equalsIgnoreCase(s[0]) && moduleSa.getPackageGuid().equalsIgnoreCase(s[2])) {\r
+ if (moduleSa.getModuleVersion() != null) {\r
+ if (!moduleSa.getModuleVersion().equals(s[1])) {\r
continue;\r
}\r
}\r
- if (msa.getPackageVersion() != null) {\r
- if (!msa.getPackageVersion().equals(s[3])) {\r
+ if (moduleSa.getPackageVersion() != null) {\r
+ if (!moduleSa.getPackageVersion().equals(s[3])) {\r
continue;\r
}\r
}\r
- return msa;\r
+ //ToDo add arch check .\r
+ if (moduleSa.getSupArchList() != null) {\r
+ if (listToString(moduleSa.getSupArchList()).equals(archsInKey)) {\r
+ return moduleSa;\r
+ }\r
+ }\r
+ else {\r
+ if (archsInKey.length() == 0) {\r
+ return moduleSa;\r
+ }\r
+ }\r
}\r
}\r
return null;\r
}\r
+ \r
+ private ModuleSADocument.ModuleSA getModuleSA(int i) {\r
+ ModuleSADocument.ModuleSA moduleSa = null;\r
+ if (fpdRoot.getFrameworkModules() == null) {\r
+ return null;\r
+ }\r
+ XmlCursor cursor = fpdRoot.getFrameworkModules().newCursor();\r
+ if (cursor.toFirstChild()) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling();\r
+ }\r
+ moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject();\r
+ }\r
+ cursor.dispose();\r
+ return moduleSa;\r
+ }\r
+ \r
public void removeModuleSA(int i) {\r
- XmlObject o = getfpdFrameworkModules();\r
+ XmlObject o = fpdRoot.getFrameworkModules();\r
if (o == null) {\r
return;\r
}\r
//\r
ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)cursor.getObject();\r
String moduleInfo = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() + " " +\r
- moduleSa.getPackageGuid()+ " " + moduleSa.getPackageVersion();\r
+ moduleSa.getPackageGuid()+ " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());\r
PcdBuildDefinitionDocument.PcdBuildDefinition pcdBuildDef = moduleSa.getPcdBuildDefinition();\r
if (pcdBuildDef != null && pcdBuildDef.getPcdDataList() != null) {\r
ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData> li = pcdBuildDef.getPcdDataList().listIterator();\r
maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleInfo);\r
}\r
}\r
+ \r
+ cursor.push();\r
+ while (cursor.hasPrevToken()) {\r
+ cursor.toPrevToken();\r
+ if (!cursor.isText()) {\r
+ break;\r
+ }\r
+ String s = cursor.getTextValue();\r
+ if (s.matches(regExpNewLineAndSpaces)) {\r
+ continue;\r
+ }\r
+ }\r
+\r
+ if (cursor.isComment()) {\r
+ cursor.removeXml();\r
+ }\r
+ \r
+ cursor.pop();\r
cursor.removeXml();\r
if (getFrameworkModulesCount() == 0) {\r
cursor.toParent();\r
cursor.dispose();\r
}\r
\r
+ public boolean adjustPcd (int seqModuleSa) throws Exception {\r
+ boolean dataModified = false;\r
+ ModuleSADocument.ModuleSA moduleSa = getModuleSA(seqModuleSa);\r
+ int pcdCount = getPcdDataCount(seqModuleSa);\r
+ String[][] saaModuleSaPcd = new String[pcdCount][7];\r
+ getPcdData(seqModuleSa, saaModuleSaPcd);\r
+ String mg = moduleSa.getModuleGuid();\r
+ String mv = moduleSa.getModuleVersion();\r
+ String pg = moduleSa.getPackageGuid();\r
+ String pv = moduleSa.getPackageVersion();\r
+ String arch = listToString(moduleSa.getSupArchList());\r
+ //\r
+ // delete pcd in ModuleSA but not in MSA files any longer.\r
+ //\r
+ String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;\r
+ int libCount = getLibraryInstancesCount(moduleKey);\r
+ String[][] saaLib = new String[libCount][5];\r
+ getLibraryInstances(moduleKey, saaLib);\r
+ ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);\r
+ Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();\r
+ //\r
+ // create vector for module & library instance MIs.\r
+ //\r
+ vMi.add(mi);\r
+ for (int j = 0; j < saaLib.length; ++j) {\r
+ String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];\r
+ ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);\r
+ vMi.add(libMi);\r
+ }\r
+ \r
+ nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {\r
+\r
+ for (int j = 0; j < vMi.size(); ++j) {\r
+ ModuleIdentification nextMi = vMi.get(j);\r
+ if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], nextMi)) {\r
+ continue nextPcd;\r
+ }\r
+ }\r
+ removePcdData(seqModuleSa, saaModuleSaPcd[i][0], saaModuleSaPcd[i][1]);\r
+ dataModified = true;\r
+ }\r
+ //\r
+ // add new Pcd from MSA file to ModuleSA.\r
+ //\r
+ for (int i = 0; i < vMi.size(); ++i) {\r
+ ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile\r
+ .getModuleXmlObject(vMi\r
+ .get(i));\r
+ if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {\r
+ continue;\r
+ }\r
+ ListIterator li = msa.getPcdCoded().getPcdEntryList().listIterator();\r
+ msaPcdIter:while (li.hasNext()) {\r
+ PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next();\r
+ ArrayList<String> al = getDynPcdMapValue(msaPcd.getCName() + " " + msaPcd.getTokenSpaceGuidCName());\r
+ if (al != null) {\r
+ for (int j = 0; j < al.size(); ++j) {\r
+ if (al.get(j).contains(moduleKey)) {\r
+ continue msaPcdIter;\r
+ }\r
+ }\r
+ }\r
+ \r
+ PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, vMi.get(i));\r
+ PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);\r
+ if (spdPcd == null) {\r
+ //\r
+ // ToDo Error \r
+ //\r
+ throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "\r
+ + mi.getName());\r
+ }\r
+ //\r
+ // AddItem to ModuleSA PcdBuildDefinitions\r
+ //\r
+ String defaultVal = msaPcd.getDefaultValue() == null ? spdPcd.getDefaultValue()\r
+ : msaPcd.getDefaultValue();\r
+\r
+ genPcdData(msaPcd.getCName(), spdPcd.getToken(), msaPcd.getTokenSpaceGuidCName(),\r
+ msaPcd.getPcdItemType().toString(), spdPcd.getDatumType() + "", defaultVal, moduleSa);\r
+ dataModified = true;\r
+ }\r
+\r
+ }\r
+ \r
+ return dataModified;\r
+ }\r
+ \r
private void maintainDynPcdMap(String pcdKey, String moduleInfo) {\r
\r
ArrayList<String> al = dynPcdMap.get(pcdKey);\r
for(int i = 0; i < al.size(); ++i){\r
String consumer = al.get(i);\r
if (consumer.contains(s[0]) && consumer.contains(s[2])){\r
+ String[] consumerPart = consumer.split(" ");\r
+ if (!consumerPart[4].equals(s[4])) {\r
+ continue;\r
+ }\r
al.remove(consumer);\r
break;\r
}\r
}\r
\r
if (al.size() == 0) {\r
+ defaultPcdValue.remove(pcdKey);\r
dynPcdMap.remove(pcdKey);\r
String[] s1 = pcdKey.split(" ");\r
removeDynamicPcdBuildData(s1[0], s1[1]);\r
\r
}\r
//\r
- // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer"\r
+ // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"\r
//\r
- public int getPcdDataCount(String key){\r
- ModuleSADocument.ModuleSA msa = getModuleSA(key);\r
+ public int getPcdDataCount (int i){\r
+ ModuleSADocument.ModuleSA msa = getModuleSA(i);\r
+ \r
if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){\r
return 0;\r
}\r
return msa.getPcdBuildDefinition().getPcdDataList().size();\r
+ \r
}\r
\r
- public void getPcdData(String key, String[][] saa) {\r
- ModuleSADocument.ModuleSA msa = getModuleSA(key);\r
+ public void getPcdData (int i, String[][] saa) {\r
+ ModuleSADocument.ModuleSA msa = getModuleSA(i);\r
+ \r
if (msa == null || msa.getPcdBuildDefinition() == null || msa.getPcdBuildDefinition().getPcdDataList() == null){\r
return;\r
}\r
ListIterator<PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData>li = msa.getPcdBuildDefinition().getPcdDataList().listIterator();\r
- for (int i = 0; i < saa.length; ++i) {\r
+ for (int k = 0; k < saa.length; ++k) {\r
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = li.next();\r
- saa[i][0] = pcdData.getCName();\r
- saa[i][1] = pcdData.getTokenSpaceGuidCName();\r
- saa[i][2] = pcdData.getItemType()+"";\r
- saa[i][3] = pcdData.getToken().toString();\r
- saa[i][4] = pcdData.getMaxDatumSize()+"";\r
- saa[i][5] = pcdData.getDatumType()+"";\r
- saa[i][6] = pcdData.getValue();\r
+ saa[k][0] = pcdData.getCName();\r
+ saa[k][1] = pcdData.getTokenSpaceGuidCName();\r
+ saa[k][2] = pcdData.getItemType()+"";\r
+ saa[k][3] = pcdData.getToken().toString();\r
+ saa[k][4] = pcdData.getMaxDatumSize()+"";\r
+ saa[k][5] = pcdData.getDatumType()+"";\r
+ saa[k][6] = pcdData.getValue();\r
\r
}\r
}\r
\r
- public void updatePcdData(String key, String cName, String tsGuid, String itemType, String maxSize, String value){\r
- ModuleSADocument.ModuleSA msa = getModuleSA(key);\r
- if (msa == null || msa.getPcdBuildDefinition() == null){\r
+ public void removePcdData (int seqModuleSa, String cName, String tsGuid) {\r
+ ModuleSADocument.ModuleSA moduleSa = getModuleSA(seqModuleSa);\r
+ if (moduleSa == null || moduleSa.getPcdBuildDefinition() == null){\r
+ return;\r
+ }\r
+ \r
+ String mg = moduleSa.getModuleGuid();\r
+ String mv = moduleSa.getModuleVersion();\r
+ String pg = moduleSa.getPackageGuid();\r
+ String pv = moduleSa.getPackageVersion();\r
+ String arch = listToString(moduleSa.getSupArchList());\r
+ String moduleKey = mg + " " + mv + " " + pg + " " + pv + " " + arch;\r
+ \r
+ XmlCursor cursor = moduleSa.getPcdBuildDefinition().newCursor();\r
+ if (cursor.toFirstChild()){\r
+ \r
+ do {\r
+ PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();\r
+ if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {\r
+ maintainDynPcdMap(cName + " " + tsGuid, moduleKey);\r
+ if (getPcdDataCount(seqModuleSa) == 1) {\r
+ cursor.toParent();\r
+ }\r
+ cursor.removeXml();\r
+ break;\r
+ }\r
+ }\r
+ while(cursor.toNextSibling());\r
+ \r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
+ public void updatePcdData (String key, String cName, String tsGuid, String itemType, String maxSize, String value){\r
+ ModuleSADocument.ModuleSA moduleSa = getModuleSA(key);\r
+ if (moduleSa == null || moduleSa.getPcdBuildDefinition() == null){\r
return;\r
}\r
\r
- XmlCursor cursor = msa.getPcdBuildDefinition().newCursor();\r
+ XmlCursor cursor = moduleSa.getPcdBuildDefinition().newCursor();\r
if (cursor.toFirstChild()){\r
do {\r
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();\r
if (pcdData.getCName().equals(cName) && pcdData.getTokenSpaceGuidCName().equals(tsGuid)) {\r
+ //\r
+ // change item type while not updating dynPcdData????\r
+ //\r
pcdData.setItemType(PcdItemTypes.Enum.forString(itemType));\r
if(pcdData.getDatumType().equals("VOID*")) {\r
pcdData.setMaxDatumSize(new Integer(maxSize));\r
}\r
pcdData.setValue(value);\r
+ defaultPcdValue.put(cName + " " + tsGuid, value);\r
break;\r
}\r
}\r
* @param sa Results: HelpText, Original item type.\r
* @return\r
*/\r
- public boolean getPcdBuildDataInfo(ModuleIdentification mi, String cName, String[] sa) throws Exception{\r
+ public boolean getPcdBuildDataInfo(ModuleIdentification mi, String cName, String tsGuid, String[] sa) throws Exception{\r
try {\r
\r
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);\r
+ ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(mi);\r
if (msa.getPcdCoded() == null) {\r
return false;\r
}\r
Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r
m.put("ModuleSurfaceArea", msa);\r
SurfaceAreaQuery.setDoc(m);\r
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);\r
+ PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);\r
//\r
// First look through MSA pcd entries.\r
//\r
if (!msaPcd.getCName().equals(cName)) {\r
continue;\r
}\r
+ if (!msaPcd.getTokenSpaceGuidCName().equals(tsGuid)) {\r
+ continue;\r
+ }\r
PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);\r
if (spdPcd == null) {\r
//\r
//\r
sa[0] = spdPcd.getHelpText() + msaPcd.getHelpText();\r
sa[1] = msaPcd.getPcdItemType()+"";\r
+ sa[2] = msa.getModuleDefinitions().getBinaryModule()+"";\r
return true;\r
}\r
\r
\r
}\r
catch (Exception e){\r
-// e.printStackTrace();\r
+ e.printStackTrace();\r
throw e;\r
}\r
\r
return false;\r
}\r
\r
+ private boolean multiSourcePcd (String cName, String tsGuidCName, String moduleKey) {\r
+ int libCount = getLibraryInstancesCount(moduleKey);\r
+ String[][] saaLib = new String[libCount][5];\r
+ getLibraryInstances(moduleKey, saaLib);\r
+ ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);\r
+ Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();\r
+ //\r
+ // create vector for module & library instance MIs.\r
+ //\r
+ vMi.add(mi);\r
+ for (int j = 0; j < saaLib.length; ++j) {\r
+ String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];\r
+ ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);\r
+ vMi.add(libMi);\r
+ }\r
+ \r
+ int pcdSourceCount = 0;\r
+ for (int i = 0; i < vMi.size(); ++i) {\r
+ if (WorkspaceProfile.pcdInMsa(cName, tsGuidCName, vMi.get(i))) {\r
+ pcdSourceCount++;\r
+ }\r
+ }\r
+ \r
+ if (pcdSourceCount < 2) {\r
+ return false;\r
+ }\r
+ else {\r
+ return true;\r
+ }\r
+ \r
+ }\r
+ \r
/**Remove PCDBuildDefinition entries from ModuleSA\r
* @param moduleKey identifier of ModuleSA.\r
* @param consumer where these entries come from.\r
*/\r
public void removePcdData(String moduleKey, ModuleIdentification consumer) {\r
- try {\r
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(consumer);\r
+ \r
+ ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(consumer);\r
if (msa.getPcdCoded() == null) {\r
return;\r
}\r
while(li.hasNext()) {\r
PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();\r
ModuleSADocument.ModuleSA moduleSA = getModuleSA(moduleKey);\r
- XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();\r
- if (cursor.toFirstChild()) {\r
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();\r
- if (msaPcd.getCName().equals(pcdData.getCName()) && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {\r
- \r
- maintainDynPcdMap(pcdData.getCName()+" "+pcdData.getTokenSpaceGuidCName(), moduleKey);\r
- cursor.removeXml();\r
- break;\r
+ if (moduleSA.getPcdBuildDefinition() != null) {\r
+ XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();\r
+ cursor.push();\r
+ if (cursor.toFirstChild()) {\r
+ do {\r
+ PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor\r
+ .getObject();\r
+ String cName = msaPcd.getCName();\r
+ String tsGuidCName = msaPcd.getTokenSpaceGuidCName();\r
+ if (cName.equals(pcdData.getCName())\r
+ && tsGuidCName.equals(pcdData.getTokenSpaceGuidCName()) && !multiSourcePcd(cName, tsGuidCName, moduleKey)) {\r
+\r
+ maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(),\r
+ moduleKey);\r
+ cursor.removeXml();\r
+ break;\r
+ }\r
+ } while (cursor.toNextSibling());\r
}\r
- while (cursor.toNextSibling()) {\r
- pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();\r
- if (msaPcd.getCName().equals(pcdData.getCName()) && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {\r
- maintainDynPcdMap(pcdData.getCName()+" "+pcdData.getTokenSpaceGuidCName(), moduleKey);\r
- cursor.removeXml();\r
- break;\r
- }\r
+ \r
+ cursor.pop();\r
+ if (moduleSA.getPcdBuildDefinition().getPcdDataList().size() == 0) {\r
+ cursor.removeXml();\r
}\r
+ cursor.dispose();\r
}\r
- cursor.dispose();\r
}\r
- \r
- }\r
- catch (Exception e){\r
- e.printStackTrace();\r
- \r
- }\r
+ \r
}\r
//\r
- // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer"\r
+ // key for ModuleSA : "ModuleGuid ModuleVer PackageGuid PackageVer Arch"\r
//\r
public int getLibraryInstancesCount(String key) {\r
ModuleSADocument.ModuleSA msa = getModuleSA(key);\r
for (int j = 0; j < i; ++j) {\r
cursor.toNextSibling();\r
}\r
+ cursor.push();\r
+ while (cursor.hasPrevToken()) {\r
+ cursor.toPrevToken();\r
+ if (!cursor.isText()) {\r
+ break;\r
+ }\r
+ String s = cursor.getTextValue();\r
+ if (s.matches(regExpNewLineAndSpaces)) {\r
+ continue;\r
+ }\r
+ }\r
+ \r
+ if (cursor.isComment()) {\r
+ cursor.removeXml();\r
+ }\r
+ cursor.pop();\r
cursor.removeXml();\r
+ if (getLibraryInstancesCount(key) == 0) {\r
+ cursor.toParent();\r
+ cursor.removeXml();\r
+ }\r
}\r
\r
cursor.dispose();\r
}\r
\r
- public void genLibraryInstance(String mg, String mv, String pg, String pv, String key) {\r
+ public void genLibraryInstance(ModuleIdentification libMi, String key) {\r
ModuleSADocument.ModuleSA msa = getModuleSA(key);\r
if (msa == null){\r
msa = getfpdFrameworkModules().addNewModuleSA();\r
libs = msa.addNewLibraries();\r
}\r
\r
+ String mn = libMi.getName();\r
+ String mg = libMi.getGuid();\r
+ String mv = libMi.getVersion();\r
+ String pn = libMi.getPackageId().getName();\r
+ String pg = libMi.getPackageId().getGuid();\r
+ String pv = libMi.getPackageId().getVersion();\r
LibrariesDocument.Libraries.Instance instance = libs.addNewInstance();\r
+ XmlCursor cursor = instance.newCursor();\r
+ try{\r
+ String comment = "Pkg: " + pn + " Mod: " + mn \r
+ + " Path: " + libMi.getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
+ cursor.insertComment(comment);\r
+ }\r
+ catch (Exception e){\r
+ e.printStackTrace();\r
+ }\r
+ finally {\r
+ cursor.dispose();\r
+ }\r
+ \r
instance.setModuleGuid(mg);\r
instance.setModuleVersion(mv);\r
instance.setPackageGuid(pg);\r
}\r
\r
public String getFvBinding(String moduleKey){\r
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r
- if (msa == null || msa.getModuleSaBuildOptions() == null) {\r
+ ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);\r
+ return getFvBinding (moduleSa);\r
+ }\r
+ \r
+ public String getFvBinding (ModuleSADocument.ModuleSA moduleSa) {\r
+ if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null) {\r
return null;\r
}\r
- return msa.getModuleSaBuildOptions().getFvBinding();\r
+ return moduleSa.getModuleSaBuildOptions().getFvBinding();\r
+ }\r
+ \r
+ public void setFvBinding(ModuleSADocument.ModuleSA moduleSa, String fvBinding) {\r
+ if (moduleSa == null ) {\r
+ return;\r
+ }\r
+ if (fvBinding == null || fvBinding.length() == 0) {\r
+ if(moduleSa.getModuleSaBuildOptions() != null){\r
+ moduleSa.getModuleSaBuildOptions().unsetFvBinding();\r
+ }\r
+ }\r
+ else {\r
+ if(moduleSa.getModuleSaBuildOptions() == null){\r
+ moduleSa.addNewModuleSaBuildOptions().setFvBinding(fvBinding);\r
+ return;\r
+ }\r
+ moduleSa.getModuleSaBuildOptions().setFvBinding(fvBinding);\r
+ }\r
}\r
\r
public void setFvBinding(String moduleKey, String fvBinding){\r
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r
- if (msa == null ) {\r
+ ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);\r
+ setFvBinding (moduleSa, fvBinding);\r
+ }\r
+ \r
+ private int fvBindingForModuleSA (ModuleSADocument.ModuleSA moduleSa, String fvName) {\r
+ if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {\r
+ return -1;\r
+ }\r
+ \r
+ String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();\r
+ String[] fvNamesArray = fvNameList.split(" ");\r
+ int occursAt = -1;\r
+ for (int i = 0; i < fvNamesArray.length; ++i) {\r
+ if (fvNamesArray[i].equals(fvName)) {\r
+ occursAt = i;\r
+ break;\r
+ }\r
+ }\r
+ return occursAt;\r
+ }\r
+ \r
+ public void removeFvBinding (ModuleSADocument.ModuleSA moduleSa, String fvName) {\r
+ if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {\r
return;\r
}\r
- if(msa.getModuleSaBuildOptions() == null){\r
- msa.addNewModuleSaBuildOptions().setFvBinding(fvBinding);\r
+ \r
+ String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();\r
+ String[] fvNamesArray = fvNameList.split(" ");\r
+ int occursAt = -1;\r
+ for (int i = 0; i < fvNamesArray.length; ++i) {\r
+ if (fvNamesArray[i].equals(fvName)) {\r
+ occursAt = i;\r
+ break;\r
+ }\r
+ }\r
+ // jump over where the input fvName occurs in the original Fv list.\r
+ if (occursAt != -1) {\r
+ String newFvNameList = " ";\r
+ for (int i = 0; i < fvNamesArray.length; ++i) {\r
+ if (i == occursAt) {\r
+ continue;\r
+ }\r
+ newFvNameList += fvNamesArray[i];\r
+ }\r
+ setFvBinding (moduleSa, newFvNameList.trim());\r
+ }\r
+\r
+ }\r
+ \r
+ /**\r
+ * @param fvName The FV name that to be removed from FvBinding List.\r
+ */\r
+ public void removeFvBindingAll (String fvName) {\r
+ if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){\r
+ removeElement(getfpdFrameworkModules());\r
+ fpdFrameworkModules = null;\r
+ return;\r
+ }\r
+ \r
+ Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();\r
+ while (li.hasNext()) {\r
+ ModuleSADocument.ModuleSA moduleSa = li.next();\r
+ removeFvBinding (moduleSa, fvName); \r
+ }\r
+ }\r
+ \r
+ public void appendFvBindingAll (String fvName) {\r
+ if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){\r
+ removeElement(getfpdFrameworkModules());\r
+ fpdFrameworkModules = null;\r
+ return;\r
+ }\r
+ \r
+ Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();\r
+ while (li.hasNext()) {\r
+ ModuleSADocument.ModuleSA moduleSa = li.next();\r
+ appendFvBinding (moduleSa, fvName); \r
+ }\r
+ }\r
+ \r
+ public void appendFvBindingFor (String oldFvName, String newFvName) {\r
+ if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){\r
+ removeElement(getfpdFrameworkModules());\r
+ fpdFrameworkModules = null;\r
+ return;\r
+ }\r
+ \r
+ Iterator<ModuleSADocument.ModuleSA> li = getfpdFrameworkModules().getModuleSAList().iterator();\r
+ while (li.hasNext()) {\r
+ ModuleSADocument.ModuleSA moduleSa = li.next();\r
+ String fvBinding = getFvBinding (moduleSa);\r
+ if (fvBinding != null && fvBindingForModuleSA (moduleSa, oldFvName) >= 0) {\r
+ appendFvBinding (moduleSa, newFvName); \r
+ }\r
+ }\r
+ }\r
+ \r
+ public void appendFvBinding (String moduleKey, String fvName) {\r
+ ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);\r
+ appendFvBinding (moduleSa, fvName);\r
+ }\r
+ \r
+ public void appendFvBinding (ModuleSADocument.ModuleSA moduleSa, String fvName) {\r
+ if (moduleSa == null) {\r
+ return;\r
+ }\r
+ \r
+ if (moduleSa.getModuleSaBuildOptions() == null || moduleSa.getModuleSaBuildOptions().getFvBinding() == null) {\r
+ setFvBinding(moduleSa, fvName);\r
return;\r
}\r
- msa.getModuleSaBuildOptions().setFvBinding(fvBinding);\r
+ \r
+ String fvNameList = moduleSa.getModuleSaBuildOptions().getFvBinding();\r
+ String newFvNameList = fvNameList + " " + fvName;\r
+ setFvBinding (moduleSa, newFvNameList.trim());\r
+ }\r
+ \r
+ public void updateFvBindingInModuleSA (String moduleKey, String fvName) {\r
+ \r
+ appendFvBinding (moduleKey, fvName);\r
}\r
\r
public String getFfsFileNameGuid(String moduleKey){\r
- ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r
- if (msa == null || msa.getModuleSaBuildOptions() == null) {\r
+ ModuleSADocument.ModuleSA moduleSa = getModuleSA(moduleKey);\r
+ if (moduleSa == null || moduleSa.getModuleSaBuildOptions() == null) {\r
return null;\r
}\r
- return msa.getModuleSaBuildOptions().getFfsFileNameGuid();\r
+ return moduleSa.getModuleSaBuildOptions().getFfsFileNameGuid();\r
}\r
\r
public void setFfsFileNameGuid(String moduleKey, String fileGuid){\r
return;\r
}\r
if(msa.getModuleSaBuildOptions() == null){\r
- msa.addNewModuleSaBuildOptions().setFfsFileNameGuid(fileGuid);\r
- return;\r
+ msa.addNewModuleSaBuildOptions();\r
+ \r
+ }\r
+ ModuleSaBuildOptionsDocument.ModuleSaBuildOptions msaBuildOpts= msa.getModuleSaBuildOptions();\r
+ if (fileGuid != null) {\r
+ msaBuildOpts.setFfsFileNameGuid(fileGuid);\r
+ }\r
+ else{\r
+ XmlCursor cursor = msaBuildOpts.newCursor();\r
+ if (cursor.toChild(xmlNs, "FfsFileNameGuid")) {\r
+ cursor.removeXml();\r
+ }\r
+ cursor.dispose();\r
}\r
- msa.getModuleSaBuildOptions().setFfsFileNameGuid(fileGuid);\r
+ \r
}\r
\r
public String getFfsFormatKey(String moduleKey){\r
msa.addNewModuleSaBuildOptions().setFfsFormatKey(ffsKey);\r
return;\r
}\r
- msa.getModuleSaBuildOptions().setFvBinding(ffsKey);\r
+ msa.getModuleSaBuildOptions().setFfsFormatKey(ffsKey);\r
+ }\r
+ \r
+ public void setModuleSAForceDebug(int i, boolean dbgEnable) {\r
+ ModuleSADocument.ModuleSA moduleSa = getModuleSA(i);\r
+ moduleSa.setForceDebug(dbgEnable);\r
+ }\r
+ \r
+ public boolean getModuleSAForceDebug (int i) {\r
+ ModuleSADocument.ModuleSA moduleSa = getModuleSA(i);\r
+ if (moduleSa.getForceDebug() == true) {\r
+ return true;\r
+ }\r
+ return false;\r
}\r
\r
public void getModuleSAOptions(String moduleKey, String[][] saa) {\r
ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r
- if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null\r
+ if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null\r
|| msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {\r
return ;\r
}\r
saa[i][0] = listToString(opt.getBuildTargets());\r
}\r
saa[i][1] = opt.getToolChainFamily();\r
- if (opt.getSupArchList() != null){\r
- saa[i][2] = listToString(opt.getSupArchList());\r
-\r
- }\r
+ saa[i][2] = opt.getTagName();\r
saa[i][3] = opt.getToolCode();\r
- saa[i][4] = opt.getTagName();\r
+ \r
+ if (opt.getSupArchList() != null){\r
+ saa[i][4] = listToString(opt.getSupArchList());\r
+ }\r
+ else {\r
+ saa[i][4] = "";\r
+ }\r
+ \r
saa[i][5] = opt.getStringValue();\r
\r
++i;\r
\r
public int getModuleSAOptionsCount(String moduleKey){\r
ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey);\r
- if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null\r
+ if (msa == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null\r
|| msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) {\r
return 0;\r
}\r
cursor.toNextSibling();\r
}\r
cursor.removeXml();\r
+ if (getModuleSAOptionsCount(moduleKey) == 0) {\r
+ cursor.toParent();\r
+ cursor.removeXml();\r
+ }\r
}\r
cursor.dispose();\r
}\r
* @param mi\r
* @param moduleSa if null, generate a new ModuleSA.\r
*/\r
- public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi, ModuleSADocument.ModuleSA moduleSa) throws Exception {\r
+ public void addFrameworkModulesPcdBuildDefs(ModuleIdentification mi, String arch, ModuleSADocument.ModuleSA moduleSa) throws Exception {\r
//ToDo add Arch filter\r
\r
try {\r
if (moduleSa == null) {\r
- moduleSa = genModuleSA(mi);\r
+ moduleSa = genModuleSA(mi, arch);\r
}\r
\r
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);\r
+ ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(mi);\r
if (msa.getPcdCoded() == null) {\r
return;\r
}\r
Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r
m.put("ModuleSurfaceArea", msa);\r
SurfaceAreaQuery.setDoc(m);\r
- PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);\r
+ PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);\r
//\r
// Implementing InitializePlatformPcdBuildDefinitions\r
//\r
//\r
// ToDo Error \r
//\r
- throw new PcdDeclNotFound(mi.getName() + " " + msaPcd.getCName());\r
+ throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module " + mi.getName());\r
}\r
//\r
// AddItem to ModuleSA PcdBuildDefinitions\r
\r
}\r
catch (Exception e){\r
-// e.printStackTrace();\r
+ \r
throw e; \r
}\r
\r
\r
private PcdDeclarationsDocument.PcdDeclarations.PcdEntry LookupPcdDeclaration (PcdCodedDocument.PcdCoded.PcdEntry msaPcd, PackageIdentification[] depPkgs) {\r
\r
- Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r
PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = null;\r
for (int i = 0; i < depPkgs.length; ++i) {\r
- m.put("PackageSurfaceArea", GlobalData.getPackageXmlObject(depPkgs[i]));\r
- SurfaceAreaQuery.setDoc(m);\r
- XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations();\r
+\r
+ XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations(depPkgs[i]);\r
if (xo == null) {\r
continue;\r
}\r
return null;\r
}\r
\r
- private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi) {\r
- PackageIdentification pi = GlobalData.getPackageForModule(mi);\r
+ private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {\r
+ PackageIdentification pi = WorkspaceProfile.getPackageForModule(mi);\r
ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();\r
+ XmlCursor cursor = msa.newCursor();\r
+ try{\r
+ String comment = "Mod: " + mi.getName() + " Type: " + SurfaceAreaQuery.getModuleType(mi) + " Path: "\r
+ + mi.getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
+ cursor.insertComment(comment);\r
+ }\r
+ catch(Exception e){\r
+ e.printStackTrace();\r
+ }\r
+ finally { \r
+ cursor.dispose();\r
+ }\r
msa.setModuleGuid(mi.getGuid());\r
msa.setModuleVersion(mi.getVersion());\r
msa.setPackageGuid(pi.getGuid());\r
msa.setPackageVersion(pi.getVersion());\r
+ if (arch != null) {\r
+ Vector<String> v = new Vector<String>();\r
+ v.add(arch);\r
+ msa.setSupArchList(v); \r
+ }\r
\r
return msa;\r
}\r
if (pcdConsumer == null) {\r
pcdConsumer = new ArrayList<String>();\r
}\r
- String listValue = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() \r
- + " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() \r
- + " " + itemType;\r
- pcdConsumer.add(listValue);\r
- dynPcdMap.put(cName + " " + tsGuid, pcdConsumer);\r
//\r
- // Special dynamic type, if this pcd already exists in other ModuleSA\r
+ // Check whether this PCD has already added to ModuleSA, if so, just return.\r
//\r
- if (itemType.equals("DYNAMIC")) {\r
- \r
- ListIterator li = pcdConsumer.listIterator();\r
- while(li.hasNext()) {\r
- String value = li.next().toString();\r
- String[] valuePart= value.split(" ");\r
- if (!valuePart[4].equals("DYNAMIC")) {\r
- //ToDo error for same pcd, other type than dynamic\r
- pcdConsumer.remove(listValue);\r
- throw new PcdItemTypeConflictException(value);\r
- }\r
+ String moduleInfo = moduleSa.getModuleGuid().toLowerCase() + " " + moduleSa.getModuleVersion() \r
+ + " " + moduleSa.getPackageGuid().toLowerCase() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList());\r
+ for (int i = 0; i < pcdConsumer.size(); ++i) {\r
+ String pcdInfo = pcdConsumer.get(i);\r
+ if (moduleInfo.equals(pcdInfo.substring(0, pcdInfo.lastIndexOf(" ")))){\r
+ return;\r
}\r
}\r
- else {\r
- ListIterator li = pcdConsumer.listIterator();\r
- while(li.hasNext()) {\r
- String value = li.next().toString();\r
- String[] valuePart= value.split(" ");\r
- if (valuePart[4].equals("DYNAMIC")) {\r
- //ToDo error for same pcd, other type than non-dynamic\r
- pcdConsumer.remove(listValue);\r
- throw new PcdItemTypeConflictException(value);\r
- }\r
- }\r
+ //\r
+ // Using existing Pcd type, if this pcd already exists in other ModuleSA\r
+ //\r
+ if (pcdConsumer.size() > 0) {\r
+ \r
+ itemType = itemType (pcdConsumer.get(0));\r
}\r
+ String listValue = moduleInfo + " " + itemType;\r
+ pcdConsumer.add(listValue);\r
+ dynPcdMap.put(cName + " " + tsGuid, pcdConsumer);\r
\r
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData fpdPcd = moduleSa.getPcdBuildDefinition().addNewPcdData();\r
fpdPcd.setCName(cName);\r
fpdPcd.setDatumType(PcdDataTypes.Enum.forString(dataType));\r
fpdPcd.setItemType(PcdItemTypes.Enum.forString(itemType));\r
\r
+ if (defaultVal != null){\r
+ fpdPcd.setValue(defaultVal);\r
+ }\r
+ else {\r
+ if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {\r
+ fpdPcd.setValue("0");\r
+ }\r
+ if (dataType.equals("BOOLEAN")){\r
+ fpdPcd.setValue("FALSE");\r
+ }\r
+ if (dataType.equals("VOID*")) {\r
+ fpdPcd.setValue("");\r
+ }\r
+ }\r
+ //\r
+ // Using existing pcd value, if this pcd already exists in other moduleSa.\r
+ //\r
+ if (defaultPcdValue.get(cName + " " + tsGuid) == null) {\r
+ defaultPcdValue.put(cName + " " + tsGuid, fpdPcd.getValue());\r
+ }\r
+ else {\r
+ fpdPcd.setValue(defaultPcdValue.get(cName + " " + tsGuid));\r
+ }\r
+ \r
+ if (dataType.equals("UINT8")){\r
+ fpdPcd.setMaxDatumSize(1);\r
+ }\r
+ if (dataType.equals("UINT16")) {\r
+ fpdPcd.setMaxDatumSize(2);\r
+ }\r
+ if (dataType.equals("UINT32")) {\r
+ fpdPcd.setMaxDatumSize(4);\r
+ }\r
+ if (dataType.equals("UINT64")){\r
+ fpdPcd.setMaxDatumSize(8);\r
+ }\r
+ if (dataType.equals("BOOLEAN")){\r
+ fpdPcd.setMaxDatumSize(1);\r
+ }\r
+ if (dataType.equals("VOID*")) {\r
+ int maxSize = setMaxSizeForPointer(fpdPcd.getValue());\r
+ fpdPcd.setMaxDatumSize(maxSize);\r
+ }\r
+ \r
+ \r
if (itemType.equals("DYNAMIC") || itemType.equals("DYNAMIC_EX")) {\r
ArrayList<String> al = LookupDynamicPcdBuildDefinition(cName + " " + tsGuid);\r
//\r
addDynamicPcdBuildData(cName, token, tsGuid, itemType, dataType, defaultVal);\r
}\r
}\r
- else {\r
- if (defaultVal != null){\r
- fpdPcd.setValue(defaultVal);\r
- }\r
- else {\r
- if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {\r
- fpdPcd.setValue("0");\r
- }\r
- if (dataType.equals("BOOLEAN")){\r
- fpdPcd.setValue("false");\r
- }\r
- if (dataType.equals("VOID*")) {\r
- fpdPcd.setValue("");\r
- }\r
- }\r
- if (dataType.equals("UINT8")){\r
- fpdPcd.setMaxDatumSize(1);\r
- }\r
- if (dataType.equals("UINT16")) {\r
- fpdPcd.setMaxDatumSize(2);\r
- }\r
- if (dataType.equals("UINT32")) {\r
- fpdPcd.setMaxDatumSize(4);\r
- }\r
- if (dataType.equals("UINT64")){\r
- fpdPcd.setMaxDatumSize(8);\r
- }\r
- if (dataType.equals("BOOLEAN")){\r
- fpdPcd.setMaxDatumSize(1);\r
- }\r
- if (dataType.equals("VOID*")) {\r
- int maxSize = setMaxSizeForPointer(fpdPcd.getValue());\r
- fpdPcd.setMaxDatumSize(maxSize);\r
- }\r
- }\r
+ \r
}\r
\r
public int setMaxSizeForPointer(String datum) throws PcdValueMalFormed{\r
\r
if (value > 0xFF) {\r
// "[FPD file error] The datum type of PCD %s in %s is VOID*, "+\r
-// "it is byte array in fact. But the element of %s exceed the byte range",\r
+// "it must be a byte array. But the element of %s exceed the byte range",\r
throw new PcdValueMalFormed (datum); \r
}\r
}\r
\r
private ArrayList<String> LookupPlatformPcdData(String pcdKey) {\r
\r
- return dynPcdMap.get("pcdKey");\r
+ return dynPcdMap.get(pcdKey);\r
}\r
\r
public int getDynamicPcdBuildDataCount() {\r
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {\r
+ if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
+ removeElement(getfpdDynPcdBuildDefs());\r
+ fpdDynPcdBuildDefs = null;\r
return 0;\r
}\r
return getfpdDynPcdBuildDefs().getPcdBuildDataList().size();\r
}\r
\r
public void getDynamicPcdBuildData(String[][] saa) {\r
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {\r
+ if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
+ removeElement(getfpdDynPcdBuildDefs());\r
+ fpdDynPcdBuildDefs = null;\r
return ;\r
}\r
List<DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData> l = getfpdDynPcdBuildDefs().getPcdBuildDataList();\r
}\r
\r
public void removeDynamicPcdBuildData(String cName, String tsGuid) {\r
- XmlObject o = getfpdDynPcdBuildDefs();\r
+ XmlObject o = fpdRoot.getDynamicPcdBuildDefinitions();\r
+ if (o == null) {\r
+ return;\r
+ }\r
\r
XmlCursor cursor = o.newCursor();\r
if (cursor.toFirstChild()) {\r
DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdBuildData = \r
(DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r
if (pcdBuildData.getCName().equals(cName) && pcdBuildData.getTokenSpaceGuidCName().equals(tsGuid)) {\r
- cursor.removeXml();\r
- if (getDynamicPcdBuildDataCount() == 0) {\r
+ \r
+ if (getDynamicPcdBuildDataCount() == 1) {\r
cursor.toParent();\r
- cursor.removeXml();\r
}\r
+ cursor.removeXml();\r
cursor.dispose();\r
return;\r
}\r
// Get the Sku Info count of ith dyn pcd element.\r
//\r
public int getDynamicPcdSkuInfoCount(int i){\r
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
+ if (fpdRoot.getDynamicPcdBuildDefinitions() == null || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList() == null \r
+ || fpdRoot.getDynamicPcdBuildDefinitions().getPcdBuildDataList().size() == 0) {\r
return 0;\r
}\r
\r
\r
public void getDynamicPcdSkuInfos(int i, String[][] saa){\r
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
+ removeElement(getfpdDynPcdBuildDefs());\r
+ fpdDynPcdBuildDefs = null;\r
return;\r
}\r
\r
public String getDynamicPcdBuildDataValue(int i){\r
String value = null;\r
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
+ removeElement(getfpdDynPcdBuildDefs());\r
+ fpdDynPcdBuildDefs = null;\r
return value;\r
}\r
\r
public String getDynamicPcdBuildDataVpdOffset(int i){\r
String vpdOffset = null;\r
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
+ removeElement(getfpdDynPcdBuildDefs());\r
+ fpdDynPcdBuildDefs = null;\r
return vpdOffset;\r
}\r
\r
\r
public void removeDynamicPcdBuildDataSkuInfo(int i) {\r
if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
+ removeElement(getfpdDynPcdBuildDefs());\r
+ fpdDynPcdBuildDefs = null;\r
return;\r
}\r
\r
//\r
public void genDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset, \r
String hiiDefault, String vpdOffset, String value, int i) {\r
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
- return;\r
- }\r
+// if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
+// return;\r
+// }\r
\r
XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();\r
if (cursor.toFirstChild()) {\r
\r
public void updateDynamicPcdBuildDataSkuInfo(String id, String varName, String varGuid, String varOffset, \r
String hiiDefault, String vpdOffset, String value, int i){\r
- if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
- return;\r
- }\r
+// if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null || getfpdDynPcdBuildDefs().getPcdBuildDataList().size() == 0) {\r
+// return;\r
+// }\r
\r
XmlCursor cursor = getfpdDynPcdBuildDefs().newCursor();\r
if (cursor.toFirstChild()) {\r
return fpdBuildOpts;\r
}\r
\r
+ public void genBuildOptionsUserExtensions(String fvName, String outputFileName, Vector<String[]> includeModules) {\r
+ QName elementFvName = new QName (xmlNs, "FvName");\r
+ QName elementIncludeModules = new QName(xmlNs, "IncludeModules");\r
+ QName elementInfFileName = new QName(xmlNs, "InfFileName");\r
+ QName elementModule = new QName(xmlNs, "Module");\r
+ \r
+ UserExtensionsDocument.UserExtensions userExts = getfpdBuildOpts().addNewUserExtensions();\r
+ userExts.setUserID("IMAGES");\r
+ userExts.setIdentifier(new BigInteger("1"));\r
+ XmlCursor cursor = userExts.newCursor();\r
+ cursor.toEndToken();\r
+ \r
+ cursor.beginElement(elementFvName);\r
+ cursor.insertChars(fvName);\r
+ cursor.toNextToken();\r
+ \r
+ cursor.beginElement(elementInfFileName);\r
+ cursor.insertChars(fvName + ".inf");\r
+ cursor.toNextToken();\r
+ \r
+ cursor.beginElement(elementIncludeModules);\r
+ for (int i = 0; i < includeModules.size(); ++i) {\r
+ cursor.beginElement(elementModule);\r
+ cursor.insertAttributeWithValue("ModuleGuid", includeModules.get(i)[0]);\r
+ if (!includeModules.get(i)[1].equals("null") && includeModules.get(i)[1].length() != 0) {\r
+ cursor.insertAttributeWithValue("ModuleVersion", includeModules.get(i)[1]);\r
+ }\r
+ cursor.insertAttributeWithValue("PackageGuid", includeModules.get(i)[2]);\r
+ if (!includeModules.get(i)[3].equals("null") && includeModules.get(i)[3].length() != 0) {\r
+ cursor.insertAttributeWithValue("PackageVersion", includeModules.get(i)[3]);\r
+ }\r
+ \r
+ cursor.insertAttributeWithValue("Arch", includeModules.get(i)[4]);\r
+ cursor.toEndToken();\r
+ cursor.toNextToken();\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
+ public int getUserExtsIncModCount (String fvName) {\r
+ if (getfpdBuildOpts().getUserExtensionsList() == null) {\r
+ return -1;\r
+ }\r
+ ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();\r
+ QName elementIncludeModules = new QName(xmlNs, "IncludeModules");\r
+ while (li.hasNext()) {\r
+ UserExtensionsDocument.UserExtensions ues = li.next();\r
+ if (!ues.getUserID().equals("IMAGES")) {\r
+ continue;\r
+ }\r
+ XmlCursor cursor = ues.newCursor();\r
+ cursor.toFirstChild();\r
+ String elementName = cursor.getTextValue();\r
+ if (elementName.equals(fvName)) {\r
+ cursor.toNextSibling(elementIncludeModules);\r
+ if (cursor.toFirstChild()) {\r
+ int i = 1;\r
+ for (i = 1; cursor.toNextSibling(); ++i);\r
+ cursor.dispose();\r
+ return i;\r
+ }\r
+ cursor.dispose();\r
+ return 0;\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ return -1;\r
+ }\r
+ \r
+ public void getUserExtsIncMods(String fvName, String[][] saa) {\r
+ if (getfpdBuildOpts().getUserExtensionsList() == null) {\r
+ return;\r
+ }\r
+ \r
+ XmlCursor cursor = getfpdBuildOpts().newCursor();\r
+ QName elementUserExts = new QName (xmlNs, "UserExtensions");\r
+ QName attribUserId = new QName ("UserID");\r
+ QName elementFvName = new QName (xmlNs, "FvName");\r
+ QName elementIncludeModules = new QName(xmlNs, "IncludeModules");\r
+ QName attribModuleGuid = new QName("ModuleGuid");\r
+ QName attribModuleVersion = new QName("ModuleVersion");\r
+ QName attribPackageGuid = new QName("PackageGuid");\r
+ QName attribPackageVersion = new QName("PackageVersion");\r
+ QName attribArch = new QName("Arch");\r
+ \r
+ if (cursor.toChild(elementUserExts)) {\r
+ do {\r
+ cursor.push();\r
+ if (cursor.getAttributeText(attribUserId).equals("IMAGES")) {\r
+ cursor.toChild(elementFvName);\r
+ String elementName = cursor.getTextValue();\r
+ if (elementName.equals(fvName)) {\r
+ cursor.toNextSibling(elementIncludeModules);\r
+ if (cursor.toFirstChild()) {\r
+ int i = 0;\r
+ do {\r
+ saa[i][0] = cursor.getAttributeText(attribModuleGuid);\r
+ saa[i][1] = cursor.getAttributeText(attribModuleVersion);\r
+ saa[i][2] = cursor.getAttributeText(attribPackageGuid);\r
+ saa[i][3] = cursor.getAttributeText(attribPackageVersion);\r
+ saa[i][4] = cursor.getAttributeText(attribArch);\r
+ ++i;\r
+ }while (cursor.toNextSibling());\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ cursor.pop();\r
+ }while (cursor.toNextSibling(elementUserExts));\r
+ }\r
+ cursor.dispose();\r
+ \r
+ }\r
+ \r
+ public void updateBuildOptionsUserExtensions (String oldFvName, String newFvName) {\r
+ if (getfpdBuildOpts().getUserExtensionsList() == null) {\r
+ return;\r
+ }\r
+ ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();\r
+ while (li.hasNext()) {\r
+ UserExtensionsDocument.UserExtensions ues = li.next();\r
+ if (!ues.getUserID().equals("IMAGES")) {\r
+ continue;\r
+ }\r
+ XmlCursor cursor = ues.newCursor();\r
+ cursor.toFirstChild();\r
+ String elementName = cursor.getTextValue();\r
+ if (elementName.equals(oldFvName)) {\r
+ cursor.setTextValue(newFvName);\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
+ }\r
+ \r
+ public void removeBuildOptionsUserExtensions (String fvName) {\r
+ if (getfpdBuildOpts().getUserExtensionsList() == null) {\r
+ return;\r
+ }\r
+ \r
+ ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();\r
+ while (li.hasNext()) {\r
+ UserExtensionsDocument.UserExtensions ues = li.next();\r
+ if (!ues.getUserID().equals("IMAGES")) {\r
+ continue;\r
+ }\r
+ XmlCursor cursor = ues.newCursor();\r
+ cursor.toFirstChild();\r
+ String elementName = cursor.getTextValue();\r
+ if (elementName.equals(fvName)) {\r
+ cursor.toParent();\r
+ cursor.removeXml();\r
+ cursor.dispose();\r
+ return;\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
+ }\r
+ \r
+ private boolean versionEqual (String v1, String v2) {\r
+ \r
+ if ((v1 == null || v1.length() == 0 || v1.equalsIgnoreCase("null")) \r
+ && (v2 == null || v2.length() == 0 || v2.equalsIgnoreCase("null"))) {\r
+ return true;\r
+ }\r
+ \r
+ if (v1 != null && v1.equals(v2)) {\r
+ return true;\r
+ }\r
+ \r
+ return false;\r
+ }\r
+ \r
+ public boolean moduleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {\r
+ boolean inList = false;\r
+ if (getUserExtsIncModCount(fvName) > 0) {\r
+ \r
+ XmlCursor cursor = getfpdBuildOpts().newCursor();\r
+ QName elementUserExts = new QName (xmlNs, "UserExtensions");\r
+ QName attribUserId = new QName ("UserID");\r
+ QName elementFvName = new QName (xmlNs, "FvName");\r
+ QName elementIncludeModules = new QName(xmlNs, "IncludeModules");\r
+ QName attribModuleGuid = new QName("ModuleGuid");\r
+ QName attribModuleVersion = new QName("ModuleVersion");\r
+ QName attribPackageGuid = new QName("PackageGuid");\r
+ QName attribPackageVersion = new QName("PackageVersion");\r
+ QName attribArch = new QName("Arch");\r
+ \r
+ if (cursor.toChild(elementUserExts)) {\r
+ do {\r
+ cursor.push();\r
+ if (cursor.getAttributeText(attribUserId).equals("IMAGES")) {\r
+ cursor.toChild(elementFvName);\r
+ String elementName = cursor.getTextValue();\r
+ if (elementName.equals(fvName)) {\r
+ cursor.toNextSibling(elementIncludeModules);\r
+ if (cursor.toFirstChild()) {\r
+ \r
+ do {\r
+ String mg = cursor.getAttributeText(attribModuleGuid);\r
+ String mv = cursor.getAttributeText(attribModuleVersion);\r
+ String pg = cursor.getAttributeText(attribPackageGuid);\r
+ String pv = cursor.getAttributeText(attribPackageVersion);\r
+ String ar = cursor.getAttributeText(attribArch);\r
+ if (!moduleGuid.equalsIgnoreCase(mg)) {\r
+ continue;\r
+ }\r
+ if (!packageGuid.equalsIgnoreCase(pg)) {\r
+ continue;\r
+ }\r
+ if (!arch.equalsIgnoreCase(ar)) {\r
+ continue;\r
+ }\r
+ if (!versionEqual(moduleVersion, mv)) {\r
+ continue;\r
+ }\r
+ if (!versionEqual(packageVersion, pv)) {\r
+ continue;\r
+ }\r
+ inList = true;\r
+ break;\r
+ }while (cursor.toNextSibling());\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ cursor.pop();\r
+ }while (cursor.toNextSibling(elementUserExts));\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ return inList;\r
+ }\r
+ \r
+ public void removeModuleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {\r
+ if (getUserExtsIncModCount(fvName) > 0) {\r
+ \r
+ XmlCursor cursor = getfpdBuildOpts().newCursor();\r
+ QName elementUserExts = new QName (xmlNs, "UserExtensions");\r
+ QName attribUserId = new QName ("UserID");\r
+ QName elementFvName = new QName (xmlNs, "FvName");\r
+ QName elementIncludeModules = new QName(xmlNs, "IncludeModules");\r
+ QName attribModuleGuid = new QName("ModuleGuid");\r
+ QName attribModuleVersion = new QName("ModuleVersion");\r
+ QName attribPackageGuid = new QName("PackageGuid");\r
+ QName attribPackageVersion = new QName("PackageVersion");\r
+ QName attribArch = new QName("Arch");\r
+ \r
+ if (cursor.toChild(elementUserExts)) {\r
+ do {\r
+ cursor.push();\r
+ if (cursor.getAttributeText(attribUserId).equals("IMAGES")) {\r
+ cursor.toChild(elementFvName);\r
+ String elementName = cursor.getTextValue();\r
+ if (elementName.equals(fvName)) {\r
+ cursor.toNextSibling(elementIncludeModules);\r
+ if (cursor.toFirstChild()) {\r
+ \r
+ do {\r
+ String mg = cursor.getAttributeText(attribModuleGuid);\r
+ String mv = cursor.getAttributeText(attribModuleVersion);\r
+ String pg = cursor.getAttributeText(attribPackageGuid);\r
+ String pv = cursor.getAttributeText(attribPackageVersion);\r
+ String ar = cursor.getAttributeText(attribArch);\r
+ if (!moduleGuid.equalsIgnoreCase(mg)) {\r
+ continue;\r
+ }\r
+ if (!packageGuid.equalsIgnoreCase(pg)) {\r
+ continue;\r
+ }\r
+ if (!arch.equalsIgnoreCase(ar)) {\r
+ continue;\r
+ }\r
+ if (!versionEqual(moduleVersion, mv)) {\r
+ continue;\r
+ }\r
+ if (!versionEqual(packageVersion, pv)) {\r
+ continue;\r
+ }\r
+ cursor.removeXml();\r
+ }while (cursor.toNextSibling());\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ cursor.pop();\r
+ }while (cursor.toNextSibling(elementUserExts));\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ }\r
+ \r
public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) {\r
UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();\r
if (udats == null) {\r
\r
private void setBuildOptionsUserDefAntTask(String id, String fileName, String execOrder, AntTaskDocument.AntTask at) {\r
at.setId(new Integer(id));\r
+ XmlCursor cursor = at.newCursor();\r
if (fileName != null){\r
at.setFilename(fileName);\r
}\r
+ else if (cursor.toChild(xmlNs, "Filename")) {\r
+ cursor.removeXml();\r
+ }\r
if (execOrder != null) {\r
at.setAntCmdOptions(execOrder);\r
}\r
+ else if (cursor.toChild(xmlNs, "AntCmdOptions")) {\r
+ cursor.removeXml();\r
+ }\r
+ cursor.dispose();\r
}\r
\r
public void removeBuildOptionsUserDefAntTask(int i) {\r
\r
private void setBuildOptionsOpt(Vector<Object> buildTargets, String toolChain, String tagName, String toolCmd, Vector<Object> archList, String contents, OptionDocument.Option opt){\r
opt.setStringValue(contents);\r
+ if (buildTargets != null) {\r
+ opt.setBuildTargets(buildTargets);\r
+ }\r
+ else {\r
+ if (opt.isSetBuildTargets()) {\r
+ opt.unsetBuildTargets();\r
+ }\r
+ }\r
+ \r
+ if (toolChain != null && toolChain.length() > 0) {\r
+ opt.setToolChainFamily(toolChain);\r
+ }\r
+ else {\r
+ if (opt.isSetToolChainFamily()) {\r
+ opt.unsetToolChainFamily();\r
+ }\r
+ }\r
+ \r
+ if (tagName != null && tagName.length() > 0) {\r
+ opt.setTagName(tagName);\r
+ }\r
+ else {\r
+ if (opt.isSetTagName()) {\r
+ opt.unsetTagName();\r
+ }\r
+ }\r
+ \r
+ if (toolCmd != null && toolCmd.length() > 0) {\r
+ opt.setToolCode(toolCmd);\r
+ }\r
+ else {\r
+ if (opt.isSetToolCode()) {\r
+ opt.unsetToolCode();\r
+ }\r
+ }\r
\r
- opt.setBuildTargets(buildTargets);\r
- opt.setToolChainFamily(toolChain);\r
- opt.setTagName(tagName);\r
- opt.setToolCode(toolCmd);\r
\r
- opt.setSupArchList(archList);\r
+ if (archList != null) {\r
+ opt.setSupArchList(archList);\r
+ }\r
+ else {\r
+ if (opt.isSetSupArchList()) {\r
+ opt.unsetSupArchList();\r
+ }\r
+ }\r
}\r
\r
public void removeBuildOptionsOpt(int i){\r
}\r
\r
public void setPlatformDefsSupportedArchs(Vector<Object> archs) {\r
- getfpdPlatformDefs().setSupportedArchitectures(archs);\r
+ if (archs != null) {\r
+ getfpdPlatformDefs().setSupportedArchitectures(archs);\r
+ }\r
+// else {\r
+// XmlCursor cursor = getfpdPlatformDefs().newCursor();\r
+// if (cursor.toChild(xmlNs, "SupportedArchitectures")) {\r
+// cursor.removeXml();\r
+// }\r
+// cursor.dispose();\r
+// }\r
}\r
\r
public void getPlatformDefsBuildTargets(Vector<Object> targets) {\r
\r
public void getPlatformDefsSkuInfos(String[][] saa){\r
if (getfpdPlatformDefs().getSkuInfo() == null || getfpdPlatformDefs().getSkuInfo().getUiSkuNameList() == null) {\r
+ if (getfpdDynPcdBuildDefs().getPcdBuildDataList() == null) {\r
+ removeElement(getfpdDynPcdBuildDefs());\r
+ fpdDynPcdBuildDefs = null;\r
+ }\r
return ;\r
}\r
\r
}\r
}\r
\r
+ public void getFvImagesFvImageFvImageNames (Vector<String> vImageNames) {\r
+ FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();\r
+ if (fis == null || fis.getFvImageList() == null) {\r
+ return;\r
+ }\r
+ \r
+ ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();\r
+ while (li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = li.next();\r
+ if (fi.getType().toString().equals("ImageName")) {\r
+ vImageNames.addAll(fi.getFvImageNamesList());\r
+ return;\r
+ }\r
+ }\r
+ }\r
+ \r
+ public void addFvImageFvImageNames (String[] fvNames) {\r
+ FvImagesDocument.FvImages fis = getfpdFlash().getFvImages();\r
+ if (fis == null || fis.getFvImageList() == null) {\r
+ genFvImagesFvImage (fvNames, "ImageName", null);\r
+ return;\r
+ }\r
+ \r
+ ListIterator<FvImagesDocument.FvImages.FvImage> li = fis.getFvImageList().listIterator();\r
+ while (li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = li.next();\r
+ if (fi.getType().toString().equals("ImageName")) {\r
+ addFvImageNamesInFvImage (fi, fvNames);\r
+ return;\r
+ }\r
+ }\r
+ genFvImagesFvImage (fvNames, "ImageName", null); \r
+ }\r
+ \r
+ public void addFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String[] fvNames) {\r
+ \r
+ for (int i = 0; i < fvNames.length; ++i) {\r
+ fi.addFvImageNames(fvNames[i]);\r
+ }\r
+ }\r
+ \r
+ public void addFvImageNamesInFvImage (int i, String[] fvNames) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return;\r
+ }\r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling(qFvImage);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ addFvImageNamesInFvImage(fi, fvNames);\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
public void genFvImagesFvImage(String[] names, String types, Map<String, String> options) {\r
\r
FvImagesDocument.FvImages fis = null;\r
cursor.dispose();\r
}\r
\r
+ /**\r
+ * @param oldFvName\r
+ * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.\r
+ */\r
+ public void updateFvImageNameAll (String oldFvName, String newFvName) {\r
+ if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {\r
+ return;\r
+ }\r
+ ListIterator<FvImagesDocument.FvImages.FvImage> li = getfpdFlash().getFvImages().getFvImageList().listIterator();\r
+ while (li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = li.next();\r
+ updateFvImageNamesInFvImage (fi, oldFvName, newFvName);\r
+ if (fi.getFvImageNamesList().size() == 0) {\r
+ li.remove();\r
+ }\r
+ }\r
+ }\r
+ \r
+ public void updateFvImageNamesInFvImage (int i, String oldFvName, String newFvName) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return;\r
+ }\r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling(qFvImage);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ updateFvImageNamesInFvImage (fi, oldFvName, newFvName);\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ /**\r
+ * @param fi\r
+ * @param oldFvName The FV Name to be replaced.\r
+ * @param newFvName The New FV Name. If null, remove the old FvImageNames entry.\r
+ */\r
+ public void updateFvImageNamesInFvImage (FvImagesDocument.FvImages.FvImage fi, String oldFvName, String newFvName) {\r
+ QName qFvImageNames = new QName(xmlNs, "FvImageNames");\r
+ XmlCursor cursor = fi.newCursor();\r
+ \r
+ if (cursor.toChild(qFvImageNames)) {\r
+ do {\r
+ String xmlValue = cursor.getTextValue();\r
+ if (xmlValue.equals(oldFvName)){\r
+ if (newFvName != null) {\r
+ cursor.setTextValue(newFvName);\r
+ }\r
+ else {\r
+ cursor.removeXml();\r
+ }\r
+ }\r
+ }while (cursor.toNextSibling(qFvImageNames));\r
+ }\r
+ \r
+ cursor.dispose();\r
+ }\r
+ \r
+ /**update the Type attribute of ith FvImage with new type.\r
+ * @param i\r
+ * @param type\r
+ */\r
+ public void updateFvImagesFvImageType (int i, String type) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return;\r
+ }\r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling(qFvImage);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ fi.setType(FvImageTypes.Enum.forString(type));\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
public void updateFvImagesFvImage(int i, String[] names, String types, Map<String, String> options){\r
\r
XmlObject o = getfpdFlash().getFvImages();\r
cursor.dispose();\r
}\r
\r
- public int getFvImagesFvImageCount() {\r
+ public int getFvImagesFvImageCount(String type) {\r
\r
if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {\r
return 0;\r
}\r
- return getfpdFlash().getFvImages().getFvImageList().size();\r
+ List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+ ListIterator li = l.listIterator();\r
+ int i = 0;\r
+ while(li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+ if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+ continue;\r
+ }\r
+ \r
+ ++i;\r
+ }\r
+ \r
+ return i;\r
}\r
\r
- /**Only Get Fv image setting - name and type.\r
+ public Vector<FvImagesDocument.FvImages.FvImage> getFvImagesFvImageWithName (String fvName, String type) {\r
+ Vector<FvImagesDocument.FvImages.FvImage> vFvImage = new Vector<FvImagesDocument.FvImages.FvImage>();\r
+ if (getfpdFlash().getFvImages() == null || getfpdFlash().getFvImages().getFvImageList() == null) {\r
+ return vFvImage;\r
+ }\r
+ List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+ ListIterator li = l.listIterator();\r
+ while(li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+ if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+ continue;\r
+ }\r
+ if (fi.getFvImageNamesList().contains(fvName)) {\r
+ vFvImage.add(fi);\r
+ }\r
+ }\r
+ \r
+ return vFvImage;\r
+ }\r
+ /**\r
* @param saa\r
+ * @param type "ALL" means all FvImage types: ImageName, Options, Attributes, Components.\r
*/\r
- public void getFvImagesFvImages(String[][] saa) {\r
+ public void getFvImagesFvImages(String[][] saa, String type) {\r
\r
if (getfpdFlash().getFvImages() == null) {\r
return;\r
int i = 0;\r
while(li.hasNext()) {\r
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+ if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+ continue;\r
+ }\r
//\r
// get FvImageNames array, space separated\r
//\r
}\r
}\r
\r
+ public void removeFvImageNameValue (int i, String attributeName) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return;\r
+ }\r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling(qFvImage);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ removeFvImageNameValue (fi, attributeName);\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ /**Remove from fi the attribute pair with attributeName in FvImageOptions.\r
+ * @param fi\r
+ * @param attributeName\r
+ */\r
+ public void removeFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String attributeName) {\r
+ if (fi.getFvImageOptions() != null && fi.getFvImageOptions().getNameValueList() != null) {\r
+ ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();\r
+ while (li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();\r
+ if (nv.getName().equals(attributeName)) {\r
+ li.remove();\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
+ public void removeTypedNamedFvImageNameValue (String fvName, String type, String optName) {\r
+ Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName(fvName, type);\r
+ for (int i = 0; i < vFvImage.size(); ++i) {\r
+ FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);\r
+ removeFvImageNameValue (fi, optName);\r
+ }\r
+ }\r
+ \r
+ /**Add name-value pair to FvImage element with type.\r
+ * @param fvName FV name to add name-value pair.\r
+ * @param type FvImage attribute.\r
+ * @param name\r
+ * @param value\r
+ */\r
+ public void setTypedNamedFvImageNameValue (String fvName, String type, String name, String value) {\r
+ boolean fvImageExists = false;\r
+ if (getfpdFlash().getFvImages() == null) {\r
+ return;\r
+ }\r
+ List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+ if (l == null) {\r
+ return;\r
+ }\r
+ ListIterator li = l.listIterator();\r
+ while(li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+ if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+ continue;\r
+ }\r
+ if (!fi.getFvImageNamesList().contains(fvName)) {\r
+ continue;\r
+ }\r
+ fvImageExists = true;\r
+ setFvImagesFvImageNameValue (fi, name, value, null);\r
+ }\r
+ \r
+ if (!fvImageExists) {\r
+ HashMap<String, String> map = new HashMap<String, String>();\r
+ map.put(name, value);\r
+ genFvImagesFvImage(new String[]{fvName}, type, map);\r
+ }\r
+ }\r
+ \r
+ /**Add to all FvImage elements with type, the name-value pair.\r
+ * @param type\r
+ * @param name\r
+ * @param value\r
+ */\r
+ public void setTypedFvImageNameValue (String type, String name, String value) {\r
+ if (getfpdFlash().getFvImages() == null) {\r
+ return;\r
+ }\r
+ List<FvImagesDocument.FvImages.FvImage> l = getfpdFlash().getFvImages().getFvImageList();\r
+ if (l == null) {\r
+ return;\r
+ }\r
+ ListIterator li = l.listIterator();\r
+ while(li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)li.next();\r
+ if (!fi.getType().toString().equals(type) && !type.equals("ALL")) {\r
+ continue;\r
+ }\r
+ setFvImagesFvImageNameValue (fi, name, value, null);\r
+ }\r
+ \r
+ }\r
+ \r
+ public void setFvImagesFvImageNameValue (int i, String name, String value) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return;\r
+ }\r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ for (int j = 0; j < i; ++j) {\r
+ cursor.toNextSibling(qFvImage);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ setFvImagesFvImageNameValue (fi, name, value, null);\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
+ /**Add to FvImage the name-value pair, or replace old name with newName, or generate new name-value pair if not exists before.\r
+ * @param fi\r
+ * @param name\r
+ * @param value\r
+ * @param newName\r
+ */\r
+ public void setFvImagesFvImageNameValue (FvImagesDocument.FvImages.FvImage fi, String name, String value, String newName) {\r
+ if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {\r
+ FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.addNewFvImageOptions().addNewNameValue();\r
+ nv.setName(name);\r
+ nv.setValue(value);\r
+ if (newName != null) {\r
+ nv.setName(newName);\r
+ }\r
+ return;\r
+ }\r
+ \r
+ XmlCursor cursor = fi.getFvImageOptions().newCursor();\r
+ if (cursor.toFirstChild()) {\r
+ do {\r
+ FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = (FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue)cursor.getObject();\r
+ if (nv.getName().equals(name)) {\r
+ nv.setValue(value);\r
+ if (newName != null) {\r
+ nv.setName(newName);\r
+ }\r
+ cursor.dispose();\r
+ return;\r
+ }\r
+ }while (cursor.toNextSibling());\r
+ }\r
+ \r
+ FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = fi.getFvImageOptions().addNewNameValue();\r
+ nv.setName(name);\r
+ nv.setValue(value);\r
+ if (newName != null) {\r
+ nv.setName(newName);\r
+ }\r
+ cursor.dispose();\r
+ }\r
+ \r
+ public void getFvImagesFvImageOptions (String fvName, Map<String, String> m) {\r
+ Vector<FvImagesDocument.FvImages.FvImage> vFvImage = getFvImagesFvImageWithName (fvName, "Options");\r
+ for (int i = 0; i < vFvImage.size(); ++i) {\r
+ FvImagesDocument.FvImages.FvImage fi = vFvImage.get(i);\r
+ if (fi == null || fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null) {\r
+ continue;\r
+ }\r
+\r
+ ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions()\r
+ .getNameValueList()\r
+ .listIterator();\r
+ while (li.hasNext()) {\r
+ FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue nv = li.next();\r
+ m.put(nv.getName(), nv.getValue());\r
+ }\r
+ }\r
+ }\r
+ \r
+ public int getFvImagePosInFvImages (String fvNameList, String type) {\r
+ XmlObject o = getfpdFlash().getFvImages();\r
+ if (o == null) {\r
+ return -1;\r
+ }\r
+ \r
+ int pos = -1;\r
+ String[] fvNameArray = fvNameList.trim().split(" ");\r
+ Vector<String> vFvNames = new Vector<String>();\r
+ \r
+ \r
+ XmlCursor cursor = o.newCursor();\r
+ QName qFvImage = new QName(xmlNs, "FvImage");\r
+ if (cursor.toChild(qFvImage)) {\r
+ do {\r
+ pos++;\r
+ vFvNames.removeAllElements();\r
+ for (int i = 0; i < fvNameArray.length; ++i) {\r
+ vFvNames.add(fvNameArray[i]);\r
+ }\r
+ FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
+ if (!fi.getType().toString().equals(type)) {\r
+ continue;\r
+ }\r
+ if (fi.getFvImageNamesList() == null || fi.getFvImageNamesList().size() != vFvNames.size()) {\r
+ continue;\r
+ }\r
+ ListIterator<String> li = fi.getFvImageNamesList().listIterator();\r
+ while (li.hasNext()) {\r
+ String name = li.next();\r
+ vFvNames.remove(name);\r
+ }\r
+ if (vFvNames.size() == 0) {\r
+ cursor.dispose();\r
+ return pos;\r
+ }\r
+ \r
+ }while (cursor.toNextSibling(qFvImage));\r
+ \r
+ }\r
+ cursor.dispose();\r
+ return -1;\r
+ }\r
/**Get FvImage Options for FvImage i\r
* @param i the ith FvImage\r
*/\r
}\r
FvImagesDocument.FvImages.FvImage fi = (FvImagesDocument.FvImages.FvImage)cursor.getObject();\r
if (fi.getFvImageOptions() == null || fi.getFvImageOptions().getNameValueList() == null){\r
+ cursor.dispose();\r
return;\r
}\r
ListIterator<FvImagesDocument.FvImages.FvImage.FvImageOptions.NameValue> li = fi.getFvImageOptions().getNameValueList().listIterator();\r
m.put(nv.getName(), nv.getValue());\r
}\r
}\r
+ cursor.dispose();\r
}\r
\r
/**\r
if (fpdHdr == null) {\r
fpdHdr = fpdRoot.addNewPlatformHeader();\r
}\r
- genPlatformDefsSkuInfo("0", "DEFAULT");\r
+ \r
return fpdHdr;\r
}\r
\r
\r
public String getFpdHdrSpec() {\r
\r
- return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r
+ return "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r
// return getFpdHdr().getSpecification();\r
}\r
\r
}\r
\r
public void setFpdHdrSpec(String s){\r
- s = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r
+ s = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";\r
getFpdHdr().setSpecification(s);\r
}\r
/**\r
}\r
return s.trim();\r
}\r
+ \r
+ private void removeElement(XmlObject o) {\r
+ XmlCursor cursor = o.newCursor();\r
+ cursor.removeXml();\r
+ cursor.dispose();\r
+ }\r
}\r
\r
class PcdItemTypeConflictException extends Exception {\r
private static final long serialVersionUID = 1L;\r
private String details = null;\r
\r
- PcdItemTypeConflictException(String info){\r
- details = info;\r
+ PcdItemTypeConflictException(String pcdName, String info){\r
+ ModuleIdentification mi = WorkspaceProfile.getModuleId(info);\r
+ details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackageId().getName();\r
}\r
\r
public String getMessage() {\r
private String details = null;\r
\r
PcdDeclNotFound(String info) {\r
- details = info;\r
+ details = "PcdDeclNotFound: " + info;\r
}\r
\r
public String getMessage() {\r
private String details = null;\r
\r
PcdValueMalFormed(String info) {\r
- details = info;\r
+ details = "PcdValueMalFormed: " + info;\r
}\r
\r
public String getMessage() {\r