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
\r
private HashMap<String, ArrayList<String>> dynPcdMap = null;\r
\r
+ private HashMap<String, String> defaultPcdValue = new HashMap<String, String>();\r
+ \r
/**\r
* look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings.\r
*/\r
return fpdFrameworkModules;\r
}\r
\r
+ public void getFrameworkModuleGuid (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
+ if (fvNames[i].equals(fvName) || fvNames[i].replaceAll("_", "").equals(fvName)) {\r
+ vGuid.add(moduleSa.getModuleGuid());\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ \r
public int getFrameworkModulesCount() {\r
if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){\r
removeElement(getfpdFrameworkModules());\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][0] = msa.getModuleGuid();\r
- saa[i][1] = 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][2] = msa.getPackageGuid();\r
- saa[i][3] = 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
int libCount = getLibraryInstancesCount(moduleKey);\r
String[][] saaLib = new String[libCount][5];\r
getLibraryInstances(moduleKey, saaLib);\r
- ModuleIdentification mi = GlobalData.getModuleId(moduleKey);\r
+ ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);\r
Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();\r
vMi.add(mi);\r
try {\r
nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {\r
- if (GlobalData.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], mi)){\r
+ if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], mi)){\r
continue;\r
}\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 = GlobalData.getModuleId(libKey);\r
+ ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);\r
vMi.add(libMi);\r
- if (GlobalData.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], libMi)) {\r
+ if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], libMi)) {\r
continue nextPcd;\r
}\r
}\r
try {\r
\r
for (int i = 0; i < vMi.size(); ++i) {\r
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) GlobalData\r
+ ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile\r
.getModuleXmlObject(vMi\r
.get(i));\r
if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {\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, vMi.get(i));\r
PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);\r
if (spdPcd == null) {\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
pcdData.setMaxDatumSize(new Integer(maxSize));\r
}\r
pcdData.setValue(value);\r
+ defaultPcdValue.put(cName + " " + tsGuid, value);\r
break;\r
}\r
}\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
*/\r
public void removePcdData(String moduleKey, ModuleIdentification consumer) {\r
try {\r
- ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(consumer);\r
+ ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(consumer);\r
if (msa.getPcdCoded() == null) {\r
return;\r
}\r
if (moduleSA.getPcdBuildDefinition() != null) {\r
XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();\r
if (cursor.toFirstChild()) {\r
- PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor\r
- .getObject();\r
- if (msaPcd.getCName().equals(pcdData.getCName())\r
- && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {\r
-\r
- maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleKey);\r
- cursor.removeXml();\r
- break;\r
- }\r
- while (cursor.toNextSibling()) {\r
- pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor.getObject();\r
+ do {\r
+ PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor\r
+ .getObject();\r
if (msaPcd.getCName().equals(pcdData.getCName())\r
&& msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {\r
+\r
maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(),\r
moduleKey);\r
cursor.removeXml();\r
break;\r
}\r
- }\r
+ } while (cursor.toNextSibling());\r
}\r
cursor.dispose();\r
}\r
String mn = libMi.getName();\r
String mg = libMi.getGuid();\r
String mv = libMi.getVersion();\r
- String pn = libMi.getPackage().getName();\r
- String pg = libMi.getPackage().getGuid();\r
- String pv = libMi.getPackage().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: " + GlobalData.getMsaFile(libMi).getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
+ + " Path: " + libMi.getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
cursor.insertComment(comment);\r
}\r
catch (Exception e){\r
return msa.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
+ 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 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 (ModuleIdentification mi, String fvName) {\r
+ Vector<Object> vSupArchs = new Vector<Object>();\r
+ getPlatformDefsSupportedArchs(vSupArchs);\r
+ String moduleInfo = mi.getGuid() + " " + mi.getVersion() + " " + mi.getPackageId().getGuid() + " " + mi.getPackageId().getVersion();\r
+ for (int i = 0; i < vSupArchs.size(); ++i) {\r
+ String moduleKey = moduleInfo + " " + vSupArchs.get(i);\r
+ appendFvBinding (moduleKey, fvName);\r
+ }\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
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 == null || msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null\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
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
}\r
\r
private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {\r
- PackageIdentification pi = GlobalData.getPackageForModule(mi);\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: " + mi.getModuleType() + " Path: "\r
- + GlobalData.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1);\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
if (pcdConsumer == null) {\r
pcdConsumer = new ArrayList<String>();\r
}\r
+ //\r
+ // Using existing Pcd type, if this pcd already exists in other ModuleSA\r
+ //\r
+ if (pcdConsumer.size() > 0) {\r
+ String[] valPart = pcdConsumer.get(0).split(" ");\r
+ itemType = valPart[5];\r
+ }\r
String listValue = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() \r
+ " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList())\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
- //\r
- /* Comment out Item type checking temporarily.\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[5].equals("DYNAMIC")) {\r
- //ToDo error for same pcd, other type than dynamic\r
- pcdConsumer.remove(listValue);\r
- throw new PcdItemTypeConflictException(cName, value);\r
- }\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[5].equals("DYNAMIC")) {\r
- //ToDo error for same pcd, other type than non-dynamic\r
- pcdConsumer.remove(listValue);\r
- throw new PcdItemTypeConflictException(cName, value);\r
- }\r
- }\r
- }\r
- */\r
+ \r
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData fpdPcd = moduleSa.getPcdBuildDefinition().addNewPcdData();\r
fpdPcd.setCName(cName);\r
fpdPcd.setToken(token);\r
fpdPcd.setValue("0");\r
}\r
if (dataType.equals("BOOLEAN")){\r
- fpdPcd.setValue("false");\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
addDynamicPcdBuildData(cName, token, tsGuid, itemType, dataType, defaultVal);\r
}\r
}\r
- else {\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
- 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
\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
return fpdBuildOpts;\r
}\r
\r
+ public void genBuildOptionsUserExtensions(String fvName, String outputFileName, Vector<String[]> includeModules) {\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("FvName");\r
+ cursor.insertChars(fvName);\r
+ cursor.toNextToken();\r
+ \r
+ cursor.beginElement("InfFileName");\r
+ cursor.insertChars(fvName + ".inf");\r
+ cursor.toNextToken();\r
+ \r
+ cursor.beginElement("IncludeModules");\r
+ for (int i = 0; i < includeModules.size(); ++i) {\r
+ cursor.beginElement("Module");\r
+ cursor.insertAttributeWithValue("ModuleGuid", includeModules.get(i)[0]);\r
+ cursor.insertAttributeWithValue("BaseName", includeModules.get(i)[1]);\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
+ 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(new QName("", "IncludeModules"));\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
+ 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.toNextSibling(new QName("", "IncludeModules"));\r
+ if (cursor.toFirstChild()) {\r
+ int i = 0;\r
+ do {\r
+ saa[i][0] = cursor.getAttributeText(new QName("ModuleGuid"));\r
+ saa[i][1] = cursor.getAttributeText(new QName("BaseName"));\r
+ ++i;\r
+ }while (cursor.toNextSibling());\r
+ }\r
+ cursor.dispose();\r
+ return;\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
+ \r
public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) {\r
UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();\r
if (udats == null) {\r
private String details = null;\r
\r
PcdItemTypeConflictException(String pcdName, String info){\r
- ModuleIdentification mi = GlobalData.getModuleId(info);\r
- details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackage().getName();\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