FileDocCategorySizeDatePackage
instrTask.javaAPI DocAndroid 1.5 API5847Wed May 06 22:41:16 BST 2009com.vladium.emma.instr

instrTask

public final class instrTask extends com.vladium.emma.ant.FilterTask
author
Vlad Roubtsov, (C) 2003

Fields Summary
private org.apache.tools.ant.types.Path
m_instrpath
private InstrProcessor.OutMode
m_outMode
private File
m_outDir
private File
m_outFile
private Boolean
m_outFileMerge
Constructors Summary
public instrTask(com.vladium.emma.ant.SuppressableTask parent)


     // end of nested class
    
    
        
    
        super (parent);
        
        m_outMode = InstrProcessor.OutMode.OUT_MODE_COPY; // default
    
Methods Summary
public org.apache.tools.ant.types.PathcreateInstrpath()

        if (m_instrpath == null)
            m_instrpath = new Path (project);
        
        return m_instrpath.createPath ();
    
public voidexecute()

        if (isEnabled ())
        {
            if (m_instrpath == null)
                throw (BuildException) newBuildException (getTaskName ()
                    + ": instrumentation path must be specified", location).fillInStackTrace ();
 
            if ((m_outMode != InstrProcessor.OutMode.OUT_MODE_OVERWRITE) && (m_outDir == null))
                throw (BuildException) newBuildException (getTaskName ()
                    + ": output directory must be specified for '" + m_outMode + "' output mode", location).fillInStackTrace ();
            
            InstrProcessor processor = InstrProcessor.create ();
                
            $assert.ASSERT (m_instrpath != null, "m_instrpath not set");
            processor.setInstrPath (m_instrpath.list (), true); // TODO: an option to set 'canonical'?
            // processor.setDependsMode ()
            processor.setInclExclFilter (getFilterSpecs ());
            $assert.ASSERT (m_outMode != null, "m_outMode not set");
            processor.setOutMode (m_outMode);
            processor.setInstrOutDir (m_outDir != null ? m_outDir.getAbsolutePath () : null);
            processor.setMetaOutFile (m_outFile != null ? m_outFile.getAbsolutePath () : null);
            processor.setMetaOutMerge (m_outFileMerge);
            processor.setPropertyOverrides (getTaskSettings ());
            
            processor.run ();
        }
    
public voidsetDestdir(java.io.File dir)

        if (m_outDir != null)
            throw (BuildException) newBuildException (getTaskName ()
                + ": outdir|destdir attribute already set", location).fillInStackTrace ();
        
        m_outDir = dir;
    
public voidsetInstrpath(org.apache.tools.ant.types.Path path)

        if (m_instrpath == null)
            m_instrpath = path;
        else
            m_instrpath.append (path);
    
public voidsetInstrpathRef(org.apache.tools.ant.types.Reference ref)

        createInstrpath ().setRefid (ref);
    
public voidsetMerge(boolean merge)

        m_outFileMerge = merge ? Boolean.TRUE : Boolean.FALSE;       
    
public voidsetMetadatafile(java.io.File file)

        if (m_outFile != null)
            throw (BuildException) newBuildException (getTaskName ()
                + ": metadata file attribute already set", location).fillInStackTrace ();
            
        m_outFile = file;
    
public voidsetMode(com.vladium.emma.instr.instrTask$ModeAttribute mode)

        
        final InstrProcessor.OutMode outMode = InstrProcessor.OutMode.nameToMode (mode.getValue ());
        if (outMode == null)
            throw (BuildException) newBuildException (getTaskName ()
                + ": invalid output mode: " + mode.getValue (), location).fillInStackTrace ();
        
        m_outMode = outMode;
    
public voidsetOutdir(java.io.File dir)

        if (m_outDir != null)
            throw (BuildException) newBuildException (getTaskName ()
                + ": outdir|destdir attribute already set", location).fillInStackTrace ();
            
        m_outDir = dir;
    
public voidsetOutfile(java.io.File file)

        if (m_outFile != null)
            throw (BuildException) newBuildException (getTaskName ()
                + ": metadata file attribute already set", location).fillInStackTrace ();
            
        m_outFile = file;