git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270940 13f79535-47bb-0310-9956-ffa450edef68master
@@ -18,6 +18,7 @@ import org.apache.aut.tar.TarOutputStream; | |||
import org.apache.avalon.excalibur.io.IOUtil; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.SourceFileScanner; | |||
import org.apache.tools.ant.types.ScannerUtil; | |||
import org.apache.tools.ant.util.mappers.MergingMapper; | |||
/** | |||
@@ -140,7 +141,7 @@ public class Tar | |||
for( Iterator e = filesets.iterator(); e.hasNext(); ) | |||
{ | |||
TarFileSet fs = (TarFileSet)e.next(); | |||
String[] files = fs.getFiles(); | |||
String[] files = ScannerUtil.getFiles( fs ); | |||
if( !archiveIsUpToDate( files ) ) | |||
{ | |||
@@ -188,7 +189,7 @@ public class Tar | |||
for( Iterator e = filesets.iterator(); e.hasNext(); ) | |||
{ | |||
TarFileSet fs = (TarFileSet)e.next(); | |||
String[] files = fs.getFiles(); | |||
String[] files = ScannerUtil.getFiles( fs ); | |||
for( int i = 0; i < files.length; i++ ) | |||
{ | |||
File f = new File( fs.getDir(), files[ i ] ); | |||
@@ -8,16 +8,11 @@ | |||
package org.apache.tools.ant.taskdefs; | |||
import org.apache.tools.ant.types.FileSet; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.ScannerUtil; | |||
import org.apache.myrmidon.api.TaskException; | |||
public class TarFileSet | |||
extends FileSet | |||
{ | |||
private String[] m_files; | |||
private int m_mode = 0100644; | |||
private String m_userName = ""; | |||
private String m_groupName = ""; | |||
@@ -36,29 +31,6 @@ public class TarFileSet | |||
m_userName = userName; | |||
} | |||
/** | |||
* Get a list of files and directories specified in the fileset. | |||
* | |||
* @return a list of file and directory names, relative to the baseDir | |||
* for the project. | |||
*/ | |||
protected String[] getFiles() | |||
throws TaskException | |||
{ | |||
if( m_files == null ) | |||
{ | |||
final DirectoryScanner scanner = ScannerUtil.getDirectoryScanner( this ); | |||
final String[] directories = scanner.getIncludedDirectories(); | |||
final String[] filesPerSe = scanner.getIncludedFiles(); | |||
m_files = new String[ directories.length + filesPerSe.length ]; | |||
System.arraycopy( directories, 0, m_files, 0, directories.length ); | |||
System.arraycopy( filesPerSe, 0, m_files, directories.length, | |||
filesPerSe.length ); | |||
} | |||
return m_files; | |||
} | |||
protected String getGroup() | |||
{ | |||
return m_groupName; | |||
@@ -14,6 +14,7 @@ import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.framework.PatternUtil; | |||
import org.apache.myrmidon.framework.PatternSet; | |||
import org.apache.tools.ant.taskdefs.TarFileSet; | |||
/** | |||
* | |||
@@ -607,4 +608,23 @@ public class ScannerUtil | |||
return getDirectoryScanner( set ); | |||
} | |||
} | |||
/** | |||
* Get a list of files and directories specified in the fileset. | |||
* | |||
* @return a list of file and directory names, relative to the baseDir | |||
* for the project. | |||
*/ | |||
public static String[] getFiles( final TarFileSet set ) | |||
throws TaskException | |||
{ | |||
final DirectoryScanner scanner = getDirectoryScanner( set ); | |||
final String[] directories = scanner.getIncludedDirectories(); | |||
final String[] filesPerSe = scanner.getIncludedFiles(); | |||
final String[] files = new String[ directories.length + filesPerSe.length ]; | |||
System.arraycopy( directories, 0, files, 0, directories.length ); | |||
System.arraycopy( filesPerSe, 0, files, directories.length, | |||
filesPerSe.length ); | |||
return files; | |||
} | |||
} |
@@ -18,6 +18,7 @@ import org.apache.aut.tar.TarOutputStream; | |||
import org.apache.avalon.excalibur.io.IOUtil; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.tools.ant.types.SourceFileScanner; | |||
import org.apache.tools.ant.types.ScannerUtil; | |||
import org.apache.tools.ant.util.mappers.MergingMapper; | |||
/** | |||
@@ -140,7 +141,7 @@ public class Tar | |||
for( Iterator e = filesets.iterator(); e.hasNext(); ) | |||
{ | |||
TarFileSet fs = (TarFileSet)e.next(); | |||
String[] files = fs.getFiles(); | |||
String[] files = ScannerUtil.getFiles( fs ); | |||
if( !archiveIsUpToDate( files ) ) | |||
{ | |||
@@ -188,7 +189,7 @@ public class Tar | |||
for( Iterator e = filesets.iterator(); e.hasNext(); ) | |||
{ | |||
TarFileSet fs = (TarFileSet)e.next(); | |||
String[] files = fs.getFiles(); | |||
String[] files = ScannerUtil.getFiles( fs ); | |||
for( int i = 0; i < files.length; i++ ) | |||
{ | |||
File f = new File( fs.getDir(), files[ i ] ); | |||
@@ -8,16 +8,11 @@ | |||
package org.apache.tools.ant.taskdefs; | |||
import org.apache.tools.ant.types.FileSet; | |||
import org.apache.tools.ant.types.DirectoryScanner; | |||
import org.apache.tools.ant.types.ScannerUtil; | |||
import org.apache.myrmidon.api.TaskException; | |||
public class TarFileSet | |||
extends FileSet | |||
{ | |||
private String[] m_files; | |||
private int m_mode = 0100644; | |||
private String m_userName = ""; | |||
private String m_groupName = ""; | |||
@@ -36,29 +31,6 @@ public class TarFileSet | |||
m_userName = userName; | |||
} | |||
/** | |||
* Get a list of files and directories specified in the fileset. | |||
* | |||
* @return a list of file and directory names, relative to the baseDir | |||
* for the project. | |||
*/ | |||
protected String[] getFiles() | |||
throws TaskException | |||
{ | |||
if( m_files == null ) | |||
{ | |||
final DirectoryScanner scanner = ScannerUtil.getDirectoryScanner( this ); | |||
final String[] directories = scanner.getIncludedDirectories(); | |||
final String[] filesPerSe = scanner.getIncludedFiles(); | |||
m_files = new String[ directories.length + filesPerSe.length ]; | |||
System.arraycopy( directories, 0, m_files, 0, directories.length ); | |||
System.arraycopy( filesPerSe, 0, m_files, directories.length, | |||
filesPerSe.length ); | |||
} | |||
return m_files; | |||
} | |||
protected String getGroup() | |||
{ | |||
return m_groupName; | |||
@@ -14,6 +14,7 @@ import org.apache.myrmidon.api.TaskContext; | |||
import org.apache.myrmidon.api.TaskException; | |||
import org.apache.myrmidon.framework.PatternUtil; | |||
import org.apache.myrmidon.framework.PatternSet; | |||
import org.apache.tools.ant.taskdefs.TarFileSet; | |||
/** | |||
* | |||
@@ -607,4 +608,23 @@ public class ScannerUtil | |||
return getDirectoryScanner( set ); | |||
} | |||
} | |||
/** | |||
* Get a list of files and directories specified in the fileset. | |||
* | |||
* @return a list of file and directory names, relative to the baseDir | |||
* for the project. | |||
*/ | |||
public static String[] getFiles( final TarFileSet set ) | |||
throws TaskException | |||
{ | |||
final DirectoryScanner scanner = getDirectoryScanner( set ); | |||
final String[] directories = scanner.getIncludedDirectories(); | |||
final String[] filesPerSe = scanner.getIncludedFiles(); | |||
final String[] files = new String[ directories.length + filesPerSe.length ]; | |||
System.arraycopy( directories, 0, files, 0, directories.length ); | |||
System.arraycopy( filesPerSe, 0, files, directories.length, | |||
filesPerSe.length ); | |||
return files; | |||
} | |||
} |