ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/etc/testcases/taskdefs/import/symlinks/d3a p3.xml
Date Wed, 28 Apr 2004 09:01:08 GMT
peterreilly    2004/04/28 02:01:08

  Modified:    src/main/org/apache/tools/ant/taskdefs ImportTask.java
               src/testcases/org/apache/tools/ant/taskdefs ImportTest.java
  Added:       src/etc/testcases/taskdefs/import/symlinks/d1 p1.xml
               src/etc/testcases/taskdefs/import/symlinks/d2 p2.xml
               src/etc/testcases/taskdefs/import/symlinks/d3a p3.xml
  Log:
  File paths to imported build files should not be canonicalized
  PR: 28505
  Obtained from: Jesse Glick
  
  Revision  Changes    Path
  1.28      +0 -9      ant/src/main/org/apache/tools/ant/taskdefs/ImportTask.java
  
  Index: ImportTask.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ImportTask.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ImportTask.java	13 Apr 2004 21:42:58 -0000	1.27
  +++ ImportTask.java	28 Apr 2004 09:01:08 -0000	1.28
  @@ -131,8 +131,6 @@
               }
           }
   
  -        importedFile = new File(getPath(importedFile));
  -
           if (importStack.contains(importedFile)) {
               getProject().log(
                   "Skipped already imported file:\n   "
  @@ -148,11 +146,4 @@
           }
       }
   
  -    private static String getPath(File file) {
  -        try {
  -            return file.getCanonicalPath();
  -        } catch (IOException e) {
  -            return file.getAbsolutePath();
  -        }
  -    }
   }
  
  
  
  1.13      +33 -1     ant/src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java
  
  Index: ImportTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/ImportTest.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ImportTest.java	18 Mar 2004 21:31:13 -0000	1.12
  +++ ImportTest.java	28 Apr 2004 09:01:08 -0000	1.13
  @@ -17,6 +17,9 @@
   
   package org.apache.tools.ant.taskdefs;
   
  +import java.io.File;
  +import java.io.IOException;
  +
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.BuildFileTest;
   import org.apache.tools.ant.Location;
  @@ -109,5 +112,34 @@
               "Did not see build exception",
               false);
       }
  -}
   
  +    public void testSymlinkedImports() throws Exception {
  +        String ln = "/usr/bin/ln";
  +        if (!new File(ln).exists()) {
  +            ln = "/bin/ln";
  +        }
  +        if (!new File(ln).exists()) {
  +            // Running on Windows or something, so skip it.
  +            return;
  +        }
  +        String symlink = "src/etc/testcases/taskdefs/import/symlinks/d3b";
  +        if (Runtime.getRuntime().exec(new String[] {ln, "-s", "d3a", symlink}).waitFor()
!= 0) {
  +            throw new IOException("'" + ln + " -s d3a " + symlink + "' failed");
  +        }
  +        try {
  +            configureProject(
  +                "src/etc/testcases/taskdefs/import/symlinks/d1/p1.xml");
  +            assertPropertyEquals(
  +                "ant.file.p2",
  +                new File("src/etc/testcases/taskdefs/import/symlinks/d2/p2.xml")
  +                .getAbsolutePath());
  +            assertPropertyEquals(
  +                "ant.file.p3",
  +                new File("src/etc/testcases/taskdefs/import/symlinks/d3b/p3.xml")
  +                .getAbsolutePath());
  +        } finally {
  +            new File(symlink).delete();
  +        }
  +    }
  +
  +}
  
  
  
  1.1                  ant/src/etc/testcases/taskdefs/import/symlinks/d1/p1.xml
  
  Index: p1.xml
  ===================================================================
  <project name="p1" default="run">
      <import file="../d2/p2.xml"/>
      <import file="../d3b/p3.xml"/>
  </project>
  
  
  
  1.1                  ant/src/etc/testcases/taskdefs/import/symlinks/d2/p2.xml
  
  Index: p2.xml
  ===================================================================
  <project name="p2"/>
  
  
  
  1.1                  ant/src/etc/testcases/taskdefs/import/symlinks/d3a/p3.xml
  
  Index: p3.xml
  ===================================================================
  <project name="p3"/>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message