Author: boisvert
Date: Mon Sep 14 22:22:18 2009
New Revision: 814886

URL: http://svn.apache.org/viewvc?rev=814886&view=rev
Log:
BUILDR-315: Fix Eclipse .classpath for local libraries (Mat Schaffer)

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=814886&r1=814885&r2=814886&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Mon Sep 14 22:22:18 2009
@@ -1,4 +1,5 @@
 1.3.5 (Pending)
+* Fixed:  BUILDR-315: Fix Eclipse .classpath for local libraries (Mat Schaffer)
 * Added:  BUILDR-300: Make Eclipse task more configurable (Antoine Toulme, 
Alex Boisvert)
 * Fixed:  BUILDR-307 Failures are not reported correctly for ScalaTest 
(Jeremie Lenfant-Engelmann)
 * Fixed:  BUILDR-278 tasks/*.rake files are loaded after the buildfile (Rhett 
Sutphin)

Modified: buildr/trunk/lib/buildr/ide/eclipse.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/eclipse.rb?rev=814886&r1=814885&r2=814886&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/eclipse.rb (original)
+++ buildr/trunk/lib/buildr/ide/eclipse.rb Mon Sep 14 22:22:18 2009
@@ -175,8 +175,8 @@
               # Separate artifacts from Maven2 repository
               m2_libs, others = others.partition { |path| 
path.to_s.index(m2repo) == 0 }
 
-              # Generated: classpath elements in the project are assumed to be 
generated
-              generated, libs = others.partition { |path| 
path.to_s.index(project.path_to.to_s) == 0 }
+              # Generated: Any non-file classpath elements in the project are 
assumed to be generated
+              libs, generated = others.partition { |path| 
File.file?(path.to_s) }
 
               classpathentry.src project.compile.sources + generated
               classpathentry.src project.resources

Modified: buildr/trunk/spec/ide/eclipse_spec.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/spec/ide/eclipse_spec.rb?rev=814886&r1=814885&r2=814886&view=diff
==============================================================================
--- buildr/trunk/spec/ide/eclipse_spec.rb (original)
+++ buildr/trunk/spec/ide/eclipse_spec.rb Mon Sep 14 22:22:18 2009
@@ -354,6 +354,30 @@
     end
   end
 
+  describe 'local dependency' do
+    before do
+      write 'lib/some-local.jar'
+      define('foo') { compile.using(:javac).with(_('lib/some-local.jar')) }
+    end
+    
+    it 'should have a lib artifact reference in the .classpath file' do
+      classpath_xml_elements.collect("classpathent...@kind='lib']") { |n| 
n.attributes['path'] }.
+        should include(File.expand_path 'lib/some-local.jar')
+    end
+  end
+
+  describe 'generated .classes' do
+    before do
+      write 'lib/some.class'
+      define('foo') { compile.using(:javac).with(_('lib')) }
+    end
+    
+    it 'should have src reference in the .classpath file' do
+      classpath_xml_elements.collect("classpathent...@kind='src']") { |n| 
n.attributes['path'] }.
+        should include('lib')
+    end
+  end
+
   describe 'maven2 artifact dependency' do
     before do
       define('foo') { 
compile.using(:javac).with('com.example:library:jar:2.0') }


Reply via email to