Methods Summary |
---|
public final Commandline.Argument | createArg()Not overridable [due to limitations in ANT's Commandline].
if (m_appArgs == null)
m_appArgs = new Commandline ();
return m_appArgs.createArgument ();
|
public org.apache.tools.ant.types.Path | createClasspath()
if (m_classpath == null)
m_classpath = new Path (project);
return m_classpath.createPath ();
|
public final com.vladium.emma.instr.FilterCfg.filterElement | createFilter()
return m_filterCfg.createFilter ();
|
public final com.vladium.emma.report.ReportCfg.Element_HTML | createHtml()
return m_reportCfg.createHtml ();
|
public final PropertyElement | createProperty()
return m_genericCfg.createProperty ();
|
public final org.apache.tools.ant.types.Path | createSourcepath()
return m_reportCfg.createSourcepath ();
|
public final com.vladium.emma.report.ReportCfg.Element_TXT | createTxt()
return m_reportCfg.createTxt ();
|
public final com.vladium.emma.report.ReportCfg.Element_XML | createXml()
return m_reportCfg.createXml ();
|
public void | execute()
log (IAppConstants.APP_VERBOSE_BUILD_ID, Project.MSG_VERBOSE);
if (getClasspath () == null)
throw (BuildException) SuppressableTask.newBuildException (getTaskName ()
+ ": this task requires 'classpath' attribute to be set", location).fillInStackTrace ();
if (isEnabled ())
{
// fork:
if (m_forkUserOverride && ! m_fork)
log (getTaskName () + ": 'fork=\"false\"' attribute setting ignored (this task always forks)", Project.MSG_WARN);
super.setFork (true); // always fork
// add emma libs to the parent task's classpath [to support non-extdir deployment]:
final Path libClasspath = m_libClasspath;
if ((libClasspath != null) && (libClasspath.size () > 0))
{
super.createClasspath ().append (libClasspath);
}
// classname|jar (1/2):
super.setClassname ("emmarun");
// <emmajava> extensions:
{
// report types:
{
String reportTypes = Strings.toListForm (m_reportCfg.getReportTypes (), ',");
if ((reportTypes == null) || (reportTypes.length () == 0)) reportTypes = "txt";
super.createArg ().setValue ("-r");
super.createArg ().setValue (reportTypes);
}
// full classpath scan flag:
{
if (m_scanCoveragePath)
{
super.createArg ().setValue ("-f");
}
}
// dump raw data flag and options:
{
if (m_dumpSessionData)
{
super.createArg ().setValue ("-raw");
if (m_outFile != null)
{
super.createArg ().setValue ("-out");
super.createArg ().setValue (m_outFile.getAbsolutePath ());
}
if (m_outFileMerge != null)
{
super.createArg ().setValue ("-merge");
super.createArg ().setValue (m_outFileMerge.booleanValue () ? "y" : "n");
}
}
else
{
if (m_outFile != null)
log (getTaskName () + ": output file attribute ignored ('fullmetadata=\"true\"' not specified)", Project.MSG_WARN);
if (m_outFileMerge != null)
log (getTaskName () + ": merge attribute setting ignored ('fullmetadata=\"true\"' not specified)", Project.MSG_WARN);
}
}
// instr filter:
{
final String [] specs = m_filterCfg.getFilterSpecs ();
if ((specs != null) && (specs.length > 0))
{
super.createArg ().setValue ("-ix");
super.createArg ().setValue (Strings.toListForm (specs, ',"));
}
}
// sourcepath:
{
final Path srcpath = m_reportCfg.getSourcepath ();
if (srcpath != null)
{
super.createArg ().setValue ("-sp");
super.createArg ().setValue (Strings.toListForm (srcpath.list (), ',"));
}
}
// all other generic settings:
{
final IProperties reportSettings = m_reportCfg.getReportSettings ();
final IProperties genericSettings = m_genericCfg.getGenericSettings ();
// TODO: another options is to read this file in the forked JVM [use '-props' pass-through]
// the best option depends on how ANT resolves relative file names
final IProperties fileSettings = m_genericCfg.getFileSettings ();
// verbosity settings use dedicated attributes and hence are more specific
// than anything generic:
final IProperties verbositySettings = m_verbosityCfg.getSettings ();
// (1) file settings have lower priority than any explicitly named overrides
// (2) named report settings override generic named settings
// (3) verbosity settings use dedicated attributes (not overlapping with report
// cfg) and hence are more specific than anything generic
final IProperties settings = IProperties.Factory.combine (reportSettings,
IProperties.Factory.combine (verbositySettings,
IProperties.Factory.combine (genericSettings,
fileSettings)));
final String [] argForm = settings.toAppArgsForm ("-D");
if (argForm.length > 0)
{
for (int a = 0; a < argForm.length; ++ a)
super.createArg ().setValue (argForm [a]);
}
}
}
// [assertion: getClasspath() is not null]
// classpath:
super.createArg ().setValue ("-cp");
super.createArg ().setPath (getClasspath ());
// classname|jar (2/2):
if (getClassname () != null)
super.createArg ().setValue (getClassname ());
else if (getJar () != null)
{
super.createArg ().setValue ("-jar");
super.createArg ().setValue (getJar ().getAbsolutePath ());
}
else
throw (BuildException) SuppressableTask.newBuildException (getTaskName ()
+ "either 'jar' or 'classname' attribute must be set", location).fillInStackTrace ();
// main class args:
if (m_appArgs != null)
{
final String [] args = m_appArgs.getArguments ();
for (int a = 0; a < args.length; ++ a)
{
super.createArg ().setValue (args [a]); // note: spaces etc are escaped correctly by ANT libs
}
}
}
else
{
// fork:
super.setFork (m_fork);
// [assertion: getClasspath() is not null]
// classpath:
super.createClasspath ().append (getClasspath ()); // can't use setClasspath() for obvious reasons
// classname|jar:
if (getClassname () != null)
super.setClassname (getClassname ());
else if (getJar () != null)
super.setJar (getJar ());
else
throw (BuildException) SuppressableTask.newBuildException (getTaskName ()
+ "either 'jar' or 'classname' attribute must be set", location).fillInStackTrace ();
// main class args:
if (m_appArgs != null)
{
final String [] args = m_appArgs.getArguments ();
for (int a = 0; a < args.length; ++ a)
{
super.createArg ().setValue (args [a]); // note: spaces etc are escaped correctly by ANT libs
}
}
}
super.execute ();
|
protected java.lang.String | getClassname()
return m_classname;
|
protected org.apache.tools.ant.types.Path | getClasspath()
return m_classpath;
|
protected java.io.File | getJar()
return m_jar;
|
public void | init()
super.init ();
m_verbosityCfg = new VerbosityCfg ();
m_genericCfg = new GenericCfg (this);
m_filterCfg = new FilterCfg (this);
m_reportCfg = new ReportCfg (project, this);
setEnabled (true);
|
protected boolean | isEnabled()
return m_enabled;
|
public void | setArgs(java.lang.String args)This is already deprecated in ANT v1.4. However, it is still supported by
the parent task so I do likewise.
throw (BuildException) SuppressableTask.newBuildException (getTaskName ()
+ ": disallows using <java>'s deprecated 'args' attribute", location).fillInStackTrace ();
|
public void | setClassname(java.lang.String classname)
if (getJar () != null)
throw (BuildException) SuppressableTask.newBuildException (getTaskName ()
+ "'jar' and 'classname' attributes cannot be set at the same time", location).fillInStackTrace ();
m_classname = classname;
|
public void | setClasspath(org.apache.tools.ant.types.Path path)
if (m_classpath == null)
m_classpath = path;
else
m_classpath.append (path);
|
public void | setClasspathRef(org.apache.tools.ant.types.Reference ref)
createClasspath ().setRefid (ref);
|
public final void | setColumns(java.lang.String columns)
m_reportCfg.setColumns (columns);
|
public final void | setDepth(com.vladium.emma.report.IReportEnums.DepthAttribute depth)
m_reportCfg.setDepth (depth);
|
public void | setDumpsessiondata(boolean dump)
m_dumpSessionData = dump;
|
public void | setEnabled(boolean enabled)
m_enabled = enabled;
|
public void | setEncoding(java.lang.String encoding)
m_reportCfg.setEncoding (encoding);
|
public final void | setFilter(java.lang.String filter)
m_filterCfg.setFilter (filter);
|
public final void | setFork(boolean fork)Not overridable.
m_fork = fork;
m_forkUserOverride = true;
|
public void | setFullmetadata(boolean full)
m_scanCoveragePath = full; // defaults to false TODO: maintain the default in a central location
|
public void | setJar(java.io.File file)
if (getClassname () != null)
throw (BuildException) SuppressableTask.newBuildException (getTaskName ()
+ "'jar' and 'classname' attributes cannot be set at the same time", location).fillInStackTrace ();
m_jar = file;
|
public final void | setLibclasspath(org.apache.tools.ant.types.Path classpath)
if (m_libClasspath == null)
m_libClasspath = classpath;
else
m_libClasspath.append (classpath);
|
public final void | setLibclasspathRef(org.apache.tools.ant.types.Reference ref)
if (m_libClasspath == null)
m_libClasspath = new Path (project);
m_libClasspath.createPath ().setRefid (ref);
|
public void | setMerge(boolean merge)
m_outFileMerge = merge ? Boolean.TRUE : Boolean.FALSE;
|
public final void | setMetrics(java.lang.String metrics)
m_reportCfg.setMetrics (metrics);
|
public void | setOutfile(java.io.File file)
if (m_outFile != null)
throw (BuildException) SuppressableTask.newBuildException (getTaskName ()
+ ": session data file attribute already set", location).fillInStackTrace ();
m_outFile = file;
|
public final void | setProperties(java.io.File file)
m_genericCfg.setProperties (file);
|
public void | setSessiondatafile(java.io.File file)
if (m_outFile != null)
throw (BuildException) SuppressableTask.newBuildException (getTaskName ()
+ ": session data file attribute already set", location).fillInStackTrace ();
m_outFile = file;
|
public final void | setSort(java.lang.String sort)
m_reportCfg.setSort (sort);
|
public final void | setSourcepath(org.apache.tools.ant.types.Path path)
m_reportCfg.setSourcepath (path);
|
public final void | setSourcepathRef(org.apache.tools.ant.types.Reference ref)
m_reportCfg.setSourcepathRef (ref);
|
public final void | setUnits(com.vladium.emma.report.IReportEnums.UnitsTypeAttribute units)
m_reportCfg.setUnits (units);
|
public void | setVerbosity(VerbosityCfg.VerbosityAttribute verbosity)
m_verbosityCfg.setVerbosity (verbosity);
|
public void | setVerbosityfilter(java.lang.String filter)
m_verbosityCfg.setVerbosityfilter (filter);
|