ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgl...@apache.org
Subject svn commit: r789479 - in /ant/core/trunk: docs/manual/CoreTasks/javac.html docs/manual/sysclasspath.html src/main/org/apache/tools/ant/taskdefs/Javac.java
Date Mon, 29 Jun 2009 22:42:40 GMT
Author: jglick
Date: Mon Jun 29 22:42:40 2009
New Revision: 789479

URL: http://svn.apache.org/viewvc?rev=789479&view=rev
Log:
Issue a warning in case neither includeantruntime nor build.sysclasspath were set,
since the default gives scripts an implicit environmental dependency which is often unwanted.
See also: http://www.netbeans.org/nonav/issues/show_bug.cgi?id=158958

Modified:
    ant/core/trunk/docs/manual/CoreTasks/javac.html
    ant/core/trunk/docs/manual/sysclasspath.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java

Modified: ant/core/trunk/docs/manual/CoreTasks/javac.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/javac.html?rev=789479&r1=789478&r2=789479&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/javac.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/javac.html Mon Jun 29 22:42:40 2009
@@ -290,7 +290,10 @@
   <tr>
     <td valign="top">includeAntRuntime</td>
     <td valign="top">Whether to include the Ant run-time libraries in the
-      classpath; defaults to <code>yes</code>.</td>
+      classpath; defaults to <code>yes</code>, unless
+      <a href="../sysclasspath.html"><code>build.sysclasspath</code></a>
is set.
+      <em>It is usually best to set this to false</em> so the script's behavior
is not
+      sensitive to the environment in which it is run.</td>
     <td align="center" valign="top">No</td>
   </tr>
   <tr>

Modified: ant/core/trunk/docs/manual/sysclasspath.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/sysclasspath.html?rev=789479&r1=789478&r2=789479&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/sysclasspath.html (original)
+++ ant/core/trunk/docs/manual/sysclasspath.html Mon Jun 29 22:42:40 2009
@@ -26,33 +26,34 @@
 
 <h2><a name="sysclasspath">build.sysclasspath</a></h2>
 <p>The value of the build.sysclasspath property
-control how the system classpath, ie. the classpath in effect when
-Ant is run, affects the behaviour of classpaths in Ant.
-The default behavior varies from Ant to Ant task.</p>
+controls how the system classpath, i.e. the classpath in effect when
+Ant is run, affects the behavior of classpaths in Ant.
+The default behavior varies from task to task.</p>
 
 The values and their meanings are:
 
 <table cellspacing="20">
+<tr><th>value</th><th>meaning</th></tr>
 <tr>
-<th align="left" valign="top">only</th>
+<td align="left" valign="top">only</td>
 <td>Only the system classpath is used and classpaths specified in build files,
 etc are ignored. This situation could be considered as the person running
 the build file knows more about the environment than the person writing the
-build file
+build file.
 </td>
 </tr>
 
 <tr>
-<th align="left" valign="top">ignore</th>
+<td align="left" valign="top">ignore</td>
 <td>
 The system classpath is ignored. This situation is the reverse of the
 above. The person running the build trusts the build file writer to get the
-build file right
+build file right. This mode is recommended for portable scripts.
 </td>
 </tr>
 
 <tr>
-<th align="left" valign="top">last</th>
+<td align="left" valign="top">last</td>
 <td>
 The classpath is concatenated to any specified classpaths at the end. This
 is a compromise, where the build file writer has priority.
@@ -60,7 +61,7 @@
 </tr>
 
 <tr>
-<th align="left" valign="top">first</th>
+<td align="left" valign="top">first</td>
 <td>
 Any specified classpaths are concatenated to the system classpath. This is
 the other form of compromise where the build runner has priority.
@@ -74,7 +75,5 @@
 Ant.  If the property has not been set, it defaults to "ignore" in
 this case.</p>
 
-
 </body>
 </html>
-

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java?rev=789479&r1=789478&r2=789479&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java Mon Jun 29 22:42:40 2009
@@ -104,7 +104,7 @@
     private String targetAttribute;
     private Path bootclasspath;
     private Path extdirs;
-    private boolean includeAntRuntime = true;
+    private Boolean includeAntRuntime;
     private boolean includeJavaRuntime = false;
     private boolean fork = false;
     private String forkedExecutable = null;
@@ -619,7 +619,7 @@
      * @param include if true, includes Ant's own classpath in the classpath
      */
     public void setIncludeantruntime(boolean include) {
-        includeAntRuntime = include;
+        includeAntRuntime = Boolean.valueOf(include);
     }
 
     /**
@@ -627,7 +627,7 @@
      * @return whether or not the ant classpath is to be included in the classpath
      */
     public boolean getIncludeantruntime() {
-        return includeAntRuntime;
+        return includeAntRuntime != null ? includeAntRuntime.booleanValue() : true;
     }
 
     /**
@@ -1039,6 +1039,11 @@
                                      + "\" does not exist "
                                      + "or is not a directory", getLocation());
         }
+        if (includeAntRuntime == null && getProject().getProperty("build.sysclasspath")
== null) {
+            log(getLocation() + "warning: 'includeantruntime' was not set, " +
+                    "defaulting to build.sysclasspath=last; set to false for repeatable builds",
+                    Project.MSG_WARN);
+        }
     }
 
     /**



Mime
View raw message