X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FJava%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2FFpdFileContents.java;h=d8dfb279ba59f2228a4fce57ceb13b79fb57ad91;hp=130b625e753a22606fc21ee5a8ac67395be600d6;hb=ceea362ed6c5e41ce78fbf8b9da8428c7f794136;hpb=d73991a143dc3200a47b50ecfd184ee43ede7900 diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index 130b625e75..d8dfb279ba 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -62,6 +62,7 @@ import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile; import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery; import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; import org.tianocore.frameworkwizard.packaging.PackageIdentification; +import org.tianocore.frameworkwizard.workspace.Workspace; /** This class processes fpd file contents such as add remove xml elements. @@ -383,7 +384,7 @@ public class FpdFileContents { cursor.dispose(); } - public boolean adjustPcd (int seqModuleSa) throws Exception { + public boolean adjustPcd (int seqModuleSa, Vector vExceptions) throws Exception { boolean dataModified = false; ModuleSADocument.ModuleSA moduleSa = getModuleSA(seqModuleSa); int pcdCount = getPcdDataCount(seqModuleSa); @@ -403,6 +404,7 @@ public class FpdFileContents { getLibraryInstances(moduleKey, saaLib); ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey); if (mi == null) { + vExceptions.add("Module " + mg + " does NOT exist in workspace."); throw new Exception ("Module does NOT exist in workspace."); } Vector vMi = new Vector(); @@ -413,7 +415,9 @@ public class FpdFileContents { for (int j = 0; j < saaLib.length; ++j) { String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4]; ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey); - vMi.add(libMi); + if (libMi != null) { + vMi.add(libMi); + } } nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) { @@ -423,7 +427,7 @@ public class FpdFileContents { if (nextMi == null) { continue; } - if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], nextMi)) { + if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], arch, nextMi)) { continue nextPcd; } } @@ -451,6 +455,13 @@ public class FpdFileContents { } } } + // Check sup arch conformance for the new PCD + if (msaPcd.getSupArchList() != null) { + String newPcdArch = msaPcd.getSupArchList().toString(); + if (!newPcdArch.toLowerCase().contains(arch.toLowerCase())) { + continue; + } + } PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, vMi.get(i)); PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs); @@ -458,8 +469,13 @@ public class FpdFileContents { // // ToDo Error // - throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module " - + mi.getName()); + String errorMessage = "No Declaration for PCD Entry " + msaPcd.getCName() + " in Module " + + mi.getName(); + if (i != 0) { + errorMessage += " Library Instance " + vMi.get(i).getName(); + } + vExceptions.add(errorMessage); + throw new PcdDeclNotFound(errorMessage); } // // AddItem to ModuleSA PcdBuildDefinitions @@ -677,7 +693,7 @@ public class FpdFileContents { int pcdSourceCount = 0; for (int i = 0; i < vMi.size(); ++i) { - if (WorkspaceProfile.pcdInMsa(cName, tsGuidCName, vMi.get(i))) { + if (WorkspaceProfile.pcdInMsa(cName, tsGuidCName, null, vMi.get(i))) { pcdSourceCount++; } } @@ -821,7 +837,7 @@ public class FpdFileContents { XmlCursor cursor = instance.newCursor(); try{ String comment = "Pkg: " + pn + " Mod: " + mn - + " Path: " + libMi.getPath().substring(System.getenv("WORKSPACE").length() + 1); + + " Path: " + libMi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1); cursor.insertComment(comment); } catch (Exception e){ @@ -1170,13 +1186,18 @@ public class FpdFileContents { ListIterator li = l.listIterator(); while (li.hasNext()) { PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry) li.next(); + if (msaPcd.getSupArchList() != null) { + if (!msaPcd.getSupArchList().toString().toLowerCase().contains(arch.toLowerCase())) { + continue; + } + } PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs); if (spdPcd == null) { // // ToDo Error // - throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module " - + mi.getName()); + throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + "\n used by Module " + + mi.getName() + " or its Library Instances."); } // // AddItem to ModuleSA PcdBuildDefinitions @@ -1224,7 +1245,7 @@ public class FpdFileContents { XmlCursor cursor = msa.newCursor(); try{ String comment = "Mod: " + mi.getName() + " Type: " + SurfaceAreaQuery.getModuleType(mi) + " Path: " - + mi.getPath().substring(System.getenv("WORKSPACE").length() + 1); + + mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1); cursor.insertComment(comment); } catch(Exception e){ @@ -1337,7 +1358,7 @@ public class FpdFileContents { fpdPcd.setDatumType(PcdDataTypes.Enum.forString(dataType)); fpdPcd.setItemType(PcdItemTypes.Enum.forString(itemType)); - if (defaultVal != null){ + if (defaultVal != null && defaultVal.length() > 0){ fpdPcd.setValue(defaultVal); } else { @@ -1348,7 +1369,7 @@ public class FpdFileContents { fpdPcd.setValue("FALSE"); } if (dataType.equals("VOID*")) { - fpdPcd.setValue(""); + fpdPcd.setValue("L\"\""); } } // @@ -1499,7 +1520,7 @@ public class FpdFileContents { saa[i][1] = dynPcd.getToken().toString(); saa[i][2] = dynPcd.getTokenSpaceGuidCName(); saa[i][3] = dynPcd.getMaxDatumSize()+""; - saa[i][4] = dynPcd.getDatumType().toString(); + saa[i][4] = dynPcd.getDatumType()+""; ++i; } @@ -1724,9 +1745,10 @@ public class FpdFileContents { return; } else { - QName qSkuInfo = new QName(xmlNs, "SkuInfo"); - cursor.toChild(qSkuInfo); - cursor.removeXml(); + pcdData.getSkuInfoList().clear(); +// QName qSkuInfo = new QName(xmlNs, "SkuInfo"); +// cursor.toChild(qSkuInfo); +// cursor.removeXml(); } } cursor.dispose(); @@ -1814,7 +1836,7 @@ public class FpdFileContents { UserExtensionsDocument.UserExtensions userExts = getfpdBuildOpts().addNewUserExtensions(); userExts.setUserID(userId); - userExts.setIdentifier(new BigInteger(id)); + userExts.setIdentifier(id); XmlCursor cursor = userExts.newCursor(); cursor.toEndToken(); @@ -1857,7 +1879,7 @@ public class FpdFileContents { if (!ues.getUserID().equals(userId)) { continue; } - if (ues.getIdentifier() == null || ues.getIdentifier().intValue() != id) { + if (ues.getIdentifier() == null || ues.getIdentifier() != new Integer(id).toString()) { continue; } XmlCursor cursor = ues.newCursor(); @@ -1957,7 +1979,7 @@ public class FpdFileContents { if (!ues.getUserID().equals(userId)) { continue; } - if (ues.getIdentifier()== null || ues.getIdentifier().intValue() != id) { + if (ues.getIdentifier()== null || ues.getIdentifier() != new Integer(id).toString()) { continue; } XmlCursor cursor = ues.newCursor(); @@ -2129,7 +2151,7 @@ public class FpdFileContents { if (!ues.getUserID().equals(userId)) { continue; } - if (ues.getIdentifier() == null || ues.getIdentifier().intValue() != id) { + if (ues.getIdentifier() == null || ues.getIdentifier() != new Integer(id).toString()) { continue; } XmlCursor cursor = ues.newCursor(); @@ -2391,10 +2413,8 @@ public class FpdFileContents { } public void updateBuildOptionsFfsSectionsType(int i, String type) { - BuildOptionsDocument.BuildOptions.Ffs ffs = getfpdBuildOpts().addNewFfs(); - if (type != null) { - ffs.addNewSections().setEncapsulationType(type); - } + BuildOptionsDocument.BuildOptions.Ffs ffs = getFfs(i); + ffs.getSections().setEncapsulationType(type); } public void genBuildOptionsFfsAttribute(int i, String name, String value) { @@ -3695,10 +3715,10 @@ class PcdItemTypeConflictException extends Exception { PcdItemTypeConflictException (String pcdName, String info) { ModuleIdentification mi = WorkspaceProfile.getModuleId(info); if (mi != null) { - details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackageId().getName(); + details = pcdName + " ItemType Conflicts with " + mi.getName() + "\n in Pkg " + mi.getPackageId().getName(); } else { - details = pcdName + " ItemType Conflicts with " + info; + details = pcdName + " ItemType Conflicts with \n" + info; } } @@ -3721,7 +3741,7 @@ class PcdItemTypeConflictException extends Exception { moduleInfo2 = info2; } - details = pcdName + " ItemType Conflicts in " + moduleInfo1 + " and " + moduleInfo2; + details = pcdName + " ItemType Conflicts in \n" + moduleInfo1 + "\n and " + moduleInfo2; } public String getMessage() {