mirror of https://github.com/acidanthera/audk.git
Fix some bugs and remove unused code.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1201 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
74c0c087a2
commit
b629771180
|
@ -195,7 +195,7 @@ public class PCDAutoGenAction extends BuildAction {
|
|||
|
||||
usageInstanceArray = null;
|
||||
if (!isBuildUsedLibrary) {
|
||||
usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(usageId);
|
||||
usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
|
||||
MemoryDatabaseManager.UsageInstanceContext = usageInstanceArray;
|
||||
MemoryDatabaseManager.CurrentModuleName = moduleName;
|
||||
} else if ((pcdNameArrayInMsa != null) && (pcdNameArrayInMsa.length > 0)) {
|
||||
|
@ -205,7 +205,7 @@ public class PCDAutoGenAction extends BuildAction {
|
|||
// these library should be used to autogen.
|
||||
//
|
||||
if (usageContext == null) {
|
||||
usageInstanceArray = dbManager.getUsageInstanceArrayByModuleName(usageId);
|
||||
usageInstanceArray = dbManager.getUsageInstanceArrayById(usageId);
|
||||
} else {
|
||||
usageInstanceArray = new ArrayList<UsageInstance>();
|
||||
|
||||
|
|
|
@ -159,9 +159,9 @@ public abstract class PlatformPcdPreprocessAction {
|
|||
|
||||
public void putError(String error) {
|
||||
if (errorString == null) {
|
||||
errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n\r\n";
|
||||
errorString = "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";
|
||||
} else {
|
||||
errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n\r\n";
|
||||
errorString += "### ERROR[" + errorCount + "] ###\r\n" + error + "\r\n";
|
||||
}
|
||||
|
||||
errorCount++;
|
||||
|
|
|
@ -220,21 +220,6 @@ public class MemoryDatabaseManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Get all PCD record for a module according to module's name, module's GUID,
|
||||
package name, package GUID, arch, version information.
|
||||
|
||||
@param usageId the id of UsageInstance.
|
||||
|
||||
@return all usage instance for this module in memory database.
|
||||
**/
|
||||
public List<UsageInstance> getUsageInstanceArrayByModuleName(UsageIdentification usageId) {
|
||||
|
||||
String primaryKey = UsageInstance.getPrimaryKey(usageId);
|
||||
|
||||
return getUsageInstanceArrayByKeyString(primaryKey);
|
||||
}
|
||||
|
||||
public void clearDatabase() {
|
||||
memoryDatabase.clear();
|
||||
}
|
||||
|
@ -246,14 +231,15 @@ public class MemoryDatabaseManager {
|
|||
|
||||
@return List<UsageInstance> the list contains all usage instances.
|
||||
**/
|
||||
public List<UsageInstance> getUsageInstanceArrayByKeyString(String primaryKey) {
|
||||
public List<UsageInstance> getUsageInstanceArrayById(UsageIdentification usageId) {
|
||||
Token[] tokenArray = null;
|
||||
int recordIndex = 0;
|
||||
UsageInstance usageInstance = null;
|
||||
List<UsageInstance> returnArray = new ArrayList<UsageInstance>();
|
||||
String primaryKey = usageId.toString();
|
||||
|
||||
tokenArray = getRecordArray();
|
||||
|
||||
|
||||
//
|
||||
// Loop to find all PCD record related to current module
|
||||
//
|
||||
|
@ -269,19 +255,34 @@ public class MemoryDatabaseManager {
|
|||
return returnArray;
|
||||
}
|
||||
|
||||
public List<Token> getPcdTokenListForModule(UsageIdentification usageId) {
|
||||
List<UsageInstance> usageList = getUsageInstanceArrayById(usageId);
|
||||
List<Token> tokenList = new ArrayList<Token>();
|
||||
|
||||
if (usageList == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int usageIndex = 0; usageIndex < usageList.size(); usageIndex++) {
|
||||
tokenList.add(usageList.get(usageIndex).parentToken);
|
||||
}
|
||||
|
||||
return tokenList;
|
||||
}
|
||||
|
||||
/**
|
||||
Get all modules name who contains PCD information
|
||||
|
||||
@return Array for module name
|
||||
@return Array for usage's identification
|
||||
**/
|
||||
public List<String> getAllModuleArray()
|
||||
public List<UsageIdentification> getAllModuleArray()
|
||||
{
|
||||
int tokenIndex = 0;
|
||||
int usageIndex = 0;
|
||||
int moduleIndex = 0;
|
||||
Token[] tokenArray = null;
|
||||
Object[] usageInstanceArray = null;
|
||||
List<String> moduleNames = new ArrayList<String>();
|
||||
List<UsageIdentification> usageArray = new ArrayList<UsageIdentification>();
|
||||
UsageInstance usageInstance = null;
|
||||
boolean bFound = false;
|
||||
String primaryKey = null;
|
||||
|
@ -296,17 +297,17 @@ public class MemoryDatabaseManager {
|
|||
usageInstance = (UsageInstance)((Map.Entry)usageInstanceArray[usageIndex]).getValue();
|
||||
primaryKey = usageInstance.getPrimaryKey();
|
||||
bFound = false;
|
||||
for (moduleIndex = 0; moduleIndex < moduleNames.size(); moduleIndex++) {
|
||||
if (moduleNames.get(moduleIndex).equalsIgnoreCase(primaryKey)) {
|
||||
for (moduleIndex = 0; moduleIndex < usageArray.size(); moduleIndex++) {
|
||||
if (usageArray.get(moduleIndex).toString().equalsIgnoreCase(primaryKey)) {
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!bFound) {
|
||||
moduleNames.add(primaryKey);
|
||||
usageArray.add(usageInstance.usageId);
|
||||
}
|
||||
}
|
||||
}
|
||||
return moduleNames;
|
||||
return usageArray;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ public class Token {
|
|||
if (tokenSpaceName == null) {
|
||||
return cName + "_nullTokenSpaceGuid";
|
||||
} else {
|
||||
return cName + "_" + tokenSpaceName.toString().replace('-', '_');
|
||||
return cName + "_" + tokenSpaceName.toString().replace('-', '_').toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue