From 1480e646f9056d56b76ea2ab9c8b9b642501f5db Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Mon, 23 May 2005 20:03:14 +0000 Subject: [PATCH] Remove clone task. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278339 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 2 - docs/manual/CoreTasks/clone.html | 57 ----------- docs/manual/coretasklist.html | 1 - src/etc/testcases/taskdefs/clone.xml | 65 ------------- .../org/apache/tools/ant/taskdefs/Clone.java | 97 ------------------- .../apache/tools/ant/taskdefs/CloneTest.java | 59 ----------- 6 files changed, 281 deletions(-) delete mode 100755 docs/manual/CoreTasks/clone.html delete mode 100644 src/etc/testcases/taskdefs/clone.xml delete mode 100755 src/main/org/apache/tools/ant/taskdefs/Clone.java delete mode 100755 src/testcases/org/apache/tools/ant/taskdefs/CloneTest.java diff --git a/WHATSNEW b/WHATSNEW index 18b0fba80..afc4dee94 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -141,8 +141,6 @@ Other changes: * Added preserveLastModified attribute to signjar task. Bugzilla report 30987. -* Added clone task. Bugzilla report 32631. - * Added condition, for inline scripted conditions * Added condition for exclusive-or combining of nested conditions. diff --git a/docs/manual/CoreTasks/clone.html b/docs/manual/CoreTasks/clone.html deleted file mode 100755 index 69e98dd5c..000000000 --- a/docs/manual/CoreTasks/clone.html +++ /dev/null @@ -1,57 +0,0 @@ - - - - - -Clone Task - - - - -

Clone

-

Description

-

Clone a project reference (presumably for augmentation).

-

Parameters

- - - - - - - - - - - -
AttributeDescriptionRequired
clonerefWhat to clone, given as a - reference to an - object with a publicly accessible clone() implementation. - Yes
-

-Assuming the clone operation is successful, the clone invocation supports -any attributes and nested elements supported by the cloned type -(the obvious exception is the "cloneref" attribute). -Please note that modifications to cloned objects may yield -unpredictable results depending on the internals of the cloned class. -

-

Examples

-

-Given a fileset foo: -

  <clone id="foo.txt" cloneref="foo">
-    <filename name="**/*.txt"/>
-  </clone>
-  <clone id="foo.nontxt" cloneref="foo">
-    <filename name="**/*.txt" negate="true"/>
-  </clone>
-
-Creates filesets foo.txt and foo.nontxt, which could be -put to such uses as filtering some files and not others when copying. -

-
- -

Copyright © 2005 The Apache Software Foundation. All rights -Reserved.

- - - - diff --git a/docs/manual/coretasklist.html b/docs/manual/coretasklist.html index 9d7be6cc3..f5dc9cf65 100644 --- a/docs/manual/coretasklist.html +++ b/docs/manual/coretasklist.html @@ -28,7 +28,6 @@ BZip2
Checksum
Chmod
-Clone
Concat
Condition
  Supported conditions
diff --git a/src/etc/testcases/taskdefs/clone.xml b/src/etc/testcases/taskdefs/clone.xml deleted file mode 100644 index 67f6db511..000000000 --- a/src/etc/testcases/taskdefs/clone.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/main/org/apache/tools/ant/taskdefs/Clone.java b/src/main/org/apache/tools/ant/taskdefs/Clone.java deleted file mode 100755 index ebfebdf19..000000000 --- a/src/main/org/apache/tools/ant/taskdefs/Clone.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2005 The Apache Software Foundation - * - * Licensed 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. - * - */ - -package org.apache.tools.ant.taskdefs; - -import java.lang.reflect.Method; - -import org.apache.tools.ant.Task; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.UnknownElement; -import org.apache.tools.ant.RuntimeConfigurable; - -/** - * Clone an Object from a reference. - * @since Ant 1.7 - */ -public class Clone extends UnknownElement { - /** Task name. */ - public static final String TASK_NAME = "clone"; - - /** Clone reference attribute ID. */ - public static final String CLONE_REF = "cloneref"; - - private static final Class[] NO_ARGS = new Class[] {}; - - /** - * Create a new instance of the Clone task. - */ - public Clone() { - super(TASK_NAME); - } - - /** - * Creates a named task or data type. If the real object is a task, - * it is configured up to the init() stage. - * - * @param ue The UnknownElement to create the real object for. - * Not used in this implementation. - * @param w The RuntimeConfigurable containing the configuration - * information to pass to the cloned Object. - * - * @return the task or data type represented by the given unknown element. - */ - protected Object makeObject(UnknownElement ue, RuntimeConfigurable w) { - String cloneref = (String) (w.getAttributeMap().get(CLONE_REF)); - if (cloneref == null) { - throw new BuildException("cloneref attribute not set"); - } - Object ob = getProject().getReference(cloneref); - if (ob == null) { - throw new BuildException( - "reference \"" + cloneref + "\" not found"); - } - try { - log("Attempting to clone " + ob.toString() + " \"" - + cloneref + "\"", Project.MSG_VERBOSE); - Method m = ob.getClass().getMethod("clone", NO_ARGS); - try { - Object bo = m.invoke(ob, (Object[])NO_ARGS); - if (bo == null) { - throw new BuildException(m.toString() + " returned null"); - } - w.removeAttribute(CLONE_REF); - w.setProxy(bo); - w.setElementTag(null); - setRuntimeConfigurableWrapper(w); - if (bo instanceof Task) { - ((Task) bo).setOwningTarget(getOwningTarget()); - ((Task) bo).init(); - } - return bo; - } catch (Exception e) { - throw new BuildException(e); - } - } catch (NoSuchMethodException e) { - throw new BuildException( - "Unable to locate public clone method for object \"" - + cloneref + "\""); - } - } - -} diff --git a/src/testcases/org/apache/tools/ant/taskdefs/CloneTest.java b/src/testcases/org/apache/tools/ant/taskdefs/CloneTest.java deleted file mode 100755 index df5f26471..000000000 --- a/src/testcases/org/apache/tools/ant/taskdefs/CloneTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2005 The Apache Software Foundation - * - * Licensed 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. - * - */ - -package org.apache.tools.ant.taskdefs; - -import org.apache.tools.ant.BuildFileTest; - -public class CloneTest extends BuildFileTest { - - public CloneTest(String name) { - super(name); - } - - public void setUp() { - configureProject("src/etc/testcases/taskdefs/clone.xml"); - } - - public void testClone1() { - executeTarget("testClone1"); - } - - public void testClone2() { - executeTarget("testClone2"); - } - - public void testClone3() { - executeTarget("testClone3"); - } - - public void testNoClone() { - expectBuildExceptionContaining("testNoClone", - "should fail because Object cannot be cloned", "public clone method"); - } - - public void testNoAttr() { - expectSpecificBuildException("testNoAttr", - "cloneref attribute not set", "cloneref attribute not set"); - } - - public void testNoRef() { - expectSpecificBuildException("testNoRef", "reference does not exist", - "reference \"thisreferencehasnotbeensetinthecurrentproject\" not found"); - } - -}