git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274134 13f79535-47bb-0310-9956-ffa450edef68master
@@ -58,7 +58,7 @@ filenames contain non US-ASCII characters. Use the encoding attribute | |||||
and set it to UTF8 to create zip files that can safely be read by | and set it to UTF8 to create zip files that can safely be read by | ||||
Java.</p> | Java.</p> | ||||
<p>Starting with Ant 1.6, <zip> can store Unix permissions | |||||
<p>Starting with Ant 1.5.2, <zip> can store Unix permissions | |||||
inside the archive (see description of the filemode and dirmode | inside the archive (see description of the filemode and dirmode | ||||
attributes for <a href="#zipfileset"><zipfileset></a>). | attributes for <a href="#zipfileset"><zipfileset></a>). | ||||
Unfortunately there is no portable way to store these permissions. | Unfortunately there is no portable way to store these permissions. | ||||
@@ -196,14 +196,14 @@ those listed below.</p> | |||||
<td valign="top">filemode</td> | <td valign="top">filemode</td> | ||||
<td valign="top">A 3 digit octal string, specify the user, group | <td valign="top">A 3 digit octal string, specify the user, group | ||||
and other modes in the standard Unix fashion. Only applies to | and other modes in the standard Unix fashion. Only applies to | ||||
plain files. Default is 644. <em>since Ant 1.6</em>.</td> | |||||
plain files. Default is 644. <em>since Ant 1.5.2</em>.</td> | |||||
<td align="center" valign="top">No</td> | <td align="center" valign="top">No</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
<td valign="top">dirmode</td> | <td valign="top">dirmode</td> | ||||
<td valign="top">A 3 digit octal string, specify the user, group | <td valign="top">A 3 digit octal string, specify the user, group | ||||
and other modes in the standard Unix fashion. Only applies to | and other modes in the standard Unix fashion. Only applies to | ||||
directories. Default is 755. <em>since Ant 1.6</em>.</td> | |||||
directories. Default is 755. <em>since Ant 1.5.2</em>.</td> | |||||
<td align="center" valign="top">No</td> | <td align="center" valign="top">No</td> | ||||
</tr> | </tr> | ||||
</table> | </table> | ||||
@@ -216,7 +216,6 @@ public class Execute { | |||||
private static String[] getProcEnvCommand() { | private static String[] getProcEnvCommand() { | ||||
if (Os.isFamily("os/2")) { | if (Os.isFamily("os/2")) { | ||||
// OS/2 - use same mechanism as Windows 2000 | // OS/2 - use same mechanism as Windows 2000 | ||||
// Not sure | |||||
String[] cmd = {"cmd", "/c", "set" }; | String[] cmd = {"cmd", "/c", "set" }; | ||||
return cmd; | return cmd; | ||||
} else if (Os.isFamily("windows")) { | } else if (Os.isFamily("windows")) { | ||||
@@ -84,7 +84,7 @@ import org.apache.tools.ant.util.FileUtils; | |||||
import org.apache.tools.ant.util.GlobPatternMapper; | import org.apache.tools.ant.util.GlobPatternMapper; | ||||
import org.apache.tools.ant.util.IdentityMapper; | import org.apache.tools.ant.util.IdentityMapper; | ||||
import org.apache.tools.ant.util.MergingMapper; | import org.apache.tools.ant.util.MergingMapper; | ||||
import org.apache.tools.ant.util.SourceSelector; | |||||
import org.apache.tools.ant.util.ResourceUtils; | |||||
import org.apache.tools.zip.ZipEntry; | import org.apache.tools.zip.ZipEntry; | ||||
import org.apache.tools.zip.ZipOutputStream; | import org.apache.tools.zip.ZipOutputStream; | ||||
@@ -521,7 +521,7 @@ public class Zip extends MatchingTask { | |||||
* @param resources the resources to add | * @param resources the resources to add | ||||
* @param zOut the stream to write to | * @param zOut the stream to write to | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
protected final void addResources(FileSet fileset, Resource[] resources, | protected final void addResources(FileSet fileset, Resource[] resources, | ||||
ZipOutputStream zOut) | ZipOutputStream zOut) | ||||
@@ -660,7 +660,7 @@ public class Zip extends MatchingTask { | |||||
} | } | ||||
/** | /** | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
private synchronized ZipScanner getZipScanner() { | private synchronized ZipScanner getZipScanner() { | ||||
if (zs == null) { | if (zs == null) { | ||||
@@ -778,10 +778,10 @@ public class Zip extends MatchingTask { | |||||
} | } | ||||
} | } | ||||
newerResources[i] = | newerResources[i] = | ||||
SourceSelector.selectOutOfDateSources(this, | |||||
initialResources[i], | |||||
myMapper, | |||||
getZipScanner()); | |||||
ResourceUtils.selectOutOfDateSources(this, | |||||
initialResources[i], | |||||
myMapper, | |||||
getZipScanner()); | |||||
needsUpdate = needsUpdate || (newerResources[i].length > 0); | needsUpdate = needsUpdate || (newerResources[i].length > 0); | ||||
if (needsUpdate && !doUpdate) { | if (needsUpdate && !doUpdate) { | ||||
@@ -804,7 +804,7 @@ public class Zip extends MatchingTask { | |||||
* | * | ||||
* <p>Included directories will preceede included files.</p> | * <p>Included directories will preceede included files.</p> | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
protected Resource[][] grabResources(FileSet[] filesets) { | protected Resource[][] grabResources(FileSet[] filesets) { | ||||
Resource[][] result = new Resource[filesets.length][]; | Resource[][] result = new Resource[filesets.length][]; | ||||
@@ -828,7 +828,7 @@ public class Zip extends MatchingTask { | |||||
} | } | ||||
/** | /** | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
protected void zipDir(File dir, ZipOutputStream zOut, String vPath, | protected void zipDir(File dir, ZipOutputStream zOut, String vPath, | ||||
int mode) | int mode) | ||||
@@ -872,7 +872,7 @@ public class Zip extends MatchingTask { | |||||
* entry from, will be null if we are not copying from an archive. | * entry from, will be null if we are not copying from an archive. | ||||
* @param mode the Unix permissions to set. | * @param mode the Unix permissions to set. | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath, | protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath, | ||||
long lastModified, File fromArchive, int mode) | long lastModified, File fromArchive, int mode) | ||||
@@ -969,7 +969,7 @@ public class Zip extends MatchingTask { | |||||
* @param vPath the name this entry shall have in the archive | * @param vPath the name this entry shall have in the archive | ||||
* @param mode the Unix permissions to set. | * @param mode the Unix permissions to set. | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
protected void zipFile(File file, ZipOutputStream zOut, String vPath, | protected void zipFile(File file, ZipOutputStream zOut, String vPath, | ||||
int mode) | int mode) | ||||
@@ -991,7 +991,7 @@ public class Zip extends MatchingTask { | |||||
/** | /** | ||||
* Ensure all parent dirs of a given entry have been added. | * Ensure all parent dirs of a given entry have been added. | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
protected final void addParentDirs(File baseDir, String entry, | protected final void addParentDirs(File baseDir, String entry, | ||||
ZipOutputStream zOut, String prefix, | ZipOutputStream zOut, String prefix, | ||||
@@ -1075,7 +1075,7 @@ public class Zip extends MatchingTask { | |||||
/** | /** | ||||
* @return true if all individual arrays are empty | * @return true if all individual arrays are empty | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
protected final static boolean isEmpty(Resource[][] r) { | protected final static boolean isEmpty(Resource[][] r) { | ||||
for (int i = 0; i < r.length; i++) { | for (int i = 0; i < r.length; i++) { | ||||
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* | * | ||||
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights | |||||
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights | |||||
* reserved. | * reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
@@ -83,7 +83,7 @@ public class ZipFileSet extends FileSet { | |||||
/** | /** | ||||
* Default value for the dirmode attribute. | * Default value for the dirmode attribute. | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
public static final int DEFAULT_DIR_MODE = | public static final int DEFAULT_DIR_MODE = | ||||
UnixStat.DIR_FLAG | UnixStat.DEFAULT_DIR_PERM; | UnixStat.DIR_FLAG | UnixStat.DEFAULT_DIR_PERM; | ||||
@@ -91,7 +91,7 @@ public class ZipFileSet extends FileSet { | |||||
/** | /** | ||||
* Default value for the filemode attribute. | * Default value for the filemode attribute. | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
public static final int DEFAULT_FILE_MODE = | public static final int DEFAULT_FILE_MODE = | ||||
UnixStat.FILE_FLAG | UnixStat.DEFAULT_FILE_PERM; | UnixStat.FILE_FLAG | UnixStat.DEFAULT_FILE_PERM; | ||||
@@ -216,7 +216,7 @@ public class ZipFileSet extends FileSet { | |||||
* other modes in the standard Unix fashion; | * other modes in the standard Unix fashion; | ||||
* optional, default=0644 | * optional, default=0644 | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
public void setFileMode(String octalString) { | public void setFileMode(String octalString) { | ||||
this.fileMode = | this.fileMode = | ||||
@@ -224,7 +224,7 @@ public class ZipFileSet extends FileSet { | |||||
} | } | ||||
/** | /** | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
public int getFileMode() { | public int getFileMode() { | ||||
return fileMode; | return fileMode; | ||||
@@ -68,7 +68,7 @@ import java.util.Vector; | |||||
* @author <a href="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</a> | * @author <a href="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</a> | ||||
* @since Ant 1.5.2 | * @since Ant 1.5.2 | ||||
*/ | */ | ||||
public class SourceSelector { | |||||
public class ResourceUtils { | |||||
/** { | /** { | ||||
* tells which source files should be reprocessed based on the | * tells which source files should be reprocessed based on the |
@@ -115,8 +115,8 @@ public class SourceFileScanner implements ResourceFactory { | |||||
// build the list of sources which are out of date with | // build the list of sources which are out of date with | ||||
// respect to the target | // respect to the target | ||||
Resource[] outofdate = | Resource[] outofdate = | ||||
SourceSelector.selectOutOfDateSources(task, sourceresources, | |||||
mapper, this); | |||||
ResourceUtils.selectOutOfDateSources(task, sourceresources, | |||||
mapper, this); | |||||
String[] result = new String[outofdate.length]; | String[] result = new String[outofdate.length]; | ||||
for (int counter=0; counter < outofdate.length; counter++) { | for (int counter=0; counter < outofdate.length; counter++) { | ||||
result[counter] = outofdate[counter].getName(); | result[counter] = outofdate[counter].getName(); | ||||
@@ -1,7 +1,7 @@ | |||||
/* | /* | ||||
* The Apache Software License, Version 1.1 | * The Apache Software License, Version 1.1 | ||||
* | * | ||||
* Copyright (c) 2001-2002 The Apache Software Foundation. All rights | |||||
* Copyright (c) 2001-2003 The Apache Software Foundation. All rights | |||||
* reserved. | * reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
@@ -194,7 +194,7 @@ public class ZipEntry extends java.util.zip.ZipEntry { | |||||
* Sets Unix permissions in a way that is understood by Info-Zip's | * Sets Unix permissions in a way that is understood by Info-Zip's | ||||
* unzip command. | * unzip command. | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
public void setUnixMode(int mode) { | public void setUnixMode(int mode) { | ||||
setExternalAttributes((mode << 16) | setExternalAttributes((mode << 16) | ||||
@@ -212,7 +212,7 @@ public class ZipEntry extends java.util.zip.ZipEntry { | |||||
* @return 0 (MS-DOS FAT) unless {@link #setUnixMode setUnixMode} | * @return 0 (MS-DOS FAT) unless {@link #setUnixMode setUnixMode} | ||||
* has been called, in which case 3 (Unix) will be returned. | * has been called, in which case 3 (Unix) will be returned. | ||||
* | * | ||||
* @since Ant 1.6 | |||||
* @since Ant 1.5.2 | |||||
*/ | */ | ||||
public int getPlatform() { | public int getPlatform() { | ||||
return platform; | return platform; | ||||
@@ -64,14 +64,14 @@ import java.io.File; | |||||
import junit.framework.TestCase; | import junit.framework.TestCase; | ||||
/** | /** | ||||
* Tests for org.apache.tools.ant.util.SourceSelector. | |||||
* Tests for org.apache.tools.ant.util.ResourceUtils. | |||||
*/ | */ | ||||
public class SourceSelectorTest extends TestCase | |||||
public class ResourceUtilsTest extends TestCase | |||||
implements ResourceFactory, FileNameMapper { | implements ResourceFactory, FileNameMapper { | ||||
private Echo taskINeedForLogging = new Echo(); | private Echo taskINeedForLogging = new Echo(); | ||||
public SourceSelectorTest(String name) { | |||||
public ResourceUtilsTest(String name) { | |||||
super(name); | super(name); | ||||
taskINeedForLogging.setProject(new Project()); | taskINeedForLogging.setProject(new Project()); | ||||
} | } | ||||
@@ -79,9 +79,9 @@ public class SourceSelectorTest extends TestCase | |||||
public void testNoDuplicates() { | public void testNoDuplicates() { | ||||
Resource r = new Resource("samual vimes", true, 1, false); | Resource r = new Resource("samual vimes", true, 1, false); | ||||
Resource[] toNew = | Resource[] toNew = | ||||
SourceSelector.selectOutOfDateSources(taskINeedForLogging, | |||||
new Resource[] {r}, | |||||
this, this); | |||||
ResourceUtils.selectOutOfDateSources(taskINeedForLogging, | |||||
new Resource[] {r}, | |||||
this, this); | |||||
assertEquals(1, toNew.length); | assertEquals(1, toNew.length); | ||||
} | } | ||||