Author: assaf
Date: Mon Sep 22 10:27:46 2008
New Revision: 697905
URL: http://svn.apache.org/viewvc?rev=697905&view=rev
Log:
To illustrate, Ant replaces VERSION and REQUIRES with Ant.version and
Ant.dependencies. The former accepts a version number from buildr.yaml, and if
not there, picks the default.
Modified:
incubator/buildr/trunk/lib/buildr/java/ant.rb
Modified: incubator/buildr/trunk/lib/buildr/java/ant.rb
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/java/ant.rb?rev=697905&r1=697904&r2=697905&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/java/ant.rb (original)
+++ incubator/buildr/trunk/lib/buildr/java/ant.rb Mon Sep 22 10:27:46 2008
@@ -24,10 +24,28 @@
# Which version of Ant we're using by default.
VERSION = '1.7.1' unless const_defined?('VERSION')
+
+ class << self
+ # Current version of Ant being used.
+ def version
+ Buildr.settings.build['ant'] || VERSION
+ end
+
+ # Ant classpath dependencies.
+ def dependencies
+ ["org.apache.ant:ant:jar:#{version}",
"org.apache.ant:ant-launcher:jar:#{version}"]
+ end
+
+ private
+ def const_missing(const)
+ return super unless const == :REQUIRES # TODO: remove in 1.5
+ Buildr.application.deprecated "Please use Ant.version/dependencies
instead of VERSION/REQUIRES"
+ dependencies
+ end
+ end
+
- # Libraries used by Ant.
- REQUIRES = "org.apache.ant:ant:jar:#{VERSION}",
"org.apache.ant:ant-launcher:jar:#{VERSION}"
- Java.classpath << REQUIRES
+ Java.classpath << lambda { Ant.dependencies }
# :call-seq:
# ant(name) { |AntProject| ... } => AntProject
@@ -65,7 +83,7 @@
Buildr.help do
Java.load
- "\nUsing Java #{ENV_JAVA['java.version']}, Ant #{Ant::VERSION}."
+ "\nUsing Java #{ENV_JAVA['java.version']}, Ant #{Ant.version}."
end
end