Return-Path: Delivered-To: apmail-jakarta-ant-dev-archive@jakarta.apache.org Received: (qmail 38320 invoked by uid 500); 13 Oct 2001 01:26:36 -0000 Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: ant-dev@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 38305 invoked from network); 13 Oct 2001 01:26:35 -0000 Message-ID: <006201c15385$d324bac0$0100a8c0@jose> From: "Jose Alberto Fernandez" To: "Ant Project List" Subject: [PATCH] Cleanup of ProjectHelper and DeclaringTasks Date: Sat, 13 Oct 2001 02:23:28 +0100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0060_01C1538E.0BAD1B00" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.3018.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------=_NextPart_000_0060_01C1538E.0BAD1B00 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, Here is the patch I mentioned in my previous e-mail. It defines a new = interface called DeclaringTask which must be implemented by those tasks = that should be allowed outside targets. As the name indicates, such = tasks should be limited to those use for declaring things like = , , . These are the only three allowed by = this patch. We can discuse later if there are any other tasks that should also be = DeclaringTasks. The thing I like is that removes one and for all the hardcoded task = names from ProjectHelper. Cheers, Jose Alberto ------=_NextPart_000_0060_01C1538E.0BAD1B00 Content-Type: text/x-vcard; name="Jose Alberto Fernandez.vcf" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Jose Alberto Fernandez.vcf" BEGIN:VCARD VERSION:2.1 N:Fernandez;Jose;Alberto FN:Jose Alberto Fernandez TEL;HOME;VOICE:+44.20.8805.0809 TEL;CELL;VOICE:+44.77.4767.3468 TEL;HOME;FAX:+44.20.8805.0809 ADR;HOME;ENCODING=3DQUOTED-PRINTABLE:;;2 Caroe Court=3D0D=3D0A1 Bury = Street;London;;N9 7LE;UK LABEL;HOME;ENCODING=3DQUOTED-PRINTABLE:2 Caroe Court=3D0D=3D0A1 Bury = Street=3D0D=3D0ALondon N9 7LE=3D0D=3D0AUK X-WAB-GENDER:2 URL:www.geocities.com/j_a_fernandez BDAY:19600811 EMAIL;PREF;INTERNET:j_a_fernandez@yahoo.com REV:20011013T012328Z END:VCARD ------=_NextPart_000_0060_01C1538E.0BAD1B00 Content-Type: text/plain; name="declare_patch.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="declare_patch.txt" Index: src/main/org/apache/tools/ant/DeclaringTask.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: DeclaringTask.java diff -N DeclaringTask.java --- /dev/null Fri Oct 12 18:04:29 2001 +++ DeclaringTask.java Fri Oct 12 18:06:11 2001 @@ -0,0 +1,67 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2001 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software = itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Ant", and "Apache Software + * Foundation" must not be used to endorse or promote products = derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant; + +/** + * Interface for tasks that perform a declaration of some sort. + * DeclaringTasks are the only ones that can be located outside = targets. + *

+ * property, taskdef and typedef are examples = + * of such tasks. + * @author Jose Alberto = Fernandez + */ +public interface DeclaringTask { +} + Index: src/main/org/apache/tools/ant/ProjectHelper.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/ProjectHelper.j= ava,v retrieving revision 1.62 diff -u -r1.62 ProjectHelper.java --- src/main/org/apache/tools/ant/ProjectHelper.java 2001/09/30 13:21:53 = 1.62 +++ src/main/org/apache/tools/ant/ProjectHelper.java 2001/10/13 01:06:16 @@ -334,24 +334,21 @@ } =20 public void startElement(String name, AttributeList attrs) = throws SAXParseException { - if (name.equals("taskdef")) { - handleTaskdef(name, attrs); - } else if (name.equals("property")) { - handleProperty(name, attrs); - } else if (name.equals("target")) { + Object cls =3D null; + + if (name.equals("target")) { handleTarget(name, attrs); + } else if ((cls =3D project.getTaskDefinitions().get(name)) = !=3D null + && DeclaringTask.class.isAssignableFrom((Class)cls)) { + handleDeclaringTask(name, attrs); } else if (project.getDataTypeDefinitions().get(name) !=3D = null) { handleDataType(name, attrs); } else { throw new SAXParseException("Unexpected element \"" + = name + "\"", locator); } } - - private void handleTaskdef(String name, AttributeList attrs) = throws SAXParseException { - (new TaskHandler(this, null, null)).init(name, attrs); - } =20 - private void handleProperty(String name, AttributeList attrs) = throws SAXParseException { + private void handleDeclaringTask(String name, AttributeList = attrs) throws SAXParseException { (new TaskHandler(this, null, null)).init(name, attrs); } =20 Index: src/main/org/apache/tools/ant/taskdefs/Definer.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Define= r.java,v retrieving revision 1.7 diff -u -r1.7 Definer.java --- src/main/org/apache/tools/ant/taskdefs/Definer.java 2001/08/06 = 09:59:51 1.7 +++ src/main/org/apache/tools/ant/taskdefs/Definer.java 2001/10/13 = 01:06:17 @@ -67,7 +67,7 @@ * @author Costin Manolache * @author Stefan Bodewig */ -public abstract class Definer extends Task { +public abstract class Definer extends Task implements DeclaringTask { private String name; private String value; private Path classpath; Index: src/main/org/apache/tools/ant/taskdefs/Property.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: = /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Proper= ty.java,v retrieving revision 1.32 diff -u -r1.32 Property.java --- src/main/org/apache/tools/ant/taskdefs/Property.java 2001/08/30 = 13:26:37 1.32 +++ src/main/org/apache/tools/ant/taskdefs/Property.java 2001/10/13 = 01:06:19 @@ -68,7 +68,7 @@ * @author Sam Ruby * @author Glenn McAllister */ -public class Property extends Task { +public class Property extends Task implements DeclaringTask { =20 protected String name; protected String value; ------=_NextPart_000_0060_01C1538E.0BAD1B00--