Modify code according suggestion from code review meeting.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1379 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qouyang 2006-08-24 09:24:29 +00:00
parent 99f70980b4
commit cb4d97bd83
3 changed files with 461 additions and 378 deletions

View File

@ -22,7 +22,6 @@ import java.util.List;
import java.util.Map;
import org.apache.xmlbeans.XmlObject;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.global.SurfaceAreaQuery;
import org.tianocore.build.id.ModuleIdentification;
@ -75,7 +74,7 @@ public class AutogenLibOrder {
// libInstanceMap.
//
libClassConsmList = SurfaceAreaQuery
.getLibraryClasses(CommonDefinition.AlwaysConsumed, arch);
.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, arch);
if (libClassConsmList != null) {
String[] classStr = new String[libClassConsmList.length];
for (int k = 0; k < libClassConsmList.length; k++) {
@ -94,7 +93,7 @@ public class AutogenLibOrder {
// Add library class and library instance map.
//
libClassDeclList = SurfaceAreaQuery
.getLibraryClasses(CommonDefinition.AlwaysProduced, arch);
.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, arch);
if (libClassDeclList != null) {
for (int j = 0; j < libClassDeclList.length; j++) {
if (this.libClassMap.containsKey(libClassDeclList[j])) {
@ -114,12 +113,12 @@ public class AutogenLibOrder {
//
// Check is the library instance list meet the require;
//
for (int s = 0; s < this.libInstanceList.size(); s++) {
String[] libClass = this.libInstanceMap.get(this.libInstanceList
.get(s));
if (libClass != null) {
for (int t = 0; t < libClass.length; t++) {
if (this.libClassMap.get(libClass[t]) == null) {
//for (int s = 0; s < this.libInstanceList.size(); s++) {
// String[] libClass = this.libInstanceMap.get(this.libInstanceList
// .get(s));
// if (libClass != null) {
// for (int t = 0; t < libClass.length; t++) {
// if (this.libClassMap.get(libClass[t]) == null) {
//
// Note: There exist a kind of module which depend on
// library class with no instance or whose instance will
@ -130,10 +129,10 @@ public class AutogenLibOrder {
// will be a warnig message given here after a standard
// log way has been decided.
//
}
}
}
}
// }
// }
// }
//}
}
/**

View File

@ -18,7 +18,8 @@ package org.tianocore.build.autogen;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import org.tianocore.common.definitions.EdkDefinitions;
import org.tianocore.common.definitions.ToolDefinitions;
/**
CommonDefinition
@ -27,88 +28,119 @@ import java.util.Set;
**/
public class CommonDefinition {
public final static String LibraryStr = "LIBRARY";
public final static String autoGenHbegin = "extern int __make_me_compile_correctly;\r\n";
public final static String include = "#include";
public final static String autoGenCLine1 = "\r\n";
///
/// final static string
///
public final static String LIBRARY = "LIBRARY";
public final static String autoGenCLine2 = "const UINT8 _gDebugPropertyMask "
+ "= DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED"
+ " | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED"
+ " | DEBUG_PROPERTY_DEBUG_CODE_ENABLED;\r\n";
public final static String AUTOGENHBEGIN = "extern int __make_me_compile_correctly;"
+ ToolDefinitions.LINE_SEPARATOR;
public final static String autoGenCLine3 = "const UINTN _gModuleDefaultErrorLevel"
+ " = EFI_D_ERROR | EFI_D_LOAD;\r\n";
public final static String INCLUDE = "#include";
public final static String autoGenHLine1 = "#define EFI_SPECIFICATION_VERSION 0x00020000\r\n";
public final static String autoGenHVersionDefault = "#define EFI_SPECIFICATION_VERSION 0x00000000\r\n";
public final static String autoGenHLine2 = "#define EDK_RELEASE_VERSION 0x00090000\r\n";
public final static String autoGenHReleaseDefault = "#define EDK_RELEASE_VERSION 0x00000000\r\n";
//public final static String DEBUGPROPERYMASK = "const UINT8 _gDebugPropertyMask "
// + "= DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED"
// + " | DEBUG_PROPERTY_DEBUG_PRINT_ENABLED"
// + " | DEBUG_PROPERTY_DEBUG_CODE_ENABLED;"
// + ToolDefinitions.LINE_SEPARATOR;
public final static String includeAutogenH = "#include <AutoGen.h>\r\n" ;
public final static String marcDefineStr = "#define ";
//public final static String DEFAULERROLEVEL = "const UINTN _gModuleDefaultErrorLevel"
// + " = EFI_D_ERROR | EFI_D_LOAD;"
// + ToolDefinitions.LINE_SEPARATOR;
public final static String gEfi = "gEfi";
public final static String protocolGuid = "ProtocolGuid";
public final static String ppiGuid = "PpiGuid";
public final static String guidGuid = "Guid";
public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";
public final static String flashMapH = "FlashMap.h";
public final static String INCLUDEAUTOGENH = INCLUDE
+ " <AutoGen.h>"
+ ToolDefinitions.LINE_SEPARATOR;
public final static String DEFINE = "#define ";
public final static String GEFI = "gEfi";
public final static String PRTOCOLGUID = "ProtocolGuid";
public final static String PPIGUID = "PpiGuid";
public final static String GUID = "Guid";
public final static String TIANOR8PLASHMAPH = "TianoR8FlashMap.h";
public final static String FLASHMAPH = "FlashMap.h";
public final static String IFNDEF = "#ifndef ";
public final static String AUTOGENH = "_AUTOGENH_";
///
/// AutoGen.h and AutoGen.c file's header
///
public final static String AUTOGENHNOTATION = "/**"
+ ToolDefinitions.LINE_SEPARATOR
+ " DO NOT EDIT"
+ ToolDefinitions.LINE_SEPARATOR
+ " FILE auto-generated by GenBuild tasks"
+ ToolDefinitions.LINE_SEPARATOR
+ " Module name:"
+ ToolDefinitions.LINE_SEPARATOR
+ " AutoGen.h"
+ ToolDefinitions.LINE_SEPARATOR
+ " Abstract:"
+ " Auto-generated AutoGen.h for building module or library."
+ ToolDefinitions.LINE_SEPARATOR
+ "**/"
+ ToolDefinitions.LINE_SEPARATOR
+ ToolDefinitions.LINE_SEPARATOR;
public final static String AUTOGENCNOTATION = "/**"
+ ToolDefinitions.LINE_SEPARATOR
+ " DO NOT EDIT"
+ ToolDefinitions.LINE_SEPARATOR
+ " FILE auto-generated by GenBuild tasks"
+ ToolDefinitions.LINE_SEPARATOR
+ " Module name:"
+ ToolDefinitions.LINE_SEPARATOR
+ " AutoGen.c"
+ ToolDefinitions.LINE_SEPARATOR
+ " Abstract:"
+ " Auto-generated AutoGen.c for building module or library."
+ ToolDefinitions.LINE_SEPARATOR
+ "**/"
+ ToolDefinitions.LINE_SEPARATOR
+ ToolDefinitions.LINE_SEPARATOR;
///
/// The defintions for identifying current module
/// is PEI Pcd driver or Dxe Pcd driver.
///
public static enum PCD_DRIVER_TYPE { NOT_PCD_DRIVER,
PEI_PCD_DRIVER,
DXE_PCD_DRIVER,
UNKNOWN_PCD_DRIVER};
PEI_PCD_DRIVER,
DXE_PCD_DRIVER,
UNKNOWN_PCD_DRIVER
};
///
/// AutoGen.h and AutoGen.c file's header
///
public final static String autogenHNotation =
"/**\r\n" +
" DO NOT EDIT\r\n" +
" FILE auto-generated by GenBuild tasks\r\n" +
" Module name:\r\n" +
" AutoGen.h\r\n" +
" Abstract:" +
" Auto-generated AutoGen.h for building module or library.\r\n" +
"**/\r\n\r\n";
public final static String autogenCNotation =
"/**\r\n" +
" DO NOT EDIT\r\n" +
" FILE auto-generated by GenBuild tasks\r\n" +
" Module name:\r\n" +
" AutoGen.c\r\n" +
" Abstract:" +
" Auto-generated AutoGen.c for building module or library.\r\n" +
"**/\r\n\r\n";
///
/// module type
///
public final static int ModuleTypeBase = 0;
public final static int ModuleTypeSec = 1;
public final static int ModuleTypePeiCore = 2;
public final static int ModuleTypePeim = 3;
public final static int ModuleTypeDxeCore = 4;
public final static int ModuleTypeDxeDriver = 5;
public final static int ModuleTypeBase = 0;
public final static int ModuleTypeSec = 1;
public final static int ModuleTypePeiCore = 2;
public final static int ModuleTypePeim = 3;
public final static int ModuleTypeDxeCore = 4;
public final static int ModuleTypeDxeDriver = 5;
public final static int ModuleTypeDxeRuntimeDriver = 6;
public final static int ModuleTypeDxeSmmDriver = 7;
public final static int ModuleTypeDxeSalDriver = 8;
public final static int ModuleTypeUefiDriver = 9;
public final static int ModuleTypeUefiApplication = 10;
public final static int ModuleTypeUnknown = 11;
public final static int ModuleTypeDxeSmmDriver = 7;
public final static int ModuleTypeDxeSalDriver = 8;
public final static int ModuleTypeUefiDriver = 9;
public final static int ModuleTypeUefiApplication = 10;
public final static int ModuleTypeUnknown = 11;
///
/// Usaged style
///
public final static String AlwaysConsumed = "ALWAYS_CONSUMED";
public final static String AlwaysProduced = "ALWAYS_PRODUCED";
public final static String ALWAYSCONSUMED = "ALWAYS_CONSUMED";
public final static String ALWAYSPRODUCED = "ALWAYS_PRODUCED";
public static class MyEnum {
@ -132,17 +164,17 @@ public class CommonDefinition {
/// Module type
///
public static final MyEnum[] moduleEnum = new MyEnum[] {
new MyEnum("BASE", ModuleTypeBase),
new MyEnum("SEC", ModuleTypeSec),
new MyEnum("PEI_CORE", ModuleTypePeiCore),
new MyEnum("PEIM", ModuleTypePeim),
new MyEnum("DXE_CORE", ModuleTypeDxeCore),
new MyEnum("DXE_DRIVER", ModuleTypeDxeDriver),
new MyEnum("DXE_RUNTIME_DRIVER", ModuleTypeDxeRuntimeDriver),
new MyEnum("DXE_SAL_DRIVER", ModuleTypeDxeSalDriver),
new MyEnum("DXE_SMM_DRIVER", ModuleTypeDxeSmmDriver),
new MyEnum("UEFI_DRIVER", ModuleTypeUefiDriver),
new MyEnum("UEFI_APPLICATION", ModuleTypeUefiApplication)};
new MyEnum(EdkDefinitions.MODULE_TYPE_BASE, ModuleTypeBase),
new MyEnum(EdkDefinitions.MODULE_TYPE_SEC, ModuleTypeSec),
new MyEnum(EdkDefinitions.MODULE_TYPE_PEI_CORE, ModuleTypePeiCore),
new MyEnum(EdkDefinitions.MODULE_TYPE_PEIM, ModuleTypePeim),
new MyEnum(EdkDefinitions.MODULE_TYPE_DXE_CORE, ModuleTypeDxeCore),
new MyEnum(EdkDefinitions.MODULE_TYPE_DXE_DRIVER, ModuleTypeDxeDriver),
new MyEnum(EdkDefinitions.MODULE_TYPE_DXE_RUNTIME_DRIVER, ModuleTypeDxeRuntimeDriver),
new MyEnum(EdkDefinitions.MODULE_TYPE_DXE_SAL_DRIVER, ModuleTypeDxeSalDriver),
new MyEnum(EdkDefinitions.MODULE_TYPE_DXE_SMM_DRIVER, ModuleTypeDxeSmmDriver),
new MyEnum(EdkDefinitions.MODULE_TYPE_UEFI_DRIVER, ModuleTypeUefiDriver),
new MyEnum(EdkDefinitions.MODULE_TYPE_UEFI_APPLICATION, ModuleTypeUefiApplication)};
/**
getModuleType
@ -152,7 +184,7 @@ public class CommonDefinition {
@param moduleTypeStr String of modlue type.
@return
**/
static public int getModuleType(String moduleTypeStr) {
public static int getModuleType(String moduleTypeStr) {
int returnValue = -1;
for (int i = 0; i < CommonDefinition.moduleEnum.length; i++) {
returnValue = CommonDefinition.moduleEnum[i].ForInt(moduleTypeStr);