buildframework/helium/sf/java/legacy/src/com/nokia/ant/HeliumLogger.java
changeset 628 7c4a911dc066
parent 588 c7c26511138f
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
    42  * 
    42  * 
    43  */
    43  */
    44 public class HeliumLogger extends DefaultLogger {
    44 public class HeliumLogger extends DefaultLogger {
    45 
    45 
    46     private static boolean stopLogToConsole;
    46     private static boolean stopLogToConsole;
       
    47     private static final String INTERNALPROPERTY = "internal.";
    47 
    48 
    48     private Project project;
    49     private Project project;
    49     private Logger log = Logger.getLogger(this.getClass());
    50     private Logger log = Logger.getLogger(this.getClass());
       
    51     
    50 
    52 
    51 
    53 
    52     /**
    54     /**
    53      * Ant call this function when build start.
    55      * Ant call this function when build start.
    54      */
    56      */
    76         super.targetStarted(event);
    78         super.targetStarted(event);
    77 
    79 
    78         /**if the target is not going to execute (due to 'if' or 'unless' conditions) 
    80         /**if the target is not going to execute (due to 'if' or 'unless' conditions) 
    79         print a message telling the user why it is not going to execute**/
    81         print a message telling the user why it is not going to execute**/
    80         if (!testIfCondition(ifCondition) && ifCondition != null) {
    82         if (!testIfCondition(ifCondition) && ifCondition != null) {
    81             project.log("Skipped because property '"
    83             if (ifCondition.startsWith(INTERNALPROPERTY)) {
    82                 + project.replaceProperties(ifCondition)
    84                 String enableProperty = ifCondition.substring(INTERNALPROPERTY.length());
    83                 + "' not set.", Project.MSG_INFO);
    85                 project.log("Skipped because property '"
       
    86                         + enableProperty
       
    87                         + "' not set to 'true'.", Project.MSG_INFO);
       
    88             } else {
       
    89                 project.log("Skipped because property '"
       
    90                         + project.replaceProperties(ifCondition)
       
    91                         + "' is not set.", Project.MSG_INFO);
       
    92             }
       
    93             
    84         } else if (!testUnlessCondition(unlessCondition) && unlessCondition != null) {
    94         } else if (!testUnlessCondition(unlessCondition) && unlessCondition != null) {
    85             project.log("Skipped because property '"
    95             if (unlessCondition.startsWith(INTERNALPROPERTY)) {
    86                 + project.replaceProperties(unlessCondition)
    96                 String enableProperty = unlessCondition.substring(INTERNALPROPERTY.length());
    87                 + "' set.", Project.MSG_INFO);
    97                 project.log("Skipped because property '"
       
    98                         + enableProperty
       
    99                         + "' is set.", Project.MSG_INFO);
       
   100             } else {
       
   101                 project.log("Skipped because property '"
       
   102                         + project.replaceProperties(unlessCondition)
       
   103                         + "' set.", Project.MSG_INFO);
       
   104             }
    88         }
   105         }
    89     }
   106     }
    90 
   107 
    91     /**
   108     /**
    92      * Log the start or end of the build as a event.
   109      * Log the start or end of the build as a event.
   127 
   144 
   128     /**
   145     /**
   129      * See if build needs a final cleanup target to be called.
   146      * See if build needs a final cleanup target to be called.
   130      */
   147      */
   131     private void cleanup() {
   148     private void cleanup() {
   132         String loggingoutputfile = project.getProperty("logging.output.file");
   149         if (project != null) {
   133         if (loggingoutputfile != null) {
   150             String loggingoutputfile = project.getProperty("logging.output.file");
   134             File file = new File(loggingoutputfile);
   151             if (loggingoutputfile != null) {
   135             if (file.exists()) {
   152                 File file = new File(loggingoutputfile);
   136                 file.delete();
   153                 if (file.exists()) {
   137             }
   154                     file.delete();
   138         }
   155                 }
   139 
   156             }
   140         if ((project.getProperty("call.cleanup") != null)
   157             if ((project.getProperty("call.cleanup") != null)
   141                 && (project.getProperty("call.cleanup").equals("yes"))) {
   158                     && (project.getProperty("call.cleanup").equals("yes"))) {
   142             project.executeTarget("cleanup-all");
   159                 project.executeTarget("cleanup-all");
       
   160             }
   143         }
   161         }
   144     }
   162     }
   145 
   163 
   146     /**
   164     /**
   147      * Get log to console status
   165      * Get log to console status