You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/01/21 19:52:46 UTC

svn commit: r613970 - in /incubator/buildr/trunk: doc/pages/recipes.textile lib/core/common.rb lib/java/java.rb lib/java/jruby.rb

Author: assaf
Date: Mon Jan 21 10:52:44 2008
New Revision: 613970

URL: http://svn.apache.org/viewvc?rev=613970&view=rev
Log:
BUILDR-24

Modified:
    incubator/buildr/trunk/doc/pages/recipes.textile
    incubator/buildr/trunk/lib/core/common.rb
    incubator/buildr/trunk/lib/java/java.rb
    incubator/buildr/trunk/lib/java/jruby.rb

Modified: incubator/buildr/trunk/doc/pages/recipes.textile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/pages/recipes.textile?rev=613970&r1=613969&r2=613970&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/pages/recipes.textile (original)
+++ incubator/buildr/trunk/doc/pages/recipes.textile Mon Jan 21 10:52:44 2008
@@ -3,6 +3,48 @@
 Commond recipes for Buildr, collected from the mailing list.
 
 
+h2.  Java
+
+h4.  Creating a classpath
+
+For Java, the classpath argument is simply a list of paths joined with an
+OS-specific path separator:
+
+{{{!ruby
+cp = paths.join(File::PATH_SEPARATOR)
+}}}
+
+This assumes @paths@ points to files and/or directories, but what if you have a
+list of artifact specifications?  You can turn those into file names in two
+steps.  First, use @artifacts@ to return a list of file tasks that point to the
+local repository:
+
+{{{!ruby
+tasks = Buildr.artifacts(specs)
+}}}
+
+Next, map that list of tasks into list of file names (essentially calling
+@name@ on each task):
+
+{{{!ruby
+paths = tasks.map(&:name)
+}}}
+
+This works as long as the artifacts are already in your local repository,
+otherwise they can't be found, but you can ask Buildr to download them by
+calling @invoke@ on each of these tasks:
+
+{{{!ruby
+tasks = Buildr.artifacts(specs).each(&:invoke)
+}}}
+
+So let's roll this all into a single line:
+
+{{{!ruby
+cp = Buildr.artifacts(specs).each(&:invoke).map(&:name).join(File::PATH_SEPARATOR)
+}}}
+
+
 h2.  Configuration
 
 h4.  Keeping your Profiles.yaml file DRY

Modified: incubator/buildr/trunk/lib/core/common.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/core/common.rb?rev=613970&r1=613969&r2=613970&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/core/common.rb (original)
+++ incubator/buildr/trunk/lib/core/common.rb Mon Jan 21 10:52:44 2008
@@ -192,7 +192,7 @@
       # Download to a file created by the task.
       fail unless args.keys.size == 1
       uri = URI.parse(args.values.first.to_s)
-      file_create(args.keys.first).tap do |task|
+      file(args.keys.first).tap do |task|
         task.sources << uri
         task.enhance { uri.download task.name }
       end

Modified: incubator/buildr/trunk/lib/java/java.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/java.rb?rev=613970&r1=613969&r2=613970&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/java.rb (original)
+++ incubator/buildr/trunk/lib/java/java.rb Mon Jan 21 10:52:44 2008
@@ -1,5 +1,6 @@
 require 'core/project'
-ENV['JAVA_HOME'] = '/System/Library/Frameworks/JavaVM.framework/Home' if RUBY_PLATFORM =~ /darwin/i
+require 'rbconfig'
+ENV['JAVA_HOME'] = '/System/Library/Frameworks/JavaVM.framework/Home' if Config::CONFIG['host_os'] =~ /darwin/i
 if PLATFORM == 'java'
   require File.join(File.dirname(__FILE__), 'jruby')
 else

Modified: incubator/buildr/trunk/lib/java/jruby.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/jruby.rb?rev=613970&r1=613969&r2=613970&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/jruby.rb (original)
+++ incubator/buildr/trunk/lib/java/jruby.rb Mon Jan 21 10:52:44 2008
@@ -1,5 +1,4 @@
 require 'java'
-require 'rbconfig'
 
 
 # Buildr runs along side a JVM, using either RJB or JRuby.  The Java module allows