buildframework/helium/sf/java/quality/src/com/nokia/helium/quality/ant/taskdefs/CoverityTask.java
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 645 b8d81fa19e7d
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
    16  */
    16  */
    17 package com.nokia.helium.quality.ant.taskdefs;
    17 package com.nokia.helium.quality.ant.taskdefs;
    18 
    18 
    19 import java.io.File;
    19 import java.io.File;
    20 import java.util.Vector;
    20 import java.util.Vector;
       
    21 
    21 import org.apache.tools.ant.BuildException;
    22 import org.apache.tools.ant.BuildException;
    22 import org.apache.tools.ant.Task;
    23 import org.apache.tools.ant.Task;
    23 import org.apache.tools.ant.taskdefs.ExecTask;
    24 import org.apache.tools.ant.taskdefs.ExecTask;
    24 
    25 
    25 import com.nokia.helium.core.ant.types.VariableImpl;
    26 import com.nokia.helium.core.ant.types.VariableImpl;
    46 public class CoverityTask extends Task {
    47 public class CoverityTask extends Task {
    47 
    48 
    48     private String command;
    49     private String command;
    49     private boolean failOnError;
    50     private boolean failOnError;
    50     private boolean execute = true;
    51     private boolean execute = true;
       
    52     private boolean append;
       
    53     private File error;
    51     private String dir;
    54     private String dir;
    52     private Vector<VariableSet> coverityOptions = new Vector<VariableSet>();
    55     private Vector<VariableSet> coverityOptions = new Vector<VariableSet>();
    53     private Vector<VariableImpl> coverityArgs = new Vector<VariableImpl>();
    56     private Vector<VariableImpl> coverityArgs = new Vector<VariableImpl>();
    54 
    57 
    55     public void execute() {
    58     public void execute() {
    75 
    78 
    76         ExecTask task = new ExecTask();
    79         ExecTask task = new ExecTask();
    77         task.setProject(getProject());
    80         task.setProject(getProject());
    78         task.setTaskName(this.getTaskName());
    81         task.setTaskName(this.getTaskName());
    79         task.setFailonerror(failOnError);
    82         task.setFailonerror(failOnError);
       
    83         task.setError(this.error);
       
    84         task.setAppend(isAppend());
    80         task.setExecutable(command);
    85         task.setExecutable(command);
    81         task.setDir(new File(this.dir));
    86         task.setDir(new File(this.dir));
    82 
    87 
    83         for (VariableSet coverityArg : coverityOptions) {
    88         for (VariableSet coverityArg : coverityOptions) {
    84             task.createArg().setLine(coverityArg.getParameter(" "));
    89             task.createArg().setLine(coverityArg.getParameter(" "));
   162     public void setExecute(boolean execute) {
   167     public void setExecute(boolean execute) {
   163         this.execute = execute;
   168         this.execute = execute;
   164     }
   169     }
   165 
   170 
   166     /**
   171     /**
       
   172      * @return the errorFile
       
   173      */
       
   174     public File getError() {
       
   175         return error;
       
   176     }
       
   177 
       
   178     /**
       
   179      * @param errorFile the errorFile to set
       
   180      */
       
   181     public void setError(File errorFile) {
       
   182         this.error = errorFile;
       
   183     }
       
   184 
       
   185     /**
       
   186      * @param append the append to set
       
   187      */
       
   188     public void setAppend(boolean append) {
       
   189         this.append = append;
       
   190     }
       
   191 
       
   192     /**
       
   193      * @return the append
       
   194      */
       
   195     public boolean isAppend() {
       
   196         return append;
       
   197     }
       
   198 
       
   199     /**
   167      * To read the coverity arguments for coverity commands.
   200      * To read the coverity arguments for coverity commands.
   168      * 
   201      * 
   169      * @param variableArg
   202      * @param variableArg
   170      */
   203      */
   171     public void addCoverityOptions(VariableSet coverityArg) {
   204     public void addCoverityOptions(VariableSet coverityArg) {
   182     public void addArg(VariableImpl coverityArg) {
   215     public void addArg(VariableImpl coverityArg) {
   183         if (!coverityArgs.contains(coverityArg)) {
   216         if (!coverityArgs.contains(coverityArg)) {
   184             coverityArgs.add(coverityArg);
   217             coverityArgs.add(coverityArg);
   185         }
   218         }
   186     }
   219     }
       
   220     
   187 
   221 
   188 }
   222 }