Browse Source

Preparing merge to 1.5 branch

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274134 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 22 years ago
parent
commit
c89a66172d
8 changed files with 33 additions and 34 deletions
  1. +3
    -3
      docs/manual/CoreTasks/zip.html
  2. +0
    -1
      src/main/org/apache/tools/ant/taskdefs/Execute.java
  3. +13
    -13
      src/main/org/apache/tools/ant/taskdefs/Zip.java
  4. +5
    -5
      src/main/org/apache/tools/ant/types/ZipFileSet.java
  5. +1
    -1
      src/main/org/apache/tools/ant/util/ResourceUtils.java
  6. +2
    -2
      src/main/org/apache/tools/ant/util/SourceFileScanner.java
  7. +3
    -3
      src/main/org/apache/tools/zip/ZipEntry.java
  8. +6
    -6
      src/testcases/org/apache/tools/ant/util/ResourceUtilsTest.java

+ 3
- 3
docs/manual/CoreTasks/zip.html View File

@@ -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, &lt;zip&gt; can store Unix permissions
<p>Starting with Ant 1.5.2, &lt;zip&gt; 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">&lt;zipfileset&gt;</a>). attributes for <a href="#zipfileset">&lt;zipfileset&gt;</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>


+ 0
- 1
src/main/org/apache/tools/ant/taskdefs/Execute.java View File

@@ -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")) {


+ 13
- 13
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -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++) {


+ 5
- 5
src/main/org/apache/tools/ant/types/ZipFileSet.java View File

@@ -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;


src/main/org/apache/tools/ant/util/SourceSelector.java → src/main/org/apache/tools/ant/util/ResourceUtils.java View File

@@ -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

+ 2
- 2
src/main/org/apache/tools/ant/util/SourceFileScanner.java View File

@@ -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();


+ 3
- 3
src/main/org/apache/tools/zip/ZipEntry.java View File

@@ -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;


src/testcases/org/apache/tools/ant/util/SourceSelectorTest.java → src/testcases/org/apache/tools/ant/util/ResourceUtilsTest.java View File

@@ -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);
} }



Loading…
Cancel
Save