diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:23 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:23 -0800 |
commit | 455f4dde9d9befd28fad85a781ba560c1b4da37e (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /ant | |
parent | 725ce5e17f431acc3b549f87464a7883f98adf66 (diff) | |
download | emma-455f4dde9d9befd28fad85a781ba560c1b4da37e.tar.gz |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'ant')
21 files changed, 0 insertions, 2839 deletions
diff --git a/ant/ant14/com/vladium/emma/ANTMain.java b/ant/ant14/com/vladium/emma/ANTMain.java deleted file mode 100644 index bc36184..0000000 --- a/ant/ant14/com/vladium/emma/ANTMain.java +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: ANTMain.java,v 1.1.1.1 2004/05/09 16:57:26 vlad_r Exp $ - */ -package com.vladium.emma; - -import com.vladium.emma.IAppConstants; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2004 - */ -public -final class ANTMain -{ - // public: ................................................................ - - - public static void main (final String [] args) - { - System.out.println ("this jar contains ANT task definitions for " + IAppConstants.APP_NAME - + " and is not meant to be executable"); - - System.out.println (); - System.out.println (IAppConstants.APP_USAGE_BUILD_ID); - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/ant/FileTask.java b/ant/ant14/com/vladium/emma/ant/FileTask.java deleted file mode 100644 index 6357799..0000000 --- a/ant/ant14/com/vladium/emma/ant/FileTask.java +++ /dev/null @@ -1,136 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: FileTask.java,v 1.2.2.1 2004/07/08 10:52:10 vlad_r Exp $ - */ -package com.vladium.emma.ant; - -import java.io.File; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.types.FileSet; - -import com.vladium.emma.ant.XFileSet; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -abstract class FileTask extends NestedTask -{ - // public: ................................................................ - - -// public static final class FileElement -// { -// public FileElement (final List /* File */ files) -// { -// m_files = files; -// } -// -// public void setFile (final File file) -// { -// if (file != null) m_files.add (file); -// } -// -// -// private final List /* File */ m_files; -// -// } // end of nested class - - - // infileset|fileset element: - - public final void addInfileset (final XFileSet set) - { - if (set != null) m_dataFileSets.add (set); - } - - public final void addFileset (final XFileSet set) - { - if (set != null) m_dataFileSets.add (set); - } - - -// // infile|file element: -// -// public final FileElement createInfile () -// { -// return new FileElement (m_dataFiles); -// } -// -// public final FileElement createFile () -// { -// return new FileElement (m_dataFiles); -// } - - // protected: ............................................................. - - - protected FileTask (final SuppressableTask parent) - { - super (parent); - - m_dataFileSets = new ArrayList (); -// m_dataFiles = new ArrayList (); - } - - - protected final String [] getDataPath (final boolean removeNonexistent) - { - final List /* String */ _files = new ArrayList (); - - // merge filesets: - for (Iterator i = m_dataFileSets.iterator (); i.hasNext (); ) - { - final FileSet set = (FileSet) i.next (); - final DirectoryScanner ds = set.getDirectoryScanner (project); - final File dsBaseDir = ds.getBasedir (); - - final String [] dsfiles = ds.getIncludedFiles (); - for (int f = 0; f < dsfiles.length; ++ f) - { - _files.add (new File (dsBaseDir, dsfiles [f]).getAbsolutePath ()); - } - } - -// // merge files: -// for (Iterator i = m_dataFiles.iterator (); i.hasNext (); ) -// { -// final File file = (File) i.next (); -// if (! removeNonexistent || file.exists ()) -// { -// _files.add (file.getAbsolutePath ()); -// } -// } - - if (_files.size () == 0) - return EMPTY_STRING_ARRAY; - else - { - final String [] files = new String [_files.size ()]; - _files.toArray (files); - - return files; - } - } - - // package: ............................................................... - - // private: ............................................................... - - - private final List /* FileSet */ m_dataFileSets; // never null -// private final List /* File */ m_dataFiles; // never null - - private static final String [] EMPTY_STRING_ARRAY = new String [0]; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/ant/FilterTask.java b/ant/ant14/com/vladium/emma/ant/FilterTask.java deleted file mode 100644 index 4af71e9..0000000 --- a/ant/ant14/com/vladium/emma/ant/FilterTask.java +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: FilterTask.java,v 1.1.1.1.2.1 2004/07/08 10:52:10 vlad_r Exp $ - */ -package com.vladium.emma.ant; - -import java.io.File; - -import com.vladium.util.Strings; -import com.vladium.emma.instr.FilterCfg; -import com.vladium.emma.instr.FilterCfg.filterElement; - -import org.apache.tools.ant.BuildException; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -abstract class FilterTask extends NestedTask -{ - // public: ................................................................ - - - public void init () throws BuildException - { - super.init (); - - m_filterCfg = new FilterCfg (this); - } - - - // filter attribute/element: - - public final void setFilter (final String filter) - { - m_filterCfg.setFilter (filter); - } - - public final filterElement createFilter () - { - return m_filterCfg.createFilter (); - } - - // protected: ............................................................. - - - protected FilterTask (final SuppressableTask parent) - { - super (parent); - } - - - protected final String [] getFilterSpecs () - { - return m_filterCfg.getFilterSpecs (); - } - - - protected static final String COMMA = ","; - protected static final String COMMA_DELIMITERS = COMMA + Strings.WHITE_SPACE; - protected static final String PATH_DELIMITERS = COMMA.concat (File.pathSeparator); - - // package: ............................................................... - - // private: ............................................................... - - - private /*final*/ FilterCfg m_filterCfg; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/ant/GenericCfg.java b/ant/ant14/com/vladium/emma/ant/GenericCfg.java deleted file mode 100644 index 02ebae6..0000000 --- a/ant/ant14/com/vladium/emma/ant/GenericCfg.java +++ /dev/null @@ -1,150 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: GenericCfg.java,v 1.1.1.1.2.1 2004/07/08 10:52:10 vlad_r Exp $ - */ -package com.vladium.emma.ant; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; - -import com.vladium.emma.EMMAProperties; -import com.vladium.util.IProperties; -import com.vladium.util.Property; - -// ---------------------------------------------------------------------------- -/** - * GenericCfg is a simple container for 'generic' properties, i.e., properties - * that are set via generic 'properties=<file>' attribute and <property> - * nested elements. This class makes no decision about relative priorities for - * propertie set in an external file or via nested elements, leaving this up - * to the parent. - * - * @author Vlad Roubtsov, (C) 2003 - */ -public -class GenericCfg -{ - // public: ................................................................ - - - public GenericCfg (final Task task) - { - if (task == null) throw new IllegalArgumentException ("null input: task"); - - m_task = task; - m_genericPropertyElements = new ArrayList (); - } - - - // .properties file attribute [actual file I/O done lazily by getFileSettings()]: - - public void setProperties (final File file) - { - m_settingsFile = file; // actual file I/O is done in getFileSettings() - } - - // generic property element: - - public PropertyElement createProperty () - { - m_genericSettings = null; - - final PropertyElement property = new PropertyElement (); - m_genericPropertyElements.add (property); - - return property; - } - - // ACCESSORS: - - public IProperties getFileSettings () - { - IProperties fileSettings = m_fileSettings; - if ((fileSettings == null) && (m_settingsFile != null)) - { - try - { - fileSettings = EMMAProperties.wrap (Property.getPropertiesFromFile (m_settingsFile)); - } - catch (IOException ioe) - { - throw (BuildException) SuppressableTask.newBuildException (m_task.getTaskName () - + ": property file [" + m_settingsFile.getAbsolutePath () + "] could not be read" , ioe, m_task.getLocation ()).fillInStackTrace (); - } - - m_fileSettings = fileSettings; - - return fileSettings; - } - - return fileSettings; - } - - public IProperties getGenericSettings () - { - IProperties genericSettings = m_genericSettings; - if (genericSettings == null) - { - genericSettings = EMMAProperties.wrap (new Properties ()); - - for (Iterator i = m_genericPropertyElements.iterator (); i.hasNext (); ) - { - final PropertyElement property = (PropertyElement) i.next (); - - final String name = property.getName (); - String value = property.getValue (); - if (value == null) value = ""; - - if (name != null) - { - // [assertion: name != null, value != null] - - final String currentValue = genericSettings.getProperty (name); - if ((currentValue != null) && ! value.equals (currentValue)) - { - throw (BuildException) SuppressableTask.newBuildException (m_task.getTaskName () - + ": conflicting settings for property [" + name + "]: [" + value + "]" , m_task.getLocation ()).fillInStackTrace (); - } - else - { - genericSettings.setProperty (name, value); - } - } - } - - m_genericSettings = genericSettings; - - return genericSettings; - } - - return genericSettings; - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - - private final Task m_task; - - private final List /* PropertyElement */ m_genericPropertyElements; // never null - private File m_settingsFile; // can be null - - private transient IProperties m_fileSettings; // can be null - private transient IProperties m_genericSettings; // can be null - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/ant/NestedTask.java b/ant/ant14/com/vladium/emma/ant/NestedTask.java deleted file mode 100644 index cd2c0ad..0000000 --- a/ant/ant14/com/vladium/emma/ant/NestedTask.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: NestedTask.java,v 1.1.1.1.2.1 2004/07/08 10:52:10 vlad_r Exp $ - */ -package com.vladium.emma.ant; - -import com.vladium.util.IProperties; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -abstract class NestedTask extends SuppressableTask -{ - // public: ................................................................ - - // protected: ............................................................. - - - protected NestedTask (final SuppressableTask parent) - { - if (parent == null) - throw new IllegalArgumentException ("null input: parent"); - - m_parent = parent; - } - - /** - * Overrides {@link SuppressableTask#getTaskSettings()} to mix in parent - * task settings as the base settings. - */ - protected final IProperties getTaskSettings () - { - final IProperties parentSettings = m_parent != null - ? m_parent.getTaskSettings () - : null; - - final IProperties taskOverrides = super.getTaskSettings (); - - // task settings are always more specific than parent settings, but attention - // needs to be paid to horizontal inheritance: - - if (parentSettings == null) - return taskOverrides; - else - { - final IProperties settings = IProperties.Factory.combine (taskOverrides, parentSettings); - - return settings; - } - } - - - protected final SuppressableTask m_parent; - - // package: ............................................................... - - // private: ............................................................... - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/ant/PropertyElement.java b/ant/ant14/com/vladium/emma/ant/PropertyElement.java deleted file mode 100644 index 2d002bc..0000000 --- a/ant/ant14/com/vladium/emma/ant/PropertyElement.java +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: PropertyElement.java,v 1.1.1.1.2.1 2004/07/10 03:34:52 vlad_r Exp $ - */ -package com.vladium.emma.ant; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -final class PropertyElement -{ - // public: ................................................................ - - - public PropertyElement () - { - // ensure the constructor is always public - } - - - public String getName () - { - return m_name; - } - - public String getValue () - { - return m_value; - } - - public void setName (final String name) - { - m_name = name; - } - - public void setValue (final String value) - { - m_value = value; - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - - private String m_name, m_value; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/ant/StringValue.java b/ant/ant14/com/vladium/emma/ant/StringValue.java deleted file mode 100644 index 454c2ce..0000000 --- a/ant/ant14/com/vladium/emma/ant/StringValue.java +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: StringValue.java,v 1.2 2004/05/20 02:28:06 vlad_r Exp $ - */ -package com.vladium.emma.ant; - -import org.apache.tools.ant.Task; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -abstract class StringValue -{ - // public: ................................................................ - - - public void appendValue (final String value, final String separator) - { - if ((value != null) && (value.length () > 0)) - { - if (m_value == null) - { - m_value = new StringBuffer (value); - } - else - { - m_value.append (separator); - m_value.append (value); // no trailing separator kept - } - } - } - - public String getValue () - { - return m_value != null ? m_value.toString () : null; - } - - // protected: ............................................................. - - - protected StringValue (final Task task) - { - if (task == null) throw new IllegalArgumentException ("null input: task"); - - m_task = task; - } - - - protected final Task m_task; - - // package: ............................................................... - - // private: ............................................................... - - - private StringBuffer m_value; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/ant/SuppressableTask.java b/ant/ant14/com/vladium/emma/ant/SuppressableTask.java deleted file mode 100644 index ff90e58..0000000 --- a/ant/ant14/com/vladium/emma/ant/SuppressableTask.java +++ /dev/null @@ -1,132 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: SuppressableTask.java,v 1.1.1.1.2.2 2004/07/16 23:32:04 vlad_r Exp $ - */ -package com.vladium.emma.ant; - -import java.io.File; - -import com.vladium.emma.IAppConstants; -import com.vladium.util.IProperties; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Location; -import org.apache.tools.ant.Task; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -abstract class SuppressableTask extends Task -{ - // public: ................................................................ - - - public void init () throws BuildException - { - super.init (); - - m_verbosityCfg = new VerbosityCfg (); - m_genericCfg = new GenericCfg (this); - } - - /** - * Set the optional 'enabled' attribute [defaults to 'true']. - */ - public final void setEnabled (final boolean enabled) - { - m_enabled = enabled; - } - - public final boolean isEnabled () - { - return m_enabled; - } - - // verbosity attribute: - - public void setVerbosity (final VerbosityCfg.VerbosityAttribute verbosity) - { - m_verbosityCfg.setVerbosity (verbosity); - } - - // verbosity class filter attribute: - - public void setVerbosityfilter (final String filter) - { - m_verbosityCfg.setVerbosityfilter (filter); - } - - // .properties file attribute: - - public final void setProperties (final File file) - { - m_genericCfg.setProperties (file); - } - - // generic property element: - - public final PropertyElement createProperty () - { - return m_genericCfg.createProperty (); - } - - - public static BuildException newBuildException (final String msg, final Location location) - { - final String prefixedMsg = ((msg == null) || (msg.length () == 0)) - ? msg - : IAppConstants.APP_THROWABLE_BUILD_ID + " " + msg; - - return new BuildException (prefixedMsg, location); - } - - public static BuildException newBuildException (final String msg, final Throwable cause, final Location location) - { - final String prefixedMsg = ((msg == null) || (msg.length () == 0)) - ? msg - : IAppConstants.APP_THROWABLE_BUILD_ID + " " + msg; - - return new BuildException (prefixedMsg, cause, location); - } - - // protected: ............................................................. - - - protected SuppressableTask () - { - m_enabled = true; // by default, all tasks are enabled - } - - protected IProperties getTaskSettings () - { - // (1) by default, generic settings are always more specific than any file settings - - // (2) verbosity settings use dedicated attributes and hence are more specific - // than anything generic - - final IProperties fileSettings = m_genericCfg.getFileSettings (); - final IProperties genericSettings = m_genericCfg.getGenericSettings (); - final IProperties verbositySettings = m_verbosityCfg.getSettings (); - - return IProperties.Factory.combine (verbositySettings, - IProperties.Factory.combine (genericSettings, - fileSettings)); - } - - // package: ............................................................... - - // private: ............................................................... - - - private /*final*/ VerbosityCfg m_verbosityCfg; - private /*final*/ GenericCfg m_genericCfg; - private boolean m_enabled; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/ant/VerbosityCfg.java b/ant/ant14/com/vladium/emma/ant/VerbosityCfg.java deleted file mode 100644 index 41d9842..0000000 --- a/ant/ant14/com/vladium/emma/ant/VerbosityCfg.java +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: VerbosityCfg.java,v 1.1.2.1 2004/07/16 23:32:04 vlad_r Exp $ - */ -package com.vladium.emma.ant; - -import java.util.Properties; - -import org.apache.tools.ant.types.EnumeratedAttribute; - -import com.vladium.emma.AppLoggers; -import com.vladium.emma.EMMAProperties; -import com.vladium.logging.ILogLevels; -import com.vladium.util.IProperties; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2004 - */ -public -final class VerbosityCfg -{ - // public: ................................................................ - - - public static final class VerbosityAttribute extends EnumeratedAttribute - { - public String [] getValues () - { - return VALUES; - } - - private static final String [] VALUES = new String [] - { - ILogLevels.SEVERE_STRING, - ILogLevels.SILENT_STRING, - ILogLevels.WARNING_STRING, - ILogLevels.QUIET_STRING, - ILogLevels.INFO_STRING, - ILogLevels.VERBOSE_STRING, - ILogLevels.TRACE1_STRING, - ILogLevels.TRACE2_STRING, - ILogLevels.TRACE3_STRING, - }; - - } // end of nested class - - - // verbosity attribute: - - public void setVerbosity (final VerbosityAttribute verbosity) - { - m_verbosity = verbosity.getValue (); - } - - // verbosity class filter attribute: - - public void setVerbosityfilter (final String filter) - { - m_verbosityFilter = filter; - } - - // ACCESSORS: - - public IProperties getSettings () - { - IProperties settings = m_settings; - if (settings == null) - { - settings = EMMAProperties.wrap (new Properties ()); - - if ((m_verbosity != null) && (m_verbosity.trim ().length () > 0)) - settings.setProperty (AppLoggers.PROPERTY_VERBOSITY_LEVEL, m_verbosity.trim ()); - - if ((m_verbosityFilter != null) && (m_verbosityFilter.trim ().length () > 0)) - settings.setProperty (AppLoggers.PROPERTY_VERBOSITY_FILTER, m_verbosityFilter.trim ()); - - m_settings = settings; - return settings; - } - - return settings; - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - - private String m_verbosity; - private String m_verbosityFilter; - - private transient IProperties m_settings; // can be null - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/data/mergeTask.java b/ant/ant14/com/vladium/emma/data/mergeTask.java deleted file mode 100644 index 361f3e9..0000000 --- a/ant/ant14/com/vladium/emma/data/mergeTask.java +++ /dev/null @@ -1,102 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: mergeTask.java,v 1.1.1.1.2.1 2004/07/08 10:52:09 vlad_r Exp $ - */ -package com.vladium.emma.data; - -import java.io.File; - -import org.apache.tools.ant.BuildException; - -import com.vladium.emma.ant.FileTask; -import com.vladium.emma.ant.SuppressableTask; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -final class mergeTask extends FileTask -{ - // public: ................................................................ - - - public mergeTask (final SuppressableTask parent) - { - super (parent); - } - - public void execute () throws BuildException - { - if (isEnabled ()) - { - String [] files = getDataPath (true); - if ((files == null) || (files.length == 0)) - throw (BuildException) newBuildException (getTaskName () - + ": no valid input data files have been specified", location).fillInStackTrace (); - - final MergeProcessor processor = MergeProcessor.create (); - - processor.setDataPath (files); files = null; - processor.setSessionOutFile (m_outFile != null ? m_outFile.getAbsolutePath () : null); - processor.setPropertyOverrides (getTaskSettings ()); - - processor.run (); - } - } - - - // mergefile|tofile|outfile|file attribute: - - public void setMergefile (final File file) - { - if (m_outFile != null) - throw (BuildException) newBuildException (getTaskName () - + ": merge data file attribute already set", location).fillInStackTrace (); - - m_outFile = file; - } - - public void setOutfile (final File file) - { - if (m_outFile != null) - throw (BuildException) newBuildException (getTaskName () - + ": merge data file attribute already set", location).fillInStackTrace (); - - m_outFile = file; - } - - public void setTofile (final File file) - { - if (m_outFile != null) - throw (BuildException) newBuildException (getTaskName () - + ": merge data file attribute already set", location).fillInStackTrace (); - - m_outFile = file; - } - - public void setFile (final File file) - { - if (m_outFile != null) - throw (BuildException) newBuildException (getTaskName () - + ": merge data file attribute already set", location).fillInStackTrace (); - - m_outFile = file; - } - - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - - private File m_outFile; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/emmaTask.java b/ant/ant14/com/vladium/emma/emmaTask.java deleted file mode 100644 index 6aa726f..0000000 --- a/ant/ant14/com/vladium/emma/emmaTask.java +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: emmaTask.java,v 1.1.1.1.2.2 2004/07/10 03:34:52 vlad_r Exp $ - */ -package com.vladium.emma; - -import com.vladium.emma.IAppConstants; -import java.util.ArrayList; -import java.util.List; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; - -import com.vladium.emma.ant.NestedTask; -import com.vladium.emma.ant.SuppressableTask; -import com.vladium.emma.data.mergeTask; -import com.vladium.emma.instr.instrTask; -import com.vladium.emma.report.reportTask; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -final class emmaTask extends SuppressableTask -{ - // public: ................................................................ - - // TODO: this and related tasks should be designed for external extensibility - // [make non final and use virtual prop getters] - - public emmaTask () - { - m_tasks = new ArrayList (); - } - - - public synchronized void execute () throws BuildException - { - log (IAppConstants.APP_VERBOSE_BUILD_ID, Project.MSG_VERBOSE); - - if (isEnabled ()) - { - while (! m_tasks.isEmpty ()) - { - final NestedTask task = (NestedTask) m_tasks.remove (0); - - final String name = getTaskName (); - try - { - setTaskName (task.getTaskName ()); - - task.execute (); - } - finally - { - setTaskName (name); - } - } - } - } - - - public NestedTask createInstr () - { - return addTask (new instrTask (this), getNestedTaskName ("instr")); - } - - public NestedTask createMerge () - { - return addTask (new mergeTask (this), getNestedTaskName ("merge")); - } - - public NestedTask createReport () - { - return addTask (new reportTask (this), getNestedTaskName ("report")); - } - - // protected: ............................................................. - - - protected NestedTask addTask (final NestedTask task, final String pseudoName) - { - initTask (task, pseudoName); - - m_tasks.add (task); - return task; - } - - protected void initTask (final NestedTask task, final String pseudoName) - { - task.setTaskName (pseudoName); - task.setProject (getProject ()); - task.setLocation (getLocation ()); - task.setOwningTarget (getOwningTarget ()); - - task.init (); - } - - protected String getNestedTaskName (final String subname) - { - return getTaskName ().concat (".").concat (subname); - } - - // package: ............................................................... - - // private: ............................................................... - - - private final List /* NestedTask */ m_tasks; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/emmajavaTask.java b/ant/ant14/com/vladium/emma/emmajavaTask.java deleted file mode 100644 index cf4339a..0000000 --- a/ant/ant14/com/vladium/emma/emmajavaTask.java +++ /dev/null @@ -1,587 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: emmajavaTask.java,v 1.1.1.1.2.2 2004/07/16 23:32:04 vlad_r Exp $ - */ -package com.vladium.emma; - -import java.io.File; - -import com.vladium.util.IProperties; -import com.vladium.util.Strings; -import com.vladium.emma.ant.*; -import com.vladium.emma.instr.FilterCfg; -import com.vladium.emma.instr.FilterCfg.filterElement; -import com.vladium.emma.report.ReportCfg; -import com.vladium.emma.report.IReportEnums.DepthAttribute; -import com.vladium.emma.report.IReportEnums.UnitsTypeAttribute; -import com.vladium.emma.report.ReportCfg.Element_HTML; -import com.vladium.emma.report.ReportCfg.Element_TXT; -import com.vladium.emma.report.ReportCfg.Element_XML; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.Java; -import org.apache.tools.ant.types.Commandline; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -class emmajavaTask extends Java -{ - // public: ................................................................ - - - public void init () throws BuildException - { - super.init (); - - m_verbosityCfg = new VerbosityCfg (); - m_genericCfg = new GenericCfg (this); - m_filterCfg = new FilterCfg (this); - m_reportCfg = new ReportCfg (project, this); - setEnabled (true); - } - - - public void execute () throws BuildException - { - 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 (); - } - - - - // <java> overrides [ANT 1.4]: - - public void setClassname (final 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 setJar (final 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 void setClasspath (final Path path) - { - if (m_classpath == null) - m_classpath = path; - else - m_classpath.append (path); - } - - public void setClasspathRef (final Reference ref) - { - createClasspath ().setRefid (ref); - } - - public Path createClasspath () - { - if (m_classpath == null) - m_classpath = new Path (project); - - return m_classpath.createPath (); - } - - /** - * This is already deprecated in ANT v1.4. However, it is still supported by - * the parent task so I do likewise. - */ - public void setArgs (final String args) - { - throw (BuildException) SuppressableTask.newBuildException (getTaskName () - + ": disallows using <java>'s deprecated 'args' attribute", location).fillInStackTrace (); - } - - /** - * Not overridable. - */ - public final void setFork (final boolean fork) - { - m_fork = fork; - m_forkUserOverride = true; - } - - /** - * Not overridable [due to limitations in ANT's Commandline]. - */ - public final Commandline.Argument createArg () - { - if (m_appArgs == null) - m_appArgs = new Commandline (); - - return m_appArgs.createArgument (); - } - - // <java> overrides [ANT 1.5]: - - // [nothing at this point] - - - // <emmajava> extensions: - - public void setEnabled (final boolean enabled) - { - m_enabled = enabled; - } - - // .properties file attribute: - - public final void setProperties (final File file) - { - m_genericCfg.setProperties (file); - } - - // generic property element: - - public final PropertyElement createProperty () - { - return m_genericCfg.createProperty (); - } - - // verbosity attribute: - - public void setVerbosity (final VerbosityCfg.VerbosityAttribute verbosity) - { - m_verbosityCfg.setVerbosity (verbosity); - } - - // verbosity class filter attribute: - - public void setVerbosityfilter (final String filter) - { - m_verbosityCfg.setVerbosityfilter (filter); - } - - // lib classpath attribute [to support non-extdir deployment]: - - public final void setLibclasspath (final Path classpath) - { - if (m_libClasspath == null) - m_libClasspath = classpath; - else - m_libClasspath.append (classpath); - } - - public final void setLibclasspathRef (final Reference ref) - { - if (m_libClasspath == null) - m_libClasspath = new Path (project); - - m_libClasspath.createPath ().setRefid (ref); - } - - // -f flag: - - public void setFullmetadata (final boolean full) - { - m_scanCoveragePath = full; // defaults to false TODO: maintain the default in a central location - } - - // -raw flag: - - public void setDumpsessiondata (final boolean dump) - { - m_dumpSessionData = dump; - } - - // -out option: - - // sessiondatafile|outfile attribute: - - public void setSessiondatafile (final File file) - { - if (m_outFile != null) - throw (BuildException) SuppressableTask.newBuildException (getTaskName () - + ": session data file attribute already set", location).fillInStackTrace (); - - m_outFile = file; - } - - public void setOutfile (final File file) - { - if (m_outFile != null) - throw (BuildException) SuppressableTask.newBuildException (getTaskName () - + ": session data file attribute already set", location).fillInStackTrace (); - - m_outFile = file; - } - -// public void setTofile (final File file) -// { -// if (m_outFile != null) -// throw (BuildException) SuppressableTask.newBuildException (getTaskName () -// + ": session data file attribute already set", location).fillInStackTrace (); -// -// m_outFile = file; -// } -// -// public void setFile (final File file) -// { -// if (m_outFile != null) -// throw (BuildException) SuppressableTask.newBuildException (getTaskName () -// + ": session data file attribute already set", location).fillInStackTrace (); -// -// m_outFile = file; -// } - - - // merge attribute: - - public void setMerge (final boolean merge) - { - m_outFileMerge = merge ? Boolean.TRUE : Boolean.FALSE; - } - - // instr filter attribute/element: - - public final void setFilter (final String filter) - { - m_filterCfg.setFilter (filter); - } - - public final filterElement createFilter () - { - return m_filterCfg.createFilter (); - } - - - // TODO: should what's below go inside <report></report> ? - - // sourcepath attribute/element: - - public final void setSourcepath (final Path path) - { - m_reportCfg.setSourcepath (path); - } - - public final void setSourcepathRef (final Reference ref) - { - m_reportCfg.setSourcepathRef (ref); - } - - public final Path createSourcepath () - { - return m_reportCfg.createSourcepath (); - } - - - // generator elements: - - public final Element_TXT createTxt () - { - return m_reportCfg.createTxt (); - } - - public final Element_HTML createHtml () - { - return m_reportCfg.createHtml (); - } - - public final Element_XML createXml () - { - return m_reportCfg.createXml (); - } - - - // report properties [defaults for all report types]: - - public final void setUnits (final UnitsTypeAttribute units) - { - m_reportCfg.setUnits (units); - } - - public final void setDepth (final DepthAttribute depth) - { - m_reportCfg.setDepth (depth); - } - - public final void setColumns (final String columns) - { - m_reportCfg.setColumns (columns); - } - - public final void setSort (final String sort) - { - m_reportCfg.setSort (sort); - } - - public final void setMetrics (final String metrics) - { - m_reportCfg.setMetrics (metrics); - } - - // these are not supported anymore - -// public final void setOutdir (final File dir) -// { -// m_reportCfg.setOutdir (dir); -// } -// -// public final void setDestdir (final File dir) -// { -// m_reportCfg.setDestdir (dir); -// } - - // should be set at this level [and conflicts with raw data opts]: - -// public void setOutfile (final String fileName) -// { -// m_reportCfg.setOutfile (fileName); -// } - - public void setEncoding (final String encoding) - { - m_reportCfg.setEncoding (encoding); - } - - // protected: ............................................................. - - - protected String getClassname () - { - return m_classname; - } - - protected File getJar () - { - return m_jar; - } - - protected Path getClasspath () - { - return m_classpath; - } - - // extended functionality: - - protected boolean isEnabled () - { - return m_enabled; - } - - // package: ............................................................... - - // private: ............................................................... - - // <java> overrides: - - private Path m_classpath; - private String m_classname; - private File m_jar; - private Commandline m_appArgs; - private boolean m_fork, m_forkUserOverride; - - // <emmajava> extensions: - - private boolean m_enabled; - private Path m_libClasspath; - private /*final*/ VerbosityCfg m_verbosityCfg; - private /*final*/ GenericCfg m_genericCfg; - private /*final*/ FilterCfg m_filterCfg; - private /*final*/ ReportCfg m_reportCfg; - private boolean m_scanCoveragePath; // defaults to false - private boolean m_dumpSessionData; //defaults to false - private File m_outFile; - private Boolean m_outFileMerge; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/instr/FilterCfg.java b/ant/ant14/com/vladium/emma/instr/FilterCfg.java deleted file mode 100644 index 1d13cae..0000000 --- a/ant/ant14/com/vladium/emma/instr/FilterCfg.java +++ /dev/null @@ -1,195 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: FilterCfg.java,v 1.2 2004/05/20 02:28:07 vlad_r Exp $ - */ -package com.vladium.emma.instr; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; - -import com.vladium.util.IConstants; -import com.vladium.util.Strings; -import com.vladium.emma.ant.StringValue; -import com.vladium.emma.ant.SuppressableTask; -import com.vladium.emma.filter.IInclExclFilter; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -class FilterCfg -{ - // public: ................................................................ - - - public static final class filterElement extends StringValue - { - public filterElement (final Task task) - { - super (task); - } - - public void setValue (final String value) - { - final String [] specs = Strings.merge (new String [] {value}, COMMA_DELIMITERS, true); - - for (int i = 0; i < specs.length; ++ i) - { - final String spec = specs [i]; - - if (spec.startsWith (IInclExclFilter.INCLUSION_PREFIX_STRING) || - spec.startsWith (IInclExclFilter.EXCLUSION_PREFIX_STRING)) - { - appendValue (spec, COMMA); - } - else - { - appendValue (IInclExclFilter.INCLUSION_PREFIX + spec, COMMA); // default to inclusion - } - } - } - - /** - * Set the 'file' attribute. - */ - public void setFile (final File file) - { - appendValue ("@".concat (file.getAbsolutePath ()), COMMA); // actual file I/O delayed until getFilterSpecs() - } - - public void setIncludes (final String value) - { - final String [] specs = Strings.merge (new String [] {value}, COMMA_DELIMITERS, true); - - for (int i = 0; i < specs.length; ++ i) - { - final String spec = specs [i]; - - if (spec.startsWith (IInclExclFilter.INCLUSION_PREFIX_STRING)) - { - appendValue (spec, COMMA); - } - else - { - if (spec.startsWith (IInclExclFilter.EXCLUSION_PREFIX_STRING)) - appendValue (IInclExclFilter.INCLUSION_PREFIX + spec.substring (1), COMMA); // override - else - appendValue (IInclExclFilter.INCLUSION_PREFIX + spec, COMMA); - } - } - } - - public void setExcludes (final String value) - { - final String [] specs = Strings.merge (new String [] {value}, COMMA_DELIMITERS, true); - - for (int i = 0; i < specs.length; ++ i) - { - final String spec = specs [i]; - - if (spec.startsWith (IInclExclFilter.EXCLUSION_PREFIX_STRING)) - { - appendValue (spec, COMMA); - } - else - { - if (spec.startsWith (IInclExclFilter.INCLUSION_PREFIX_STRING)) - appendValue (IInclExclFilter.EXCLUSION_PREFIX + spec.substring (1), COMMA); // override - else - appendValue (IInclExclFilter.EXCLUSION_PREFIX + spec, COMMA); - } - } - } - - } // end of nested class - - - public FilterCfg (final Task task) - { - if (task == null) throw new IllegalArgumentException ("null input: task"); - - m_task = task; - m_filterList = new ArrayList (); - } - - - // filter attribute/element: - - public void setFilter (final String filter) - { - createFilter ().appendValue (filter, COMMA); - } - - public filterElement createFilter () - { - final filterElement result = new filterElement (m_task); - m_filterList.add (result); - - return result; - } - - // ACCESSORS: - - public String [] getFilterSpecs () - { - if (m_specs != null) - return m_specs; - else - { - if ((m_filterList == null) || m_filterList.isEmpty ()) - { - m_specs = IConstants.EMPTY_STRING_ARRAY; - } - else - { - final String [] values = new String [m_filterList.size ()]; - - int j = 0; - for (Iterator i = m_filterList.iterator (); i.hasNext (); ++ j) - values [j] = ((StringValue) i.next ()).getValue (); - - try - { - m_specs = Strings.mergeAT (values, COMMA_DELIMITERS, true); - } - catch (IOException ioe) - { - throw (BuildException) SuppressableTask.newBuildException (m_task.getTaskName () - + ": I/O exception while processing input" , ioe, m_task.getLocation ()).fillInStackTrace (); - } - } - - return m_specs; - } - } - - // protected: ............................................................. - - - protected static final String COMMA = ","; - protected static final String COMMA_DELIMITERS = COMMA + Strings.WHITE_SPACE; - protected static final String PATH_DELIMITERS = COMMA.concat (File.pathSeparator); - - // package: ............................................................... - - // private: ............................................................... - - - private final Task m_task; // never null - private final List /* filterElement */ m_filterList; // never null - - private transient String [] m_specs; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/instr/instrTask.java b/ant/ant14/com/vladium/emma/instr/instrTask.java deleted file mode 100644 index 30c9f3d..0000000 --- a/ant/ant14/com/vladium/emma/instr/instrTask.java +++ /dev/null @@ -1,181 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: instrTask.java,v 1.1.1.1.2.1 2004/07/08 10:52:12 vlad_r Exp $ - */ -package com.vladium.emma.instr; - -import java.io.File; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.EnumeratedAttribute; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; - -import com.vladium.util.asserts.$assert; -import com.vladium.emma.ant.FilterTask; -import com.vladium.emma.ant.SuppressableTask; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -final class instrTask extends FilterTask -{ - // public: ................................................................ - - - public static final class ModeAttribute extends EnumeratedAttribute - { - public String [] getValues () - { - return VALUES; - } - - private static final String [] VALUES = new String [] {"copy", "overwrite", "fullcopy"}; - - } // end of nested class - - - public instrTask (final SuppressableTask parent) - { - super (parent); - - m_outMode = InstrProcessor.OutMode.OUT_MODE_COPY; // default - } - - - public void execute () throws BuildException - { - 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 (); - } - } - - - // instrpath attribute/element: - - public void setInstrpath (final Path path) - { - if (m_instrpath == null) - m_instrpath = path; - else - m_instrpath.append (path); - } - - public void setInstrpathRef (final Reference ref) - { - createInstrpath ().setRefid (ref); - } - - public Path createInstrpath () - { - if (m_instrpath == null) - m_instrpath = new Path (project); - - return m_instrpath.createPath (); - } - - - // outdir|destdir attribute: - - public void setOutdir (final File dir) - { - if (m_outDir != null) - throw (BuildException) newBuildException (getTaskName () - + ": outdir|destdir attribute already set", location).fillInStackTrace (); - - m_outDir = dir; - } - - public void setDestdir (final File dir) - { - if (m_outDir != null) - throw (BuildException) newBuildException (getTaskName () - + ": outdir|destdir attribute already set", location).fillInStackTrace (); - - m_outDir = dir; - } - - - // metadatafile|outfile attribute: - - public void setMetadatafile (final File file) - { - if (m_outFile != null) - throw (BuildException) newBuildException (getTaskName () - + ": metadata file attribute already set", location).fillInStackTrace (); - - m_outFile = file; - } - - public void setOutfile (final File file) - { - if (m_outFile != null) - throw (BuildException) newBuildException (getTaskName () - + ": metadata file attribute already set", location).fillInStackTrace (); - - m_outFile = file; - } - - // merge attribute: - - public void setMerge (final boolean merge) - { - m_outFileMerge = merge ? Boolean.TRUE : Boolean.FALSE; - } - - - // mode attribute: - - public void setMode (final 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; - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - - private Path m_instrpath; - private InstrProcessor.OutMode m_outMode; - private File m_outDir; - private File m_outFile; - private Boolean m_outFileMerge; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/report/IReportEnums.java b/ant/ant14/com/vladium/emma/report/IReportEnums.java deleted file mode 100644 index 7b81457..0000000 --- a/ant/ant14/com/vladium/emma/report/IReportEnums.java +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: IReportEnums.java,v 1.1.1.1 2004/05/09 16:57:27 vlad_r Exp $ - */ -package com.vladium.emma.report; - -import com.vladium.emma.report.IReportProperties; -import org.apache.tools.ant.types.EnumeratedAttribute; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -interface IReportEnums -{ - // public: ................................................................ - - - final class TypeAttribute extends EnumeratedAttribute - { - public String [] getValues () - { - return VALUES; - } - - // TODO: keep this enum in a centralized location - private static final String [] VALUES = new String [] - { - "txt", - "html", - "xml", - }; - - } // end of nested class - - - final class DepthAttribute extends EnumeratedAttribute - { - public String [] getValues () - { - return VALUES; - } - - // TODO: keep this enum in a centralized location - private static final String [] VALUES = new String [] - { - IReportProperties.DEPTH_ALL, - IReportProperties.DEPTH_PACKAGE, - IReportProperties.DEPTH_SRCFILE, - IReportProperties.DEPTH_CLASS, - IReportProperties.DEPTH_METHOD, - }; - - } // end of nested class - - - final class ViewTypeAttribute extends EnumeratedAttribute - { - public String [] getValues () - { - return VALUES; - } - - // TODO: keep this enum in a centralized location - private static final String [] VALUES = new String [] - { - IReportProperties.SRC_VIEW, - IReportProperties.CLS_VIEW, - }; - - } // end of nested class - - - static final class UnitsTypeAttribute extends EnumeratedAttribute - { - public String [] getValues () - { - return VALUES; - } - - // TODO: keep this enum in a centralized location - private static final String [] VALUES = new String [] - { - IReportProperties.INSTR_UNITS, - IReportProperties.COUNT_UNITS, - }; - - } // end of nested class - -} // end of interface -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/report/ReportCfg.java b/ant/ant14/com/vladium/emma/report/ReportCfg.java deleted file mode 100644 index 71a01b4..0000000 --- a/ant/ant14/com/vladium/emma/report/ReportCfg.java +++ /dev/null @@ -1,424 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: ReportCfg.java,v 1.1.1.1.2.1 2004/07/08 10:52:11 vlad_r Exp $ - */ -package com.vladium.emma.report; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; - -import com.vladium.util.IConstants; -import com.vladium.util.IProperties; -import com.vladium.emma.EMMAProperties; -import com.vladium.emma.ant.PropertyElement; -import com.vladium.emma.ant.SuppressableTask; -import com.vladium.emma.report.IReportEnums.DepthAttribute; -import com.vladium.emma.report.IReportEnums.UnitsTypeAttribute; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; - -// ---------------------------------------------------------------------------- -/** - * ReportCfg is a container for report type {@link ReportCfg.Element}s that are - * in turn containers for all properties that could be set on a <report> - * report type configurator (<txt>, <html>, etc). The elements provide - * the ability for report properties to be set either via the generic <property> - * nested elements or dedicated attributes. Potential conflicts between the same - * conceptual property being set via an attribute and a nested element are resolved - * by making dedicated attributes higher priority.<P> - * - * Note that ReportCfg does not handle any non-report related properties. - * This can be done via {@link com.vladium.emma.ant.GenericCfg}. It is also the - * parent's responsibility to merge any inherited report properties with - * ReportCfg settings. - * - * @author Vlad Roubtsov, (C) 2003 - */ -public -class ReportCfg implements IReportProperties -{ - // public: ................................................................ - - - public static abstract class Element implements IReportEnums, IReportProperties - { - public void setUnits (final UnitsTypeAttribute units) - { - m_settings.setProperty (m_prefix.concat (UNITS_TYPE), units.getValue ()); - } - - public void setDepth (final DepthAttribute depth) - { - m_settings.setProperty (m_prefix.concat (DEPTH), depth.getValue ()); - } - - public void setColumns (final String columns) - { - m_settings.setProperty (m_prefix.concat (COLUMNS), columns); - } - - public void setSort (final String sort) - { - m_settings.setProperty (m_prefix.concat (SORT), sort); - } - - public void setMetrics (final String metrics) - { - m_settings.setProperty (m_prefix.concat (METRICS), metrics); - } - - // not supported anymore: - -// public void setOutdir (final File dir) -// { -// // TODO: does ANT resolve files relative to current JVM dir or ${basedir}? -// m_settings.setProperty (m_prefix.concat (OUT_DIR), dir.getAbsolutePath ()); -// } - - public void setOutfile (final String fileName) - { - m_settings.setProperty (m_prefix.concat (OUT_FILE), fileName); - } - - public void setEncoding (final String encoding) - { - m_settings.setProperty (m_prefix.concat (OUT_ENCODING), encoding); - } - - // generic property element [don't doc this publicly]: - - public PropertyElement createProperty () - { - // TODO: error out on conficting duplicate settings - - final PropertyElement property = new PropertyElement (); - m_genericSettings.add (property); - - return property; - } - - protected abstract String getType (); - - - Element (final Task task, final IProperties settings) - { - if (task == null) - throw new IllegalArgumentException ("null input: task"); - if (settings == null) - throw new IllegalArgumentException ("null input: settings"); - - m_task = task; - m_settings = settings; - - m_prefix = PREFIX.concat (getType ()).concat ("."); - - m_genericSettings = new ArrayList (); - } - - - void processGenericSettings () - { - for (Iterator i = m_genericSettings.iterator (); i.hasNext (); ) - { - final PropertyElement property = (PropertyElement) i.next (); - - final String name = property.getName (); - final String value = property.getValue () != null ? property.getValue () : ""; - - if (name != null) - { - final String prefixedName = m_prefix.concat (name); - - // generically named settings don't override report named settings: - - if (! m_settings.isOverridden (prefixedName)) - m_settings.setProperty (prefixedName, value); - } - } - } - - - protected final Task m_task; // never null - protected final String m_prefix; // never null - protected final IProperties m_settings; // never null - protected final List /* PropertyElement */ m_genericSettings; // never null - - } // end of nested class - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - public static class Element_HTML extends Element - { - protected final String getType () - { - return TYPE; - } - - Element_HTML (final Task task, final IProperties settings) - { - super (task, settings); - } - - - static final String TYPE = "html"; - - } // end of nested class - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - public static class Element_TXT extends Element - { - protected final String getType () - { - return TYPE; - } - - Element_TXT (final Task task, final IProperties settings) - { - super (task, settings); - } - - - static final String TYPE = "txt"; - - } // end of nested class - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - public static class Element_XML extends Element - { - protected final String getType () - { - return TYPE; - } - - Element_XML (final Task task, final IProperties settings) - { - super (task, settings); - } - - - static final String TYPE = "xml"; - - } // end of nested class - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - public ReportCfg (final Project project, final Task task) - { - m_project = project; - m_task = task; - - m_reportTypes = new ArrayList (4); - m_cfgList = new ArrayList (4); - m_settings = EMMAProperties.wrap (new Properties ()); - } - - public Path getSourcepath () - { - return m_srcpath; - } - - public String [] getReportTypes () - { - final BuildException failure = getFailure (); - - if (failure != null) - throw failure; - else - { - if (m_reportTypes.isEmpty ()) - return IConstants.EMPTY_STRING_ARRAY; - else - { - final String [] result = new String [m_reportTypes.size ()]; - m_reportTypes.toArray (result); - - return result; - } - } - } - - public IProperties getReportSettings () - { - final BuildException failure = getFailure (); - - if (failure != null) - throw failure; - else - { - if (! m_processed) - { - // collect all nested elements' generic settins into m_settings: - - for (Iterator i = m_cfgList.iterator (); i.hasNext (); ) - { - final Element cfg = (Element) i.next (); - cfg.processGenericSettings (); - } - - m_processed = true; - } - - return m_settings; // no clone - } - } - - - // sourcepath attribute/element: - - public void setSourcepath (final Path path) - { - if (m_srcpath == null) - m_srcpath = path; - else - m_srcpath.append (path); - } - - public void setSourcepathRef (final Reference ref) - { - createSourcepath ().setRefid (ref); - } - - public Path createSourcepath () - { - if (m_srcpath == null) - m_srcpath = new Path (m_project); - - return m_srcpath.createPath (); - } - - - // generator elements: - - public Element_TXT createTxt () - { - return (Element_TXT) addCfgElement (Element_TXT.TYPE, - new Element_TXT (m_task, m_settings)); - } - - public Element_HTML createHtml () - { - return (Element_HTML) addCfgElement (Element_HTML.TYPE, - new Element_HTML (m_task, m_settings)); - } - - public Element_XML createXml () - { - return (Element_XML) addCfgElement (Element_XML.TYPE, - new Element_XML (m_task, m_settings)); - } - - - // report properties [defaults for all report types]: - - public void setUnits (final UnitsTypeAttribute units) - { - m_settings.setProperty (PREFIX.concat (UNITS_TYPE), units.getValue ()); - } - - public void setDepth (final DepthAttribute depth) - { - m_settings.setProperty (PREFIX.concat (DEPTH), depth.getValue ()); - } - - public void setColumns (final String columns) - { - m_settings.setProperty (PREFIX.concat (COLUMNS), columns); - } - - public void setSort (final String sort) - { - m_settings.setProperty (PREFIX.concat (SORT), sort); - } - - public void setMetrics (final String metrics) - { - m_settings.setProperty (PREFIX.concat (METRICS), metrics); - } - - // not supported anymore: - -// public void setOutdir (final File dir) -// { -// // TODO: does ANT resolve files relative to current JVM dir or ${basedir}? -// m_settings.setProperty (PREFIX.concat (OUT_DIR), dir.getAbsolutePath ()); -// } -// -// public void setDestdir (final File dir) -// { -// // TODO: does ANT resolve files relative to current JVM dir or ${basedir}? -// m_settings.setProperty (PREFIX.concat (OUT_DIR), dir.getAbsolutePath ()); -// } - - public void setOutfile (final String fileName) - { - m_settings.setProperty (PREFIX.concat (OUT_FILE), fileName); - } - - public void setEncoding (final String encoding) - { - m_settings.setProperty (PREFIX.concat (OUT_ENCODING), encoding); - } - - // protected: ............................................................. - - - protected Element addCfgElement (final String type, final Element cfg) - { - if (m_reportTypes.contains (type)) - { - setFailure ((BuildException) SuppressableTask.newBuildException (m_task.getTaskName () - + ": duplicate configuration for report type [" + type + "]" , - m_task.getLocation ()).fillInStackTrace ()); - } - else - { - m_reportTypes.add (type); - m_cfgList.add (cfg); - } - - return cfg; - } - - // package: ............................................................... - - // private: ............................................................... - - - private void setFailure (final BuildException failure) - { - if (m_settingsFailure == null) m_settingsFailure = failure; // record the first one only - } - - private BuildException getFailure () - { - return m_settingsFailure; - } - - - private final Project m_project; - private final Task m_task; - - private final List /* report type:String */ m_reportTypes; // using a list to keep the generation order same as configuration - private final List /* Element */ m_cfgList; - private final IProperties m_settings; // never null - - private Path m_srcpath; - - private transient BuildException m_settingsFailure; // can be null - private transient boolean m_processed; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant14/com/vladium/emma/report/reportTask.java b/ant/ant14/com/vladium/emma/report/reportTask.java deleted file mode 100644 index b726753..0000000 --- a/ant/ant14/com/vladium/emma/report/reportTask.java +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: reportTask.java,v 1.1.1.1.2.1 2004/07/08 10:52:11 vlad_r Exp $ - */ -package com.vladium.emma.report; - -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; - -import com.vladium.util.IProperties; -import com.vladium.emma.ant.FileTask; -import com.vladium.emma.ant.SuppressableTask; -import com.vladium.emma.report.ReportCfg.Element_HTML; -import com.vladium.emma.report.ReportCfg.Element_TXT; -import com.vladium.emma.report.ReportCfg.Element_XML; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2003 - */ -public -final class reportTask extends FileTask implements IReportProperties, IReportEnums -{ - public reportTask (final SuppressableTask parent) - { - super (parent); - } - - public void init () throws BuildException - { - super.init (); - - m_reportCfg = new ReportCfg (getProject (), this); - } - - - public void execute () throws BuildException - { - if (isEnabled ()) - { - final String [] reportTypes = m_reportCfg.getReportTypes (); - - if ((reportTypes == null) || (reportTypes.length == 0)) // no "txt" default for report processor - throw (BuildException) newBuildException (getTaskName () - + ": no report types specified: provide at least one of <txt>, <html>, <xml> nested elements", location).fillInStackTrace (); - - String [] files = getDataPath (true); - if ((files == null) || (files.length == 0)) - throw (BuildException) newBuildException (getTaskName () - + ": no valid input data files have been specified", location).fillInStackTrace (); - - final Path srcpath = m_reportCfg.getSourcepath (); - - // combine report and all generic settings: - final IProperties settings; - { - final IProperties taskSettings = getTaskSettings (); - final IProperties reportSettings = m_reportCfg.getReportSettings (); - - // named report settings override generic named settings and file - // settings have lower priority than any explicitly named overrides: - settings = IProperties.Factory.combine (reportSettings, taskSettings); - } - - final ReportProcessor processor = ReportProcessor.create (); - - processor.setDataPath (files); files = null; - processor.setSourcePath (srcpath != null ? srcpath.list () : null); - processor.setReportTypes (reportTypes); - processor.setPropertyOverrides (settings); - - processor.run (); - } - } - - - // sourcepath attribute/element: - - public void setSourcepath (final Path path) - { - m_reportCfg.setSourcepath (path); - } - - public void setSourcepathRef (final Reference ref) - { - m_reportCfg.setSourcepathRef (ref); - } - - public Path createSourcepath () - { - return m_reportCfg.createSourcepath (); - } - - - // generator elements: - - public Element_TXT createTxt () - { - return m_reportCfg.createTxt (); - } - - public Element_HTML createHtml () - { - return m_reportCfg.createHtml (); - } - - public Element_XML createXml () - { - return m_reportCfg.createXml (); - } - - - // report properties [defaults for all report types]: - - public void setUnits (final UnitsTypeAttribute units) - { - m_reportCfg.setUnits (units); - } - - public void setDepth (final DepthAttribute depth) - { - m_reportCfg.setDepth (depth); - } - - public void setColumns (final String columns) - { - m_reportCfg.setColumns (columns); - } - - public void setSort (final String sort) - { - m_reportCfg.setSort (sort); - } - - public void setMetrics (final String metrics) - { - m_reportCfg.setMetrics (metrics); - } - - // not supported anymore: - -// public void setOutdir (final File dir) -// { -// m_reportCfg.setOutdir (dir); -// } -// -// public void setDestdir (final File dir) -// { -// m_reportCfg.setDestdir (dir); -// } - - // should not be set at the global level: - -// public void setOutfile (final String fileName) -// { -// m_reportCfg.setOutfile (fileName); -// } - - public void setEncoding (final String encoding) - { - m_reportCfg.setEncoding (encoding); - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - - - private ReportCfg m_reportCfg; - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant15/com/vladium/emma/ant/IANTVersion.java b/ant/ant15/com/vladium/emma/ant/IANTVersion.java deleted file mode 100644 index 2a8458d..0000000 --- a/ant/ant15/com/vladium/emma/ant/IANTVersion.java +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: IANTVersion.java,v 1.1.1.1.2.1 2004/07/10 03:34:52 vlad_r Exp $ - */ -package com.vladium.emma.ant; - -import java.io.File; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.apache.tools.ant.types.FileSet; - -// ---------------------------------------------------------------------------- -/** - * @author Vlad Roubtsov, (C) 2004 - */ -public -interface IANTVersion -{ - // public: ................................................................ - - /** 'true' iff the current runtime version is 1.2 or later */ - boolean ANT_1_5_PLUS = _ANTVersion._ANT_1_5_PLUS; // static final but not inlinable - - - abstract class _ANTVersion - { - static final boolean _ANT_1_5_PLUS; // set in <clinit> - - private _ANTVersion () { /* prevent subclassing */ } - - static - { - boolean temp = true; - try - { - final Method m = FileSet.class.getMethod ("setFile", new Class [] { File.class }); - - // [assertion: 'm' is public] - - final int modifiers = m.getModifiers (); - if ((modifiers & Modifier.STATIC) != 0) - temp = false; - } - catch (NoSuchMethodException nsme) - { - temp = false; - } - catch (SecurityException se) - { - temp = false; - } - catch (Throwable t) - { - t.printStackTrace (System.out); - temp = false; - } - - _ANT_1_5_PLUS = temp; - } - - } // end of nested class - -} // end of interface -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/ant15/com/vladium/emma/ant/XFileSet.java b/ant/ant15/com/vladium/emma/ant/XFileSet.java deleted file mode 100644 index 49e0bb2..0000000 --- a/ant/ant15/com/vladium/emma/ant/XFileSet.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. - * - * This program and the accompanying materials are made available under - * the terms of the Common Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/cpl-v10.html - * - * $Id: XFileSet.java,v 1.1.1.1 2004/05/09 16:57:28 vlad_r Exp $ - */ -package com.vladium.emma.ant; - -import java.io.File; - -import org.apache.tools.ant.types.FileSet; -import org.apache.tools.ant.types.PatternSet; - -// ---------------------------------------------------------------------------- -/** - * An extension of ANT's stock FileSet that adds the convenience of specifying - * a single 'file' attribute - * - * @author Vlad Roubtsov, (C) 2004 - */ -public -final class XFileSet extends FileSet -{ - // public: ................................................................ - - - public XFileSet () - { - super (); - } - - public XFileSet (final FileSet fileset) - { - super (fileset); - } - - - // 'file' attribute: - public void setFile (final File file) - { - if (IANTVersion.ANT_1_5_PLUS) - { - super.setFile (file); - } - else - { - if (isReference ()) throw tooManyAttributes (); - - final File parent = file.getParentFile (); - if (parent != null) setDir (parent); - - final PatternSet.NameEntry include = createInclude (); - include.setName (file.getName ()); - } - } - - // protected: ............................................................. - - // package: ............................................................... - - // private: ............................................................... - -} // end of class -// ----------------------------------------------------------------------------
\ No newline at end of file diff --git a/ant/data/placeholder.exclude b/ant/data/placeholder.exclude deleted file mode 100644 index e69de29..0000000 --- a/ant/data/placeholder.exclude +++ /dev/null diff --git a/ant/res/placeholder.exclude b/ant/res/placeholder.exclude deleted file mode 100644 index e69de29..0000000 --- a/ant/res/placeholder.exclude +++ /dev/null |