X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Tools%2FJava%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fworkspace%2FWorkspaceTools.java;h=a90ec26955e5d24908af82ae8a0d78ce962adec2;hb=0c61f948b21d7624c22685a29740db130471aa58;hp=4e40d59efc16f54fd5d0db2018ae14ba5be93434;hpb=feccee87a78e68d575dbdf44b34ca0cb5a21ea8d;p=mirror_edk2.git diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java index 4e40d59efc..a90ec26955 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java @@ -23,6 +23,8 @@ import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlException; import org.tianocore.DbPathAndFilename; import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes; +import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations; +import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions; import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea; import org.tianocore.MsaFilesDocument.MsaFiles; import org.tianocore.PackageDependenciesDocument.PackageDependencies; @@ -37,6 +39,7 @@ import org.tianocore.frameworkwizard.common.SaveFile; import org.tianocore.frameworkwizard.common.Sort; import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.Identifications.Identification; +import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType; import org.tianocore.frameworkwizard.far.FarHeader; import org.tianocore.frameworkwizard.far.FarIdentification; import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; @@ -217,6 +220,32 @@ public class WorkspaceTools { return GlobalData.vPackageList; } + /** + Get all package which match parameter isRepackagable + + @param isRepackagable + @return + + **/ + public Vector getAllRepackagbalePackages() { + Vector v = new Vector(); + for (int index = 0; index < GlobalData.openingPackageList.size(); index++) { + OpeningPackageType opt = GlobalData.openingPackageList.getOpeningPackageByIndex(index); + if (opt.getXmlSpd() != null) { + if (opt.getXmlSpd().getPackageDefinitions() != null) { + if (opt.getXmlSpd().getPackageDefinitions().getRePackage()) { + v.addElement(opt.getId()); + } + } else { + v.addElement(opt.getId()); + } + } else { + v.addElement(opt.getId()); + } + } + return v; + } + public Vector getAllFars() { Vector v = new Vector(); @@ -456,7 +485,31 @@ public class WorkspaceTools { String help = spd.getPcdDeclarations().getPcdEntryList().get(index).getHelpText(); Vector type = Tools.convertListToVector(spd.getPcdDeclarations().getPcdEntryList() .get(index).getValidUsage()); - + // + // The algorithm for PCD of msa should be: + // 1. If the type of PCD from Spd is FEATURE_FLAG, + // the type of Msa only can be FEATURE_FLAG. + // 2. If the type of PCD from Spd is not FEATURE_FLAG, + // the type of Msa could be selected from the PCD's all types and "DYNAMIC" type. + // + boolean hasFEATURE_FLAG = false; + boolean hasDYNAMIC = false; + for (int indexOfType = 0; indexOfType < type.size(); indexOfType++) { + if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_DYNAMIC)) { + hasDYNAMIC = true; + } + if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) { + hasFEATURE_FLAG = true; + } + } + if (hasFEATURE_FLAG) { + type.removeAllElements(); + type.addElement(DataType.PCD_ITEM_TYPE_FEATURE_FLAG); + } else { + if (!hasDYNAMIC) { + type.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC); + } + } vector.addPcd(new PcdIdentification(name, guidCName, help, type)); } } @@ -640,10 +693,11 @@ public class WorkspaceTools { // // Check id // - if (mid.equals(id)) { - return GlobalData.vPackageList.elementAt(indexI); + if (mid != null) { + if (mid.equals(id)) { + return GlobalData.vPackageList.elementAt(indexI); + } } - } } @@ -676,6 +730,10 @@ public class WorkspaceTools { msaFile.setFilenameArray(msaFile.getFilenameList().size() - 1, fn); spd.setMsaFiles(msaFile); SaveFile.saveSpdFile(mid.getPackageId().getPath(), spd); + // + // Update GlobalData + // + GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId()).setMsaFiles(msaFile); } /** @@ -733,10 +791,18 @@ public class WorkspaceTools { public Vector getAllFilesPathOfModule(String path) { Vector v = new Vector(); path = Tools.convertPathToCurrentOsType(path); + + // + // First add msa file's path + // v.addElement(path); + ModuleSurfaceArea msa = GlobalData.openingModuleList .getModuleSurfaceAreaFromId(GlobalData.openingModuleList .getIdByPath(path)); + // + // Get common defined files of module + // if (msa != null) { // // Get all files' path of a module @@ -751,6 +817,35 @@ public class WorkspaceTools { } } + // + // Get include header files for this module + // + if (msa.getLibraryClassDefinitions() != null) { + LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions(); + for (int index = 0; index < lcd.sizeOfLibraryClassArray(); index++) { + if (lcd.getLibraryClassList().get(index).getUsage().toString() + .equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED) + || lcd.getLibraryClassList().get(index).getUsage().toString() + .equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) { + // + // Get library class name + // + String name = lcd.getLibraryClassList().get(index).getKeyword(); + + // + // Find file path for this class + // + PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId(); + PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid); + String headerFile = getHeaderFileFromPackageByLibraryClassName(spd, name); + if (!Tools.isEmpty(headerFile)) { + v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath()) + + DataType.FILE_SEPARATOR + headerFile)); + } + } + } + } + return v; } @@ -844,4 +939,20 @@ public class WorkspaceTools { } return v; } + + public String getHeaderFileFromPackageByLibraryClassName(PackageSurfaceArea spd, String name) { + String headerFile = ""; + if (spd != null) { + if (spd.getLibraryClassDeclarations() != null) { + LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations(); + for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) { + if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) { + return lcdl.getLibraryClassList().get(indexOfLibOfSpd).getIncludeHeader(); + } + } + } + } + + return headerFile; + } }