Add Package-Guid Map.
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 14 Oct 2006 07:01:53 +0000 (07:01 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 14 Oct 2006 07:01:53 +0000 (07:01 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1745 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Conf/Migration/PkgGuid.csv [new file with mode: 0644]
Tools/Java/Source/MigrationTools/org/tianocore/migration/Database.java
Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java

diff --git a/Tools/Conf/Migration/PkgGuid.csv b/Tools/Conf/Migration/PkgGuid.csv
new file mode 100644 (file)
index 0000000..5ad3f90
--- /dev/null
@@ -0,0 +1,3 @@
+PackageName,GuidValue\r
+MdePkg,5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec\r
+EdkModulePkg,68169ab0-d41b-4009-9060-292c253ac43d\r
index 68ddf40..f14184a 100644 (file)
@@ -23,6 +23,7 @@ public final class Database {
         DatabasePath = path;\r
 \r
         try {\r
+            importPkgGuid("PkgGuid.csv");\r
             importDBLib("Library.csv");\r
             importDBGuid("Guid.csv", "Guid");\r
             importDBGuid("Ppi.csv", "Ppi");\r
@@ -41,9 +42,32 @@ public final class Database {
     private Map<String,Guid> hashguid = new HashMap<String,Guid>();\r
     private Map<String,Func> hashfunc = new HashMap<String,Func>();\r
     private Map<String,Macro> hashmacro = new HashMap<String,Macro>();\r
+    private Map<String,String> hashPkgGuid = new HashMap<String,String>();\r
     \r
     //-------------------------------------import------------------------------------------//\r
-    \r
+    private void importPkgGuid(String filename) throws Exception {\r
+       BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
+        String line;\r
+        String[] linecontext;\r
+        Func lf;\r
+        \r
+        if (rd.ready()) {\r
+            System.out.println("Found " + filename + ", Importing Package Guid Database.");\r
+            //\r
+            // Skip the title row.\r
+            // \r
+            line = rd.readLine();\r
+            while ((line = rd.readLine()) != null) {\r
+                if (line.length() != 0) {\r
+                    linecontext = line.split(",");\r
+                    hashPkgGuid.put(linecontext[0], linecontext[1]);\r
+                }\r
+            }\r
+        }\r
+    }\r
+    public Iterator<String> dumpAllPkgGuid() {\r
+        return hashPkgGuid.values().iterator();\r
+    }\r
     private void importDBLib(String filename) throws Exception {\r
         BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));\r
         String line;\r
index 9217857..5c2eaf0 100644 (file)
@@ -225,8 +225,14 @@ public class MsaOwner {
     }\r
     \r
     public final boolean setupPackageDependencies() {\r
-        addPackage("5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec");\r
-        addPackage("68169ab0-d41b-4009-9060-292c253ac43d");\r
+        Iterator<String> it;\r
+        //\r
+        // For now, simply add all package guids in the database. \r
+        // \r
+        it = MigrationTool.db.dumpAllPkgGuid();\r
+        while (it.hasNext()) {\r
+            packagedependencies.addNewPackage().setPackageGuid(it.next());\r
+        }\r
         return true;\r
     }\r
     \r
index af8646f..a8e26c5 100644 (file)
@@ -120,9 +120,13 @@ public class MsaWriter {
         md.setSupportedArchitectures(arch);\r
         md.setBinaryModule(false);\r
         md.setOutputFileBasename(mi.modulename);\r
-        \r
-        pd.addNewPackage().setPackageGuid("5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec");\r
-        pd.addNewPackage().setPackageGuid("68169ab0-d41b-4009-9060-292c253ac43d");\r
+        //\r
+        // For now, simply add all package guids in the database. \r
+        // \r
+        it = MigrationTool.db.dumpAllPkgGuid();\r
+        while (it.hasNext()) {\r
+            pd.addNewPackage().setPackageGuid(it.next());\r
+        }\r
         externs.addNewSpecification().setStringValue("EFI_SPECIFICATION_VERSION 0x00020000");\r
         externs.addNewSpecification().setStringValue("EDK_RELEASE_VERSION 0x00020000");\r
         if (mi.entrypoint != null) {\r