X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fplatform%2Fui%2FFpdFileContents.java;h=e60426446fbe826b66cf251432da64e9b5db78e4;hp=096fec5810359f1e9f28fef6be36ab82c2db299a;hb=61919f8cfa2cdd6a965928933844a91d7aa69626;hpb=a70d444e06ead96652431b6667bcc84a99e9b4e9 diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index 096fec5810..e60426446f 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -60,8 +60,8 @@ import org.tianocore.UserDefinedAntTasksDocument; import org.tianocore.UserExtensionsDocument; import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile; import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery; -import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification; -import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification; +import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; +import org.tianocore.frameworkwizard.packaging.PackageIdentification; /** This class processes fpd file contents such as add remove xml elements. @@ -184,6 +184,32 @@ public class FpdFileContents { return fpdFrameworkModules; } + public void getFrameworkModuleGuid (String fvName, Vector vGuid) { + if (getFrameworkModulesCount() == 0){ + return; + } + + ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator(); + while(li.hasNext()) { + ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next(); + if (moduleSa.getModuleSaBuildOptions() == null) { + continue; + } + String fvBinding = moduleSa.getModuleSaBuildOptions().getFvBinding(); + if (fvBinding == null) { + continue; + } + + String[] fvNames = fvBinding.split(" "); + for (int i = 0; i < fvNames.length; ++i) { + if (fvNames[i].equals(fvName) || fvNames[i].replaceAll("_", "").equals(fvName)) { + vGuid.add(moduleSa.getModuleGuid()); + break; + } + } + } + } + public int getFrameworkModulesCount() { if (getfpdFrameworkModules().getModuleSAList() == null || getfpdFrameworkModules().getModuleSAList().size() == 0){ removeElement(getfpdFrameworkModules()); @@ -201,13 +227,13 @@ public class FpdFileContents { ListIterator li = getfpdFrameworkModules().getModuleSAList().listIterator(); int i = 0; while(li.hasNext()) { - ModuleSADocument.ModuleSA msa = (ModuleSADocument.ModuleSA)li.next(); - saa[i][0] = msa.getModuleGuid(); - saa[i][1] = msa.getModuleVersion(); + ModuleSADocument.ModuleSA moduleSa = (ModuleSADocument.ModuleSA)li.next(); + saa[i][0] = moduleSa.getModuleGuid(); + saa[i][1] = moduleSa.getModuleVersion(); - saa[i][2] = msa.getPackageGuid(); - saa[i][3] = msa.getPackageVersion(); - saa[i][4] = listToString(msa.getSupArchList()); + saa[i][2] = moduleSa.getPackageGuid(); + saa[i][3] = moduleSa.getPackageVersion(); + saa[i][4] = listToString(moduleSa.getSupArchList()); ++i; } } @@ -702,14 +728,14 @@ public class FpdFileContents { String mn = libMi.getName(); String mg = libMi.getGuid(); String mv = libMi.getVersion(); - String pn = libMi.getPackage().getName(); - String pg = libMi.getPackage().getGuid(); - String pv = libMi.getPackage().getVersion(); + String pn = libMi.getPackageId().getName(); + String pg = libMi.getPackageId().getGuid(); + String pv = libMi.getPackageId().getVersion(); LibrariesDocument.Libraries.Instance instance = libs.addNewInstance(); XmlCursor cursor = instance.newCursor(); try{ String comment = "Pkg: " + pn + " Mod: " + mn - + " Path: " + WorkspaceProfile.getMsaFile(libMi).getPath().substring(System.getenv("WORKSPACE").length() + 1); + + " Path: " + libMi.getPath().substring(System.getenv("WORKSPACE").length() + 1); cursor.insertComment(comment); } catch (Exception e){ @@ -739,11 +765,18 @@ public class FpdFileContents { if (msa == null ) { return; } - if(msa.getModuleSaBuildOptions() == null){ - msa.addNewModuleSaBuildOptions().setFvBinding(fvBinding); - return; + if (fvBinding == null || fvBinding.length() == 0) { + if(msa.getModuleSaBuildOptions() != null){ + msa.getModuleSaBuildOptions().unsetFvBinding(); + } + } + else { + if(msa.getModuleSaBuildOptions() == null){ + msa.addNewModuleSaBuildOptions().setFvBinding(fvBinding); + return; + } + msa.getModuleSaBuildOptions().setFvBinding(fvBinding); } - msa.getModuleSaBuildOptions().setFvBinding(fvBinding); } public String getFfsFileNameGuid(String moduleKey){ @@ -947,12 +980,10 @@ public class FpdFileContents { private PcdDeclarationsDocument.PcdDeclarations.PcdEntry LookupPcdDeclaration (PcdCodedDocument.PcdCoded.PcdEntry msaPcd, PackageIdentification[] depPkgs) { - Map m = new HashMap(); PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = null; for (int i = 0; i < depPkgs.length; ++i) { - m.put("PackageSurfaceArea", WorkspaceProfile.getPackageXmlObject(depPkgs[i])); - SurfaceAreaQuery.setDoc(m); - XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations(); + + XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations(depPkgs[i]); if (xo == null) { continue; } @@ -980,8 +1011,8 @@ public class FpdFileContents { ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA(); XmlCursor cursor = msa.newCursor(); try{ - String comment = "Mod: " + mi.getName() + " Type: " + mi.getModuleType() + " Path: " - + WorkspaceProfile.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1); + String comment = "Mod: " + mi.getName() + " Type: " + SurfaceAreaQuery.getModuleType(mi) + " Path: " + + mi.getPath().substring(System.getenv("WORKSPACE").length() + 1); cursor.insertComment(comment); } catch(Exception e){ @@ -1498,7 +1529,7 @@ public class FpdFileContents { return fpdBuildOpts; } - public void genBuildOptionsUserExtensions(String fvName, String infName, String outputFileName, String[][] includeModules) { + public void genBuildOptionsUserExtensions(String fvName, String outputFileName, String[][] includeModules) { UserExtensionsDocument.UserExtensions userExts = getfpdBuildOpts().addNewUserExtensions(); userExts.setUserID("IMAGES"); userExts.setIdentifier(new BigInteger("1")); @@ -1510,7 +1541,7 @@ public class FpdFileContents { cursor.toNextToken(); cursor.beginElement("InfFileName"); - cursor.insertChars(infName); + cursor.insertChars(fvName + ".inf"); cursor.toNextToken(); cursor.beginElement("IncludeModules"); @@ -1584,6 +1615,32 @@ public class FpdFileContents { } + public void removeBuildOptionsUserExtensions (String fvName) { + if (getfpdBuildOpts().getUserExtensionsList() == null) { + return; + } + + ListIterator li = getfpdBuildOpts().getUserExtensionsList().listIterator(); + while (li.hasNext()) { + UserExtensionsDocument.UserExtensions ues = li.next(); + if (!ues.getUserID().equals("IMAGES")) { + continue; + } + XmlCursor cursor = ues.newCursor(); + cursor.toFirstChild(); + String elementName = cursor.getTextValue(); + if (elementName.equals(fvName)) { + cursor.toParent(); + cursor.removeXml(); + cursor.dispose(); + return; + } + cursor.dispose(); + } + + } + + public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) { UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks(); if (udats == null) { @@ -2693,7 +2750,7 @@ class PcdItemTypeConflictException extends Exception { PcdItemTypeConflictException(String pcdName, String info){ ModuleIdentification mi = WorkspaceProfile.getModuleId(info); - details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackage().getName(); + details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackageId().getName(); } public String getMessage() {