-changed the overrode the Datattype.getCheckedRef() logic in ArchiveFileSet, delegating to the overridden getRef in all such cases; the subclasses all do their fileset imports there. Added a test. Not changed WHATSNEW unless there's evidence that this test fails in Ant1.7.1 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@751695 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -676,7 +676,7 @@ public class Tar extends MatchingTask { | |||||
| * @return true if the collection is a fileset. | * @return true if the collection is a fileset. | ||||
| * @since Ant 1.7 | * @since Ant 1.7 | ||||
| */ | */ | ||||
| protected static final boolean isFileFileSet(ResourceCollection rc) { | |||||
| protected static boolean isFileFileSet(ResourceCollection rc) { | |||||
| return rc instanceof FileSet && rc.isFilesystemOnly(); | return rc instanceof FileSet && rc.isFilesystemOnly(); | ||||
| } | } | ||||
| @@ -687,7 +687,7 @@ public class Tar extends MatchingTask { | |||||
| * @return a list of the filenames. | * @return a list of the filenames. | ||||
| * @since Ant 1.7 | * @since Ant 1.7 | ||||
| */ | */ | ||||
| protected static final String[] getFileNames(FileSet fs) { | |||||
| protected static String[] getFileNames(FileSet fs) { | |||||
| DirectoryScanner ds = fs.getDirectoryScanner(fs.getProject()); | DirectoryScanner ds = fs.getDirectoryScanner(fs.getProject()); | ||||
| String[] directories = ds.getIncludedDirectories(); | String[] directories = ds.getIncludedDirectories(); | ||||
| String[] filesPerSe = ds.getIncludedFiles(); | String[] filesPerSe = ds.getIncludedFiles(); | ||||
| @@ -196,6 +196,21 @@ public abstract class ArchiveFileSet extends FileSet { | |||||
| return null; | return null; | ||||
| } | } | ||||
| /** | |||||
| * Performs the check for circular references and returns the | |||||
| * referenced object. | |||||
| * This is an override which does not delegate to the superclass; instead it invokes | |||||
| * {@link #getRef(Project)}, because that conains the special support for fileset | |||||
| * references, which can be handled by all ArchiveFileSets. | |||||
| * @param p the Ant Project instance against which to resolve references. | |||||
| * @return the dereferenced object. | |||||
| * @throws BuildException if the reference is invalid (circular ref, wrong class, etc). | |||||
| * @since Ant 1.8 | |||||
| */ | |||||
| protected Object getCheckedRef(Project p) { | |||||
| return getRef(p); | |||||
| } | |||||
| /** | /** | ||||
| * Prepend this prefix to the path for each archive entry. | * Prepend this prefix to the path for each archive entry. | ||||
| * Prevents both prefix and fullpath from being specified | * Prevents both prefix and fullpath from being specified | ||||
| @@ -0,0 +1,33 @@ | |||||
| <?xml version="1.0"?> | |||||
| <!-- | |||||
| Licensed to the Apache Software Foundation (ASF) under one or more | |||||
| contributor license agreements. See the NOTICE file distributed with | |||||
| this work for additional information regarding copyright ownership. | |||||
| The ASF licenses this file to You under the Apache License, Version 2.0 | |||||
| (the "License"); you may not use this file except in compliance with | |||||
| the License. You may obtain a copy of the License at | |||||
| http://www.apache.org/licenses/LICENSE-2.0 | |||||
| Unless required by applicable law or agreed to in writing, software | |||||
| distributed under the License is distributed on an "AS IS" BASIS, | |||||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
| See the License for the specific language governing permissions and | |||||
| limitations under the License. | |||||
| --> | |||||
| <project name="tar-test" default="antunit" | |||||
| xmlns:au="antlib:org.apache.ant.antunit"> | |||||
| <import file="../antunit-base.xml" /> | |||||
| <target name="setUp"> | |||||
| <mkdir dir="${output}" /> | |||||
| </target> | |||||
| <target name="testTarFilesetHandlesFilesetReferences" depends="setUp"> | |||||
| <fileset id="xml.fileset" dir="." includes="*.xml" /> | |||||
| <tar destfile="${output}/testtar.tar"> | |||||
| <tarfileset prefix="pre" refid="xml.fileset" /> | |||||
| </tar> | |||||
| </target> | |||||
| </project> | |||||