Add exception and log mechanism
authorqouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 20 Jun 2006 11:57:17 +0000 (11:57 +0000)
committerqouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 20 Jun 2006 11:57:17 +0000 (11:57 +0000)
1. Add :
   a. GenBuildLogger.java in Tools/Source/GenBuild/org/tianocore/build/gobal.
   b.Tools/Source/Common/build.xml
2. modify:
   a.edksetup.bat
   b.Tools/build.xml
   c.Tools/Source/GenBuild/build.xml
   d. Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@574 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/Common/build.xml [new file with mode: 0644]
Tools/Source/GenBuild/build.xml
Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java
Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java [new file with mode: 0644]
Tools/build.xml
edksetup.bat

diff --git a/Tools/Source/Common/build.xml b/Tools/Source/Common/build.xml
new file mode 100644 (file)
index 0000000..ad517cd
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0"?>\r
+<!--\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+-->\r
+<project name="Common" default="all" basedir=".">\r
+\r
+  <taskdef resource="net/sf/antcontrib/antlib.xml"/>\r
+  <property environment="env"/>\r
+  <property name="WORKSPACE" value="${env.WORKSPACE}"/>\r
+  <property name="buildDir" value="build"/>\r
+  <property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>\r
+  <target name="all" depends="install"/>\r
+  <target name="source">\r
+    <mkdir dir="${buildDir}"/>\r
+    <javac srcdir="." destdir="${buildDir}">\r
+      <compilerarg value="-Xlint"/>\r
+    </javac>\r
+  </target>\r
+  <target name="clean">\r
+    <delete dir="${buildDir}"/>\r
+  </target>\r
+  <target name="cleanall">\r
+    <delete dir="${buildDir}"/>\r
+    <if>\r
+      <available file="${installLocation}/Common.jar"/>\r
+      <then>\r
+        <echo message="You must manually remove the file: ${installLocation}/Common.jar"/>\r
+        <echo message="Java has already loaded the file, and cannot remove it within ANT!"/>\r
+      </then>\r
+    </if>\r
+  </target>\r
+  <target name="install" depends="source">\r
+    <jar destfile="${installLocation}/Common.jar"\r
+      basedir="${buildDir}"\r
+      includes="**"\r
+    />\r
+  </target>\r
+</project>\r
index 473646b..811f96b 100644 (file)
@@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   <property name="WORKSPACE" value="${env.WORKSPACE}"/>\r
   <path id="classpath">\r
     <fileset dir="${WORKSPACE}/Tools/Jars" includes="SurfaceArea.jar"/>\r
+    <fileset dir="${WORKSPACE}/Tools/Jars" includes="Common.jar"/>\r
     <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>\r
   </path>\r
   <property name="buildDir" value="build"/>\r
index 5ee07fb..3127b87 100644 (file)
@@ -50,10 +50,12 @@ import org.w3c.dom.Node;
 import org.tianocore.build.autogen.AutoGen;\r
 import org.tianocore.build.autogen.CommonDefinition;\r
 import org.tianocore.build.fpd.FpdParserTask;\r
+import org.tianocore.build.global.GenBuildLogger;\r
 import org.tianocore.build.global.GlobalData;\r
 import org.tianocore.build.global.OutputManager;\r
 import org.tianocore.build.global.SurfaceAreaQuery;\r
 import org.tianocore.build.toolchain.ToolChainFactory;\r
+import org.tianocore.logger.EdkLog;\r
 import org.tianocore.FilenameDocument;\r
 import org.tianocore.MsaHeaderDocument;\r
 import org.tianocore.MsaLibHeaderDocument;\r
@@ -200,6 +202,13 @@ public class GenBuildTask extends Task {
     **/\r
     public void execute() throws BuildException {\r
         System.out.println("Module [" + baseName + "] start.");\r
+        //\r
+        // Inital GenBuild log  method \r
+        //\r
+        GenBuildLogger logger = new GenBuildLogger(getProject());\r
+        EdkLog.setLogger(logger);\r
+        EdkLog.setLogLevel(1);\r
+        \r
         OutputManager.update(getProject());\r
         GlobalData.initInfo("Tools" + File.separatorChar + "Conf" + File.separatorChar + "FrameworkDatabase.db",\r
                             getProject().getProperty("WORKSPACE_DIR"));\r
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java b/Tools/Source/GenBuild/org/tianocore/build/global/GenBuildLogger.java
new file mode 100644 (file)
index 0000000..4c179b8
--- /dev/null
@@ -0,0 +1,36 @@
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+Module Name:\r
+  GenBuildLogger.java\r
+\r
+Abstract:\r
+\r
+--*/\r
+\r
+package org.tianocore.build.global;\r
+import org.apache.tools.ant.Project;\r
+import org.tianocore.logger.LogMethod;\r
+\r
+public class GenBuildLogger implements LogMethod {\r
+    private Project project;\r
+    public GenBuildLogger(Project project) {\r
+        this.project = project;\r
+        \r
+    }\r
+\r
+    public void putMessage(Object msgSource, int msgLevel, String msg) {\r
+        if (this.project != null){\r
+            this.project.log(msg, Project.MSG_INFO);\r
+        }\r
+        \r
+    }\r
+}
\ No newline at end of file
index 2188431..f73e693 100644 (file)
@@ -18,6 +18,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
       <!-- Note: this is an ordered list. The projects have dependencies between them. -->\r
       <filelist dir="."\r
         files="\r
+          Source/Common/build.xml\r
           Source/GenBuild/build.xml\r
           Source/FrameworkTasks/build.xml\r
           Source/Cpptasks/build.xml\r
index 60c55c4..10d5325 100644 (file)
@@ -118,12 +118,14 @@ call ant -f %WORKSPACE%\Tools\build.xml SurfaceArea
 @REM\r
 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\%Tools\Jars\SurfaceArea.jar\r
 \r
+\r
 call ant -f %WORKSPACE%\Tools\build.xml JavaCode\r
 \r
 @REM\r
 @REM We have all of the Java Programs and add-in classes created, so we can start\r
 @REM using the cpp-tasks to create our tools\r
 @REM\r
+set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\Common.jar\r
 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\GenBuild.jar\r
 set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\cpptasks.jar;%WORKSPACE%\Tools\Jars\frameworktasks.jar\r
 \r