ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r677914 - in /ant/core/trunk/src: main/org/apache/tools/ant/Project.java main/org/apache/tools/ant/taskdefs/Ant.java main/org/apache/tools/ant/taskdefs/SubAnt.java tests/antunit/taskdefs/subant-test.xml
Date Fri, 18 Jul 2008 14:21:39 GMT
Author: bodewig
Date: Fri Jul 18 07:21:38 2008
New Revision: 677914

URL: http://svn.apache.org/viewvc?rev=677914&view=rev
Log:
new attribute allowNativeBasedir for <ant>.  Not yet documented.  Not yet complete (doesn't
work when basedir is a user or inherited property).  Work in progress.  Needed for PR 30569.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/Project.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java
    ant/core/trunk/src/tests/antunit/taskdefs/subant-test.xml

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Project.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Project.java?rev=677914&r1=677913&r2=677914&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Project.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Project.java Fri Jul 18 07:21:38 2008
@@ -822,7 +822,7 @@
         this.baseDir = baseDir;
         setPropertyInternal(MagicNames.PROJECT_BASEDIR, this.baseDir.getPath());
         String msg = "Project base dir set to: " + this.baseDir;
-         log(msg, MSG_VERBOSE);
+        log(msg, MSG_VERBOSE);
     }
 
     /**

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java?rev=677914&r1=677913&r2=677914&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java Fri Jul 18 07:21:38 2008
@@ -107,6 +107,15 @@
     private boolean targetAttributeSet = false;
 
     /**
+     * Whether the basedir of the new project should be the same one
+     * as it would be when running the build file directly -
+     * independent of dir and/or inheritAll settings.
+     *
+     * @since Ant 1.8.0
+     */
+    private boolean allowNativeBasedir = false;
+
+    /**
      * simple constructor
      */
     public Ant() {
@@ -121,6 +130,16 @@
         bindToOwner(owner);
     }
 
+    /**
+     * Whether the basedir of the new project should be the same one
+     * as it would be when running the build file directly -
+     * independent of dir and/or inheritAll settings.
+     *
+     * @since Ant 1.8.0
+     */
+    public void setAllowNativeBasedir(boolean b) {
+        allowNativeBasedir = b;
+    }
 
     /**
      * If true, pass all properties to the new Ant project.
@@ -321,12 +340,14 @@
             initializeProject();
 
             if (dir != null) {
+                if (!allowNativeBasedir) {
                 newProject.setBaseDir(dir);
                 if (savedDir != null) {
                     // has been set explicitly
                     newProject.setInheritedProperty(MagicNames.PROJECT_BASEDIR,
                                                     dir.getAbsolutePath());
                 }
+                }
             } else {
                 dir = getProject().getBaseDir();
             }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java?rev=677914&r1=677913&r2=677914&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SubAnt.java Fri Jul 18 07:21:38
2008
@@ -553,6 +553,8 @@
 
         if (directory != null) {
             antTask.setDir(directory);
+        } else {
+            antTask.setAllowNativeBasedir(true);
         }
 
         antTask.setInheritAll(inheritAll);

Modified: ant/core/trunk/src/tests/antunit/taskdefs/subant-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/subant-test.xml?rev=677914&r1=677913&r2=677914&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/subant-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/subant-test.xml Fri Jul 18 07:21:38 2008
@@ -59,4 +59,10 @@
          target="testSubAntDoesntSetBasedir"/>
   </target>
 
+  <target name="testSubAntDoesntSetBasedirAfterAntWithDirWhenNativeDir">
+    <ant antfile="${ant.file}" dir="${basedir}"
+         target="testSubAntDoesntSetBasedir"
+         allowNativeBaseDir="true"/>
+  </target>
+
 </project>



Mime
View raw message