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 2008/08/05 03:34:50 UTC

svn commit: r682559 - in /incubator/buildr/trunk: lib/buildr/ide/eclipse.rb spec/eclipse_spec.rb

Author: boisvert
Date: Mon Aug  4 18:34:50 2008
New Revision: 682559

URL: http://svn.apache.org/viewvc?rev=682559&view=rev
Log:
BUILDR-119: eclipse task does not accept test resource folders

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

Modified: incubator/buildr/trunk/lib/buildr/ide/eclipse.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/ide/eclipse.rb?rev=682559&r1=682558&r2=682559&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/ide/eclipse.rb (original)
+++ incubator/buildr/trunk/lib/buildr/ide/eclipse.rb Mon Aug  4 18:34:50 2008
@@ -108,9 +108,10 @@
                 end
 
                 # Test resources go in separate output directory as well
-                project.test.resources.sources.each do |path|
+                test_resource_sources = project.test.resources.sources.map { |src| relative[src] }
+                test_resource_sources.each do |path|
                   if File.exist? project.path_to(path)
-                    xml.classpathentry :kind=>'src', :path=>relative[path], :output => relative[project.test.compile.target], :excluding=>excludes
+                    xml.classpathentry :kind=>'src', :path=>path, :output => relative[project.test.compile.target], :excluding=>excludes
                   end
                 end
               end

Added: incubator/buildr/trunk/spec/eclipse_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/eclipse_spec.rb?rev=682559&view=auto
==============================================================================
--- incubator/buildr/trunk/spec/eclipse_spec.rb (added)
+++ incubator/buildr/trunk/spec/eclipse_spec.rb Mon Aug  4 18:34:50 2008
@@ -0,0 +1,77 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership.  The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+
+require File.join(File.dirname(__FILE__), 'spec_helpers')
+
+describe Buildr::Eclipse do
+
+  describe "eclipse's .classpath file" do
+    
+    describe 'source folders' do
+      
+      def classpath_sources attribute='path'
+        task('eclipse').invoke
+        REXML::Document.new(File.open('.classpath')).
+          root.elements.collect("classpathentry[@kind='src']") { |n| n.attributes[attribute] }
+      end
+
+      before do
+        write 'buildfile'
+        write 'src/main/java/Main.java'
+        write 'src/test/java/Test.java'
+      end
+      
+      it 'should accept a default main source folder' do
+        define('foo')
+        classpath_sources.should include('src/main/java')
+      end
+      
+      it 'should accept a user-defined main source folder' do
+        define('foo') { compile path_to('src/java') }
+        write 'src/java/Foo.java'
+        classpath_sources.should include('src/java')
+      end
+      
+      it 'should accept a default test source folder' do
+        define('foo')
+        classpath_sources.should include('src/test/java')
+      end
+      
+      it 'should accept a user-defined test source folder' do
+        define('foo') { test.compile path_to('src/test') }
+        classpath_sources.should include('src/test')
+      end
+      
+      it 'should accept a default main resource folder' do
+        write 'src/main/resources/config.xml'
+        define('foo')
+        classpath_sources.should include('src/main/resources')
+      end
+    
+      it 'should accept a default test resource folder' do
+        write 'src/test/resources/config-test.xml'
+        define('foo')
+        classpath_sources.should include('src/test/resources')
+      end
+    
+      it 'should ignore CVS and SVN files' do
+        define('foo')
+        classpath_sources('excluding').uniq.should == ['**/.svn/|**/CVS/']
+      end
+      
+    end
+  end
+end