Repository: buildr
Updated Branches:
  refs/heads/master 474ab47a3 -> 79fae9f1d


BUILDR-486: Buildr-generated poms should include dependencies


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/79fae9f1
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/79fae9f1
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/79fae9f1

Branch: refs/heads/master
Commit: 79fae9f1d16b7f31d316d9b53e9c1978a66463ae
Parents: 474ab47
Author: Antoine Toulme <[email protected]>
Authored: Tue Aug 23 22:26:56 2016 -0700
Committer: Antoine Toulme <[email protected]>
Committed: Tue Aug 23 22:26:56 2016 -0700

----------------------------------------------------------------------
 addon/buildr/custom_pom.rb    |  4 ++--
 spec/addon/custom_pom_spec.rb | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/79fae9f1/addon/buildr/custom_pom.rb
----------------------------------------------------------------------
diff --git a/addon/buildr/custom_pom.rb b/addon/buildr/custom_pom.rb
index b03ac9e..b60f5ee 100644
--- a/addon/buildr/custom_pom.rb
+++ b/addon/buildr/custom_pom.rb
@@ -213,7 +213,7 @@ module Buildr
             optional_deps = 
Buildr.artifacts(project.pom.optional_dependencies).collect { |d| d.to_s }
             deps =
               Buildr.artifacts(project.compile.dependencies).
-                select { |d| d.is_a?(Artifact) }.
+                select { |d| d.is_a?(ActsAsArtifact) }.
                 collect do |d|
                 f = d.to_s
                 scope = provided_deps.include?(f) ? 'provided' :
@@ -221,7 +221,7 @@ module Buildr
                     'compile'
                 d.to_hash.merge(:scope => scope, :optional => 
optional_deps.include?(f))
               end + Buildr.artifacts(project.test.compile.dependencies).
-                select { |d| d.is_a?(Artifact) && 
!project.compile.dependencies.include?(d) }.collect { |d| 
d.to_hash.merge(:scope => 'test') }
+                select { |d| d.is_a?(ActsAsArtifact) && 
!project.compile.dependencies.include?(d) }.collect { |d| 
d.to_hash.merge(:scope => 'test') }
             deps.each do |dependency|
               xml.dependency do
                 xml.groupId dependency[:group]

http://git-wip-us.apache.org/repos/asf/buildr/blob/79fae9f1/spec/addon/custom_pom_spec.rb
----------------------------------------------------------------------
diff --git a/spec/addon/custom_pom_spec.rb b/spec/addon/custom_pom_spec.rb
index 55d5549..25e2cf5 100644
--- a/spec/addon/custom_pom_spec.rb
+++ b/spec/addon/custom_pom_spec.rb
@@ -156,6 +156,30 @@ describe Buildr::CustomPom do
       verify_dependency(@pom_xml, 'id-test', 'group', '1.0', 'test', nil)
     end
   end
+  
+  describe 'with a multi-module project' do
+    before do
+      write 'foo/src/main/java/Foo.java', 'public class Foo {}'
+      write 'bar/src/main/java/Bar.java', 'public class Bar {}'
+      define('myproject', :group => 'group', :version => '1.0') do
+        define('foo') do
+          package(:jar)
+        end
+        define(:bar) do
+          compile.with project('foo')
+          package(:jar)
+          pom.description = 'BAR Project'
+        end
+      end
+      task('package').invoke
+      
+      @pom_xml = project_pom_xml(project('myproject:bar'))
+    end
+    
+    it 'should add foo to the dependencies of bar\'s pom.xml' do
+      verify_dependency(@pom_xml, 'myproject-foo', 'group', '1.0', nil, nil)
+    end
+  end
 end
 
 end

Reply via email to