import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
+import org.tianocore.frameworkwizard.workspace.Workspace;\r
\r
/**\r
This class processes fpd file contents such as add remove xml elements. \r
cursor.dispose();\r
}\r
\r
- public boolean adjustPcd (int seqModuleSa) throws Exception {\r
+ public boolean adjustPcd (int seqModuleSa, Vector<String> vExceptions) throws Exception {\r
boolean dataModified = false;\r
ModuleSADocument.ModuleSA moduleSa = getModuleSA(seqModuleSa);\r
int pcdCount = getPcdDataCount(seqModuleSa);\r
getLibraryInstances(moduleKey, saaLib);\r
ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);\r
if (mi == null) {\r
+ vExceptions.add("Module " + mg + " does NOT exist in workspace.");\r
throw new Exception ("Module does NOT exist in workspace.");\r
}\r
Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();\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
+ if (libMi != null) {\r
+ vMi.add(libMi);\r
+ }\r
}\r
\r
nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {\r
//\r
// ToDo Error \r
//\r
- throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "\r
- + mi.getName());\r
+ String errorMessage = "No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "\r
+ + mi.getName();\r
+ if (i != 0) {\r
+ errorMessage += " Library Instance " + vMi.get(i).getName(); \r
+ }\r
+ vExceptions.add(errorMessage);\r
+ throw new PcdDeclNotFound(errorMessage);\r
}\r
//\r
// AddItem to ModuleSA PcdBuildDefinitions\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
+ + " Path: " + libMi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);\r
cursor.insertComment(comment);\r
}\r
catch (Exception e){\r
//\r
// ToDo Error \r
//\r
- throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module "\r
- + mi.getName());\r
+ throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + "\n used by Module "\r
+ + mi.getName() + " or its Library Instances.");\r
}\r
//\r
// AddItem to ModuleSA PcdBuildDefinitions\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
+ + mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1);\r
cursor.insertComment(comment);\r
}\r
catch(Exception e){\r
fpdPcd.setDatumType(PcdDataTypes.Enum.forString(dataType));\r
fpdPcd.setItemType(PcdItemTypes.Enum.forString(itemType));\r
\r
- if (defaultVal != null){\r
+ if (defaultVal != null && defaultVal.length() > 0){\r
fpdPcd.setValue(defaultVal);\r
}\r
else {\r
fpdPcd.setValue("FALSE");\r
}\r
if (dataType.equals("VOID*")) {\r
- fpdPcd.setValue("");\r
+ fpdPcd.setValue("L\"\"");\r
}\r
}\r
//\r
saa[i][1] = dynPcd.getToken().toString();\r
saa[i][2] = dynPcd.getTokenSpaceGuidCName();\r
saa[i][3] = dynPcd.getMaxDatumSize()+"";\r
- saa[i][4] = dynPcd.getDatumType().toString();\r
+ saa[i][4] = dynPcd.getDatumType()+"";\r
\r
++i;\r
}\r
return;\r
}\r
else {\r
- QName qSkuInfo = new QName(xmlNs, "SkuInfo");\r
- cursor.toChild(qSkuInfo);\r
- cursor.removeXml();\r
+ pcdData.getSkuInfoList().clear();\r
+// QName qSkuInfo = new QName(xmlNs, "SkuInfo");\r
+// cursor.toChild(qSkuInfo);\r
+// cursor.removeXml();\r
}\r
}\r
cursor.dispose();\r
PcdItemTypeConflictException (String pcdName, String info) {\r
ModuleIdentification mi = WorkspaceProfile.getModuleId(info);\r
if (mi != null) {\r
- details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackageId().getName(); \r
+ details = pcdName + " ItemType Conflicts with " + mi.getName() + "\n in Pkg " + mi.getPackageId().getName(); \r
}\r
else {\r
- details = pcdName + " ItemType Conflicts with " + info;\r
+ details = pcdName + " ItemType Conflicts with \n" + info;\r
}\r
}\r
\r
moduleInfo2 = info2;\r
}\r
\r
- details = pcdName + " ItemType Conflicts in " + moduleInfo1 + " and " + moduleInfo2;\r
+ details = pcdName + " ItemType Conflicts in \n" + moduleInfo1 + "\n and " + moduleInfo2;\r
}\r
\r
public String getMessage() {\r