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 | |||
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 | |||
attributes for <a href="#zipfileset"><zipfileset></a>). | |||
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">A 3 digit octal string, specify the user, group | |||
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> | |||
</tr> | |||
<tr> | |||
<td valign="top">dirmode</td> | |||
<td valign="top">A 3 digit octal string, specify the user, group | |||
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> | |||
</tr> | |||
</table> | |||
@@ -216,7 +216,6 @@ public class Execute { | |||
private static String[] getProcEnvCommand() { | |||
if (Os.isFamily("os/2")) { | |||
// OS/2 - use same mechanism as Windows 2000 | |||
// Not sure | |||
String[] cmd = {"cmd", "/c", "set" }; | |||
return cmd; | |||
} 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.IdentityMapper; | |||
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.ZipOutputStream; | |||
@@ -521,7 +521,7 @@ public class Zip extends MatchingTask { | |||
* @param resources the resources to add | |||
* @param zOut the stream to write to | |||
* | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
protected final void addResources(FileSet fileset, Resource[] resources, | |||
ZipOutputStream zOut) | |||
@@ -660,7 +660,7 @@ public class Zip extends MatchingTask { | |||
} | |||
/** | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
private synchronized ZipScanner getZipScanner() { | |||
if (zs == null) { | |||
@@ -778,10 +778,10 @@ public class Zip extends MatchingTask { | |||
} | |||
} | |||
newerResources[i] = | |||
SourceSelector.selectOutOfDateSources(this, | |||
initialResources[i], | |||
myMapper, | |||
getZipScanner()); | |||
ResourceUtils.selectOutOfDateSources(this, | |||
initialResources[i], | |||
myMapper, | |||
getZipScanner()); | |||
needsUpdate = needsUpdate || (newerResources[i].length > 0); | |||
if (needsUpdate && !doUpdate) { | |||
@@ -804,7 +804,7 @@ public class Zip extends MatchingTask { | |||
* | |||
* <p>Included directories will preceede included files.</p> | |||
* | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
protected Resource[][] grabResources(FileSet[] filesets) { | |||
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, | |||
int mode) | |||
@@ -872,7 +872,7 @@ public class Zip extends MatchingTask { | |||
* entry from, will be null if we are not copying from an archive. | |||
* @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, | |||
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 mode the Unix permissions to set. | |||
* | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
protected void zipFile(File file, ZipOutputStream zOut, String vPath, | |||
int mode) | |||
@@ -991,7 +991,7 @@ public class Zip extends MatchingTask { | |||
/** | |||
* 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, | |||
ZipOutputStream zOut, String prefix, | |||
@@ -1075,7 +1075,7 @@ public class Zip extends MatchingTask { | |||
/** | |||
* @return true if all individual arrays are empty | |||
* | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
protected final static boolean isEmpty(Resource[][] r) { | |||
for (int i = 0; i < r.length; i++) { | |||
@@ -1,7 +1,7 @@ | |||
/* | |||
* 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. | |||
* | |||
* 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. | |||
* | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
public static final int DEFAULT_DIR_MODE = | |||
UnixStat.DIR_FLAG | UnixStat.DEFAULT_DIR_PERM; | |||
@@ -91,7 +91,7 @@ public class ZipFileSet extends FileSet { | |||
/** | |||
* Default value for the filemode attribute. | |||
* | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
public static final int DEFAULT_FILE_MODE = | |||
UnixStat.FILE_FLAG | UnixStat.DEFAULT_FILE_PERM; | |||
@@ -216,7 +216,7 @@ public class ZipFileSet extends FileSet { | |||
* other modes in the standard Unix fashion; | |||
* optional, default=0644 | |||
* | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
public void setFileMode(String octalString) { | |||
this.fileMode = | |||
@@ -224,7 +224,7 @@ public class ZipFileSet extends FileSet { | |||
} | |||
/** | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
public int getFileMode() { | |||
return fileMode; | |||
@@ -68,7 +68,7 @@ import java.util.Vector; | |||
* @author <a href="mailto:levylambert@tiscali-dsl.de">Antoine Levy-Lambert</a> | |||
* @since Ant 1.5.2 | |||
*/ | |||
public class SourceSelector { | |||
public class ResourceUtils { | |||
/** { | |||
* 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 | |||
// respect to the target | |||
Resource[] outofdate = | |||
SourceSelector.selectOutOfDateSources(task, sourceresources, | |||
mapper, this); | |||
ResourceUtils.selectOutOfDateSources(task, sourceresources, | |||
mapper, this); | |||
String[] result = new String[outofdate.length]; | |||
for (int counter=0; counter < outofdate.length; counter++) { | |||
result[counter] = outofdate[counter].getName(); | |||
@@ -1,7 +1,7 @@ | |||
/* | |||
* 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. | |||
* | |||
* 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 | |||
* unzip command. | |||
* | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
public void setUnixMode(int mode) { | |||
setExternalAttributes((mode << 16) | |||
@@ -212,7 +212,7 @@ public class ZipEntry extends java.util.zip.ZipEntry { | |||
* @return 0 (MS-DOS FAT) unless {@link #setUnixMode setUnixMode} | |||
* has been called, in which case 3 (Unix) will be returned. | |||
* | |||
* @since Ant 1.6 | |||
* @since Ant 1.5.2 | |||
*/ | |||
public int getPlatform() { | |||
return platform; | |||
@@ -64,14 +64,14 @@ import java.io.File; | |||
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 { | |||
private Echo taskINeedForLogging = new Echo(); | |||
public SourceSelectorTest(String name) { | |||
public ResourceUtilsTest(String name) { | |||
super(name); | |||
taskINeedForLogging.setProject(new Project()); | |||
} | |||
@@ -79,9 +79,9 @@ public class SourceSelectorTest extends TestCase | |||
public void testNoDuplicates() { | |||
Resource r = new Resource("samual vimes", true, 1, false); | |||
Resource[] toNew = | |||
SourceSelector.selectOutOfDateSources(taskINeedForLogging, | |||
new Resource[] {r}, | |||
this, this); | |||
ResourceUtils.selectOutOfDateSources(taskINeedForLogging, | |||
new Resource[] {r}, | |||
this, this); | |||
assertEquals(1, toNew.length); | |||
} | |||