summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-06 05:58:31 +0000
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-06 05:58:31 +0000
commit91f7d582299ddc08babbff1624df3fd136a37ee9 (patch)
tree702a95439594395a3e37d241589f822d8ea7c86a
parent7ab9a5e5801699bb29cd4eb12b70011b918828fc (diff)
downloadedk2-91f7d582299ddc08babbff1624df3fd136a37ee9.zip
edk2-91f7d582299ddc08babbff1624df3fd136a37ee9.tar.gz
edk2-91f7d582299ddc08babbff1624df3fd136a37ee9.tar.bz2
Remove FrameworkLogger in FrameworkTasks and EdkException in GenBuild. Update EdkLog to accept one more parameter. Remove all System.out in GenBuild.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1474 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--Tools/Source/Common/org/tianocore/common/logger/EdkLog.java12
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java15
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java15
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java11
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java14
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FrameworkLogger.java40
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java14
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java14
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java9
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java14
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java11
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java14
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java14
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java14
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java14
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java15
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java15
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java1
-rw-r--r--Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java15
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java3
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java165
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java15
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/exception/EdkException.java36
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java2
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java23
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java6
26 files changed, 202 insertions, 319 deletions
diff --git a/Tools/Source/Common/org/tianocore/common/logger/EdkLog.java b/Tools/Source/Common/org/tianocore/common/logger/EdkLog.java
index cfa7d53..6b3ed95 100644
--- a/Tools/Source/Common/org/tianocore/common/logger/EdkLog.java
+++ b/Tools/Source/Common/org/tianocore/common/logger/EdkLog.java
@@ -59,6 +59,18 @@ public class EdkLog {
logger.putMessage(null, EDK_INFO, message);
}
}
+
+ public static void log(Object o, int level, String message) {
+ if (level <= logLevel) {
+ logger.putMessage(o, level, message);
+ }
+ }
+
+ public static void log(Object o, String message) {
+ if (EDK_INFO <= logLevel) {
+ logger.putMessage(o, EDK_INFO, message);
+ }
+ }
public static void flushLogToFile(File file) {
logger.flushToFile(file);
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java
index d73ea6a..672e712 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java
@@ -63,12 +63,7 @@ public class CreateMtFileTask extends Task implements EfiDefine {
public void execute() throws BuildException {
Project project = this.getOwningTarget().getProject();
- //
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "createmtfile");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
+
//
// absolute path of efi tools
//
@@ -109,20 +104,20 @@ public class CreateMtFileTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, (new File(this.outputFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.outputFile)).getName());
revl = runner.execute();
if (EFI_SUCCESS == revl) {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "CreateMtFile succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "CreateMtFile succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
throw new BuildException("CreateMtFile failed!");
}
} catch (Exception e) {
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java
index 8f8ea2e..0f82002 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java
@@ -59,12 +59,7 @@ public class EfiCompressTask extends Task implements EfiDefine {
public void execute() throws BuildException {
Project project = this.getOwningTarget().getProject();
- //
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "eficompress");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
+
//
// absolute path of efi tools
//
@@ -105,8 +100,8 @@ public class EfiCompressTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, (new File(this.inputFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());
revl = runner.execute();
@@ -114,12 +109,12 @@ public class EfiCompressTask extends Task implements EfiDefine {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "EfiCompress succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "EfiCompress succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
throw new BuildException("EfiCompress failed!");
}
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java
index 0eba56e..7eb9878 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java
@@ -112,12 +112,7 @@ public class EfiRomTask extends Task implements EfiDefine {
public void execute() throws BuildException {
Project project = this.getOwningTarget().getProject();
- //
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "efirom");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
+
//
// absolute path of efi tools
//
@@ -163,8 +158,8 @@ public class EfiRomTask extends Task implements EfiDefine {
}
}
- EdkLog.log(EdkLog.EDK_VERBOSE, argList.toString().replaceAll(",",""));
- EdkLog.log(EdkLog.EDK_INFO, " ");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, argList.toString().replaceAll(",",""));
+ EdkLog.log(this, EdkLog.EDK_INFO, " ");
//
// lauch the program
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java
index ce0939f..44c5b9c 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java
@@ -142,12 +142,6 @@ public class FlashMapTask extends Task implements EfiDefine {
Project project = this.getOwningTarget().getProject();
//
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "flashmap");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
- //
// absolute path of efi tools
//
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
@@ -198,13 +192,13 @@ public class FlashMapTask extends Task implements EfiDefine {
//
// log command line string.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, cmdProc.getOutputStream().toString());
- EdkLog.log(EdkLog.EDK_INFO, (new File(this.flashDefFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, cmdProc.getOutputStream().toString());
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.flashDefFile)).getName());
if (exitCode != 0) {
int len = cmdOut.read(buf, 0, 1024);
- EdkLog.log(EdkLog.EDK_INFO, new String(buf, 0, len));
+ EdkLog.log(this, EdkLog.EDK_INFO, new String(buf, 0, len));
} else {
- EdkLog.log(EdkLog.EDK_VERBOSE, "FlashMap succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "FlashMap succeeded!");
}
} catch (Exception e) {
throw new BuildException(e.getMessage());
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FrameworkLogger.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FrameworkLogger.java
deleted file mode 100644
index 0c4e40c..0000000
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/FrameworkLogger.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*++
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-Module Name:
- FrameworkLogger.java
-
-Abstract:
-
---*/
-
-package org.tianocore.framework.tasks;
-
-import org.apache.tools.ant.Project;
-import java.io.File;
-import org.tianocore.common.logger.LogMethod;
-
-class FrameworkLogger implements LogMethod {
- private Project project;
- private String titleName;
- public FrameworkLogger(Project project, String taskName) {
- this.project = project;
- this.titleName = taskName;
- }
-
- public void putMessage(Object msgSource, int msgLevel, String msg) {
- String frameworkMsg = " [" + this.titleName + "] " + msg;
- this.project.log(frameworkMsg, Project.MSG_INFO);
- }
-
- public void flushToFile(File file) {
- }
-} \ No newline at end of file
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java
index 5ccf535..d9eafac 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java
@@ -60,12 +60,6 @@ public class GenAcpiTableTask extends Task implements EfiDefine {
Project project = this.getOwningTarget().getProject();
//
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "genacpitable");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
- //
// absolute path of efi tools
//
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
@@ -105,20 +99,20 @@ public class GenAcpiTableTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, (new File(this.inputFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());
revl = runner.execute();
if (EFI_SUCCESS == revl) {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "GenAcpiTable succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenAcpiTable succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
throw new BuildException("GenAcpiTable failed!");
}
} catch (Exception e) {
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java
index 591ec03..12def7c 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java
@@ -91,12 +91,6 @@ public class GenCapsuleHdrTask extends Task implements EfiDefine {
Project project = this.getOwningTarget().getProject();
//
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "gencapsulehdr");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
- //
// absolute path of efi tools
//
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
@@ -138,20 +132,20 @@ public class GenCapsuleHdrTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, (new File(scriptFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(scriptFile)).getName());
revl = runner.execute();
if (EFI_SUCCESS == revl) {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "GenCapsuleHdr succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenCapsuleHdr succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_ERROR, "ERROR = " + Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_ERROR, "ERROR = " + Integer.toHexString(revl));
throw new BuildException("GenCapsuleHdr failed!");
}
} catch (Exception e) {
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java
index b41e7f8..b7c5b7f 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java
@@ -124,13 +124,6 @@ public class GenFfsFileTask extends Task implements EfiDefine, FfsTypes {
String ffsSuffix = "";
String outputPath = "";
- Project project = this.getOwningTarget().getProject();
- //
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "genFfs");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
//
// Get Fraemwork_Tools_Path
@@ -751,7 +744,7 @@ public class GenFfsFileTask extends Task implements EfiDefine, FfsTypes {
FfsHeader ffsHeader = new FfsHeader();
FfsHeader orgFfsHeader = new FfsHeader();
- EdkLog.log(EdkLog.EDK_INFO, ffsFile.getName());
+ EdkLog.log(this, EdkLog.EDK_INFO, ffsFile.getName());
try {
//
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java
index a0743c6..9f0b743 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java
@@ -79,12 +79,6 @@ public class GenTeImageTask extends Task implements EfiDefine {
Project project = this.getOwningTarget().getProject();
//
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, toolName.toLowerCase());
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
- //
// absolute path of efi tools
//
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
@@ -126,8 +120,8 @@ public class GenTeImageTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, (new File(this.inputFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());
revl = runner.execute();
@@ -135,12 +129,12 @@ public class GenTeImageTask extends Task implements EfiDefine {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "GenTeImage succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenTeImage succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = "+ Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = "+ Integer.toHexString(revl));
throw new BuildException("GenTeImage failed!");
}
} catch (Exception e) {
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
index f41bcfc..76ab8e0 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
@@ -16,15 +16,11 @@ package org.tianocore.framework.tasks;
import java.io.File;
import java.io.FileReader;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
@@ -75,9 +71,6 @@ public class MakeDeps extends Task {
Project prj = this.getOwningTarget().getProject();
String toolPath = prj.getProperty("env.FRAMEWORK_TOOLS_PATH");
- FrameworkLogger logger = new FrameworkLogger(prj, "makedeps");
- EdkLog.setLogLevel(prj.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
///
/// compose full tool path
@@ -145,7 +138,7 @@ public class MakeDeps extends Task {
runner.setAntRun(prj);
runner.setCommandline(cmd.getCommandline());
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmd.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmd.getCommandline()));
int result = 0;
try {
@@ -155,7 +148,7 @@ public class MakeDeps extends Task {
}
if (result != 0) {
- EdkLog.log(EdkLog.EDK_INFO, "MakeDeps failed!");
+ EdkLog.log(this, EdkLog.EDK_INFO, "MakeDeps failed!");
throw new BuildException("MakeDeps: failed to generate dependency file!");
}
}
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java
index 7309d77..e01b040 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java
@@ -70,12 +70,6 @@ public class ModifyInfTask extends Task implements EfiDefine {
Project project = this.getOwningTarget().getProject();
//
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "modifyinftask");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
- //
// absolute path of efi tools
//
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
@@ -120,20 +114,20 @@ public class ModifyInfTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, (new File(this.inputFVInfFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFVInfFile)).getName());
revl = runner.execute();
if (EFI_SUCCESS == revl) {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "ModifyInfTask succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "ModifyInfTask succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
throw new BuildException("ModifyInfTask failed!");
}
} catch (Exception e) {
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java
index 4e545e0..d7dfc41 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java
@@ -73,12 +73,6 @@ public class PeiReBaseTask extends Task implements EfiDefine {
public void execute() throws BuildException {
Project project = this.getOwningTarget().getProject();
- //
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, toolName.toLowerCase());
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
//
// absolute path of efi tools
@@ -130,8 +124,8 @@ public class PeiReBaseTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, this.inputFileName);
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, this.inputFileName);
revl = runner.execute();
@@ -139,12 +133,12 @@ public class PeiReBaseTask extends Task implements EfiDefine {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "PeiReBase succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "PeiReBase succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
throw new BuildException("PeiReBase failed!");
}
} catch (Exception e) {
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java
index 28d5e87..1bcfacf 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java
@@ -67,12 +67,6 @@ public class SecApResetVectorFixupTask extends Task implements EfiDefine {
Project project = this.getOwningTarget().getProject();
//
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "secapresetvectorfixup");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
- //
// absolute path of efi tools
//
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
@@ -112,8 +106,8 @@ public class SecApResetVectorFixupTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, (new File(this.fvInputFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.fvInputFile)).getName());
revl = runner.execute();
@@ -121,12 +115,12 @@ public class SecApResetVectorFixupTask extends Task implements EfiDefine {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "SecApResetVectorFixup succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "SecApResetVectorFixup succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
throw new BuildException("SecApResetVectorFixup failed!");
}
} catch (Exception e) {
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java
index 8f46ff9..3e2dd1a 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java
@@ -69,13 +69,7 @@ public class SecFixupTask extends Task implements EfiDefine {
public void execute() throws BuildException {
Project project = this.getOwningTarget().getProject();
- //
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, toolName
- .toLowerCase());
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
+
//
// absolute path of efi tools
//
@@ -117,7 +111,7 @@ public class SecFixupTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
revl = runner.execute();
@@ -125,12 +119,12 @@ public class SecFixupTask extends Task implements EfiDefine {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "SecFixup succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "SecFixup succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = "+ Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = "+ Integer.toHexString(revl));
throw new BuildException("SecFixup failed!");
}
} catch (Exception e) {
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java
index a71eb01..01abde7 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java
@@ -59,13 +59,6 @@ public class SplitfileTask extends Task implements EfiDefine {
Project project = this.getOwningTarget().getProject();
//
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "splitfile");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
-
- //
// absolute path of efi tools
//
String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
@@ -99,19 +92,19 @@ public class SplitfileTask extends Task implements EfiDefine {
runner.setAntRun(project);
runner.setCommandline(cmdline.getCommandline());
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, (new File(this.inputFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());
revl = runner.execute();
if (EFI_SUCCESS == revl) {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "SplitFile succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "SplitFile succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
throw new BuildException("SplitFile failed!");
}
} catch (Exception e) {
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java
index 107575c..14488be 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java
@@ -60,12 +60,7 @@ public class StripTask extends Task implements EfiDefine {
public void execute() throws BuildException {
Project project = this.getOwningTarget().getProject();
- //
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "strip");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
+
//
// absolute path of efi tools
//
@@ -106,8 +101,8 @@ public class StripTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, (new File(this.inputFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.inputFile)).getName());
revl = runner.execute();
@@ -115,12 +110,12 @@ public class StripTask extends Task implements EfiDefine {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "Strip succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "Strip succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
throw new BuildException("Strip failed!");
}
} catch (Exception e) {
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java
index d99f239..198ba5e 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java
@@ -167,7 +167,6 @@ public class VfrCompilerTask extends Task implements EfiDefine {
} else {
command = toolPath + "/" + "VfrCompile";
}
- List<Object> includePath = new ArrayList<Object>();
String incPath = "";
int count = includepathList.size();
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java
index ccba47d..a6df494 100644
--- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java
+++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java
@@ -60,12 +60,7 @@ public class ZeroDebugDataTask extends Task implements EfiDefine {
public void execute() throws BuildException {
Project project = this.getOwningTarget().getProject();
- //
- // set Logger
- //
- FrameworkLogger logger = new FrameworkLogger(project, "zerodebugdata");
- EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));
- EdkLog.setLogger(logger);
+
//
// absolute path of efi tools
//
@@ -106,8 +101,8 @@ public class ZeroDebugDataTask extends Task implements EfiDefine {
//
// Set debug log information.
//
- EdkLog.log(EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(EdkLog.EDK_INFO, (new File(this.peFile)).getName());
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
+ EdkLog.log(this, EdkLog.EDK_INFO, (new File(this.peFile)).getName());
revl = runner.execute();
@@ -115,12 +110,12 @@ public class ZeroDebugDataTask extends Task implements EfiDefine {
//
// command execution success
//
- EdkLog.log(EdkLog.EDK_VERBOSE, "ZeroDebugData succeeded!");
+ EdkLog.log(this, EdkLog.EDK_VERBOSE, "ZeroDebugData succeeded!");
} else {
//
// command execution fail
//
- EdkLog.log(EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
+ EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
throw new BuildException("ZeroDebugData failed!");
}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java
index ed94da3..702c28f 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/FfsProcess.java
@@ -26,6 +26,7 @@ import org.tianocore.build.global.GlobalData;
import org.tianocore.build.global.SurfaceAreaQuery;
import org.tianocore.build.id.FpdModuleIdentification;
import org.tianocore.common.definitions.EdkDefinitions;
+import org.tianocore.common.logger.EdkLog;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -129,7 +130,7 @@ public class FfsProcess {
// Otherwise report warning message
//
if (buildType == null) {
- System.out.println("Warning: this module doesn't specify a FfsFormatKey. ");
+ EdkLog.log(EdkLog.EDK_WARNING, "Warning: this module doesn't specify a FfsFormatKey. ");
} else {
throw new BuildException("Can't find the FfsFormatKey [" + buildType + "] attribute in the FPD file!");
}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java
index ea5657c..9d68419 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/FrameworkBuildTask.java
@@ -15,6 +15,7 @@ package org.tianocore.build;
import java.io.BufferedReader;
import java.io.File;
+import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Hashtable;
import java.util.Iterator;
@@ -24,6 +25,10 @@ import java.util.Set;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
+import org.tianocore.build.exception.AutoGenException;
+import org.tianocore.build.exception.GenBuildException;
+import org.tianocore.build.exception.PcdAutogenException;
+import org.tianocore.build.exception.PlatformPcdPreprocessBuildException;
import org.tianocore.build.fpd.FpdParserForThread;
import org.tianocore.build.fpd.FpdParserTask;
import org.tianocore.build.global.GenBuildLogger;
@@ -31,6 +36,7 @@ import org.tianocore.build.global.GlobalData;
import org.tianocore.build.toolchain.ConfigReader;
import org.tianocore.build.toolchain.ToolChainInfo;
import org.tianocore.common.definitions.ToolDefinitions;
+import org.tianocore.common.exception.EdkException;
import org.tianocore.common.logger.EdkLog;
/**
@@ -105,6 +111,37 @@ public class FrameworkBuildTask extends Task{
private String type = "all";
public void execute() throws BuildException {
+ try {
+ processFrameworkBuild();
+ } catch (PcdAutogenException e) {
+ //
+ // Add more logic process here
+ //
+ throw new BuildException(e.getMessage());
+ } catch (AutoGenException e) {
+ //
+ // Add more logic process here
+ //
+ throw new BuildException(e.getMessage());
+ } catch (PlatformPcdPreprocessBuildException e) {
+ //
+ // Add more logic process here
+ //
+ throw new BuildException(e.getMessage());
+ } catch (GenBuildException e) {
+ //
+ // Add more logic process here
+ //
+ throw new BuildException(e.getMessage());
+ } catch (EdkException e) {
+ //
+ // Add more logic process here
+ //
+ throw new BuildException(e.getMessage());
+ }
+ }
+
+ private void processFrameworkBuild() throws EdkException, GenBuildException, AutoGenException, PcdAutogenException, PlatformPcdPreprocessBuildException {
//
// set Logger
//
@@ -143,7 +180,7 @@ public class FrameworkBuildTask extends Task{
}
}
}
- } catch (Exception e) {
+ } catch (IOException e) {
throw new BuildException(e.getMessage());
}
@@ -199,12 +236,12 @@ public class FrameworkBuildTask extends Task{
// Build every FPD files (PLATFORM build)
//
if (buildFile.getName().endsWith(ToolDefinitions.FPD_EXTENSION)) {
- System.out.println("Processing the FPD file [" + buildFile.getPath() + "] ..>> ");
+ EdkLog.log(this, "Processing the FPD file [" + buildFile.getPath() + "] ..>> ");
//
// Iff for platform build will enable the multi-thread if set in target.txt
//
if (multithread && type.equalsIgnoreCase("all")) {
- System.out.println("Multi-thread build is enabled. ");
+ EdkLog.log(this, "Multi-thread build is enabled. ");
FpdParserForThread fpdParserForThread = new FpdParserForThread();
fpdParserForThread.setType(type);
fpdParserForThread.setProject(getProject());
@@ -237,8 +274,8 @@ public class FrameworkBuildTask extends Task{
//
else if (buildFile.getName().endsWith(ToolDefinitions.MSA_EXTENSION)) {
File tmpFile = new File(GlobalData.getWorkspacePath() + File.separatorChar + activePlatform);
- System.out.println("Using the FPD file [" + tmpFile.getPath() + "] for the active platform. ");
- System.out.println("Processing the MSA file [" + buildFile.getPath() + "] ..>> ");
+ EdkLog.log(this, "Using the FPD file [" + tmpFile.getPath() + "] for the active platform. ");
+ EdkLog.log(this, "Processing the MSA file [" + buildFile.getPath() + "] ..>> ");
GenBuildTask genBuildTask = new GenBuildTask();
genBuildTask.setSingleModuleBuild(true);
genBuildTask.setType(type);
@@ -290,13 +327,13 @@ public class FrameworkBuildTask extends Task{
index++;
}
- System.out.println("Finding " + allFiles.length + " FPD files: ");
+ EdkLog.log(this, "Finding " + allFiles.length + " FPD files: ");
for (int i = 0; i < allFiles.length; i++) {
System.out.println("[" + (i + 1) + "]: " + allFiles[i].getName());
}
boolean flag = true;
- System.out.print("Please select one of the following FPD files to build:[1] ");
+ EdkLog.log(this, "Please select one of the following FPD files to build:[1] ");
do{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
@@ -308,7 +345,7 @@ public class FrameworkBuildTask extends Task{
}
int indexSelect = Integer.parseInt(str);
if (indexSelect <=0 || indexSelect > allFiles.length) {
- System.out.print("Please enter a number between [1.." + allFiles.length + "]:[1] ");
+ EdkLog.log(this, "Please enter a number between [1.." + allFiles.length + "]:[1] ");
continue ;
} else {
file = allFiles[indexSelect - 1];
@@ -316,7 +353,7 @@ public class FrameworkBuildTask extends Task{
continue ;
}
} catch (Exception e) {
- System.out.print("Please enter a valid number:[1] ");
+ EdkLog.log(this, "Please enter a valid number:[1] ");
flag = true;
}
} while (flag);
@@ -335,69 +372,63 @@ public class FrameworkBuildTask extends Task{
}
}
- private void readTargetFile(){
- try {
- String targetFile = getProject().getProperty("WORKSPACE_DIR") + File.separatorChar + targetFilename;
-
- String[][] targetFileInfo = ConfigReader.parse(targetFile);
-
- //
- // Get ToolChain Info from target.txt
- //
- ToolChainInfo envToolChainInfo = new ToolChainInfo();
- String str = getValue(ToolDefinitions.TARGET_KEY_TARGET, targetFileInfo);
- if (str == null || str.trim().equals("")) {
- envToolChainInfo.addTargets("*");
- } else {
- envToolChainInfo.addTargets(str);
- }
- str = getValue(ToolDefinitions.TARGET_KEY_TOOLCHAIN, targetFileInfo);
- if (str == null || str.trim().equals("")) {
- envToolChainInfo.addTagnames("*");
- } else {
- envToolChainInfo.addTagnames(str);
- }
- str = getValue(ToolDefinitions.TARGET_KEY_ARCH, targetFileInfo);
- if (str == null || str.trim().equals("")) {
- envToolChainInfo.addArchs("*");
- } else {
- envToolChainInfo.addArchs(str);
- }
- GlobalData.setToolChainEnvInfo(envToolChainInfo);
-
- str = getValue(ToolDefinitions.TARGET_KEY_TOOLS_DEF, targetFileInfo);
- if (str != null && str.trim().length() > 0) {
- toolsDefFilename = str;
- }
-
- str = getValue(ToolDefinitions.TARGET_KEY_ACTIVE_PLATFORM, targetFileInfo);
- if (str != null && ! str.trim().equals("")) {
- if ( ! str.endsWith(".fpd")) {
- throw new BuildException("FPD file's extension must be \"" + ToolDefinitions.FPD_EXTENSION + "\"!");
- }
- activePlatform = str;
- }
-
- str = getValue(ToolDefinitions.TARGET_KEY_MULTIPLE_THREAD, targetFileInfo);
- if (str != null && str.trim().equalsIgnoreCase("Enable")) {
- multithread = true;
+ private void readTargetFile() throws EdkException{
+ String targetFile = getProject().getProperty("WORKSPACE_DIR") + File.separatorChar + targetFilename;
+
+ String[][] targetFileInfo = ConfigReader.parse(targetFile);
+
+ //
+ // Get ToolChain Info from target.txt
+ //
+ ToolChainInfo envToolChainInfo = new ToolChainInfo();
+ String str = getValue(ToolDefinitions.TARGET_KEY_TARGET, targetFileInfo);
+ if (str == null || str.trim().equals("")) {
+ envToolChainInfo.addTargets("*");
+ } else {
+ envToolChainInfo.addTargets(str);
+ }
+ str = getValue(ToolDefinitions.TARGET_KEY_TOOLCHAIN, targetFileInfo);
+ if (str == null || str.trim().equals("")) {
+ envToolChainInfo.addTagnames("*");
+ } else {
+ envToolChainInfo.addTagnames(str);
+ }
+ str = getValue(ToolDefinitions.TARGET_KEY_ARCH, targetFileInfo);
+ if (str == null || str.trim().equals("")) {
+ envToolChainInfo.addArchs("*");
+ } else {
+ envToolChainInfo.addArchs(str);
+ }
+ GlobalData.setToolChainEnvInfo(envToolChainInfo);
+
+ str = getValue(ToolDefinitions.TARGET_KEY_TOOLS_DEF, targetFileInfo);
+ if (str != null && str.trim().length() > 0) {
+ toolsDefFilename = str;
+ }
+
+ str = getValue(ToolDefinitions.TARGET_KEY_ACTIVE_PLATFORM, targetFileInfo);
+ if (str != null && ! str.trim().equals("")) {
+ if ( ! str.endsWith(".fpd")) {
+ throw new BuildException("FPD file's extension must be \"" + ToolDefinitions.FPD_EXTENSION + "\"!");
}
+ activePlatform = str;
+ }
+
+ str = getValue(ToolDefinitions.TARGET_KEY_MULTIPLE_THREAD, targetFileInfo);
+ if (str != null && str.trim().equalsIgnoreCase("Enable")) {
+ multithread = true;
+ }
- str = getValue(ToolDefinitions.TARGET_KEY_MAX_CONCURRENT_THREAD_NUMBER, targetFileInfo);
- if (str != null ) {
- try {
- int threadNum = Integer.parseInt(str);
- if (threadNum > 0) {
- MAX_CONCURRENT_THREAD_NUMBER = threadNum;
- }
- } catch (Exception enuma) {
-
+ str = getValue(ToolDefinitions.TARGET_KEY_MAX_CONCURRENT_THREAD_NUMBER, targetFileInfo);
+ if (str != null ) {
+ try {
+ int threadNum = Integer.parseInt(str);
+ if (threadNum > 0) {
+ MAX_CONCURRENT_THREAD_NUMBER = threadNum;
}
+ } catch (Exception enuma) {
}
}
- catch (Exception ex) {
- throw new BuildException(ex.getMessage());
- }
}
private String getValue(String key, String[][] map) {
diff --git a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
index 978b11f..9b6251a 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
@@ -35,6 +35,7 @@ import org.apache.xmlbeans.XmlObject;
import org.tianocore.common.definitions.ToolDefinitions;
import org.tianocore.common.exception.EdkException;
+import org.tianocore.common.logger.EdkLog;
import org.tianocore.build.autogen.AutoGen;
import org.tianocore.build.fpd.FpdParserTask;
import org.tianocore.build.global.GlobalData;
@@ -231,7 +232,7 @@ public class GenBuildTask extends Ant {
// Whether the module is built before
//
if (moduleId.isLibrary() == false && GlobalData.hasFpdModuleSA(fpdModuleId) == false) {
- System.out.println("\nWARNING: " + moduleId + " for " + archList[k] + " was not found in current platform FPD file!\n");
+ EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: " + moduleId + " for " + archList[k] + " was not found in current platform FPD file!\n");
continue;
} else if (GlobalData.isModuleBuilt(fpdModuleId)) {
break;
@@ -256,7 +257,7 @@ public class GenBuildTask extends Ant {
// don't do anything if no tools found
//
if (GlobalData.isCommandSet(targetList[i], toolchainList[j], archList[k]) == false) {
- System.out.println("Warning: No build issued. No tools were found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");
+ EdkLog.log(this, EdkLog.EDK_WARNING, "Warning: No build issued. No tools were found for [target=" + targetList[i] + " toolchain=" + toolchainList[j] + " arch=" + archList[k] + "]\n");
continue;
}
@@ -266,8 +267,8 @@ public class GenBuildTask extends Ant {
//
getProject().setProperty("TOOLCHAIN", toolchainList[j]);
- System.out.println("Build " + moduleId + " start >>>");
- System.out.println("Target: " + targetList[i] + " Tagname: " + toolchainList[j] + " Arch: " + archList[k]);
+ EdkLog.log(this, "Build " + moduleId + " start >>>");
+ EdkLog.log(this, "Target: " + targetList[i] + " Tagname: " + toolchainList[j] + " Arch: " + archList[k]);
saq.push(GlobalData.getDoc(fpdModuleId));
//
@@ -576,7 +577,7 @@ public class GenBuildTask extends Ant {
// then call the exist BaseName_build.xml directly.
//
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
- System.out.println("Call user-defined " + moduleId.getName() + "_build.xml");
+ EdkLog.log(this, "Call user-defined " + moduleId.getName() + "_build.xml");
String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
antCall(antFilename, null);
@@ -606,7 +607,7 @@ public class GenBuildTask extends Ant {
// then call the exist BaseName_build.xml directly.
//
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
- System.out.println("Calling user-defined " + moduleId.getName() + "_build.xml");
+ EdkLog.log(this, "Calling user-defined " + moduleId.getName() + "_build.xml");
String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
antCall(antFilename, "clean");
@@ -624,7 +625,7 @@ public class GenBuildTask extends Ant {
// then call the exist BaseName_build.xml directly.
//
if (moduleId.getModuleType().equalsIgnoreCase("USER_DEFINED")) {
- System.out.println("Calling user-defined " + moduleId.getName() + "_build.xml");
+ EdkLog.log(this, "Calling user-defined " + moduleId.getName() + "_build.xml");
String antFilename = getProject().getProperty("MODULE_DIR") + File.separatorChar + moduleId.getName() + "_build.xml";
antCall(antFilename, "cleanall");
diff --git a/Tools/Source/GenBuild/org/tianocore/build/exception/EdkException.java b/Tools/Source/GenBuild/org/tianocore/build/exception/EdkException.java
deleted file mode 100644
index 086ecd8..0000000
--- a/Tools/Source/GenBuild/org/tianocore/build/exception/EdkException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/** @file
- EntityException class.
-
- The class handle the exception throwed by entity class.
-
-Copyright (c) 2006, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-package org.tianocore.build.exception;
-
-/**
- The class handle the exception throwed by entity class.
-**/
-public class EdkException extends Exception {
- static final long serialVersionUID = -8034897190740066938L;
- /**
- Constructure function
-
- @param expStr exception message string.
- **/
- public EdkException(String expStr) {
- super("[EdkException]:" + expStr);
- }
-
- public EdkException() {
- super();
- }
-}
-
diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java
index 3751224..05f6e01 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java
@@ -613,7 +613,7 @@ public class PlatformBuildFileGenerator {
root.appendChild(recursiveNode(childItem, document));
}
else if (childItem.getNodeType() == Node.TEXT_NODE){
- if ( ! childItem.getNodeValue().trim().equalsIgnoreCase("")) {
+ if (!childItem.getNodeValue().trim().equalsIgnoreCase("")) {
root.setTextContent(childItem.getNodeValue());
}
}
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java b/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java
index 9bc3f2d..f102b9c 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java
@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Vector;
import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
import org.tianocore.common.logger.EdkLog;
import org.tianocore.common.logger.LogMethod;
@@ -72,40 +73,40 @@ public class GenBuildLogger implements LogMethod {
//
switch (msgLevel) {
case EdkLog.EDK_ALWAYS:
- this.project.log(msg, Project.MSG_INFO);
+ log(msgSource, msg, Project.MSG_INFO);
break;
case EdkLog.EDK_ERROR:
if (flag) {
- this.project.log(msg, Project.MSG_ERR);
+ log(msgSource, msg, Project.MSG_ERR);
} else {
- this.project.log(msg, Project.MSG_ERR);
+ log(msgSource, msg, Project.MSG_ERR);
v.add(msg);
}
break;
case EdkLog.EDK_WARNING:
if (flag) {
- this.project.log(msg, Project.MSG_WARN);
+ log(msgSource, msg, Project.MSG_WARN);
} else {
v.add(msg);
}
break;
case EdkLog.EDK_INFO:
if (flag) {
- this.project.log(msg, Project.MSG_INFO);
+ log(msgSource, msg, Project.MSG_INFO);
} else {
v.add(msg);
}
break;
case EdkLog.EDK_VERBOSE:
if (flag) {
- this.project.log(msg, Project.MSG_VERBOSE);
+ log(msgSource, msg, Project.MSG_VERBOSE);
} else {
v.add(msg);
}
break;
case EdkLog.EDK_DEBUG:
if (flag) {
- this.project.log(msg, Project.MSG_DEBUG);
+ log(msgSource, msg, Project.MSG_DEBUG);
} else {
v.add(msg);
}
@@ -119,4 +120,12 @@ public class GenBuildLogger implements LogMethod {
//
}
+
+ private void log(Object msgSource, String msg, int level) {
+ if (msgSource instanceof Task) {
+ this.project.log((Task)msgSource, msg, level);
+ } else {
+ this.project.log(msg, level);
+ }
+ }
} \ No newline at end of file
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
index 45f36ee..facd177 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java
@@ -161,7 +161,7 @@ public class GlobalData {
// CONF dir + tools definition file name
//
File toolsDefFile = new File(workspaceDir + File.separatorChar + toolsDefFilename);
- System.out.println("Using tool definiton file [" + toolsDefFile.getPath() + "].");
+ EdkLog.log("Using tool definiton file [" + toolsDefFile.getPath() + "].");
try {
toolsDef = new ToolChainConfig(toolsDefFile);
} catch (Exception e) {
@@ -661,8 +661,8 @@ public class GlobalData {
}
toolChainInfo.addCommands(toolsDef.getConfigInfo().getCommands());
toolChainInfo.normalize();
- System.out.println("Current build tool chain information summary: ");
- System.out.println(toolChainInfo + "");
+ EdkLog.log("Current build tool chain information summary: ");
+ EdkLog.log(toolChainInfo + "");
}
return toolChainInfo;
}