ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r650229 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/ant/IvyBuildList.java test/buildlist/H/ test/buildlist/H/build.xml test/java/org/apache/ivy/ant/IvyBuildListTest.java
Date Mon, 21 Apr 2008 19:21:51 GMT
Author: maartenc
Date: Mon Apr 21 12:21:49 2008
New Revision: 650229

URL: http://svn.apache.org/viewvc?rev=650229&view=rev
Log:
FIX: onMissingDescriptor doesn't work due to == comparison (IVY-805) (thanks to Ben Hale)

Added:
    ant/ivy/core/trunk/test/buildlist/H/
    ant/ivy/core/trunk/test/buildlist/H/build.xml
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=650229&r1=650228&r2=650229&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon Apr 21 12:21:49 2008
@@ -28,6 +28,7 @@
 	Jacob Grydholt Jensen
 	Scott Goldstein
 	Pierre H├Ągnestrand
+	Ben Hale
 	Peter Hayes
 	Matt Inger
 	Anders Janmyr
@@ -78,6 +79,7 @@
 - IMPROVEMENT: Change allownomd and skipbuildwithoutivy into a more semantically correct
name (IVY-297)
 - IMPROVEMENT: Smarter determination if an expression is exact or not for RegexpPatternMatcher
and GlobPatternMatcher
 
+- FIX: onMissingDescriptor doesn't work due to == comparison (IVY-805) (thanks to Ben Hale)
 - FIX: revision token is not set in report outputpattern (IVY-272)
 - FIX: Ivy uses the first set of configurations it sees when resolving multiple versions
of a module (IVY-681)
 - FIX: Eviction fails for libs not providing their ivy configuration and providing artifacts
named different between lib versions (IVY-537)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java?rev=650229&r1=650228&r2=650229&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyBuildList.java Mon Apr 21 12:21:49 2008
@@ -244,7 +244,7 @@
             new WarningNonMatchingVersionReporter();
         List sortedModules = ivy.sortModuleDescriptors(mds, nonMatchingVersionReporter);
 
