import org.apache.xmlbeans.XmlException;\r
import org.tianocore.DbPathAndFilename;\r
import org.tianocore.FrameworkDatabaseDocument;\r
+import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes;\r
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
import org.tianocore.MsaFilesDocument.MsaFiles;\r
import org.tianocore.MsaHeaderDocument.MsaHeader;\r
import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
import org.tianocore.PlatformHeaderDocument.PlatformHeader;\r
import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
+import org.tianocore.SourceFilesDocument.SourceFiles;\r
import org.tianocore.SpdHeaderDocument.SpdHeader;\r
import org.tianocore.frameworkwizard.common.DataType;\r
-import org.tianocore.frameworkwizard.common.Identification;\r
import org.tianocore.frameworkwizard.common.Log;\r
-import org.tianocore.frameworkwizard.common.OpenFile;\r
import org.tianocore.frameworkwizard.common.SaveFile;\r
import org.tianocore.frameworkwizard.common.Tools;\r
-import org.tianocore.frameworkwizard.module.Identification.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
+import org.tianocore.frameworkwizard.common.Identifications.OpenFile;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
\r
MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles();\r
if (files != null) {\r
for (int index = 0; index < files.getFilenameList().size(); index++) {\r
- modulePath.addElement(files.getFilenameList().get(index));\r
+ String msaPath = files.getFilenameList().get(index);\r
+ msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;\r
+ msaPath = Tools.convertPathToCurrentOsType(msaPath);\r
+ modulePath.addElement(msaPath);\r
}\r
}\r
} catch (IOException e) {\r
- e.printStackTrace();\r
+\r
} catch (XmlException e) {\r
- e.printStackTrace();\r
+\r
} catch (Exception e) {\r
- e.printStackTrace();\r
+\r
}\r
return modulePath;\r
}\r
+ \r
+ /**\r
+ Get all Industry Std Includes' paths from one package\r
+ \r
+ @return a Vector with all paths\r
+ \r
+ **/\r
+ public Vector<String> getAllIndustryStdIncludesOfPackage(String path) {\r
+ Vector<String> includePath = new Vector<String>();\r
+ try {\r
+ IndustryStdIncludes files = OpenFile.openSpdFile(path).getIndustryStdIncludes();\r
+ if (files != null) {\r
+ for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {\r
+ String temp = files.getIndustryStdHeaderList().get(index).getName();\r
+ temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r
+ temp = Tools.convertPathToCurrentOsType(temp);\r
+ includePath.addElement(temp);\r
+ }\r
+ }\r
+ } catch (IOException e) {\r
+\r
+ } catch (XmlException e) {\r
+\r
+ } catch (Exception e) {\r
+\r
+ }\r
+ return includePath;\r
+ }\r
\r
/**\r
Get all package basic information form the FrameworkDatabase.db file\r
vPackageList.addElement(new PackageIdentification(id));\r
} catch (IOException e) {\r
Log.err("Open Package Surface Area " + path, e.getMessage());\r
- e.printStackTrace();\r
+\r
} catch (XmlException e) {\r
Log.err("Open Package Surface Area " + path, e.getMessage());\r
- e.printStackTrace();\r
+\r
} catch (Exception e) {\r
Log.err("Open Package Surface Area " + path, "Invalid file type");\r
- e.printStackTrace();\r
+\r
}\r
}\r
+ Tools.sortPackages(vPackageList, DataType.SORT_TYPE_ASCENDING);\r
return vPackageList;\r
}\r
+ \r
+ /**\r
+ Get all module basic information from a package\r
+ \r
+ @param id Package id\r
+ @return A vector includes all modules' basic information\r
+ \r
+ **/\r
+ public Vector<ModuleIdentification> getAllModules(PackageIdentification pid) {\r
+ Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();\r
+ Vector<String> modulePaths = this.getAllModulesOfPackage(pid.getPath());\r
+ Identification id = null;\r
+ String modulePath = null;\r
+ \r
+ for (int index = 0; index < modulePaths.size(); index++) {\r
+ try {\r
+ modulePath = modulePaths.get(index);\r
+ id = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
+ } catch (IOException e) {\r
+ Log.log("Error when Open Module Surface Area " + modulePath, e.getMessage());\r
+ } catch (XmlException e) {\r
+ Log.log("Error when Open Module Surface Area " + modulePath, e.getMessage());\r
+ } catch (Exception e) {\r
+ Log.log("Error when Open Module Surface Area " + modulePath, "Invalid file type " + e.getMessage());\r
+ }\r
+ v.addElement(new ModuleIdentification(id, pid));\r
+ }\r
+ Tools.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r
+ return v;\r
+ \r
+ }\r
\r
/**\r
- Get all package basic information form the FrameworkDatabase.db file\r
+ Get all module basic information form the FrameworkDatabase.db file\r
\r
- @return vPackageList A vector includes all packages' basic information\r
+ @return vModuleList A vector includes all modules' basic information\r
\r
*/\r
public Vector<ModuleIdentification> getAllModules() {\r
for (int indexI = 0; indexI < vPackageList.size(); indexI++) {\r
packagePath = vPackageList.elementAt(indexI).getPath();\r
modulePaths = this.getAllModulesOfPackage(packagePath);\r
- packagePath = packagePath.substring(0, packagePath.lastIndexOf(DataType.FILE_SEPARATOR)\r
- + DataType.FILE_SEPARATOR.length());\r
+ \r
for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
- modulePath = Tools.convertPathToCurrentOsType(packagePath + modulePaths.elementAt(indexJ));\r
try {\r
+ modulePath = modulePaths.get(indexJ);\r
id = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
vModuleList.addElement(new ModuleIdentification(id, vPackageList.elementAt(indexI)));\r
} catch (IOException e) {\r
Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
- e.printStackTrace();\r
} catch (XmlException e) {\r
Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
- e.printStackTrace();\r
} catch (Exception e) {\r
Log.err("Open Module Surface Area " + modulePath, "Invalid file type");\r
- e.printStackTrace();\r
}\r
}\r
}\r
-\r
+ Tools.sortModules(vModuleList, DataType.SORT_TYPE_ASCENDING);\r
return vModuleList;\r
}\r
\r
vPlatformList.addElement(new PlatformIdentification(id));\r
} catch (IOException e) {\r
Log.err("Open Platform Surface Area " + path, e.getMessage());\r
- e.printStackTrace();\r
} catch (XmlException e) {\r
Log.err("Open Platform Surface Area " + path, e.getMessage());\r
- e.printStackTrace();\r
} catch (Exception e) {\r
Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
- e.printStackTrace();\r
}\r
}\r
+ Tools.sortPlatforms(vPlatformList, DataType.SORT_TYPE_ASCENDING);\r
return vPlatformList;\r
}\r
\r
}\r
}\r
}\r
+ Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
}\r
}\r
}\r
+ Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
for (int index = 0; index < spd.getPpiDeclarations().getEntryList().size(); index++) {\r
vector.addElement(spd.getPpiDeclarations().getEntryList().get(index).getCName());\r
}\r
- } \r
+ }\r
}\r
+ Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
for (int index = 0; index < spd.getGuidDeclarations().getEntryList().size(); index++) {\r
vector.addElement(spd.getGuidDeclarations().getEntryList().get(index).getCName());\r
}\r
- } \r
+ }\r
}\r
+ Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
for (int index = 0; index < spd.getPcdDeclarations().getPcdEntryList().size(); index++) {\r
vector.addElement(spd.getPcdDeclarations().getPcdEntryList().get(index).getCName());\r
}\r
- } \r
+ }\r
}\r
+ Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
}\r
} catch (IOException e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
} catch (XmlException e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
} catch (Exception e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
}\r
}\r
+ Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
}\r
} catch (IOException e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
} catch (XmlException e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
} catch (Exception e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
}\r
}\r
+ Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
}\r
} catch (IOException e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
} catch (XmlException e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
} catch (Exception e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
}\r
}\r
+ Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
}\r
} catch (IOException e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
} catch (XmlException e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
} catch (Exception e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
}\r
}\r
+ Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
}\r
} catch (IOException e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
} catch (XmlException e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
} catch (Exception e) {\r
// TODO Auto-generated catch block\r
- e.printStackTrace();\r
}\r
}\r
+ Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
return vector;\r
}\r
\r
for (int indexI = 0; indexI < vPackageList.size(); indexI++) {\r
packagePath = vPackageList.elementAt(indexI).getPath();\r
modulePaths = this.getAllModulesOfPackage(packagePath);\r
- packagePath = packagePath.substring(0, packagePath.lastIndexOf(DataType.FILE_SEPARATOR)\r
- + DataType.FILE_SEPARATOR.length());\r
for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
- modulePath = Tools.convertPathToCurrentOsType(packagePath + modulePaths.elementAt(indexJ));\r
+ modulePath = modulePaths.get(indexJ);\r
try {\r
mid = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
//\r
return vPackageList.elementAt(indexI);\r
}\r
} catch (IOException e) {\r
- e.printStackTrace();\r
+\r
} catch (XmlException e) {\r
- e.printStackTrace();\r
+ \r
} catch (Exception e) {\r
- e.printStackTrace();\r
+\r
}\r
}\r
}\r
strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
}\r
+\r
+ /**\r
+ Get all file's path from one module\r
+ \r
+ @param path\r
+ @return\r
+ @throws IOException\r
+ @throws XmlException\r
+ @throws Exception\r
+ \r
+ **/\r
+ public Vector<String> getAllModuleFilesPath(String path) throws IOException, XmlException, Exception {\r
+ Vector<String> v = new Vector<String>();\r
+ path = Tools.convertPathToCurrentOsType(path);\r
+ v.addElement(path);\r
+ ModuleSurfaceArea msa = OpenFile.openMsaFile(path);\r
+ if (msa != null) {\r
+ //\r
+ // Get all files' path of a module\r
+ //\r
+ SourceFiles sf = msa.getSourceFiles();\r
+ if (sf != null) {\r
+ for (int index = 0; index < sf.getFilenameList().size(); index++) {\r
+ String temp = sf.getFilenameList().get(index).getStringValue();\r
+ temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r
+ v.addElement(Tools.convertPathToCurrentOsType(temp));\r
+ }\r
+ }\r
+ }\r
+\r
+ return v;\r
+ }\r
+\r
+ /**\r
+ Get all file's path from one package\r
+ \r
+ @param path\r
+ @return\r
+ @throws IOException\r
+ @throws XmlException\r
+ @throws Exception\r
+ \r
+ **/\r
+ public Vector<String> getAllPakcageFilesPath(String path) throws IOException, XmlException, Exception {\r
+ Vector<String> v = new Vector<String>();\r
+ path = Tools.convertPathToCurrentOsType(path);\r
+ //\r
+ // First add package\r
+ //\r
+ v.addElement(path);\r
+ \r
+ //\r
+ // Add the package's industry std includes one by one\r
+ //\r
+ Vector<String> f1 = new Vector<String>();\r
+ f1 = getAllIndustryStdIncludesOfPackage(path);\r
+ for (int index = 0; index < f1.size(); index++) {\r
+ v.addElement(f1.get(index));\r
+ }\r
+ \r
+ //\r
+ // Add module's files one by one\r
+ //\r
+ f1 = new Vector<String>();\r
+ f1 = getAllModulesOfPackage(path);\r
+ for (int indexI = 0; indexI < f1.size(); indexI++) {\r
+ Vector<String> f2 = getAllModuleFilesPath(f1.get(indexI));\r
+ for (int indexJ = 0; indexJ < f2.size(); indexJ++) {\r
+ v.addElement(f2.get(indexJ));\r
+ }\r
+ }\r
+\r
+ return v;\r
+ }\r
}\r