Author: toulmean
Date: Thu Jul  1 07:12:06 2010
New Revision: 959543

URL: http://svn.apache.org/viewvc?rev=959543&view=rev
Log:
BUILDR-461 Packages with different ids collide

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

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=959543&r1=959542&r2=959543&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Jul  1 07:12:06 2010
@@ -3,6 +3,7 @@
 * Added:  BUILDR-425 Specify dev dependencies in .gemspec
 * Change: BUILDR-459 Update gemspec to accept json_pure ~> 1.4.3
 * Fixed:  BUILDR-455 cc_spec.rb l 160 depends on time and thus fails 
intermittently
+* Fixed:  BUILDR-461 Packages with different ids collide
 
 1.4.0 (2010-06-18)
 * Added:  BUILDR-405 Enhance the idea7x extension to supply a task to delete 
generated files

Modified: buildr/trunk/lib/buildr/packaging/package.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/package.rb?rev=959543&r1=959542&r2=959543&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/package.rb (original)
+++ buildr/trunk/lib/buildr/packaging/package.rb Thu Jul  1 07:12:06 2010
@@ -151,7 +151,7 @@ module Buildr
           spec = send("package_as_#{spec[:type]}_spec", spec) if 
respond_to?("package_as_#{spec[:type]}_spec")
           file_name = path_to(:target, Artifact.hash_to_file_name(spec))
         end
-        package = (no_options && packages.detect { |pkg| pkg.type == 
spec[:type] &&
+        package = (no_options && packages.detect { |pkg| pkg.type == 
spec[:type] && pkg.id == spec[:id] &&
           (pkg.respond_to?(:classifier) ? pkg.classifier : nil) == 
spec[:classifier]}) ||
           packages.find { |pkg| pkg.name == file_name } ||
           packager.call(file_name)

Modified: buildr/trunk/spec/packaging/packaging_spec.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/packaging_spec.rb?rev=959543&r1=959542&r2=959543&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/packaging_spec.rb (original)
+++ buildr/trunk/spec/packaging/packaging_spec.rb Thu Jul  1 07:12:06 2010
@@ -263,7 +263,15 @@ describe Project, '#package' do
     end
     project('foo').packages.uniq.size.should be(5)
   end
-
+  
+  it 'should create different tasks for package with different ids' do
+    define 'foo', :version=>'1.0' do
+      package(:jar, :id=>'bar')
+      package(:jar)
+    end
+    project('foo').packages.uniq.size.should be(2)
+  end
+    
   it 'should create different tasks for package with classifier' do
     define 'foo', :version=>'1.0' do
       package(:jar)


Reply via email to