Add two definitions to ToolDefinitions. Enhance EdkLog and GenBuildLogger. GenBuildLogger contains two behaviors now, one is for normal; while another is for multi-thread. (4)

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1450 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
wuyizhong
2006-09-05 05:47:21 +00:00
parent 97fc032b57
commit c8df018e44
9 changed files with 208 additions and 141 deletions

View File

@@ -26,10 +26,12 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.tianocore.build.fpd.FpdParserForThread;
import org.tianocore.build.fpd.FpdParserTask;
import org.tianocore.build.global.GenBuildLogger;
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.logger.EdkLog;
/**
<p>
@@ -103,6 +105,13 @@ public class FrameworkBuildTask extends Task{
private String type = "all";
public void execute() throws BuildException {
//
// set Logger
//
GenBuildLogger logger = new GenBuildLogger(getProject());
EdkLog.setLogLevel(getProject().getProperty("env.LOGLEVEL"));
EdkLog.setLogger(logger);
//
// Seach build.xml -> .FPD -> .MSA file
//
@@ -200,7 +209,7 @@ public class FrameworkBuildTask extends Task{
fpdParserForThread.setType(type);
fpdParserForThread.setProject(getProject());
fpdParserForThread.setFpdFile(buildFile);
fpdParserForThread.execute();
fpdParserForThread.perform();
return ;
}
@@ -208,7 +217,7 @@ public class FrameworkBuildTask extends Task{
fpdParserTask.setType(type);
fpdParserTask.setProject(getProject());
fpdParserTask.setFpdFile(buildFile);
fpdParserTask.execute();
fpdParserTask.perform();
//
// If cleanall delete the Platform_build.xml
@@ -239,7 +248,7 @@ public class FrameworkBuildTask extends Task{
}
genBuildTask.setProject(getProject());
genBuildTask.setMsaFile(buildFile);
genBuildTask.execute();
genBuildTask.perform();
}
}
@@ -268,7 +277,6 @@ public class FrameworkBuildTask extends Task{
String name = (String)piter.next();
originalProperties.put(new String(name), new String((String)allProperties.get(name)));
}
}
private File intercommuniteWithUser(){
@@ -370,12 +378,12 @@ public class FrameworkBuildTask extends Task{
activePlatform = str;
}
str = getValue("MULTIPLE_THREAD", targetFileInfo);
str = getValue(ToolDefinitions.TARGET_KEY_MULTIPLE_THREAD, targetFileInfo);
if (str != null && str.trim().equalsIgnoreCase("Enable")) {
multithread = true;
}
str = getValue("MAX_CONCURRENT_THREAD_NUMBER", targetFileInfo);
str = getValue(ToolDefinitions.TARGET_KEY_MAX_CONCURRENT_THREAD_NUMBER, targetFileInfo);
if (str != null ) {
try {
int threadNum = Integer.parseInt(str);

View File

@@ -35,10 +35,8 @@ 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.GenBuildLogger;
import org.tianocore.build.global.GlobalData;
import org.tianocore.build.global.OutputManager;
import org.tianocore.build.global.SurfaceAreaQuery;
@@ -130,13 +128,6 @@ public class GenBuildTask extends Ant {
if (!FrameworkBuildTask.multithread) {
cleanupProperties();
}
//
// set Logger
//
GenBuildLogger logger = new GenBuildLogger(getProject());
EdkLog.setLogLevel(getProject().getProperty("env.LOGLEVEL"));
EdkLog.setLogger(logger);
//
// Enable all specified properties

View File

@@ -1,9 +1,6 @@
/** @file
This file is ANT task FpdParserTask.
FpdParserTask is used to parse FPD (Framework Platform Description) and generate
build.out.xml. It is for Package or Platform build use.
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
@@ -37,31 +34,6 @@ import org.tianocore.build.GenBuildThread;
import org.tianocore.common.exception.EdkException;
/**
<code>FpdParserTask</code> is an ANT task. The main function is parsing Framework
Platform Descritpion (FPD) XML file and generating its ANT build script for
corresponding platform.
<p>The task sets global properties PLATFORM, PLATFORM_DIR, PLATFORM_RELATIVE_DIR
and BUILD_DIR. </p>
<p>The task generates ${PLATFORM}_build.xml file which will be called by top level
build.xml. The task also generate Fv.inf files (File is for Tool GenFvImage)
and flash definition file (File is for Tool FlashMap) if necessary. </p>
<p>FpdParserTask task stores all FPD information to GlobalData. And parse
tools definition file to set up compiler options for different Target and
different ToolChainTag. </p>
<p>The method parseFpdFile is also prepared for single module build. </p>
<p>The usage is (take NT32 Platform for example):</p>
<pre>
&lt;FPDParser platformName="Nt32" /&gt;
</pre>
<p>The task will initialize all information through parsing Framework Database,
SPD, Tool chain configuration files. </p>
@since GenBuild 1.0
**/
@@ -94,19 +66,8 @@ public class FpdParserForThread extends FpdParserTask {
}
/**
ANT task's entry method. The main steps is described as following:
<ul>
<li>Initialize global information (Framework DB, SPD files and all MSA files
listed in SPD). This step will execute only once in whole build process;</li>
<li>Parse specified FPD file; </li>
<li>Generate FV.inf files; </li>
<li>Generate PlatformName_build.xml file for Flatform build; </li>
<li>Collect PCD information. </li>
</ul>
@throws BuildException
Surface area is not valid.
**/
public void execute() throws BuildException {
//

View File

@@ -1,38 +1,122 @@
/*++
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
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.
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
Module Name:
GenBuildLogger.java
Abstract:
Abstract:
--*/
--*/
package org.tianocore.build.global;
import java.io.File;
import java.util.List;
import java.util.Vector;
import org.apache.tools.ant.Project;
import org.tianocore.common.logger.EdkLog;
import org.tianocore.common.logger.LogMethod;
public class GenBuildLogger implements LogMethod {
private Project project;
public GenBuildLogger(Project project) {
this.project = project;
private Project project = null;
///
/// flag to present whether cache all msg or not
/// true means not to cache.
///
private boolean flag = true;
private List<String> v = null;
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);
public GenBuildLogger (Project project, boolean flag) {
this.project = project;
this.flag = flag;
//
// Only flag is false, v will be initialized and used.
//
if (!flag) {
v = new Vector<String>(2048);
}
}
/**
Rules: flag = true: means no cache Action: Print it to console
flag = false: mean cache all msg exception some special Action: loglevel
is EDK_ALWAYS -- Print but no cache loglevel is EDK_ERROR -- Print and
cache the msg others -- No print and cache the msg
**/
public synchronized void putMessage(Object msgSource, int msgLevel,
String msg) {
if (this.project == null) {
return;
}
//
// If msgLevel is always print, then print it
//
switch (msgLevel) {
case EdkLog.EDK_ALWAYS:
this.project.log(msg, Project.MSG_INFO);
break;
case EdkLog.EDK_ERROR:
if (flag) {
this.project.log(msg, Project.MSG_ERR);
} else {
this.project.log(msg, Project.MSG_ERR);
v.add(msg);
}
break;
case EdkLog.EDK_WARNING:
if (flag) {
this.project.log(msg, Project.MSG_WARN);
} else {
v.add(msg);
}
break;
case EdkLog.EDK_INFO:
if (flag) {
this.project.log(msg, Project.MSG_INFO);
} else {
v.add(msg);
}
break;
case EdkLog.EDK_VERBOSE:
if (flag) {
this.project.log(msg, Project.MSG_VERBOSE);
} else {
v.add(msg);
}
break;
case EdkLog.EDK_DEBUG:
if (flag) {
this.project.log(msg, Project.MSG_DEBUG);
} else {
v.add(msg);
}
break;
}
}
public void flushToFile(File file) {
//
// Sort msg and store to the file (TBD)
//
}
}