Add exception and log mechanism

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
This commit is contained in:
qouyang 2006-06-20 11:57:17 +00:00
parent c082c8cffe
commit b9546cc80d
6 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,45 @@
<?xml version="1.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.
-->
<project name="Common" default="all" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<property environment="env"/>
<property name="WORKSPACE" value="${env.WORKSPACE}"/>
<property name="buildDir" value="build"/>
<property name="installLocation" value="${WORKSPACE}/Tools/Jars"/>
<target name="all" depends="install"/>
<target name="source">
<mkdir dir="${buildDir}"/>
<javac srcdir="." destdir="${buildDir}">
<compilerarg value="-Xlint"/>
</javac>
</target>
<target name="clean">
<delete dir="${buildDir}"/>
</target>
<target name="cleanall">
<delete dir="${buildDir}"/>
<if>
<available file="${installLocation}/Common.jar"/>
<then>
<echo message="You must manually remove the file: ${installLocation}/Common.jar"/>
<echo message="Java has already loaded the file, and cannot remove it within ANT!"/>
</then>
</if>
</target>
<target name="install" depends="source">
<jar destfile="${installLocation}/Common.jar"
basedir="${buildDir}"
includes="**"
/>
</target>
</project>

View File

@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<property name="WORKSPACE" value="${env.WORKSPACE}"/> <property name="WORKSPACE" value="${env.WORKSPACE}"/>
<path id="classpath"> <path id="classpath">
<fileset dir="${WORKSPACE}/Tools/Jars" includes="SurfaceArea.jar"/> <fileset dir="${WORKSPACE}/Tools/Jars" includes="SurfaceArea.jar"/>
<fileset dir="${WORKSPACE}/Tools/Jars" includes="Common.jar"/>
<fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/> <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
</path> </path>
<property name="buildDir" value="build"/> <property name="buildDir" value="build"/>

View File

@ -50,10 +50,12 @@ import org.w3c.dom.Node;
import org.tianocore.build.autogen.AutoGen; import org.tianocore.build.autogen.AutoGen;
import org.tianocore.build.autogen.CommonDefinition; import org.tianocore.build.autogen.CommonDefinition;
import org.tianocore.build.fpd.FpdParserTask; import org.tianocore.build.fpd.FpdParserTask;
import org.tianocore.build.global.GenBuildLogger;
import org.tianocore.build.global.GlobalData; import org.tianocore.build.global.GlobalData;
import org.tianocore.build.global.OutputManager; import org.tianocore.build.global.OutputManager;
import org.tianocore.build.global.SurfaceAreaQuery; import org.tianocore.build.global.SurfaceAreaQuery;
import org.tianocore.build.toolchain.ToolChainFactory; import org.tianocore.build.toolchain.ToolChainFactory;
import org.tianocore.logger.EdkLog;
import org.tianocore.FilenameDocument; import org.tianocore.FilenameDocument;
import org.tianocore.MsaHeaderDocument; import org.tianocore.MsaHeaderDocument;
import org.tianocore.MsaLibHeaderDocument; import org.tianocore.MsaLibHeaderDocument;
@ -200,6 +202,13 @@ public class GenBuildTask extends Task {
**/ **/
public void execute() throws BuildException { public void execute() throws BuildException {
System.out.println("Module [" + baseName + "] start."); System.out.println("Module [" + baseName + "] start.");
//
// Inital GenBuild log method
//
GenBuildLogger logger = new GenBuildLogger(getProject());
EdkLog.setLogger(logger);
EdkLog.setLogLevel(1);
OutputManager.update(getProject()); OutputManager.update(getProject());
GlobalData.initInfo("Tools" + File.separatorChar + "Conf" + File.separatorChar + "FrameworkDatabase.db", GlobalData.initInfo("Tools" + File.separatorChar + "Conf" + File.separatorChar + "FrameworkDatabase.db",
getProject().getProperty("WORKSPACE_DIR")); getProject().getProperty("WORKSPACE_DIR"));

View File

@ -0,0 +1,36 @@
/*++
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:
GenBuildLogger.java
Abstract:
--*/
package org.tianocore.build.global;
import org.apache.tools.ant.Project;
import org.tianocore.logger.LogMethod;
public class GenBuildLogger implements LogMethod {
private Project project;
public GenBuildLogger(Project project) {
this.project = project;
}
public void putMessage(Object msgSource, int msgLevel, String msg) {
if (this.project != null){
this.project.log(msg, Project.MSG_INFO);
}
}
}

View 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. --> <!-- Note: this is an ordered list. The projects have dependencies between them. -->
<filelist dir="." <filelist dir="."
files=" files="
Source/Common/build.xml
Source/GenBuild/build.xml Source/GenBuild/build.xml
Source/FrameworkTasks/build.xml Source/FrameworkTasks/build.xml
Source/Cpptasks/build.xml Source/Cpptasks/build.xml

View File

@ -118,12 +118,14 @@ call ant -f %WORKSPACE%\Tools\build.xml SurfaceArea
@REM @REM
set CLASSPATH=%CLASSPATH%;%WORKSPACE%\%Tools\Jars\SurfaceArea.jar set CLASSPATH=%CLASSPATH%;%WORKSPACE%\%Tools\Jars\SurfaceArea.jar
call ant -f %WORKSPACE%\Tools\build.xml JavaCode call ant -f %WORKSPACE%\Tools\build.xml JavaCode
@REM @REM
@REM We have all of the Java Programs and add-in classes created, so we can start @REM We have all of the Java Programs and add-in classes created, so we can start
@REM using the cpp-tasks to create our tools @REM using the cpp-tasks to create our tools
@REM @REM
set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\Common.jar
set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\GenBuild.jar set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\GenBuild.jar
set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\cpptasks.jar;%WORKSPACE%\Tools\Jars\frameworktasks.jar set CLASSPATH=%CLASSPATH%;%WORKSPACE%\Tools\Jars\cpptasks.jar;%WORKSPACE%\Tools\Jars\frameworktasks.jar