ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maart...@apache.org
Subject svn commit: r644522 - in /ant/ivy/core/trunk: CHANGES.txt doc/ant.html src/java/org/apache/ivy/Ivy.java src/java/org/apache/ivy/ant/IvyTask.java test/java/org/apache/ivy/ant/IvyTaskTest.java
Date Thu, 03 Apr 2008 21:42:28 GMT
Author: maartenc
Date: Thu Apr  3 14:42:27 2008
New Revision: 644522

URL: http://svn.apache.org/viewvc?rev=644522&view=rev
Log:
IMPROVEMENT: Load Ivy version number into some Ant property (IVY-790)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/doc/ant.html
    ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=644522&r1=644521&r2=644522&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Apr  3 14:42:27 2008
@@ -69,6 +69,7 @@
 - NEW: Add a new resolve mode (optionally per module) to utilize dynamic constraint rule
metadata (IVY-740)
 - NEW: Add transitive dependency version and branch override mechanism (IVY-784)
 
+- IMPROVEMENT: Load Ivy version number into some Ant property (IVY-790)
 - IMPROVEMENT: Make Ivy standalone runnable with no required dependencies (IVY-757)
 - IMPROVEMENT: add branch attribute in ivy:install task (IVY-727)
 - IMPROVEMENT: Parse description information in ivy files (IVY-766)

Modified: ant/ivy/core/trunk/doc/ant.html
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/doc/ant.html?rev=644522&r1=644521&r2=644522&view=diff
==============================================================================
--- ant/ivy/core/trunk/doc/ant.html (original)
+++ ant/ivy/core/trunk/doc/ant.html Thu Apr  3 14:42:27 2008
@@ -102,6 +102,8 @@
 </code>
 <em>For the latest version of these properties, you can check the [[svn:src/java/org/apache/ivy/core/settings/ivy.properties
svn version]].</em>
 
+<span class="since">since 2.0</span> After calling the first Ivy task, the property
ivy.version will be available and contains the version of the used Ivy library. 
+
 <h1>Ivy tasks attributes : generalities</h1>
 Some tasks attributes values may be given through different places. The three possible places
are :
 <ol>

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java?rev=644522&r1=644521&r2=644522&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java Thu Apr  3 14:42:27 2008
@@ -164,7 +164,6 @@
      * Ivy is initialized.
      * 
      * @return the current version of Ivy
-     * @see #getIvyVersion()
      */
     public static String getIvyVersion() {
         return IVY_VERSION;
@@ -176,7 +175,6 @@
      * May be empty if unknown.
      * 
      * @return the date at which this version of Ivy has been built
-     * @see #getIvyVersion()
      */
     public static String getIvyDate() {
         return IVY_DATE;

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java?rev=644522&r1=644521&r2=644522&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java Thu Apr  3 14:42:27 2008
@@ -249,6 +249,8 @@
      * Called when task starts its execution.
      */
     protected void prepareTask() {
+        getProject().setProperty("ivy.version", Ivy.getIvyVersion());
+        
         // push current project and Ivy on the stack in context
         IvyContext.pushNewCopyContext();
         IvyContext.getContext().setIvy(getIvyInstance());

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java?rev=644522&r1=644521&r2=644522&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyTaskTest.java Thu Apr  3 14:42:27 2008
@@ -33,7 +33,6 @@
     public void testDefaultSettings() throws MalformedURLException {
         Project p = new Project();
         p.setBasedir("test/repositories");
-        // p.setProperty("ivy.settings.file" , "ivysettings.xml");
         p.setProperty("myproperty", "myvalue");
         IvyTask task = new IvyTask() {
             public void doExecute() throws BuildException {
@@ -61,8 +60,6 @@
 
     public void testReferencedSettings() throws MalformedURLException {
         Project p = new Project();
-        // p.setBasedir("test/repositories");
-        // p.setProperty("ivy.settings.file" , "ivysettings.xml");
         p.setProperty("myproperty", "myvalue");
 
         IvyAntSettings antSettings = new IvyAntSettings();
@@ -90,7 +87,18 @@
         assertEquals(new File("test/repositories").getAbsolutePath(), settings.getVariables().getVariable(
             "ivy.settings.dir"));
         assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
-
     }
 
+    public void testIvyVersionAsAntProperty() {
+        Project p = new Project();
+        p.setBasedir("test/repositories");
+        IvyTask task = new IvyTask() {
+            public void doExecute() throws BuildException {
+            }
+        };
+        task.setProject(p);
+        task.execute();
+
+        assertNotNull(p.getProperty("ivy.version"));                
+    }
 }



Mime
View raw message