You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2002/06/12 10:48:21 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Sequential.java
bodewig 2002/06/12 01:48:21
Modified: . Tag: ANT_15_BRANCH WHATSNEW
docs/manual/CoreTasks Tag: ANT_15_BRANCH checksum.html
src/main/org/apache/tools/ant Tag: ANT_15_BRANCH
RuntimeConfigurable.java Task.java
src/main/org/apache/tools/ant/taskdefs Tag: ANT_15_BRANCH
Sequential.java
Log:
Make <property> inside <sequential> have an effect on later tasks in
the same <sequential>.
The problem here has been, that Sequential#maybeConfigure would
configure all tasks before the first one has been executed. A similar
change is probably needed for all TaskContainer's with a contract
similar to <sequential>'s.
PR: 9259
Revision Changes Path
No revision
No revision
1.263.2.35 +9 -0 jakarta-ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/jakarta-ant/WHATSNEW,v
retrieving revision 1.263.2.34
retrieving revision 1.263.2.35
diff -u -r1.263.2.34 -r1.263.2.35
--- WHATSNEW 11 Jun 2002 16:08:32 -0000 1.263.2.34
+++ WHATSNEW 12 Jun 2002 08:48:20 -0000 1.263.2.35
@@ -24,10 +24,19 @@
* <linecontains> filterreader could swallow lines.
+* <sequential> will used to configure the tasks (set their attributes)
+before the first task has been executed. This means that properties
+that have been set by nested task seemed to be unset for the other
+tasks in the same <sequential> element.
+
Other changes:
--------------
* <checksum> now uses a buffer (of configurable size).
+
+* The "Trying to override task definition" warning has been degraded
+to verbose level if the two task definitions only differ in the class
+loader instance that has loaded the definition.
Changes from Ant 1.5beta1 to Ant 1.5beta2
=========================================
No revision
No revision
1.4.2.3 +1 -1 jakarta-ant/docs/manual/CoreTasks/checksum.html
Index: checksum.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/checksum.html,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -u -r1.4.2.2 -r1.4.2.3
--- checksum.html 11 Jun 2002 17:59:01 -0000 1.4.2.2
+++ checksum.html 12 Jun 2002 08:48:20 -0000 1.4.2.3
@@ -151,7 +151,7 @@
the result will be true only if the checksums matched correctly for all files being
considered.
-<hr><p align="center">Copyright © 2001 Apache Software Foundation. All rights
+<hr><p align="center">Copyright © 2001-2002 Apache Software Foundation. All rights
Reserved.</p>
</body>
No revision
No revision
1.14.2.2 +36 -6 jakarta-ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java
Index: RuntimeConfigurable.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/RuntimeConfigurable.java,v
retrieving revision 1.14.2.1
retrieving revision 1.14.2.2
diff -u -r1.14.2.1 -r1.14.2.2
--- RuntimeConfigurable.java 9 Jun 2002 10:04:07 -0000 1.14.2.1
+++ RuntimeConfigurable.java 12 Jun 2002 08:48:21 -0000 1.14.2.2
@@ -199,6 +199,30 @@
* an element which doesn't accept it.
*/
public void maybeConfigure(Project p) throws BuildException {
+ maybeConfigure(p, true);
+ }
+
+ /**
+ * Configures the wrapped element. The attributes and text for
+ * the wrapped element are configured. Each time the wrapper is
+ * configured, the attributes and text for it are reset.
+ *
+ * If the element has an <code>id</code> attribute, a reference
+ * is added to the project as well.
+ *
+ * @param p The project containing the wrapped element.
+ * Must not be <code>null</code>.
+ *
+ * @param configureChildren Whether to configure child elements as
+ * well. if true, child elements will be configured after the
+ * wrapped element.
+ *
+ * @exception BuildException if the configuration fails, for instance due
+ * to invalid attributes or children, or text being added to
+ * an element which doesn't accept it.
+ */
+ public void maybeConfigure(Project p, boolean configureChildren)
+ throws BuildException {
String id = null;
if (proxyConfigured) {
@@ -219,14 +243,20 @@
if (child.wrappedObject instanceof Task) {
Task childTask = (Task) child.wrappedObject;
childTask.setRuntimeConfigurableWrapper(child);
- childTask.maybeConfigure();
- } else {
- child.maybeConfigure(p);
}
- ProjectHelper.storeChild(p, wrappedObject, child.wrappedObject,
- child.getElementTag().toLowerCase(Locale.US));
- }
+ if (configureChildren) {
+ if (child.wrappedObject instanceof Task) {
+ Task childTask = (Task) child.wrappedObject;
+ childTask.maybeConfigure();
+ } else {
+ child.maybeConfigure(p);
+ }
+ ProjectHelper.storeChild(p, wrappedObject, child.wrappedObject,
+ child.getElementTag()
+ .toLowerCase(Locale.US));
+ }
+ }
if (id != null) {
p.addReference(id, wrappedObject);
}
1.27.2.2 +9 -0 jakarta-ant/src/main/org/apache/tools/ant/Task.java
Index: Task.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/Task.java,v
retrieving revision 1.27.2.1
retrieving revision 1.27.2.2
diff -u -r1.27.2.1 -r1.27.2.2
--- Task.java 23 May 2002 16:36:10 -0000 1.27.2.1
+++ Task.java 12 Jun 2002 08:48:21 -0000 1.27.2.2
@@ -342,6 +342,15 @@
}
/**
+ * Has this task been marked invalid?
+ *
+ * @since Ant 1.5
+ */
+ protected final boolean isInvalid() {
+ return invalid;
+ }
+
+ /**
* Replacement element used if this task is invalidated.
*/
private UnknownElement replacement;
No revision
No revision
1.7.2.1 +15 -0 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Sequential.java
Index: Sequential.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Sequential.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- Sequential.java 14 Apr 2002 11:16:13 -0000 1.7
+++ Sequential.java 12 Jun 2002 08:48:21 -0000 1.7.2.1
@@ -76,6 +76,21 @@
private Vector nestedTasks = new Vector();
/**
+ * Override {@link org.apache.tools.ant.Task#maybeConfigure
+ * maybeConfigure} in a way that leaves the nested tasks
+ * unconfigured until they get executed.
+ *
+ * @since Ant 1.5
+ */
+ public void maybeConfigure() throws BuildException {
+ if (isInvalid()) {
+ super.maybeConfigure();
+ } else {
+ getRuntimeConfigurableWrapper().maybeConfigure(getProject(), false);
+ }
+ }
+
+ /**
* Add a nested task to Sequential.
* <p>
* @param nestedTask Nested task to execute Sequential
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>