add check for empty value of definitions.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2391 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jlin16 2007-02-14 03:08:45 +00:00
parent 84d87a73e9
commit c0db4cdc64
1 changed files with 38 additions and 19 deletions

View File

@ -158,53 +158,70 @@ public class ToolChainId {
String rLine = null; String rLine = null;
String inLine[] = new String[2]; String inLine[] = new String[2];
while ((rLine = reader.readLine()) != null) { while ((rLine = reader.readLine()) != null) {
rLine = rLine.trim();
if ((rLine.startsWith("ACTIVE_PLATFORM")) && (activePlatform == null)) { if ((rLine.startsWith("ACTIVE_PLATFORM")) && (activePlatform == null)) {
// Only one active platform is permitted! // Only one active platform is permitted!
inLine = rLine.trim().split("="); inLine = rLine.split("=");
if (inLine.length > 1) {
activePlatform = inLine[1].trim(); activePlatform = inLine[1].trim();
} }
}
if ((rLine.startsWith("TARGET" + " ")) || (rLine.startsWith("TARGET" + "\t")) if ((rLine.startsWith("TARGET" + " ")) || (rLine.startsWith("TARGET" + "\t"))
|| (rLine.startsWith("TARGET="))) { || (rLine.startsWith("TARGET="))) {
// Handle multiple Target Names // Handle multiple Target Names
if (rLine.contains(",")) { if (rLine.contains(",")) {
inLine = rLine.trim().split("="); inLine = rLine.split("=");
if (inLine.length > 1) {
buildTargets = inLine[1].trim().replaceAll(",", " "); buildTargets = inLine[1].trim().replaceAll(",", " ");
}
} else { } else {
inLine = rLine.trim().split("="); inLine = rLine.trim().split("=");
if (inLine.length > 1) {
buildTargets = inLine[1].trim(); buildTargets = inLine[1].trim();
} }
} }
}
if (rLine.startsWith("TARGET_ARCH")) { if (rLine.startsWith("TARGET_ARCH")) {
// Handle multiple Target Architectures // Handle multiple Target Architectures
if (rLine.contains(",")) { if (rLine.contains(",")) {
inLine = rLine.trim().split("="); inLine = rLine.split("=");
if (inLine.length > 1) {
targetArchs = inLine[1].trim().replaceAll(",", " "); targetArchs = inLine[1].trim().replaceAll(",", " ");
}
} else { } else {
inLine = rLine.trim().split("="); inLine = rLine.split("=");
if (inLine.length > 1) {
targetArchs = inLine[1].trim(); targetArchs = inLine[1].trim();
} }
} }
}
if (rLine.startsWith("TOOL_CHAIN_CONF")) { if (rLine.startsWith("TOOL_CHAIN_CONF")) {
// Only one file is permitted // Only one file is permitted
inLine = rLine.trim().split("="); inLine = rLine.split("=");
if (inLine.length > 1) {
toolDefinitionFile = inLine[1].trim(); toolDefinitionFile = inLine[1].trim();
} }
}
if (rLine.startsWith("TOOL_CHAIN_TAG")) { if (rLine.startsWith("TOOL_CHAIN_TAG")) {
// Handle multiple Tool TagNames // Handle multiple Tool TagNames
if (rLine.contains(",")) { if (rLine.contains(",")) {
inLine = rLine.trim().split("="); inLine = rLine.split("=");
if (inLine.length > 1) {
tagNames = inLine[1].trim().replaceAll(",", " "); tagNames = inLine[1].trim().replaceAll(",", " ");
}
} else { } else {
inLine = rLine.trim().split("="); inLine = rLine.split("=");
if (inLine.length > 1) {
tagNames = inLine[1].trim(); tagNames = inLine[1].trim();
} }
} }
}
if (rLine.startsWith("MULTIPLE_THREAD")) { if (rLine.startsWith("MULTIPLE_THREAD")) {
// Handle Thread Enable flag // Handle Thread Enable flag
if ((rLine.trim().toLowerCase().contains("enabled")) if ((rLine.toLowerCase().contains("enabled"))
|| (rLine.trim().toLowerCase().contains("true"))) { || (rLine.toLowerCase().contains("true"))) {
threadEnabled = true; threadEnabled = true;
} else { } else {
threadEnabled = false; threadEnabled = false;
@ -213,10 +230,12 @@ public class ToolChainId {
if (rLine.startsWith("MAX_CONCURRENT_THREAD_NUMBER")) { if (rLine.startsWith("MAX_CONCURRENT_THREAD_NUMBER")) {
// Handle Thread Enable flag // Handle Thread Enable flag
inLine = rLine.trim().split("="); inLine = rLine.split("=");
if (inLine.length > 1) {
maxThreadCount = Integer.valueOf(inLine[1].trim()); maxThreadCount = Integer.valueOf(inLine[1].trim());
} }
} }
}
reader.close(); reader.close();
} catch (IOException e) { } catch (IOException e) {
Log.log(this.strTargetFile + " Read Error ", e.getMessage()); Log.log(this.strTargetFile + " Read Error ", e.getMessage());