-        if (onMissingDescriptor != OnMissingDescriptor.TAIL) {
+        if (!OnMissingDescriptor.TAIL.equals(onMissingDescriptor)) {
             for (ListIterator iter = noDescriptor.listIterator(); iter.hasNext();) {
                 File buildFile = (File) iter.next();
                 addBuildFile(path, buildFile);
@@ -286,7 +286,7 @@
             File buildFile = (File) buildFiles.get(md);
             addBuildFile(path, buildFile);
         }
-        if (onMissingDescriptor == OnMissingDescriptor.TAIL) {
+        if (OnMissingDescriptor.TAIL.equals(onMissingDescriptor)) {
             for (ListIterator iter = noDescriptor.listIterator(); iter.hasNext();) {
                 File buildFile = (File) iter.next();
                 addBuildFile(path, buildFile);
@@ -298,23 +298,23 @@
     }
 
     private void onMissingDescriptor(File buildFile, File ivyFile, List noDescriptor) {
-        if (onMissingDescriptor == OnMissingDescriptor.SKIP) {
+        if (OnMissingDescriptor.SKIP.equals(onMissingDescriptor)) {
             Message.debug("skipping " + buildFile + ": descriptor " + ivyFile
                     + " doesn't exist");
-        } else if (onMissingDescriptor == OnMissingDescriptor.FAIL) {
+        } else if (OnMissingDescriptor.FAIL.equals(onMissingDescriptor)) {
             throw new BuildException(
                 "a module has no module descriptor and onMissingDescriptor=fail. "
                 + "Build file: " + buildFile + ". Expected descriptor: " + ivyFile);
         } else {
-            if (onMissingDescriptor == OnMissingDescriptor.WARN) {
+            if (OnMissingDescriptor.WARN.equals(onMissingDescriptor)) {
                 Message.warn(
                     "a module has no module descriptor. "
                     + "Build file: " + buildFile + ". Expected descriptor: " + ivyFile);
             }
             Message.verbose("no descriptor for " + buildFile + ": descriptor=" + ivyFile
                     + ": adding it at the " 
-                    + onMissingDescriptor == OnMissingDescriptor.TAIL 
-                    ? "tail" : "head" + " of the path");
+                    + (OnMissingDescriptor.TAIL.equals(onMissingDescriptor) 
+                    ? "tail" : "head" + " of the path"));
             Message.verbose(
                 "\t(change onMissingDescriptor if you want to take another action");
             noDescriptor.add(buildFile);

Added: ant/ivy/core/trunk/test/buildlist/H/build.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/buildlist/H/build.xml?rev=650229&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/buildlist/H/build.xml (added)
+++ ant/ivy/core/trunk/test/buildlist/H/build.xml Mon Apr 21 12:21:49 2008
@@ -0,0 +1,18 @@
+<!--
+   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.    
+-->

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java?rev=650229&r1=650228&r2=650229&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java Mon Apr 21 12:21:49
2008
@@ -57,7 +57,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -96,7 +96,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("reverse.ordered.build.files");
 
         buildlist.execute();
@@ -136,7 +136,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/**");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -167,7 +167,7 @@
         fs.setDir(new File("test/buildlist"));
         fs.setIncludes("**/build.xml");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -194,7 +194,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/**");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -231,7 +231,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/**");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -263,7 +263,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/**");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -296,7 +296,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/**");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -331,7 +331,7 @@
         fs.setDir(new File("test/buildlist"));
         fs.setIncludes("**/build.xml");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -359,7 +359,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/**");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -398,7 +398,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/**");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -432,7 +432,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/**");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -465,7 +465,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();
@@ -489,6 +489,69 @@
         assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[3])
                 .getAbsolutePath());
     }
+    
+    public void testOnMissingDescriptor() {
+        Project p = new Project();
+
+        IvyBuildList buildlist = new IvyBuildList();
+        buildlist.setProject(p);
+
+        FileSet fs = new FileSet();
+        fs.setDir(new File("test/buildlist"));
+        fs.setIncludes("**/build.xml");
+        fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
+        buildlist.addFileset(fs);
+        buildlist.setOnMissingDescriptor(new String("tail")); // IVY-805: new String instance
+        buildlist.setReference("ordered.build.files");
+        buildlist.execute();
+
+        Object o = p.getReference("ordered.build.files");
+        assertNotNull(o);
+        assertTrue(o instanceof Path);
+
+        Path path = (Path) o;
+        String[] files = path.list();
+        assertNotNull(files);
+        
+        assertEquals(6, files.length);
+
+        assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[0])
+                .getAbsolutePath());
+        assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[1])
+                .getAbsolutePath());
+        assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[2])
+                .getAbsolutePath());
+        assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[3])
+                .getAbsolutePath());
+        assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[4])
+                .getAbsolutePath());
+        assertEquals(new File("test/buildlist/H/build.xml").getAbsolutePath(), new File(files[5])
+                .getAbsolutePath());
+        
+        buildlist.setOnMissingDescriptor(new String("skip")); // IVY-805: new String instance
+        buildlist.execute();
+
+        o = p.getReference("ordered.build.files");
+        assertNotNull(o);
+        assertTrue(o instanceof Path);
+
+        path = (Path) o;
+        files = path.list();
+        assertNotNull(files);
+        
+        assertEquals(5, files.length);
+
+        assertEquals(new File("test/buildlist/B/build.xml").getAbsolutePath(), new File(files[0])
+                .getAbsolutePath());
+        assertEquals(new File("test/buildlist/C/build.xml").getAbsolutePath(), new File(files[1])
+                .getAbsolutePath());
+        assertEquals(new File("test/buildlist/A/build.xml").getAbsolutePath(), new File(files[2])
+                .getAbsolutePath());
+        assertEquals(new File("test/buildlist/D/build.xml").getAbsolutePath(), new File(files[3])
+                .getAbsolutePath());
+        assertEquals(new File("test/buildlist/E/build.xml").getAbsolutePath(), new File(files[4])
+                .getAbsolutePath());
+    }
 
     public void testWithModuleWithSameNameAndDifferentOrg() {
         Project p = new Project();
@@ -501,7 +564,7 @@
         fs.setIncludes("**/build.xml");
         fs.setExcludes("F/build.xml,G/build.xml");
         buildlist.addFileset(fs);
-
+        buildlist.setOnMissingDescriptor("skip");
         buildlist.setReference("ordered.build.files");
 
         buildlist.execute();



Mime
View raw message