public final static String TARGET_KEY_TOOLCHAIN = "TOOL_CHAIN_TAG";\r
public final static String TARGET_KEY_ARCH = "TARGET_ARCH";\r
public final static String TARGET_KEY_TOOLS_DEF = "TOOL_CHAIN_CONF";\r
+ public final static String TARGET_KEY_MULTIPLE_THREAD = "MULTIPLE_THREAD";\r
+ public final static String TARGET_KEY_MAX_CONCURRENT_THREAD_NUMBER \r
+ = "MAX_CONCURRENT_THREAD_NUMBER";\r
}\r
\r
public class EdkException extends Exception {\r
static final long serialVersionUID = -8494188017252114029L;\r
- private StackTraceElement[] stackTrace;\r
+\r
public static boolean isPrintStack = false;\r
\r
public EdkException(String message) {\r
\r
package org.tianocore.common.logger;\r
\r
+import java.io.File;\r
import java.util.logging.Level;\r
import java.util.logging.Logger;\r
\r
};\r
\r
public DefaultLogger() {\r
-\r
}\r
\r
public void putMessage(Object msgSource, int msgLevel, String msg) {\r
+ if (msgLevel < 0 || msgLevel > levelMap.length) {\r
+ msgLevel = 2;\r
+ }\r
logger.log(levelMap[msgLevel], msg);\r
}\r
+ \r
+ public void flushToFile(File file){\r
+ \r
+ }\r
}
\ No newline at end of file
/*++\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
+ 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
+ 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
- EdkLogger.java\r
+ Module Name:\r
+ EdkLogger.java\r
\r
-Abstract:\r
-\r
---*/\r
+ Abstract:\r
\r
+ --*/\r
package org.tianocore.common.logger;\r
\r
-import org.tianocore.common.logger.LogMethod;\r
+import java.io.File;\r
\r
public class EdkLog {\r
- private static final String error = "ERROR";\r
- private static final String warning = "WARNING";\r
- private static final String info = "INFO";\r
- private static final String verbose = "VERBOSE";\r
- private static final String debug = "DEBUG";\r
+ public static final String always = "ALWAYS";\r
+\r
+ public static final String error = "ERROR";\r
+\r
+ public static final String warning = "WARNING";\r
+\r
+ public static final String info = "INFO";\r
+\r
+ public static final String verbose = "VERBOSE";\r
+\r
+ public static final String debug = "DEBUG";\r
+\r
+ public static final int EDK_ALWAYS = -1;\r
+\r
+ public static final int EDK_ERROR = 0;\r
\r
- public static final int EDK_ERROR = 0;\r
public static final int EDK_WARNING = 1;\r
- public static final int EDK_INFO = 2;\r
+\r
+ public static final int EDK_INFO = 2;\r
+\r
public static final int EDK_VERBOSE = 3;\r
- public static final int EDK_DEBUG = 4;\r
+\r
+ public static final int EDK_DEBUG = 4;\r
\r
private static int logLevel = EDK_INFO;\r
+\r
private static LogMethod logger = new DefaultLogger();\r
\r
public static void log(int level, String message) {\r
- if (level <= logLevel){\r
- logger.putMessage(null, logLevel, message);\r
+ if (level <= logLevel) {\r
+ logger.putMessage(null, level, message);\r
}\r
-\r
}\r
\r
- public static void log(int logLevel, String message, Exception cause) {\r
-\r
- }\r
-\r
- public static void log(int logLevel, Exception cause) {\r
-\r
+ public static void log(String message) {\r
+ if (EDK_INFO <= logLevel) {\r
+ logger.putMessage(null, EDK_INFO, message);\r
+ }\r
}\r
\r
- public static void log(Exception cause) {\r
-\r
+ public static void flushLogToFile(File file) {\r
+ logger.flushToFile(file);\r
}\r
\r
public static void setLogger(LogMethod l) {\r
logger = l;\r
}\r
\r
- public static void setLogLevel (int level){\r
+ public static void setLogLevel(int level) {\r
logLevel = level;\r
}\r
- public static void setLogLevel (String level){\r
- if (level == null){\r
- return;\r
- }\r
- String levelStr = level.trim();\r
- if (levelStr.equalsIgnoreCase(error)){\r
- logLevel = EDK_ERROR;\r
- }\r
- if (levelStr.equalsIgnoreCase(debug)){\r
- logLevel = EDK_DEBUG;\r
- }\r
- if (levelStr.equalsIgnoreCase(info)){\r
- logLevel = EDK_INFO;\r
- }\r
- if (levelStr.equalsIgnoreCase(verbose)){\r
- logLevel = EDK_VERBOSE;\r
- }\r
- if (levelStr.equalsIgnoreCase(warning)){\r
- logLevel = EDK_WARNING;\r
- }\r
+\r
+ public static void setLogLevel(String level) {\r
+ if (level == null) {\r
+ return;\r
+ }\r
+ String levelStr = level.trim();\r
+ if (levelStr.equalsIgnoreCase(error)) {\r
+ logLevel = EDK_ERROR;\r
+ }\r
+ if (levelStr.equalsIgnoreCase(debug)) {\r
+ logLevel = EDK_DEBUG;\r
+ }\r
+ if (levelStr.equalsIgnoreCase(info)) {\r
+ logLevel = EDK_INFO;\r
+ }\r
+ if (levelStr.equalsIgnoreCase(verbose)) {\r
+ logLevel = EDK_VERBOSE;\r
+ }\r
+ if (levelStr.equalsIgnoreCase(warning)) {\r
+ logLevel = EDK_WARNING;\r
+ }\r
}\r
- public static int getLogLevel (){\r
+\r
+ public static int getLogLevel() {\r
return logLevel;\r
}\r
}\r
-\r
-\r
/*++\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
+ 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
+ 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
- LogMethod.java\r
+ Module Name:\r
+ LogMethod.java\r
\r
-Abstract:\r
+ Abstract:\r
\r
---*/\r
+ --*/\r
\r
package org.tianocore.common.logger;\r
\r
+import java.io.File;\r
+\r
public interface LogMethod {\r
public void putMessage(Object msgSource, int msgLevel, String msg);\r
+\r
+ public void flushToFile(File file);\r
}\r
import org.apache.tools.ant.Task;\r
import org.tianocore.build.fpd.FpdParserForThread;\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.toolchain.ConfigReader;\r
import org.tianocore.build.toolchain.ToolChainInfo;\r
import org.tianocore.common.definitions.ToolDefinitions;\r
+import org.tianocore.common.logger.EdkLog;\r
\r
/**\r
<p>\r
private String type = "all";\r
\r
public void execute() throws BuildException {\r
+ //\r
+ // set Logger\r
+ //\r
+ GenBuildLogger logger = new GenBuildLogger(getProject());\r
+ EdkLog.setLogLevel(getProject().getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+\r
//\r
// Seach build.xml -> .FPD -> .MSA file\r
//\r
fpdParserForThread.setType(type);\r
fpdParserForThread.setProject(getProject());\r
fpdParserForThread.setFpdFile(buildFile);\r
- fpdParserForThread.execute();\r
+ fpdParserForThread.perform();\r
return ;\r
}\r
\r
fpdParserTask.setType(type);\r
fpdParserTask.setProject(getProject());\r
fpdParserTask.setFpdFile(buildFile);\r
- fpdParserTask.execute();\r
+ fpdParserTask.perform();\r
\r
//\r
// If cleanall delete the Platform_build.xml\r
}\r
genBuildTask.setProject(getProject());\r
genBuildTask.setMsaFile(buildFile);\r
- genBuildTask.execute();\r
+ genBuildTask.perform();\r
}\r
}\r
\r
String name = (String)piter.next();\r
originalProperties.put(new String(name), new String((String)allProperties.get(name)));\r
}\r
- \r
}\r
\r
private File intercommuniteWithUser(){\r
activePlatform = str;\r
}\r
\r
- str = getValue("MULTIPLE_THREAD", targetFileInfo);\r
+ str = getValue(ToolDefinitions.TARGET_KEY_MULTIPLE_THREAD, targetFileInfo);\r
if (str != null && str.trim().equalsIgnoreCase("Enable")) {\r
multithread = true;\r
}\r
\r
- str = getValue("MAX_CONCURRENT_THREAD_NUMBER", targetFileInfo);\r
+ str = getValue(ToolDefinitions.TARGET_KEY_MAX_CONCURRENT_THREAD_NUMBER, targetFileInfo);\r
if (str != null ) {\r
try {\r
int threadNum = Integer.parseInt(str);\r
\r
import org.tianocore.common.definitions.ToolDefinitions;\r
import org.tianocore.common.exception.EdkException;\r
-import org.tianocore.common.logger.EdkLog;\r
import org.tianocore.build.autogen.AutoGen;\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
if (!FrameworkBuildTask.multithread) {\r
cleanupProperties();\r
}\r
- \r
- //\r
- // set Logger\r
- //\r
- GenBuildLogger logger = new GenBuildLogger(getProject());\r
- EdkLog.setLogLevel(getProject().getProperty("env.LOGLEVEL"));\r
- EdkLog.setLogger(logger);\r
\r
//\r
// Enable all specified properties\r
/** @file\r
This file is ANT task FpdParserTask. \r
\r
- FpdParserTask is used to parse FPD (Framework Platform Description) and generate\r
- build.out.xml. It is for Package or Platform build use. \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
import org.tianocore.common.exception.EdkException;\r
\r
/**\r
- <code>FpdParserTask</code> is an ANT task. The main function is parsing Framework\r
- Platform Descritpion (FPD) XML file and generating its ANT build script for \r
- corresponding platform. \r
-\r
- <p>The task sets global properties PLATFORM, PLATFORM_DIR, PLATFORM_RELATIVE_DIR\r
- and BUILD_DIR. </p>\r
- \r
- <p>The task generates ${PLATFORM}_build.xml file which will be called by top level\r
- build.xml. The task also generate Fv.inf files (File is for Tool GenFvImage) \r
- and flash definition file (File is for Tool FlashMap) if necessary. </p>\r
- \r
- <p>FpdParserTask task stores all FPD information to GlobalData. And parse\r
- tools definition file to set up compiler options for different Target and\r
- different ToolChainTag. </p>\r
- \r
- <p>The method parseFpdFile is also prepared for single module build. </p>\r
- \r
- <p>The usage is (take NT32 Platform for example):</p>\r
-\r
- <pre>\r
- <FPDParser platformName="Nt32" />\r
- </pre>\r
-\r
- <p>The task will initialize all information through parsing Framework Database, \r
- SPD, Tool chain configuration files. </p>\r
\r
@since GenBuild 1.0\r
**/\r
}\r
\r
/**\r
- ANT task's entry method. The main steps is described as following: \r
- \r
- <ul>\r
- <li>Initialize global information (Framework DB, SPD files and all MSA files \r
- listed in SPD). This step will execute only once in whole build process;</li>\r
- <li>Parse specified FPD file; </li>\r
- <li>Generate FV.inf files; </li>\r
- <li>Generate PlatformName_build.xml file for Flatform build; </li>\r
- <li>Collect PCD information. </li>\r
- </ul>\r
\r
- @throws BuildException\r
- Surface area is not valid. \r
+\r
**/\r
public void execute() throws BuildException {\r
//\r
/*++\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
+ 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
+ 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
+ Module Name:\r
+ GenBuildLogger.java\r
\r
-Abstract:\r
+ Abstract:\r
\r
---*/\r
+ --*/\r
\r
package org.tianocore.build.global;\r
\r
+import java.io.File;\r
+import java.util.List;\r
+import java.util.Vector;\r
+\r
import org.apache.tools.ant.Project;\r
\r
+import org.tianocore.common.logger.EdkLog;\r
import org.tianocore.common.logger.LogMethod;\r
\r
public class GenBuildLogger implements LogMethod {\r
- private Project project;\r
- public GenBuildLogger(Project project) {\r
+ private Project project = null;\r
+\r
+ ///\r
+ /// flag to present whether cache all msg or not\r
+ /// true means not to cache.\r
+ ///\r
+ private boolean flag = true;\r
+\r
+ private List<String> v = null;\r
+\r
+ public GenBuildLogger (Project project) {\r
+ this.project = project;\r
+ }\r
+\r
+ public GenBuildLogger (Project project, boolean flag) {\r
this.project = project;\r
+ this.flag = flag;\r
\r
+ //\r
+ // Only flag is false, v will be initialized and used.\r
+ //\r
+ if (!flag) {\r
+ v = new Vector<String>(2048);\r
+ }\r
}\r
\r
- public void putMessage(Object msgSource, int msgLevel, String msg) {\r
- if (this.project != null){\r
+ /**\r
+ Rules: flag = true: means no cache Action: Print it to console\r
+ \r
+ flag = false: mean cache all msg exception some special Action: loglevel\r
+ is EDK_ALWAYS -- Print but no cache loglevel is EDK_ERROR -- Print and\r
+ cache the msg others -- No print and cache the msg\r
+ **/\r
+ public synchronized void putMessage(Object msgSource, int msgLevel,\r
+ String msg) {\r
+ if (this.project == null) {\r
+ return;\r
+ }\r
+\r
+ //\r
+ // If msgLevel is always print, then print it\r
+ //\r
+ switch (msgLevel) {\r
+ case EdkLog.EDK_ALWAYS:\r
this.project.log(msg, Project.MSG_INFO);\r
+ break;\r
+ case EdkLog.EDK_ERROR:\r
+ if (flag) {\r
+ this.project.log(msg, Project.MSG_ERR);\r
+ } else {\r
+ this.project.log(msg, Project.MSG_ERR);\r
+ v.add(msg);\r
+ }\r
+ break;\r
+ case EdkLog.EDK_WARNING:\r
+ if (flag) {\r
+ this.project.log(msg, Project.MSG_WARN);\r
+ } else {\r
+ v.add(msg);\r
+ }\r
+ break;\r
+ case EdkLog.EDK_INFO:\r
+ if (flag) {\r
+ this.project.log(msg, Project.MSG_INFO);\r
+ } else {\r
+ v.add(msg);\r
+ }\r
+ break;\r
+ case EdkLog.EDK_VERBOSE:\r
+ if (flag) {\r
+ this.project.log(msg, Project.MSG_VERBOSE);\r
+ } else {\r
+ v.add(msg);\r
+ }\r
+ break;\r
+ case EdkLog.EDK_DEBUG:\r
+ if (flag) {\r
+ this.project.log(msg, Project.MSG_DEBUG);\r
+ } else {\r
+ v.add(msg);\r
+ }\r
+ break;\r
}\r
+ }\r
+\r
+ public void flushToFile(File file) {\r
+ //\r
+ // Sort msg and store to the file (TBD)\r
+ //\r
\r
}\r
}
\ No newline at end of file