Author: boisvert
Date: Wed Oct 13 05:25:33 2010
New Revision: 1021998

URL: http://svn.apache.org/viewvc?rev=1021998&view=rev
Log:
BUILDR-534 package_with_sources does not package source artifacts if no sources 
but resources exist.
(Tammo Van Lessen)

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/java/packaging.rb
    buildr/trunk/spec/java/packaging_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1021998&r1=1021997&r2=1021998&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Wed Oct 13 05:25:33 2010
@@ -19,6 +19,8 @@
 * Fixed:  BUILDR-531 Improve error message when build requires gem that can't 
be found in local/remote 
           gem repositories (Peter Donald)
 * Fixed:  BUILDR-532 package_as_source does not package resources (Tammo van 
Lessen)
+* Fixed:  BUILDR-534 package_with_sources does not package source artifacts if 
no sources but resources exist.
+          (Tammo Van Lessen)
 * Fixed:  JavaRebel was previously not correctly detected.
 
 1.4.2 (2010-09-18)

Modified: buildr/trunk/lib/buildr/java/packaging.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/packaging.rb?rev=1021998&r1=1021997&r2=1021998&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ buildr/trunk/lib/buildr/java/packaging.rb Wed Oct 13 05:25:33 2010
@@ -630,7 +630,7 @@ module Buildr
           selected = options[:only] ? projects(options[:only]) :
             options[:except] ? ([self] + projects - 
projects(options[:except])) :
             [self] + projects
-          selected.reject { |project| project.compile.sources.empty? }.
+          selected.reject { |project| project.compile.sources.empty? && 
project.resources.target.nil? }.
             each { |project| project.package(:sources) }
         end
       end

Modified: buildr/trunk/spec/java/packaging_spec.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/spec/java/packaging_spec.rb?rev=1021998&r1=1021997&r2=1021998&view=diff
==============================================================================
--- buildr/trunk/spec/java/packaging_spec.rb (original)
+++ buildr/trunk/spec/java/packaging_spec.rb Wed Oct 13 05:25:33 2010
@@ -1122,6 +1122,13 @@ describe Packaging, 'sources' do
     project('foo').packages.first.should contain('foo.properties')
   end
 
+  it 'should create sources jar if resources exists (but not sources)' do
+    write 'src/main/resources/foo.properties', 'foo=bar'
+    define('foo', :version=>'1.0') { package(:sources) }
+    project('foo').package(:sources).invoke
+    project('foo').packages.first.should contain('foo.properties')
+  end
+
   it 'should be a ZipTask' do
     define 'foo', :version=>'1.0' do
       package(:sources).should be_kind_of(ZipTask)


Reply via email to