You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2009/07/10 21:23:14 UTC

svn commit: r793081 - in /buildr/trunk: CHANGELOG lib/buildr/ide/eclipse.rb spec/ide/eclipse_spec.rb

Author: boisvert
Date: Fri Jul 10 19:23:14 2009
New Revision: 793081

URL: http://svn.apache.org/viewvc?rev=793081&view=rev
Log:
BUILDR-295 Eclipse task: make 'M2_REPO' repository variable configurable

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/ide/eclipse.rb
    buildr/trunk/spec/ide/eclipse_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=793081&r1=793080&r2=793081&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Fri Jul 10 19:23:14 2009
@@ -3,6 +3,7 @@
 * Added:  BUILDR-56 Download Scala artifacts if not available locally
 * Added:  Mandriva (urpmi) installation support (with help from Franck Villaume).
 * Added:  BUILDR-163 cobertura:check (Marko Sibakov, Daniel Spiewak).
+* Added:  BUILDR-295 Eclipse task: make 'M2_REPO' repository variable configurable
 * Change: Monkey-Patched FileUtils::sh on JRuby to use POSIX `system`
 * Change: Updated to Rake 0.8.7, RSpec 1.2.6 and JRuby-openssl 0.5.1.
 * Fixed:  BUILDR-23 Support for setting file mode when packaging (Ittay Dror).

Modified: buildr/trunk/lib/buildr/ide/eclipse.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/eclipse.rb?rev=793081&r1=793080&r2=793081&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/eclipse.rb (original)
+++ buildr/trunk/lib/buildr/ide/eclipse.rb Fri Jul 10 19:23:14 2009
@@ -23,6 +23,28 @@
 
     include Extension
 
+    def eclipse
+        Eclipse.instance
+    end
+     
+    class Eclipse
+      include Singleton
+      
+      attr_reader :options
+       
+      def initialize
+        @options = Options.new
+      end
+    end
+     
+    class Options
+      attr_accessor :m2_repo_var
+
+      def initialize
+        @m2_repo_var = 'M2_REPO'
+      end
+    end
+    
     first_time do
       # Global task "eclipse" generates artifacts for all projects.
       desc 'Generate Eclipse artifacts for all projects'
@@ -85,7 +107,7 @@
 
               classpathentry.output project.compile.target if project.compile.target
               classpathentry.lib libs
-              classpathentry.var m2_libs, 'M2_REPO', m2repo
+              classpathentry.var m2_libs, Eclipse.instance.options.m2_repo_var, m2repo
 
               classpathentry.con 'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER' if scala
               classpathentry.con 'org.eclipse.jdt.launching.JRE_CONTAINER'
@@ -214,6 +236,9 @@
     end
 
   end
+  
+  include Eclipse
+  
 end # module Buildr
 
 

Modified: buildr/trunk/spec/ide/eclipse_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/eclipse_spec.rb?rev=793081&r1=793080&r2=793081&view=diff
==============================================================================
--- buildr/trunk/spec/ide/eclipse_spec.rb (original)
+++ buildr/trunk/spec/ide/eclipse_spec.rb Fri Jul 10 19:23:14 2009
@@ -310,4 +310,15 @@
     end
   end
   
+  describe 'maven2 repository variable' do
+    it 'should be configurable' do
+      eclipse.options.m2_repo_var = 'PROJ_REPO'
+      define('foo') { compile.using(:javac).with('com.example:library:jar:2.0') }
+      artifact('com.example:library:jar:2.0') { |task| write task.name }
+
+      task('eclipse').invoke
+      classpath_xml_elements.collect("classpathentry[@kind='var']") { |n| n.attributes['path'] }.
+        should include('PROJ_REPO/com/example/library/2.0/library-2.0.jar')
+    end
+  end
 end