git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270798 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -776,7 +776,8 @@ public class Javac extends MatchingTask | |||||
| GlobPatternMapper m = new GlobPatternMapper(); | GlobPatternMapper m = new GlobPatternMapper(); | ||||
| m.setFrom( "*.java" ); | m.setFrom( "*.java" ); | ||||
| m.setTo( "*.class" ); | m.setTo( "*.class" ); | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| SourceFileScanner sfs = new SourceFileScanner(); | |||||
| setupLogger( sfs ); | |||||
| File[] newFiles = sfs.restrictAsFiles( files, srcDir, destDir, m ); | File[] newFiles = sfs.restrictAsFiles( files, srcDir, destDir, m ); | ||||
| if( newFiles.length > 0 ) | if( newFiles.length > 0 ) | ||||
| @@ -67,7 +67,6 @@ public class Patch | |||||
| * @param file The new Patchfile value | * @param file The new Patchfile value | ||||
| */ | */ | ||||
| public void setPatchfile( final File patchFile ) | public void setPatchfile( final File patchFile ) | ||||
| throws TaskException | |||||
| { | { | ||||
| m_patchFile = patchFile; | m_patchFile = patchFile; | ||||
| } | } | ||||
| @@ -564,8 +564,9 @@ public class Rmic extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| newFiles = sfs.restrict( files, baseDir, baseDir, mapper ); | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| newFiles = scanner.restrict( files, baseDir, baseDir, mapper ); | |||||
| } | } | ||||
| for( int i = 0; i < newFiles.length; i++ ) | for( int i = 0; i < newFiles.length; i++ ) | ||||
| @@ -226,7 +226,8 @@ public class Tar | |||||
| private boolean archiveIsUpToDate( final String[] files ) | private boolean archiveIsUpToDate( final String[] files ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| final SourceFileScanner scanner = new SourceFileScanner( this ); | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| final MergingMapper mapper = new MergingMapper(); | final MergingMapper mapper = new MergingMapper(); | ||||
| mapper.setTo( tarFile.getAbsolutePath() ); | mapper.setTo( tarFile.getAbsolutePath() ); | ||||
| return scanner.restrict( files, baseDir, null, mapper ).length == 0; | return scanner.restrict( files, baseDir, null, mapper ).length == 0; | ||||
| @@ -161,7 +161,8 @@ public class UpToDate extends MatchingTask implements Condition | |||||
| protected boolean scanDir( File srcDir, String files[] ) | protected boolean scanDir( File srcDir, String files[] ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| FileNameMapper mapper = null; | FileNameMapper mapper = null; | ||||
| File dir = srcDir; | File dir = srcDir; | ||||
| if( mapperElement == null ) | if( mapperElement == null ) | ||||
| @@ -175,7 +176,7 @@ public class UpToDate extends MatchingTask implements Condition | |||||
| { | { | ||||
| mapper = mapperElement.getImplementation(); | mapper = mapperElement.getImplementation(); | ||||
| } | } | ||||
| return sfs.restrict( files, srcDir, dir, mapper ).length == 0; | |||||
| return scanner.restrict( files, srcDir, dir, mapper ).length == 0; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -458,12 +458,13 @@ public class Zip | |||||
| if( !zipFile.exists() ) | if( !zipFile.exists() ) | ||||
| return false; | return false; | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| MergingMapper mm = new MergingMapper(); | MergingMapper mm = new MergingMapper(); | ||||
| mm.setTo( zipFile.getAbsolutePath() ); | mm.setTo( zipFile.getAbsolutePath() ); | ||||
| for( int i = 0; i < scanners.length; i++ ) | for( int i = 0; i < scanners.length; i++ ) | ||||
| { | { | ||||
| if( sfs.restrict( fileNames[ i ], scanners[ i ].getBasedir(), null, | |||||
| if( scanner.restrict( fileNames[ i ], scanners[ i ].getBasedir(), null, | |||||
| mm ).length > 0 ) | mm ).length > 0 ) | ||||
| { | { | ||||
| return false; | return false; | ||||
| @@ -176,7 +176,7 @@ public class ExecTask | |||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| checkConfiguration(); | |||||
| validate(); | |||||
| if( isValidOs() ) | if( isValidOs() ) | ||||
| { | { | ||||
| runExec( prepareExec() ); | runExec( prepareExec() ); | ||||
| @@ -250,7 +250,7 @@ public class ExecTask | |||||
| * | * | ||||
| * @exception TaskException Description of Exception | * @exception TaskException Description of Exception | ||||
| */ | */ | ||||
| protected void checkConfiguration() | |||||
| protected void validate() | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( m_command.getExecutable() == null ) | if( m_command.getExecutable() == null ) | ||||
| @@ -313,8 +313,9 @@ public class ExecuteOn extends ExecTask | |||||
| { | { | ||||
| if( mapper != null ) | if( mapper != null ) | ||||
| { | { | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| return sfs.restrict( ds.getIncludedDirectories(), baseDir, destDir, | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| return scanner.restrict( ds.getIncludedDirectories(), baseDir, destDir, | |||||
| mapper ); | mapper ); | ||||
| } | } | ||||
| else | else | ||||
| @@ -336,8 +337,9 @@ public class ExecuteOn extends ExecTask | |||||
| { | { | ||||
| if( mapper != null ) | if( mapper != null ) | ||||
| { | { | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| return sfs.restrict( ds.getIncludedFiles(), baseDir, destDir, | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| return scanner.restrict( ds.getIncludedFiles(), baseDir, destDir, | |||||
| mapper ); | mapper ); | ||||
| } | } | ||||
| else | else | ||||
| @@ -346,10 +348,10 @@ public class ExecuteOn extends ExecTask | |||||
| } | } | ||||
| } | } | ||||
| protected void checkConfiguration() | |||||
| protected void validate() | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| super.checkConfiguration(); | |||||
| super.validate(); | |||||
| if( filesets.size() == 0 ) | if( filesets.size() == 0 ) | ||||
| { | { | ||||
| throw new TaskException( "no filesets specified" ); | throw new TaskException( "no filesets specified" ); | ||||
| @@ -305,7 +305,8 @@ public class Copy | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| final SourceFileScanner scanner = new SourceFileScanner( this ); | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| return scanner.restrict( names, fromDir, toDir, mapper ); | return scanner.restrict( names, fromDir, toDir, mapper ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -96,7 +96,7 @@ public class Javadoc | |||||
| public void setAdditionalparam( String add ) | public void setAdditionalparam( String add ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| m_command.createArgument().setLine( add ); | |||||
| m_command.addLine( add ); | |||||
| } | } | ||||
| public void setAuthor( boolean src ) | public void setAuthor( boolean src ) | ||||
| @@ -258,7 +258,7 @@ public class Cab | |||||
| if( m_options != null ) | if( m_options != null ) | ||||
| { | { | ||||
| cmd.createArgument().setLine( m_options ); | |||||
| cmd.addLine( m_options ); | |||||
| } | } | ||||
| cmd.addArgument( "n" ); | cmd.addArgument( "n" ); | ||||
| @@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| /** | /** | ||||
| * Basic task for apache stylebook. | * Basic task for apache stylebook. | ||||
| @@ -57,12 +58,12 @@ public class StyleBook | |||||
| { | { | ||||
| validate(); | validate(); | ||||
| createArg().setValue( "targetDirectory=" + m_targetDirectory ); | |||||
| createArg().setValue( m_book.toString() ); | |||||
| createArg().setValue( m_skinDirectory.toString() ); | |||||
| addArg( new Argument( "targetDirectory=" + m_targetDirectory ) ); | |||||
| addArg( new Argument( m_book.toString() ) ); | |||||
| addArg( new Argument( m_skinDirectory.toString() ) ); | |||||
| if( null != m_loaderConfig ) | if( null != m_loaderConfig ) | ||||
| { | { | ||||
| createArg().setValue( "loaderConfig=" + m_loaderConfig ); | |||||
| addArg( new Argument( "loaderConfig=" + m_loaderConfig ) ); | |||||
| } | } | ||||
| super.execute(); | super.execute(); | ||||
| @@ -13,6 +13,7 @@ import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | import org.apache.tools.ant.taskdefs.exec.Execute2; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| /** | /** | ||||
| * BorlandGenerateClient is dedicated to the Borland Application Server 4.5 This | * BorlandGenerateClient is dedicated to the Borland Application Server 4.5 This | ||||
| @@ -219,31 +220,32 @@ public class BorlandGenerateClient extends Task | |||||
| //execTask.addClasspath( classpath.concatSystemClasspath( "last" ) ); | //execTask.addClasspath( classpath.concatSystemClasspath( "last" ) ); | ||||
| execTask.setFork( true ); | execTask.setFork( true ); | ||||
| execTask.createArg().setValue( "generateclient" ); | |||||
| execTask.addArg( new Argument( "generateclient" ) ); | |||||
| if( debug ) | if( debug ) | ||||
| { | { | ||||
| execTask.createArg().setValue( "-trace" ); | |||||
| execTask.addArg( new Argument( "-trace" ) ); | |||||
| }// end of if () | }// end of if () | ||||
| // | // | ||||
| execTask.createArg().setValue( "-short" ); | |||||
| execTask.createArg().setValue( "-jarfile" ); | |||||
| execTask.addArg( new Argument( "-short" ) ); | |||||
| execTask.addArg( new Argument( "-jarfile" ) ); | |||||
| // ejb jar file | // ejb jar file | ||||
| execTask.createArg().setValue( ejbjarfile.getAbsolutePath() ); | |||||
| execTask.addArg( new Argument( ejbjarfile.getAbsolutePath() ) ); | |||||
| //client jar file | //client jar file | ||||
| execTask.createArg().setValue( "-single" ); | |||||
| execTask.createArg().setValue( "-clientjarfile" ); | |||||
| execTask.createArg().setValue( clientjarfile.getAbsolutePath() ); | |||||
| execTask.addArg( new Argument( "-single" ) ); | |||||
| execTask.addArg( new Argument( "-clientjarfile" ) ); | |||||
| execTask.addArg( new Argument( clientjarfile.getAbsolutePath() ) ); | |||||
| getLogger().debug( "Calling EJBUtilities" ); | getLogger().debug( "Calling EJBUtilities" ); | ||||
| execTask.execute(); | execTask.execute(); | ||||
| } | } | ||||
| catch( Exception e ) | |||||
| catch( final Exception e ) | |||||
| { | { | ||||
| // Have to catch this because of the semantics of calling main() | // Have to catch this because of the semantics of calling main() | ||||
| String msg = "Exception while calling generateclient Details: " + e.toString(); | |||||
| throw new TaskException( msg, e ); | |||||
| final String message = | |||||
| "Exception while calling generateclient Details: " + e.toString(); | |||||
| throw new TaskException( message, e ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -16,6 +16,7 @@ import org.apache.tools.ant.types.DirectoryScanner; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| /** | /** | ||||
| * Class to precompile JSP's using weblogic's jsp compiler (weblogic.jspc) | * Class to precompile JSP's using weblogic's jsp compiler (weblogic.jspc) | ||||
| @@ -230,7 +231,7 @@ public class WLJspc extends MatchingTask | |||||
| System.out.println( "arg = " + arg ); | System.out.println( "arg = " + arg ); | ||||
| //helperTask.clearArgs(); | //helperTask.clearArgs(); | ||||
| helperTask.createArg().setValue( arg ); | |||||
| helperTask.addArg( new Argument( arg ) ); | |||||
| helperTask.addClasspath( compileClasspath ); | helperTask.addClasspath( compileClasspath ); | ||||
| if( helperTask.executeJava() != 0 ) | if( helperTask.executeJava() != 0 ) | ||||
| { | { | ||||
| @@ -11,6 +11,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.taskdefs.optional.jsp.JspC; | import org.apache.tools.ant.taskdefs.optional.jsp.JspC; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| /** | /** | ||||
| * The implementation of the jasper compiler. This is a cut-and-paste of the | * The implementation of the jasper compiler. This is a cut-and-paste of the | ||||
| @@ -41,7 +42,7 @@ public class JasperC | |||||
| java.setClassname( "org.apache.jasper.JspC" ); | java.setClassname( "org.apache.jasper.JspC" ); | ||||
| String args[] = cmd.getArguments(); | String args[] = cmd.getArguments(); | ||||
| for( int i = 0; i < args.length; i++ ) | for( int i = 0; i < args.length; i++ ) | ||||
| java.createArg().setValue( args[ i ] ); | |||||
| java.addArg( new Argument( args[ i ] ) ); | |||||
| java.execute(); | java.execute(); | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -210,8 +210,8 @@ public abstract class AbstractMetamataTask | |||||
| ArrayList options = getOptions(); | ArrayList options = getOptions(); | ||||
| m_optionsFile = createTmpFile(); | m_optionsFile = createTmpFile(); | ||||
| generateOptionsFile( m_optionsFile, options ); | generateOptionsFile( m_optionsFile, options ); | ||||
| Argument args = m_cmdl.createArgument(); | |||||
| args.setLine( "-arguments " + m_optionsFile.getAbsolutePath() ); | |||||
| m_cmdl.addArgument( "-arguments " ); | |||||
| m_cmdl.addArgument( m_optionsFile.getAbsolutePath() ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -211,8 +211,8 @@ public class MParse | |||||
| String[] options = getOptions(); | String[] options = getOptions(); | ||||
| m_optionsFile = createTmpFile(); | m_optionsFile = createTmpFile(); | ||||
| generateOptionsFile( m_optionsFile, options ); | generateOptionsFile( m_optionsFile, options ); | ||||
| Argument args = m_cmdl.createArgument(); | |||||
| args.setLine( "-arguments " + m_optionsFile.getAbsolutePath() ); | |||||
| m_cmdl.addArgument( "-arguments" ); | |||||
| m_cmdl.addArgument( m_optionsFile.getAbsolutePath() ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -150,7 +150,7 @@ public abstract class P4Base | |||||
| { | { | ||||
| cmd.addArgument( m_p4Client ); | cmd.addArgument( m_p4Client ); | ||||
| } | } | ||||
| cmd.createArgument().setLine( command ); | |||||
| cmd.addLine( command ); | |||||
| String[] cmdline = cmd.getCommandline(); | String[] cmdline = cmd.getCommandline(); | ||||
| String cmdl = ""; | String cmdl = ""; | ||||
| @@ -113,7 +113,8 @@ public class Native2Ascii | |||||
| final DirectoryScanner scanner = getDirectoryScanner( m_srcDir ); | final DirectoryScanner scanner = getDirectoryScanner( m_srcDir ); | ||||
| String[] files = scanner.getIncludedFiles(); | String[] files = scanner.getIncludedFiles(); | ||||
| final SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| final SourceFileScanner sfs = new SourceFileScanner(); | |||||
| setupLogger( sfs ); | |||||
| final FileNameMapper mapper = buildMapper(); | final FileNameMapper mapper = buildMapper(); | ||||
| files = sfs.restrict( files, m_srcDir, m_destDir, mapper ); | files = sfs.restrict( files, m_srcDir, m_destDir, mapper ); | ||||
| int count = files.length; | int count = files.length; | ||||
| @@ -9,13 +9,14 @@ package org.apache.tools.ant.taskdefs.unix; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.aut.nativelib.Os; | import org.apache.aut.nativelib.Os; | ||||
| import org.apache.tools.ant.taskdefs.exec.ExecuteOn; | |||||
| import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.ExecuteOn; | |||||
| import org.apache.tools.ant.types.Argument; | |||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.types.PatternSet; | |||||
| import org.apache.tools.ant.types.NameEntry; | import org.apache.tools.ant.types.NameEntry; | ||||
| import org.apache.tools.ant.types.PatternSet; | |||||
| /** | /** | ||||
| * Chmod equivalent for unix-like environments. | * Chmod equivalent for unix-like environments. | ||||
| @@ -26,13 +27,12 @@ import org.apache.tools.ant.types.NameEntry; | |||||
| * mnowostawski@infoscience.otago.ac.nz</a> | * mnowostawski@infoscience.otago.ac.nz</a> | ||||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | ||||
| */ | */ | ||||
| public class Chmod extends ExecuteOn | |||||
| public class Chmod | |||||
| extends ExecuteOn | |||||
| { | { | ||||
| private FileSet defaultSet = new FileSet(); | |||||
| private boolean defaultSetDefined = false; | |||||
| private boolean havePerm = false; | |||||
| private FileSet m_defaultSet = new FileSet(); | |||||
| private boolean m_defaultSetDefined; | |||||
| private boolean m_havePerm; | |||||
| public Chmod() | public Chmod() | ||||
| throws TaskException | throws TaskException | ||||
| @@ -51,14 +51,14 @@ public class Chmod extends ExecuteOn | |||||
| public void setDefaultexcludes( boolean useDefaultExcludes ) | public void setDefaultexcludes( boolean useDefaultExcludes ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| defaultSet.setDefaultexcludes( useDefaultExcludes ); | |||||
| m_defaultSetDefined = true; | |||||
| m_defaultSet.setDefaultexcludes( useDefaultExcludes ); | |||||
| } | } | ||||
| public void setDir( File src ) | public void setDir( File src ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSet.setDir( src ); | |||||
| m_defaultSet.setDir( src ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -70,8 +70,8 @@ public class Chmod extends ExecuteOn | |||||
| public void setExcludes( String excludes ) | public void setExcludes( String excludes ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| defaultSet.setExcludes( excludes ); | |||||
| m_defaultSetDefined = true; | |||||
| m_defaultSet.setExcludes( excludes ); | |||||
| } | } | ||||
| public void setExecutable( String e ) | public void setExecutable( String e ) | ||||
| @@ -98,14 +98,14 @@ public class Chmod extends ExecuteOn | |||||
| public void setIncludes( String includes ) | public void setIncludes( String includes ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| defaultSet.setIncludes( includes ); | |||||
| m_defaultSetDefined = true; | |||||
| m_defaultSet.setIncludes( includes ); | |||||
| } | } | ||||
| public void setPerm( String perm ) | public void setPerm( String perm ) | ||||
| { | { | ||||
| createArg().setValue( perm ); | |||||
| havePerm = true; | |||||
| addArg( new Argument( perm ) ); | |||||
| m_havePerm = true; | |||||
| } | } | ||||
| public void setSkipEmptyFilesets( final boolean skip ) | public void setSkipEmptyFilesets( final boolean skip ) | ||||
| @@ -122,8 +122,8 @@ public class Chmod extends ExecuteOn | |||||
| public NameEntry createExclude() | public NameEntry createExclude() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| return defaultSet.createExclude(); | |||||
| m_defaultSetDefined = true; | |||||
| return m_defaultSet.createExclude(); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -134,8 +134,8 @@ public class Chmod extends ExecuteOn | |||||
| public NameEntry createInclude() | public NameEntry createInclude() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| return defaultSet.createInclude(); | |||||
| m_defaultSetDefined = true; | |||||
| return m_defaultSet.createInclude(); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -146,31 +146,31 @@ public class Chmod extends ExecuteOn | |||||
| public PatternSet createPatternSet() | public PatternSet createPatternSet() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| return defaultSet.createPatternSet(); | |||||
| m_defaultSetDefined = true; | |||||
| return m_defaultSet.createPatternSet(); | |||||
| } | } | ||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( defaultSetDefined || defaultSet.getDir() == null ) | |||||
| if( m_defaultSetDefined || m_defaultSet.getDir() == null ) | |||||
| { | { | ||||
| super.execute(); | super.execute(); | ||||
| } | } | ||||
| else if( isValidOs() ) | else if( isValidOs() ) | ||||
| { | { | ||||
| // we are chmodding the given directory | // we are chmodding the given directory | ||||
| createArg().setValue( defaultSet.getDir().getPath() ); | |||||
| addArg( new Argument( m_defaultSet.getDir().getPath() ) ); | |||||
| Execute execute = prepareExec(); | Execute execute = prepareExec(); | ||||
| try | try | ||||
| { | { | ||||
| execute.setCommandline( getCommand().getCommandline() ); | execute.setCommandline( getCommand().getCommandline() ); | ||||
| runExecute( execute ); | runExecute( execute ); | ||||
| } | } | ||||
| catch( IOException e ) | |||||
| catch( final IOException ioe ) | |||||
| { | { | ||||
| final String message = "Execute failed: " + e; | |||||
| throw new TaskException( message, e ); | |||||
| final String message = "Execute failed: " + ioe; | |||||
| throw new TaskException( message, ioe ); | |||||
| } | } | ||||
| finally | finally | ||||
| { | { | ||||
| @@ -185,18 +185,18 @@ public class Chmod extends ExecuteOn | |||||
| return Os.isFamily( "unix" ) && super.isValidOs(); | return Os.isFamily( "unix" ) && super.isValidOs(); | ||||
| } | } | ||||
| protected void checkConfiguration() | |||||
| protected void validate() | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( !havePerm ) | |||||
| if( !m_havePerm ) | |||||
| { | { | ||||
| throw new TaskException( "Required attribute perm not set in chmod" ); | throw new TaskException( "Required attribute perm not set in chmod" ); | ||||
| } | } | ||||
| if( defaultSetDefined && defaultSet.getDir() != null ) | |||||
| if( m_defaultSetDefined && m_defaultSet.getDir() != null ) | |||||
| { | { | ||||
| addFileset( defaultSet ); | |||||
| addFileset( m_defaultSet ); | |||||
| } | } | ||||
| super.checkConfiguration(); | |||||
| super.validate(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -124,7 +124,7 @@ public class Rpm | |||||
| cmd.addArgument( "_topdir" + m_topDir ); | cmd.addArgument( "_topdir" + m_topDir ); | ||||
| } | } | ||||
| cmd.createArgument().setLine( m_command ); | |||||
| cmd.addLine( m_command ); | |||||
| if( m_cleanBuildDir ) | if( m_cleanBuildDir ) | ||||
| { | { | ||||
| @@ -10,6 +10,7 @@ package org.apache.tools.ant.types; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.avalon.excalibur.util.StringUtil; | import org.apache.avalon.excalibur.util.StringUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| /** | /** | ||||
| * Commandline objects help handling command lines specifying processes to | * Commandline objects help handling command lines specifying processes to | ||||
| @@ -132,6 +133,14 @@ public class Commandline | |||||
| m_arguments.add( argument ); | m_arguments.add( argument ); | ||||
| } | } | ||||
| public void addLine( final String line ) | |||||
| throws TaskException | |||||
| { | |||||
| final Argument argument = new Argument(); | |||||
| argument.setLine( line ); | |||||
| addArgument( argument ); | |||||
| } | |||||
| /** | /** | ||||
| * Return a marker. <p> | * Return a marker. <p> | ||||
| * | * | ||||
| @@ -178,11 +178,6 @@ public class CommandlineJava | |||||
| m_sysProperties.addVariable( sysp ); | m_sysProperties.addVariable( sysp ); | ||||
| } | } | ||||
| public Argument createArgument() | |||||
| { | |||||
| return m_javaCommand.createArgument(); | |||||
| } | |||||
| public void addArgument( final String argument ) | public void addArgument( final String argument ) | ||||
| { | { | ||||
| m_javaCommand.addArgument( argument ); | m_javaCommand.addArgument( argument ); | ||||
| @@ -13,7 +13,6 @@ import org.apache.aut.nativelib.Os; | |||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.util.mappers.FileNameMapper; | import org.apache.tools.ant.util.mappers.FileNameMapper; | ||||
| /** | /** | ||||
| @@ -29,16 +28,6 @@ import org.apache.tools.ant.util.mappers.FileNameMapper; | |||||
| public class SourceFileScanner | public class SourceFileScanner | ||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| { | { | ||||
| private Task m_task; | |||||
| /** | |||||
| * @param task The task we should log messages through | |||||
| */ | |||||
| public SourceFileScanner( Task task ) | |||||
| { | |||||
| this.m_task = task; | |||||
| } | |||||
| /** | /** | ||||
| * Restrict the given set of files to those that are newer than their | * Restrict the given set of files to those that are newer than their | ||||
| * corresponding target files. | * corresponding target files. | ||||
| @@ -776,7 +776,8 @@ public class Javac extends MatchingTask | |||||
| GlobPatternMapper m = new GlobPatternMapper(); | GlobPatternMapper m = new GlobPatternMapper(); | ||||
| m.setFrom( "*.java" ); | m.setFrom( "*.java" ); | ||||
| m.setTo( "*.class" ); | m.setTo( "*.class" ); | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| SourceFileScanner sfs = new SourceFileScanner(); | |||||
| setupLogger( sfs ); | |||||
| File[] newFiles = sfs.restrictAsFiles( files, srcDir, destDir, m ); | File[] newFiles = sfs.restrictAsFiles( files, srcDir, destDir, m ); | ||||
| if( newFiles.length > 0 ) | if( newFiles.length > 0 ) | ||||
| @@ -67,7 +67,6 @@ public class Patch | |||||
| * @param file The new Patchfile value | * @param file The new Patchfile value | ||||
| */ | */ | ||||
| public void setPatchfile( final File patchFile ) | public void setPatchfile( final File patchFile ) | ||||
| throws TaskException | |||||
| { | { | ||||
| m_patchFile = patchFile; | m_patchFile = patchFile; | ||||
| } | } | ||||
| @@ -564,8 +564,9 @@ public class Rmic extends MatchingTask | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| newFiles = sfs.restrict( files, baseDir, baseDir, mapper ); | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| newFiles = scanner.restrict( files, baseDir, baseDir, mapper ); | |||||
| } | } | ||||
| for( int i = 0; i < newFiles.length; i++ ) | for( int i = 0; i < newFiles.length; i++ ) | ||||
| @@ -226,7 +226,8 @@ public class Tar | |||||
| private boolean archiveIsUpToDate( final String[] files ) | private boolean archiveIsUpToDate( final String[] files ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| final SourceFileScanner scanner = new SourceFileScanner( this ); | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| final MergingMapper mapper = new MergingMapper(); | final MergingMapper mapper = new MergingMapper(); | ||||
| mapper.setTo( tarFile.getAbsolutePath() ); | mapper.setTo( tarFile.getAbsolutePath() ); | ||||
| return scanner.restrict( files, baseDir, null, mapper ).length == 0; | return scanner.restrict( files, baseDir, null, mapper ).length == 0; | ||||
| @@ -161,7 +161,8 @@ public class UpToDate extends MatchingTask implements Condition | |||||
| protected boolean scanDir( File srcDir, String files[] ) | protected boolean scanDir( File srcDir, String files[] ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| FileNameMapper mapper = null; | FileNameMapper mapper = null; | ||||
| File dir = srcDir; | File dir = srcDir; | ||||
| if( mapperElement == null ) | if( mapperElement == null ) | ||||
| @@ -175,7 +176,7 @@ public class UpToDate extends MatchingTask implements Condition | |||||
| { | { | ||||
| mapper = mapperElement.getImplementation(); | mapper = mapperElement.getImplementation(); | ||||
| } | } | ||||
| return sfs.restrict( files, srcDir, dir, mapper ).length == 0; | |||||
| return scanner.restrict( files, srcDir, dir, mapper ).length == 0; | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -458,12 +458,13 @@ public class Zip | |||||
| if( !zipFile.exists() ) | if( !zipFile.exists() ) | ||||
| return false; | return false; | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| MergingMapper mm = new MergingMapper(); | MergingMapper mm = new MergingMapper(); | ||||
| mm.setTo( zipFile.getAbsolutePath() ); | mm.setTo( zipFile.getAbsolutePath() ); | ||||
| for( int i = 0; i < scanners.length; i++ ) | for( int i = 0; i < scanners.length; i++ ) | ||||
| { | { | ||||
| if( sfs.restrict( fileNames[ i ], scanners[ i ].getBasedir(), null, | |||||
| if( scanner.restrict( fileNames[ i ], scanners[ i ].getBasedir(), null, | |||||
| mm ).length > 0 ) | mm ).length > 0 ) | ||||
| { | { | ||||
| return false; | return false; | ||||
| @@ -176,7 +176,7 @@ public class ExecTask | |||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| checkConfiguration(); | |||||
| validate(); | |||||
| if( isValidOs() ) | if( isValidOs() ) | ||||
| { | { | ||||
| runExec( prepareExec() ); | runExec( prepareExec() ); | ||||
| @@ -250,7 +250,7 @@ public class ExecTask | |||||
| * | * | ||||
| * @exception TaskException Description of Exception | * @exception TaskException Description of Exception | ||||
| */ | */ | ||||
| protected void checkConfiguration() | |||||
| protected void validate() | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( m_command.getExecutable() == null ) | if( m_command.getExecutable() == null ) | ||||
| @@ -313,8 +313,9 @@ public class ExecuteOn extends ExecTask | |||||
| { | { | ||||
| if( mapper != null ) | if( mapper != null ) | ||||
| { | { | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| return sfs.restrict( ds.getIncludedDirectories(), baseDir, destDir, | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| return scanner.restrict( ds.getIncludedDirectories(), baseDir, destDir, | |||||
| mapper ); | mapper ); | ||||
| } | } | ||||
| else | else | ||||
| @@ -336,8 +337,9 @@ public class ExecuteOn extends ExecTask | |||||
| { | { | ||||
| if( mapper != null ) | if( mapper != null ) | ||||
| { | { | ||||
| SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| return sfs.restrict( ds.getIncludedFiles(), baseDir, destDir, | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| return scanner.restrict( ds.getIncludedFiles(), baseDir, destDir, | |||||
| mapper ); | mapper ); | ||||
| } | } | ||||
| else | else | ||||
| @@ -346,10 +348,10 @@ public class ExecuteOn extends ExecTask | |||||
| } | } | ||||
| } | } | ||||
| protected void checkConfiguration() | |||||
| protected void validate() | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| super.checkConfiguration(); | |||||
| super.validate(); | |||||
| if( filesets.size() == 0 ) | if( filesets.size() == 0 ) | ||||
| { | { | ||||
| throw new TaskException( "no filesets specified" ); | throw new TaskException( "no filesets specified" ); | ||||
| @@ -305,7 +305,8 @@ public class Copy | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| final SourceFileScanner scanner = new SourceFileScanner( this ); | |||||
| final SourceFileScanner scanner = new SourceFileScanner(); | |||||
| setupLogger( scanner ); | |||||
| return scanner.restrict( names, fromDir, toDir, mapper ); | return scanner.restrict( names, fromDir, toDir, mapper ); | ||||
| } | } | ||||
| } | } | ||||
| @@ -96,7 +96,7 @@ public class Javadoc | |||||
| public void setAdditionalparam( String add ) | public void setAdditionalparam( String add ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| m_command.createArgument().setLine( add ); | |||||
| m_command.addLine( add ); | |||||
| } | } | ||||
| public void setAuthor( boolean src ) | public void setAuthor( boolean src ) | ||||
| @@ -258,7 +258,7 @@ public class Cab | |||||
| if( m_options != null ) | if( m_options != null ) | ||||
| { | { | ||||
| cmd.createArgument().setLine( m_options ); | |||||
| cmd.addLine( m_options ); | |||||
| } | } | ||||
| cmd.addArgument( "n" ); | cmd.addArgument( "n" ); | ||||
| @@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs.optional; | |||||
| import java.io.File; | import java.io.File; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| /** | /** | ||||
| * Basic task for apache stylebook. | * Basic task for apache stylebook. | ||||
| @@ -57,12 +58,12 @@ public class StyleBook | |||||
| { | { | ||||
| validate(); | validate(); | ||||
| createArg().setValue( "targetDirectory=" + m_targetDirectory ); | |||||
| createArg().setValue( m_book.toString() ); | |||||
| createArg().setValue( m_skinDirectory.toString() ); | |||||
| addArg( new Argument( "targetDirectory=" + m_targetDirectory ) ); | |||||
| addArg( new Argument( m_book.toString() ) ); | |||||
| addArg( new Argument( m_skinDirectory.toString() ) ); | |||||
| if( null != m_loaderConfig ) | if( null != m_loaderConfig ) | ||||
| { | { | ||||
| createArg().setValue( "loaderConfig=" + m_loaderConfig ); | |||||
| addArg( new Argument( "loaderConfig=" + m_loaderConfig ) ); | |||||
| } | } | ||||
| super.execute(); | super.execute(); | ||||
| @@ -13,6 +13,7 @@ import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute2; | import org.apache.tools.ant.taskdefs.exec.Execute2; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| /** | /** | ||||
| * BorlandGenerateClient is dedicated to the Borland Application Server 4.5 This | * BorlandGenerateClient is dedicated to the Borland Application Server 4.5 This | ||||
| @@ -219,31 +220,32 @@ public class BorlandGenerateClient extends Task | |||||
| //execTask.addClasspath( classpath.concatSystemClasspath( "last" ) ); | //execTask.addClasspath( classpath.concatSystemClasspath( "last" ) ); | ||||
| execTask.setFork( true ); | execTask.setFork( true ); | ||||
| execTask.createArg().setValue( "generateclient" ); | |||||
| execTask.addArg( new Argument( "generateclient" ) ); | |||||
| if( debug ) | if( debug ) | ||||
| { | { | ||||
| execTask.createArg().setValue( "-trace" ); | |||||
| execTask.addArg( new Argument( "-trace" ) ); | |||||
| }// end of if () | }// end of if () | ||||
| // | // | ||||
| execTask.createArg().setValue( "-short" ); | |||||
| execTask.createArg().setValue( "-jarfile" ); | |||||
| execTask.addArg( new Argument( "-short" ) ); | |||||
| execTask.addArg( new Argument( "-jarfile" ) ); | |||||
| // ejb jar file | // ejb jar file | ||||
| execTask.createArg().setValue( ejbjarfile.getAbsolutePath() ); | |||||
| execTask.addArg( new Argument( ejbjarfile.getAbsolutePath() ) ); | |||||
| //client jar file | //client jar file | ||||
| execTask.createArg().setValue( "-single" ); | |||||
| execTask.createArg().setValue( "-clientjarfile" ); | |||||
| execTask.createArg().setValue( clientjarfile.getAbsolutePath() ); | |||||
| execTask.addArg( new Argument( "-single" ) ); | |||||
| execTask.addArg( new Argument( "-clientjarfile" ) ); | |||||
| execTask.addArg( new Argument( clientjarfile.getAbsolutePath() ) ); | |||||
| getLogger().debug( "Calling EJBUtilities" ); | getLogger().debug( "Calling EJBUtilities" ); | ||||
| execTask.execute(); | execTask.execute(); | ||||
| } | } | ||||
| catch( Exception e ) | |||||
| catch( final Exception e ) | |||||
| { | { | ||||
| // Have to catch this because of the semantics of calling main() | // Have to catch this because of the semantics of calling main() | ||||
| String msg = "Exception while calling generateclient Details: " + e.toString(); | |||||
| throw new TaskException( msg, e ); | |||||
| final String message = | |||||
| "Exception while calling generateclient Details: " + e.toString(); | |||||
| throw new TaskException( message, e ); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -16,6 +16,7 @@ import org.apache.tools.ant.types.DirectoryScanner; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.taskdefs.MatchingTask; | import org.apache.tools.ant.taskdefs.MatchingTask; | ||||
| import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| /** | /** | ||||
| * Class to precompile JSP's using weblogic's jsp compiler (weblogic.jspc) | * Class to precompile JSP's using weblogic's jsp compiler (weblogic.jspc) | ||||
| @@ -230,7 +231,7 @@ public class WLJspc extends MatchingTask | |||||
| System.out.println( "arg = " + arg ); | System.out.println( "arg = " + arg ); | ||||
| //helperTask.clearArgs(); | //helperTask.clearArgs(); | ||||
| helperTask.createArg().setValue( arg ); | |||||
| helperTask.addArg( new Argument( arg ) ); | |||||
| helperTask.addClasspath( compileClasspath ); | helperTask.addClasspath( compileClasspath ); | ||||
| if( helperTask.executeJava() != 0 ) | if( helperTask.executeJava() != 0 ) | ||||
| { | { | ||||
| @@ -11,6 +11,7 @@ import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.tools.ant.taskdefs.Java; | import org.apache.tools.ant.taskdefs.Java; | ||||
| import org.apache.tools.ant.taskdefs.optional.jsp.JspC; | import org.apache.tools.ant.taskdefs.optional.jsp.JspC; | ||||
| import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
| import org.apache.tools.ant.types.Argument; | |||||
| /** | /** | ||||
| * The implementation of the jasper compiler. This is a cut-and-paste of the | * The implementation of the jasper compiler. This is a cut-and-paste of the | ||||
| @@ -41,7 +42,7 @@ public class JasperC | |||||
| java.setClassname( "org.apache.jasper.JspC" ); | java.setClassname( "org.apache.jasper.JspC" ); | ||||
| String args[] = cmd.getArguments(); | String args[] = cmd.getArguments(); | ||||
| for( int i = 0; i < args.length; i++ ) | for( int i = 0; i < args.length; i++ ) | ||||
| java.createArg().setValue( args[ i ] ); | |||||
| java.addArg( new Argument( args[ i ] ) ); | |||||
| java.execute(); | java.execute(); | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -210,8 +210,8 @@ public abstract class AbstractMetamataTask | |||||
| ArrayList options = getOptions(); | ArrayList options = getOptions(); | ||||
| m_optionsFile = createTmpFile(); | m_optionsFile = createTmpFile(); | ||||
| generateOptionsFile( m_optionsFile, options ); | generateOptionsFile( m_optionsFile, options ); | ||||
| Argument args = m_cmdl.createArgument(); | |||||
| args.setLine( "-arguments " + m_optionsFile.getAbsolutePath() ); | |||||
| m_cmdl.addArgument( "-arguments " ); | |||||
| m_cmdl.addArgument( m_optionsFile.getAbsolutePath() ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -211,8 +211,8 @@ public class MParse | |||||
| String[] options = getOptions(); | String[] options = getOptions(); | ||||
| m_optionsFile = createTmpFile(); | m_optionsFile = createTmpFile(); | ||||
| generateOptionsFile( m_optionsFile, options ); | generateOptionsFile( m_optionsFile, options ); | ||||
| Argument args = m_cmdl.createArgument(); | |||||
| args.setLine( "-arguments " + m_optionsFile.getAbsolutePath() ); | |||||
| m_cmdl.addArgument( "-arguments" ); | |||||
| m_cmdl.addArgument( m_optionsFile.getAbsolutePath() ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -150,7 +150,7 @@ public abstract class P4Base | |||||
| { | { | ||||
| cmd.addArgument( m_p4Client ); | cmd.addArgument( m_p4Client ); | ||||
| } | } | ||||
| cmd.createArgument().setLine( command ); | |||||
| cmd.addLine( command ); | |||||
| String[] cmdline = cmd.getCommandline(); | String[] cmdline = cmd.getCommandline(); | ||||
| String cmdl = ""; | String cmdl = ""; | ||||
| @@ -113,7 +113,8 @@ public class Native2Ascii | |||||
| final DirectoryScanner scanner = getDirectoryScanner( m_srcDir ); | final DirectoryScanner scanner = getDirectoryScanner( m_srcDir ); | ||||
| String[] files = scanner.getIncludedFiles(); | String[] files = scanner.getIncludedFiles(); | ||||
| final SourceFileScanner sfs = new SourceFileScanner( this ); | |||||
| final SourceFileScanner sfs = new SourceFileScanner(); | |||||
| setupLogger( sfs ); | |||||
| final FileNameMapper mapper = buildMapper(); | final FileNameMapper mapper = buildMapper(); | ||||
| files = sfs.restrict( files, m_srcDir, m_destDir, mapper ); | files = sfs.restrict( files, m_srcDir, m_destDir, mapper ); | ||||
| int count = files.length; | int count = files.length; | ||||
| @@ -9,13 +9,14 @@ package org.apache.tools.ant.taskdefs.unix; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.aut.nativelib.Os; | import org.apache.aut.nativelib.Os; | ||||
| import org.apache.tools.ant.taskdefs.exec.ExecuteOn; | |||||
| import org.apache.myrmidon.api.TaskException; | |||||
| import org.apache.tools.ant.taskdefs.exec.Execute; | import org.apache.tools.ant.taskdefs.exec.Execute; | ||||
| import org.apache.tools.ant.taskdefs.exec.ExecuteOn; | |||||
| import org.apache.tools.ant.types.Argument; | |||||
| import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
| import org.apache.tools.ant.types.PatternSet; | |||||
| import org.apache.tools.ant.types.NameEntry; | import org.apache.tools.ant.types.NameEntry; | ||||
| import org.apache.tools.ant.types.PatternSet; | |||||
| /** | /** | ||||
| * Chmod equivalent for unix-like environments. | * Chmod equivalent for unix-like environments. | ||||
| @@ -26,13 +27,12 @@ import org.apache.tools.ant.types.NameEntry; | |||||
| * mnowostawski@infoscience.otago.ac.nz</a> | * mnowostawski@infoscience.otago.ac.nz</a> | ||||
| * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | ||||
| */ | */ | ||||
| public class Chmod extends ExecuteOn | |||||
| public class Chmod | |||||
| extends ExecuteOn | |||||
| { | { | ||||
| private FileSet defaultSet = new FileSet(); | |||||
| private boolean defaultSetDefined = false; | |||||
| private boolean havePerm = false; | |||||
| private FileSet m_defaultSet = new FileSet(); | |||||
| private boolean m_defaultSetDefined; | |||||
| private boolean m_havePerm; | |||||
| public Chmod() | public Chmod() | ||||
| throws TaskException | throws TaskException | ||||
| @@ -51,14 +51,14 @@ public class Chmod extends ExecuteOn | |||||
| public void setDefaultexcludes( boolean useDefaultExcludes ) | public void setDefaultexcludes( boolean useDefaultExcludes ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| defaultSet.setDefaultexcludes( useDefaultExcludes ); | |||||
| m_defaultSetDefined = true; | |||||
| m_defaultSet.setDefaultexcludes( useDefaultExcludes ); | |||||
| } | } | ||||
| public void setDir( File src ) | public void setDir( File src ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSet.setDir( src ); | |||||
| m_defaultSet.setDir( src ); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -70,8 +70,8 @@ public class Chmod extends ExecuteOn | |||||
| public void setExcludes( String excludes ) | public void setExcludes( String excludes ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| defaultSet.setExcludes( excludes ); | |||||
| m_defaultSetDefined = true; | |||||
| m_defaultSet.setExcludes( excludes ); | |||||
| } | } | ||||
| public void setExecutable( String e ) | public void setExecutable( String e ) | ||||
| @@ -98,14 +98,14 @@ public class Chmod extends ExecuteOn | |||||
| public void setIncludes( String includes ) | public void setIncludes( String includes ) | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| defaultSet.setIncludes( includes ); | |||||
| m_defaultSetDefined = true; | |||||
| m_defaultSet.setIncludes( includes ); | |||||
| } | } | ||||
| public void setPerm( String perm ) | public void setPerm( String perm ) | ||||
| { | { | ||||
| createArg().setValue( perm ); | |||||
| havePerm = true; | |||||
| addArg( new Argument( perm ) ); | |||||
| m_havePerm = true; | |||||
| } | } | ||||
| public void setSkipEmptyFilesets( final boolean skip ) | public void setSkipEmptyFilesets( final boolean skip ) | ||||
| @@ -122,8 +122,8 @@ public class Chmod extends ExecuteOn | |||||
| public NameEntry createExclude() | public NameEntry createExclude() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| return defaultSet.createExclude(); | |||||
| m_defaultSetDefined = true; | |||||
| return m_defaultSet.createExclude(); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -134,8 +134,8 @@ public class Chmod extends ExecuteOn | |||||
| public NameEntry createInclude() | public NameEntry createInclude() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| return defaultSet.createInclude(); | |||||
| m_defaultSetDefined = true; | |||||
| return m_defaultSet.createInclude(); | |||||
| } | } | ||||
| /** | /** | ||||
| @@ -146,31 +146,31 @@ public class Chmod extends ExecuteOn | |||||
| public PatternSet createPatternSet() | public PatternSet createPatternSet() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| defaultSetDefined = true; | |||||
| return defaultSet.createPatternSet(); | |||||
| m_defaultSetDefined = true; | |||||
| return m_defaultSet.createPatternSet(); | |||||
| } | } | ||||
| public void execute() | public void execute() | ||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( defaultSetDefined || defaultSet.getDir() == null ) | |||||
| if( m_defaultSetDefined || m_defaultSet.getDir() == null ) | |||||
| { | { | ||||
| super.execute(); | super.execute(); | ||||
| } | } | ||||
| else if( isValidOs() ) | else if( isValidOs() ) | ||||
| { | { | ||||
| // we are chmodding the given directory | // we are chmodding the given directory | ||||
| createArg().setValue( defaultSet.getDir().getPath() ); | |||||
| addArg( new Argument( m_defaultSet.getDir().getPath() ) ); | |||||
| Execute execute = prepareExec(); | Execute execute = prepareExec(); | ||||
| try | try | ||||
| { | { | ||||
| execute.setCommandline( getCommand().getCommandline() ); | execute.setCommandline( getCommand().getCommandline() ); | ||||
| runExecute( execute ); | runExecute( execute ); | ||||
| } | } | ||||
| catch( IOException e ) | |||||
| catch( final IOException ioe ) | |||||
| { | { | ||||
| final String message = "Execute failed: " + e; | |||||
| throw new TaskException( message, e ); | |||||
| final String message = "Execute failed: " + ioe; | |||||
| throw new TaskException( message, ioe ); | |||||
| } | } | ||||
| finally | finally | ||||
| { | { | ||||
| @@ -185,18 +185,18 @@ public class Chmod extends ExecuteOn | |||||
| return Os.isFamily( "unix" ) && super.isValidOs(); | return Os.isFamily( "unix" ) && super.isValidOs(); | ||||
| } | } | ||||
| protected void checkConfiguration() | |||||
| protected void validate() | |||||
| throws TaskException | throws TaskException | ||||
| { | { | ||||
| if( !havePerm ) | |||||
| if( !m_havePerm ) | |||||
| { | { | ||||
| throw new TaskException( "Required attribute perm not set in chmod" ); | throw new TaskException( "Required attribute perm not set in chmod" ); | ||||
| } | } | ||||
| if( defaultSetDefined && defaultSet.getDir() != null ) | |||||
| if( m_defaultSetDefined && m_defaultSet.getDir() != null ) | |||||
| { | { | ||||
| addFileset( defaultSet ); | |||||
| addFileset( m_defaultSet ); | |||||
| } | } | ||||
| super.checkConfiguration(); | |||||
| super.validate(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -124,7 +124,7 @@ public class Rpm | |||||
| cmd.addArgument( "_topdir" + m_topDir ); | cmd.addArgument( "_topdir" + m_topDir ); | ||||
| } | } | ||||
| cmd.createArgument().setLine( m_command ); | |||||
| cmd.addLine( m_command ); | |||||
| if( m_cleanBuildDir ) | if( m_cleanBuildDir ) | ||||
| { | { | ||||
| @@ -10,6 +10,7 @@ package org.apache.tools.ant.types; | |||||
| import java.io.File; | import java.io.File; | ||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||
| import org.apache.avalon.excalibur.util.StringUtil; | import org.apache.avalon.excalibur.util.StringUtil; | ||||
| import org.apache.myrmidon.api.TaskException; | |||||
| /** | /** | ||||
| * Commandline objects help handling command lines specifying processes to | * Commandline objects help handling command lines specifying processes to | ||||
| @@ -132,6 +133,14 @@ public class Commandline | |||||
| m_arguments.add( argument ); | m_arguments.add( argument ); | ||||
| } | } | ||||
| public void addLine( final String line ) | |||||
| throws TaskException | |||||
| { | |||||
| final Argument argument = new Argument(); | |||||
| argument.setLine( line ); | |||||
| addArgument( argument ); | |||||
| } | |||||
| /** | /** | ||||
| * Return a marker. <p> | * Return a marker. <p> | ||||
| * | * | ||||
| @@ -178,11 +178,6 @@ public class CommandlineJava | |||||
| m_sysProperties.addVariable( sysp ); | m_sysProperties.addVariable( sysp ); | ||||
| } | } | ||||
| public Argument createArgument() | |||||
| { | |||||
| return m_javaCommand.createArgument(); | |||||
| } | |||||
| public void addArgument( final String argument ) | public void addArgument( final String argument ) | ||||
| { | { | ||||
| m_javaCommand.addArgument( argument ); | m_javaCommand.addArgument( argument ); | ||||
| @@ -13,7 +13,6 @@ import org.apache.aut.nativelib.Os; | |||||
| import org.apache.avalon.excalibur.io.FileUtil; | import org.apache.avalon.excalibur.io.FileUtil; | ||||
| import org.apache.avalon.framework.logger.AbstractLogEnabled; | import org.apache.avalon.framework.logger.AbstractLogEnabled; | ||||
| import org.apache.myrmidon.api.TaskException; | import org.apache.myrmidon.api.TaskException; | ||||
| import org.apache.tools.ant.Task; | |||||
| import org.apache.tools.ant.util.mappers.FileNameMapper; | import org.apache.tools.ant.util.mappers.FileNameMapper; | ||||
| /** | /** | ||||
| @@ -29,16 +28,6 @@ import org.apache.tools.ant.util.mappers.FileNameMapper; | |||||
| public class SourceFileScanner | public class SourceFileScanner | ||||
| extends AbstractLogEnabled | extends AbstractLogEnabled | ||||
| { | { | ||||
| private Task m_task; | |||||
| /** | |||||
| * @param task The task we should log messages through | |||||
| */ | |||||
| public SourceFileScanner( Task task ) | |||||
| { | |||||
| this.m_task = task; | |||||
| } | |||||
| /** | /** | ||||
| * Restrict the given set of files to those that are newer than their | * Restrict the given set of files to those that are newer than their | ||||
| * corresponding target files. | * corresponding target files. | ||||