Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 50399 invoked from network); 27 Feb 2004 11:45:18 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 27 Feb 2004 11:45:18 -0000 Received: (qmail 59161 invoked by uid 500); 27 Feb 2004 11:45:16 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 58978 invoked by uid 500); 27 Feb 2004 11:45:15 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 58965 invoked by uid 500); 27 Feb 2004 11:45:15 -0000 Received: (qmail 58961 invoked from network); 27 Feb 2004 11:45:15 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 27 Feb 2004 11:45:15 -0000 Received: (qmail 50368 invoked by uid 1539); 27 Feb 2004 11:45:15 -0000 Date: 27 Feb 2004 11:45:15 -0000 Message-ID: <20040227114515.50367.qmail@minotaur.apache.org> From: peterreilly@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant WHATSNEW build.xml X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N peterreilly 2004/02/27 03:45:15 Modified: src/main/org/apache/tools/ant/helper ProjectHelper2.java src/testcases/org/apache/tools/ant ProjectTest.java . WHATSNEW build.xml Log: Fix for duplicate targets in the build file. In ant 1.5 these were not allowed. In ant 1.6, with import file's targets being allowed to be overridden, duplicate targets where incorrectly allowed in normal build files. The fix just checks if the duplicate target is defined in an imported file or in a "main" file. Reported by: Dominique Devienne See: http://marc.theaimsgroup.com/?t=107705039100004&r=1&w=2 Revision Changes Path 1.42 +8 -0 ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java Index: ProjectHelper2.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/helper/ProjectHelper2.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- ProjectHelper2.java 9 Feb 2004 21:05:18 -0000 1.41 +++ ProjectHelper2.java 27 Feb 2004 11:45:14 -0000 1.42 @@ -804,6 +804,14 @@ // If the name has already been defined ( import for example ) if (currentTargets.containsKey(name)) { + if (!context.isIgnoringProjectTag()) { + // not in an import'ed file + throw new BuildException( + "Duplicate target '" + name + "'", + new Location(context.getLocator().getSystemId(), + context.getLocator().getLineNumber(), + context.getLocator().getColumnNumber())); + } // Alter the name. if (context.getCurrentProjectName() != null) { String newName = context.getCurrentProjectName() 1.24 +10 -3 ant/src/testcases/org/apache/tools/ant/ProjectTest.java Index: ProjectTest.java =================================================================== RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/ProjectTest.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- ProjectTest.java 20 Feb 2004 12:24:04 -0000 1.23 +++ ProjectTest.java 27 Feb 2004 11:45:14 -0000 1.24 @@ -206,8 +206,15 @@ public void testDuplicateTargets() { // fail, because buildfile contains two targets with the same name - BFT bft = new BFT("", "core/duplicate-target.xml"); - bft.expectBuildException("twice", "Duplicate target"); + try { + BFT bft = new BFT("", "core/duplicate-target.xml"); + } catch (BuildException ex) { + assertEquals("specific message", + "Duplicate target 'twice'", + ex.getMessage()); + return; + } + fail("Should throw BuildException about duplicate target"); } public void testDuplicateTargetsImport() { @@ -265,4 +272,4 @@ class DummyTaskPackage extends Task { public DummyTaskPackage() {} public void execute() {} -} \ No newline at end of file +} 1.556 +5 -1 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.555 retrieving revision 1.556 diff -u -r1.555 -r1.556 --- WHATSNEW 25 Feb 2004 13:02:52 -0000 1.555 +++ WHATSNEW 27 Feb 2004 11:45:15 -0000 1.556 @@ -53,7 +53,11 @@ * MacroDef did not allow attributes named 'description'. Bugzilla Report 27175. -* Throw build exception if name attribute missing from patternset. Bugzilla Report 25982. +* Throw build exception if name attribute missing from patternset#NameEntry. + Bugzilla Report 25982. + +* Throw build exception if target repeated in build file, but allow targets + to be repeated in imported files. Other changes: -------------- 1.412 +1 -8 ant/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/ant/build.xml,v retrieving revision 1.411 retrieving revision 1.412 diff -u -r1.411 -r1.412 --- build.xml 26 Feb 2004 16:35:26 -0000 1.411 +++ build.xml 27 Feb 2004 11:45:15 -0000 1.412 @@ -329,13 +329,6 @@ - - creates a minimum distribution in ./dist" depends="dist-lite"/> - \ No newline at end of file + --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org