bodewig 2003/01/27 08:25:31 Modified: . Tag: ANT_15_BRANCH WHATSNEW src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH Tar.java Log: Merge fix for 14995 from HEAD Revision Changes Path No revision No revision 1.263.2.115 +2 -0 jakarta-ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/jakarta-ant/WHATSNEW,v retrieving revision 1.263.2.114 retrieving revision 1.263.2.115 diff -u -r1.263.2.114 -r1.263.2.115 --- WHATSNEW 20 Jan 2003 12:42:42 -0000 1.263.2.114 +++ WHATSNEW 27 Jan 2003 16:25:27 -0000 1.263.2.115 @@ -67,6 +67,8 @@ * fix up folder creation in PVCS task +* <tar>'s up-to-date check didn't work for nested <(tar)fileset>s. + Other changes: -------------- No revision No revision 1.32.2.3 +17 -7 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tar.java Index: Tar.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Tar.java,v retrieving revision 1.32.2.2 retrieving revision 1.32.2.3 diff -u -r1.32.2.2 -r1.32.2.3 --- Tar.java 4 Dec 2002 17:02:33 -0000 1.32.2.2 +++ Tar.java 27 Jan 2003 16:25:29 -0000 1.32.2.3 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -265,14 +265,14 @@ boolean upToDate = true; for (Enumeration e = filesets.elements(); e.hasMoreElements();) { TarFileSet fs = (TarFileSet) e.nextElement(); - String[] files = fs.getFiles(project); + String[] files = fs.getFiles(getProject()); - if (!archiveIsUpToDate(files)) { + if (!archiveIsUpToDate(files, fs.getDir(getProject()))) { upToDate = false; } for (int i = 0; i < files.length; ++i) { - if (tarFile.equals(new File(fs.getDir(project), + if (tarFile.equals(new File(fs.getDir(getProject()), files[i]))) { throw new BuildException("A tar file cannot include " + "itself", location); @@ -309,7 +309,7 @@ for (Enumeration e = filesets.elements(); e.hasMoreElements();) { TarFileSet fs = (TarFileSet) e.nextElement(); - String[] files = fs.getFiles(project); + String[] files = fs.getFiles(getProject()); if (files.length > 1 && fs.getFullpath().length() > 0) { throw new BuildException("fullpath attribute may only " + "be specified for " @@ -317,7 +317,7 @@ + "single file."); } for (int i = 0; i < files.length; i++) { - File f = new File(fs.getDir(project), files[i]); + File f = new File(fs.getDir(getProject()), files[i]); String name = files[i].replace(File.separatorChar, '/'); tarFile(f, tOut, name, fs); } @@ -428,11 +428,21 @@ } } + /** + * @deprecated use the two-arg version instead. + */ protected boolean archiveIsUpToDate(String[] files) { + return archiveIsUpToDate(files, baseDir); + } + + /** + * @since Ant 1.5.2 + */ + protected boolean archiveIsUpToDate(String[] files, File dir) { SourceFileScanner sfs = new SourceFileScanner(this); MergingMapper mm = new MergingMapper(); mm.setTo(tarFile.getAbsolutePath()); - return sfs.restrict(files, baseDir, null, mm).length == 0; + return sfs.restrict(files, dir, null, mm).length == 0; } /**
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>