ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r388848 - in /ant/core/trunk/src/main/org/apache/tools/ant: Diagnostics.java MagicNames.java Main.java Project.java
Date Sat, 25 Mar 2006 22:35:36 GMT
Author: jkf
Date: Sat Mar 25 14:35:34 2006
New Revision: 388848

URL: http://svn.apache.org/viewcvs?rev=388848&view=rev
Log:
Adding property storing the ant core library.

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java
    ant/core/trunk/src/main/org/apache/tools/ant/MagicNames.java
    ant/core/trunk/src/main/org/apache/tools/ant/Main.java
    ant/core/trunk/src/main/org/apache/tools/ant/Project.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java?rev=388848&r1=388847&r2=388848&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Diagnostics.java Sat Mar 25 14:35:34 2006
@@ -263,6 +263,9 @@
             ignoreThrowable(e);
             out.println("optional tasks : not available");
         }
+        
+        header(out, "ANT PROPERTIES");
+        doReportAntProperties(out);
 
         header(out, "ANT_HOME/lib jar listing");
         doReportAntHomeLibraries(out);
@@ -328,6 +331,18 @@
         }
     }
 
+    /**
+     * Report the content of ANT_HOME/lib directory
+     * @param out the stream to print the content to
+     */
+    private static void doReportAntProperties(PrintStream out) {
+        Project p = new Project();
+        p.initProperties();
+        out.println(MagicNames.ANT_VERSION + ": " + p.getProperty(MagicNames.ANT_VERSION));
+        out.println(MagicNames.ANT_JAVA_VERSION + ": " + p.getProperty(MagicNames.ANT_JAVA_VERSION));
+        out.println(MagicNames.ANT_LIB + ": " + p.getProperty(MagicNames.ANT_LIB));
+        out.println(MagicNames.ANT_HOME + ": " + p.getProperty(MagicNames.ANT_HOME));
+    }
 
     /**
      * Report the content of ANT_HOME/lib directory

Modified: ant/core/trunk/src/main/org/apache/tools/ant/MagicNames.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/MagicNames.java?rev=388848&r1=388847&r2=388848&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/MagicNames.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/MagicNames.java Sat Mar 25 14:35:34 2006
@@ -106,13 +106,21 @@
 
     /**
      * Property used to store the java version ant is running in.
+     * @since Ant 1.7
      */
     public static final String ANT_JAVA_VERSION = "ant.java.version";
 
     /**
      * Property used to store the location of ant.
+     * @since Ant 1.7
      */
     public static final String ANT_HOME = "ant.home";
+
+    /**
+     * Property used to store the location of the ant library (typically the ant.jar file.)
+     * @since Ant 1.7
+     */
+    public static final String ANT_LIB = "ant.core.lib";
 
     /**
      * property for regular expression implementation.

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Main.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/Main.java?rev=388848&r1=388847&r2=388848&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Main.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Main.java Sat Mar 25 14:35:34 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2005 The Apache Software Foundation
+ * Copyright 2000-2006 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
@@ -638,7 +638,6 @@
 
 
                 project.init();
-                project.setUserProperty(MagicNames.ANT_VERSION, getAntVersion());
 
                 // set user-define properties
                 Enumeration e = definedProps.keys();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/Project.java
URL: http://svn.apache.org/viewcvs/ant/core/trunk/src/main/org/apache/tools/ant/Project.java?rev=388848&r1=388847&r2=388848&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 Sat Mar 25 14:35:34 2006
@@ -193,7 +193,7 @@
      * @deprecated
      */
     public static final String ANT_JAVA_VERSION = MagicNames.ANT_JAVA_VERSION;
-    
+
     /**
      * Set the input handler.
      *
@@ -282,14 +282,29 @@
      * @exception BuildException if the default task list cannot be loaded.
      */
     public void init() throws BuildException {
-        setJavaVersionProperty();
+        initProperties();
 
         ComponentHelper.getComponentHelper(this).initDefaultDefinitions();
+    }
 
+    /**
+     * Initializes the properties.
+     * @exception BuildException if an vital property could not be set.
+     * @since Ant 1.7
+     */
+    public void initProperties() throws BuildException {
+        setJavaVersionProperty();
         setSystemProperties();
+        setPropertyInternal(MagicNames.ANT_VERSION, Main.getAntVersion());
+        setAntLib();
     }
 
-
+    private void setAntLib() {
+        File antlib = org.apache.tools.ant.launch.Locator.getClassSource(Project.class);
+        if (antlib != null) {
+            setPropertyInternal(MagicNames.ANT_LIB, antlib.getAbsolutePath());
+        }
+    }
     /**
      * Factory method to create a class loader for loading classes from
      * a given path.



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


Mime
View raw message