import java.util.Map;\r
\r
import org.apache.xmlbeans.XmlObject;\r
-import org.tianocore.LibraryClassDocument.LibraryClass;\r
-\r
+import org.tianocore.build.exception.AutoGenException;\r
import org.tianocore.build.global.GlobalData;\r
import org.tianocore.build.global.SurfaceAreaQuery;\r
import org.tianocore.build.id.ModuleIdentification;\r
+import org.tianocore.common.exception.EdkException;\r
\r
/**\r
This class This class is to reorder library instance sequence according to\r
@param libraryList List of the library instance.\r
@throws Exception\r
**/\r
- AutogenLibOrder(ModuleIdentification[] libraryList, String arch) throws Exception {\r
+ AutogenLibOrder(ModuleIdentification[] libraryList, String arch) throws EdkException {\r
LibraryInstanceNode libInstanceNode;\r
String[] libClassDeclList = null;\r
String[] libClassConsmList = null;\r
// Add libraryInstance in to libInstanceList.\r
// \r
Map<String, XmlObject> libDoc = GlobalData.getDoc(libraryList[i], arch);\r
- SurfaceAreaQuery.push(libDoc);\r
- libInstanceNode = new LibraryInstanceNode (libraryList[i],SurfaceAreaQuery.getLibConstructorName(), SurfaceAreaQuery.getLibDestructorName());\r
+ SurfaceAreaQuery saq = new SurfaceAreaQuery(libDoc);\r
+ libInstanceNode = new LibraryInstanceNode (libraryList[i],saq.getLibConstructorName(), saq.getLibDestructorName());\r
libInstanceList.add(libInstanceNode);\r
\r
//\r
// Add library instance and consumed library class list to\r
// libInstanceMap.\r
//\r
- libClassConsmList = SurfaceAreaQuery\r
- .getLibraryClasses(CommonDefinition.AlwaysConsumed);\r
+ libClassConsmList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch);\r
if (libClassConsmList != null) {\r
String[] classStr = new String[libClassConsmList.length];\r
for (int k = 0; k < libClassConsmList.length; k++) {\r
classStr[k] = libClassConsmList[k];\r
}\r
if (this.libInstanceMap.containsKey(libraryList[i])) {\r
- throw new Exception(\r
+ throw new AutoGenException(\r
libraryList[i].getName()\r
- + "this library instance is already exist, please check you library instance list!");\r
+ + "-- this library instance already exists, please check the library instance list!");\r
} else {\r
this.libInstanceMap.put(libraryList[i], classStr);\r
}\r
//\r
// Add library class and library instance map.\r
//\r
- libClassDeclList = SurfaceAreaQuery\r
- .getLibraryClasses(CommonDefinition.AlwaysProduced);\r
+ libClassDeclList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch);\r
if (libClassDeclList != null) {\r
for (int j = 0; j < libClassDeclList.length; j++) {\r
if (this.libClassMap.containsKey(libClassDeclList[j])) {\r
System.out.println(libClassDeclList[j]\r
+ " class is already implement by "\r
+ this.libClassMap.get(libClassDeclList[j]));\r
- throw new Exception(libClassDeclList\r
- + " is already have library instance!");\r
+ throw new AutoGenException("Library Class: " + libClassDeclList\r
+ + " already has a library instance!");\r
} else {\r
this.libClassMap.put(libClassDeclList[j], libraryList[i]);\r
}\r
}\r
}\r
- SurfaceAreaQuery.pop();\r
}\r
\r
//\r
// Check is the library instance list meet the require;\r
//\r
- for (int s = 0; s < this.libInstanceList.size(); s++) {\r
- String[] libClass = this.libInstanceMap.get(this.libInstanceList\r
- .get(s));\r
- if (libClass != null) {\r
- for (int t = 0; t < libClass.length; t++) {\r
- if (this.libClassMap.get(libClass[t]) == null) {\r
+ //for (int s = 0; s < this.libInstanceList.size(); s++) {\r
+ // String[] libClass = this.libInstanceMap.get(this.libInstanceList\r
+ // .get(s));\r
+ // if (libClass != null) {\r
+ // for (int t = 0; t < libClass.length; t++) {\r
+ // if (this.libClassMap.get(libClass[t]) == null) {\r
//\r
// Note: There exist a kind of module which depend on \r
// library class with no instance or whose instance will\r
// will be a warnig message given here after a standard \r
// log way has been decided.\r
//\r
- }\r
- }\r
- }\r
- }\r
+ // }\r
+ // }\r
+ // }\r
+ //}\r
}\r
\r
/**\r