]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix EDKT256: using unified logging mechanism in PcdAutogen tools.
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Sep 2006 06:11:15 +0000 (06:11 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Sep 2006 06:11:15 +0000 (06:11 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1626 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
Tools/Source/GenBuild/org/tianocore/build/pcd/action/PCDAutoGenAction.java
Tools/Source/GenBuild/org/tianocore/build/pcd/action/PlatformPcdPreprocessActionForBuilding.java
Tools/Source/PcdTools/org/tianocore/pcd/action/ActionMessage.java [deleted file]
Tools/Source/PcdTools/org/tianocore/pcd/action/BuildAction.java

index b496e32ed5de3ea933167369a1b7573bbc15bb45..2b1f30fa0d34b738b6d868a9428ba165fbad1f94 100644 (file)
@@ -37,7 +37,6 @@ import org.apache.xmlbeans.XmlObject;
 import org.tianocore.common.definitions.EdkDefinitions;\r
 import org.tianocore.common.exception.EdkException;\r
 import org.tianocore.common.logger.EdkLog;\r
-import org.tianocore.pcd.action.ActionMessage;\r
 import org.tianocore.build.FrameworkBuildTask;\r
 import org.tianocore.build.global.GlobalData;\r
 import org.tianocore.build.global.OutputManager;\r
@@ -454,7 +453,7 @@ public class FpdParserTask extends Task {
             // Pcd Collection. Call CollectPCDAction to collect pcd info.\r
             //\r
             PlatformPcdPreprocessActionForBuilding ca = new PlatformPcdPreprocessActionForBuilding();\r
-            ca.perform(platformId.getFpdFile().getPath(), ActionMessage.NULL_MESSAGE_LEVEL);\r
+            ca.perform(platformId.getFpdFile().getPath());\r
         } catch (IOException ex) {\r
             BuildException buildException = new BuildException("Parsing of the FPD file [" + fpdFile.getPath() + "] failed!\n" + ex.getMessage());\r
             buildException.setStackTrace(ex.getStackTrace());\r
index 312e5e21369ee48405f8caf0d2498642a0897fb4..a2f1c6a1bf83bb2f5c8a26709f7f13e18c9a38b6 100644 (file)
@@ -25,7 +25,7 @@ import org.tianocore.build.FrameworkBuildTask;
 import org.tianocore.build.autogen.CommonDefinition;\r
 import org.tianocore.build.global.GlobalData;\r
 import org.tianocore.build.id.ModuleIdentification;\r
-import org.tianocore.pcd.action.ActionMessage;\r
+import org.tianocore.common.logger.EdkLog;\r
 import org.tianocore.pcd.action.BuildAction;\r
 import org.tianocore.pcd.entity.MemoryDatabaseManager;\r
 import org.tianocore.pcd.entity.Token;\r
@@ -190,8 +190,7 @@ public class PCDAutoGenAction extends BuildAction {
       @throws BuildActionException Failed to execute this aciton class.\r
     **/\r
     public void performAction() {\r
-        ActionMessage.debug(this,\r
-                            "Starting PCDAutoGenAction to generate autogen.h and autogen.c!...");\r
+        EdkLog.log(EdkLog.EDK_DEBUG, "Starting PCDAutoGenAction to generate autogen.h and autogen.c!...");\r
 \r
         dbManager = GlobalData.getPCDMemoryDBManager();\r
 \r
@@ -199,8 +198,7 @@ public class PCDAutoGenAction extends BuildAction {
             return;\r
         }\r
 \r
-        ActionMessage.debug(this,\r
-                            "PCD memory database contains " + dbManager.getDBSize() + " PCD tokens.");\r
+        EdkLog.log(EdkLog.EDK_DEBUG, "PCD memory database contains " + dbManager.getDBSize() + " PCD tokens.");\r
 \r
         generateAutogenForModule();\r
     }\r
index 2013b74706f62fb16cd8474bc1151f74d58f867e..6d71dd3b3708f7883f71e50d797317872952d8e4 100644 (file)
@@ -32,7 +32,6 @@ import org.tianocore.PlatformSurfaceAreaDocument;
 import org.tianocore.build.exception.PlatformPcdPreprocessBuildException;\r
 import org.tianocore.build.global.GlobalData;\r
 import org.tianocore.build.id.FpdModuleIdentification;\r
-import org.tianocore.pcd.action.ActionMessage;\r
 import org.tianocore.pcd.action.PlatformPcdPreprocessAction;\r
 import org.tianocore.pcd.entity.MemoryDatabaseManager;\r
 import org.tianocore.pcd.entity.ModulePcdInfoFromFpd;\r
@@ -62,18 +61,6 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
     ///\r
     private PlatformSurfaceAreaDocument fpdDocInstance;\r
 \r
-    /**\r
-      Set action message level for CollectPcdAction tool.\r
-\r
-      The message should be restored when this action exit.\r
-\r
-      @param actionMessageLevel parameter for this action\r
-    **/\r
-    public void setActionMessageLevel(int actionMessageLevel) {\r
-        originalMessageLevel       = ActionMessage.messageLevel;\r
-        ActionMessage.messageLevel = actionMessageLevel;\r
-    }\r
-\r
     /**\r
       Set FPDFileName parameter for this action class.\r
 \r
@@ -87,20 +74,17 @@ public class PlatformPcdPreprocessActionForBuilding extends PlatformPcdPreproces
       Common function interface for outer.\r
 \r
       @param fpdFilePath    The fpd file path of current build or processing.\r
-      @param messageLevel   The message level for this Action.\r
 \r
       @throws  PlatformPreprocessBuildException \r
                             The exception of this function. Because it can *not* be predict\r
                             where the action class will be used. So only Exception can be throw.\r
 \r
     **/\r
-    public void perform(String fpdFilePath, int messageLevel\r
+    public void perform(String fpdFilePath) \r
         throws PlatformPcdPreprocessBuildException {\r
         this.fpdFilePath = fpdFilePath;\r
-        setActionMessageLevel(messageLevel);\r
         checkParameter();\r
         execute();\r
-        ActionMessage.messageLevel = originalMessageLevel;\r
     }\r
 \r
     /**\r
diff --git a/Tools/Source/PcdTools/org/tianocore/pcd/action/ActionMessage.java b/Tools/Source/PcdTools/org/tianocore/pcd/action/ActionMessage.java
deleted file mode 100644 (file)
index 1e26eff..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/** @file\r
-  ActionMessage class.\r
-\r
-  ActionMessage class take over all message for loging and waning. This class should\r
-  dispatch message into different class according to instance class type.\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
-**/\r
-package org.tianocore.pcd.action;\r
-\r
-import org.apache.tools.ant.Task;\r
-\r
-/** ActionMessage class take over all message for loging and waning. This class\r
-    should dispatch message into different Action class according to instance\r
-    class type.\r
-**/\r
-public class ActionMessage {\r
-    ///\r
-    /// Macro definition for NULL messge level.\r
-    /// In this meessage level, all message will be hidden.\r
-    ///\r
-    public final static int NULL_MESSAGE_LEVEL    = 0;\r
-\r
-    ///\r
-    /// Macro definition for Log messge level.\r
-    /// In this message level, Only log information will be shown.\r
-    ///\r
-    public final static int LOG_MESSAGE_LEVEL     = 1;\r
-\r
-    ///\r
-    /// Macro definition for Warning message level.\r
-    /// In this message level, log and waning message will be shown.\r
-    ///\r
-    public final static int WARNING_MESSAGE_LEVEL = 2;\r
-\r
-    ///\r
-    /// Macro definition for Debug mesage level.\r
-    /// In this message level, log, warning, debug message will be shown.\r
-    ///\r
-    public final static int DEBUG_MESSAGE_LEVEL   = 3;\r
-\r
-    ///\r
-    /// Macor definition for MAX message level.\r
-    /// In this message level, all message will be shown.\r
-    ///\r
-    public final static int MAX_MESSAGE_LEVEL     = 4;\r
-\r
-    ///\r
-    /// Current message level. It will control all message output for PCD tool.\r
-    ///\r
-    public       static int messageLevel          = NULL_MESSAGE_LEVEL;\r
-\r
-    /**\r
-      Log() function provide common log information functionality for all\r
-      PCD tool includes all function\r
-\r
-      This function will dispatch message to special class such as BuildAction\r
-      Class, Entity Class etc.\r
-\r
-      @param thisClass   The class object who want log information.\r
-      @param logStr      The string contains log information.\r
-    **/\r
-    public static void log(Object thisClass, String logStr) {\r
-        if(messageLevel < LOG_MESSAGE_LEVEL) {\r
-            return;\r
-        }\r
-\r
-        if(thisClass instanceof Task) {\r
-            BuildAction.logMsg(thisClass, "$$LOG$$:" + logStr);\r
-        } else {\r
-            System.out.println("$$LOG$$:" + logStr);\r
-        }\r
-    }\r
-\r
-    /**\r
-      Warning() function provide common warning information functionality for all\r
-      PCD tool.\r
-\r
-      This function will dispatch message to special class such as BuildAction\r
-      Class, Entity Class etc.\r
-\r
-      @param thisClass   The class object who want warn information.\r
-      @param warningStr  The string contains warning information.\r
-    **/\r
-    public static void warning(Object thisClass, String warningStr) {\r
-        if(messageLevel < WARNING_MESSAGE_LEVEL) {\r
-            return;\r
-        }\r
-\r
-        if(thisClass instanceof Task) {\r
-            BuildAction.warningMsg(thisClass, "**WARNING**:" + warningStr);\r
-        } else {\r
-            System.out.println("**WARNING**:" + warningStr);\r
-        }\r
-    }\r
-\r
-    /**\r
-      Debug() function provide common Debug information functionality for all\r
-      PCD tool.\r
-\r
-      This function will dispatch message to special class such as BuildAction\r
-      Class, Entity Class etc.\r
-\r
-      @param thisClass   The class object who want Debug information.\r
-      @param debugStr    The string contains Debug information.\r
-    **/\r
-    public static void debug(Object thisClass, String debugStr) {\r
-        if(messageLevel < DEBUG_MESSAGE_LEVEL) {\r
-            return;\r
-        }\r
-\r
-        if(thisClass instanceof Task) {\r
-            BuildAction.logMsg(thisClass, "%%DEBUG%%:" + debugStr);\r
-        } else {\r
-            System.out.println("%%DEBUG%%:" + debugStr);\r
-        }\r
-    }\r
-}\r
index e5288f364b3bb97f8601169271dd2c19a25487ea..9d30a76bdc02de32b373f2f6fa85546d5df7e999 100644 (file)
@@ -44,48 +44,6 @@ public abstract class BuildAction extends Task {
     **/\r
     public abstract void performAction() throws BuildActionException;\r
 \r
-    /**\r
-      setMessageLevel function set current message for task instance object.\r
-\r
-      The message should be restored when this action exit.\r
-\r
-      @param messageLevel The message level for this action.\r
-    **/\r
-    public void setMessageLevel(int messageLevel) {\r
-        originalMessageLevel        = ActionMessage.messageLevel;\r
-        ActionMessage.messageLevel  = messageLevel;\r
-    }\r
-\r
-    /**\r
-      logMsg function provide common log information functionality for all \r
-      PCD tool extends from ANT task class.\r
-\r
-      This function will use the log function in Ant task class.\r
-     \r
-      @param action     The class object who want log information.\r
-      @param logStr     The string contains log information.\r
-    **/\r
-    public static void logMsg(Object action, String logStr) {\r
-        try {      \r
-            ((Task) action).log(logStr, Project.MSG_INFO);\r
-        } catch (Exception exp) {\r
-        }\r
-    }\r
-\r
-    /**\r
-      warningMsg function provide common warning information functionality for all \r
-      PCD tool.\r
-\r
-      This function will dispatch message to special class such as BuildAction\r
-      Class, Entity Class etc.\r
-     \r
-      @param action      The class object who want warn information.\r
-      @param warningStr  The string contains warning information.\r
-    **/  \r
-    public static void warningMsg(Object action, String warningStr) {\r
-        ((Task) action).log(warningStr, Project.MSG_WARN);\r
-    }\r
-\r
     /**\r
       execute function is the main flow for all build action class.\r
 \r
@@ -99,10 +57,5 @@ public abstract class BuildAction extends Task {
     public void execute() throws BuildActionException {\r
         checkParameter();\r
         performAction();\r
-\r
-        //\r
-        // Restore orignal message level when exist the action.\r
-        //\r
-        ActionMessage.messageLevel = originalMessageLevel;\r
     }\r
 }\r