buildr 1.4.7.pre2 → 1.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/CHANGELOG +24 -2
  2. data/Rakefile +4 -1
  3. data/addon/buildr/{checkstyle.rake → checkstyle.rb} +0 -0
  4. data/addon/buildr/{findbugs.rake → findbugs.rb} +0 -0
  5. data/addon/buildr/gwt.rake +82 -0
  6. data/addon/buildr/{javancss.rake → javancss.rb} +0 -0
  7. data/addon/buildr/jdepend.rb.orig +178 -0
  8. data/addon/buildr/nailgun.rb +2 -2
  9. data/addon/buildr/{pmd.rake → pmd.rb} +3 -1
  10. data/addon/buildr/sonar.rb +142 -0
  11. data/buildr.gemspec +21 -17
  12. data/doc/installing.textile.orig +282 -0
  13. data/doc/more_stuff.textile +31 -0
  14. data/doc/more_stuff.textile.orig +1004 -0
  15. data/etc/KEYS +44 -0
  16. data/lib/buildr.rb +3 -3
  17. data/lib/buildr/core/doc.rb +9 -3
  18. data/lib/buildr/core/generate.rb +2 -2
  19. data/lib/buildr/core/run.rb +1 -1
  20. data/lib/buildr/core/shell.rb +1 -1
  21. data/lib/buildr/core/test.rb +1 -1
  22. data/lib/buildr/core/util.rb +2 -2
  23. data/lib/buildr/ide/eclipse.rb +4 -4
  24. data/lib/buildr/ide/idea.rb +184 -1
  25. data/lib/buildr/java/ant.rb +2 -3
  26. data/lib/buildr/java/bdd.rb +4 -4
  27. data/lib/buildr/java/pom.rb +5 -4
  28. data/lib/buildr/java/rjb.rb +1 -1
  29. data/lib/buildr/java/test_result.rb +4 -0
  30. data/lib/buildr/packaging/version_requirement.rb +1 -1
  31. data/lib/buildr/packaging/zip.rb +1 -1
  32. data/lib/buildr/run.rb +3 -2
  33. data/lib/buildr/scala/org/apache/buildr/Specs2Runner.class +0 -0
  34. data/lib/buildr/version.rb +1 -1
  35. data/rakelib/doc.rake +5 -5
  36. data/rakelib/package.rake +3 -3
  37. data/rakelib/rspec.rake +22 -4
  38. data/rakelib/stage.rake +16 -12
  39. data/spec/core/application_spec.rb +1 -1
  40. data/spec/core/cc_spec.rb +12 -4
  41. data/spec/core/doc_spec.rb +1 -1
  42. data/spec/core/run_spec.rb +17 -4
  43. data/spec/core/test_spec.rb +5 -3
  44. data/spec/ide/idea_spec.rb +2 -2
  45. data/spec/java/cobertura_spec.rb +4 -0
  46. data/spec/java/emma_spec.rb +4 -1
  47. data/spec/java/java_spec.rb +1 -1
  48. data/spec/java/pom_spec.rb +125 -0
  49. data/spec/packaging/archive_spec.rb +1 -1
  50. data/spec/packaging/artifact_spec.rb +1 -1
  51. data/spec/sandbox.rb +4 -0
  52. data/spec/spec_helpers.rb +6 -1
  53. data/spec/version_requirement_spec.rb +2 -0
  54. metadata +390 -239
@@ -74,7 +74,7 @@ module Java
74
74
 
75
75
  # On OS X we know where the default JDK is. We can try to guess for other OS.
76
76
  # We set JAVA_HOME early so we can use it without calling Java.load first.
77
- ENV['JAVA_HOME'] ||= '/System/Library/Frameworks/JavaVM.framework/Home' if Config::CONFIG['host_os'] =~ /darwin/i
77
+ ENV['JAVA_HOME'] ||= '/System/Library/Frameworks/JavaVM.framework/Home' if RbConfig::CONFIG['host_os'] =~ /darwin/i
78
78
 
79
79
  class << self
80
80
 
@@ -13,6 +13,10 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
+ # It is necessary to require these files here as the bdd plugin directly includes this file
17
+ require 'yaml'
18
+ require 'rspec/core/formatters/base_formatter'
19
+
16
20
  module Buildr #:nodoc:
17
21
  module TestFramework
18
22
 
@@ -49,7 +49,7 @@ module Buildr
49
49
  class << self
50
50
  # is +str+ a version string?
51
51
  def version?(str)
52
- /^\s*\d[#{VER_CHARS}]*\s*$/ === str
52
+ /^\s*r?\d[#{VER_CHARS}]*\s*$/ === str
53
53
  end
54
54
 
55
55
  # is +str+ a version requirement?
@@ -177,7 +177,7 @@ module Zip #:nodoc:
177
177
 
178
178
  class ZipEntrySet
179
179
  def <<(entry)
180
- @entrySet[entry.to_s] = entry if entry != nil
180
+ @entrySet[entry.name.to_s] = entry if entry != nil
181
181
  end
182
182
  end
183
183
  end
@@ -171,8 +171,9 @@ module Buildr
171
171
  end
172
172
 
173
173
  after_define(:run => :test) do |project|
174
- project.run.with project.test.compile.dependencies
175
- project.run.with project.test.compile.target if project.test.compile.target
174
+ project.run.with project.compile.dependencies
175
+ project.run.with project.resources.target if project.resources.target
176
+ project.run.with project.compile.target if project.compile.target
176
177
  end
177
178
 
178
179
  # :call-seq:
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module Buildr
17
- VERSION = '1.4.7.pre2'.freeze
17
+ VERSION = '1.4.7'.freeze
18
18
  end
@@ -14,8 +14,8 @@
14
14
  # the License.
15
15
 
16
16
  if !RUBY_PLATFORM[/java/]
17
+ gem 'rdoc'
17
18
  require 'rdoc/task'
18
-
19
19
  desc "Creates a symlink to rake's lib directory to support combined rdoc generation"
20
20
  file "rake/lib" do
21
21
  rake_path = $LOAD_PATH.find { |p| File.exist? File.join(p, "rake.rb") }
@@ -24,7 +24,7 @@ if !RUBY_PLATFORM[/java/]
24
24
  end
25
25
 
26
26
  desc "Generate RDoc documentation in rdoc/"
27
- Rake::RDocTask.new :rdoc do |rdoc|
27
+ RDoc::Task.new :rdoc do |rdoc|
28
28
  rdoc.rdoc_dir = 'rdoc'
29
29
  rdoc.title = spec.name
30
30
  rdoc.options = spec.rdoc_options.clone
@@ -66,8 +66,8 @@ if !RUBY_PLATFORM[/java/]
66
66
  puts "Buildr uses the jekyll gem to generate the Web site. You can install it by running bundler"
67
67
  end
68
68
 
69
- if `pygmentize -V`.empty?
70
- puts "Buildr uses the Pygments python library. You can install it by running 'sudo easy_install Pygments'"
69
+ if 0 == system("pygmentize -V > /dev/null 2> /dev/null")
70
+ puts "Buildr uses the Pygments python library. You can install it by running 'sudo easy_install Pygments' or 'sudo apt-get install python-pygments'"
71
71
  end
72
72
 
73
73
  desc "Generate Buildr documentation as buildr.pdf"
@@ -79,7 +79,7 @@ if !RUBY_PLATFORM[/java/]
79
79
  desc "Build a copy of the Web site in the ./_site"
80
80
  task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr.pdf'] do
81
81
  cp_r 'rdoc', '_site'
82
- fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/files/lib/buildr_rb.html')
82
+ fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/lib/buildr_rb.html')
83
83
  cp '_reports/specs.html', '_site'
84
84
  cp_r '_reports/coverage', '_site'
85
85
  fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
@@ -25,7 +25,7 @@ end
25
25
  desc "Install Buildr from source"
26
26
  task :install=>["#{package.package_dir}/#{package.gem_spec.file_name}"] do |task|
27
27
  print "Installing #{spec.name} ... "
28
- args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{package.package_dir}/#{package.gem_spec.file_name}"
28
+ args = RbConfig::CONFIG['ruby_install_name'], '-S', 'gem', 'install', "#{package.package_dir}/#{package.gem_spec.file_name}"
29
29
  args.unshift('sudo') if sudo_needed?
30
30
  sh *args
31
31
  puts "[x] Installed Buildr #{spec.version}"
@@ -34,7 +34,7 @@ end
34
34
  desc "Uninstall previous rake install"
35
35
  task :uninstall do |task|
36
36
  puts "Uninstalling #{spec.name} ... "
37
- args = Config::CONFIG['ruby_install_name'], '-S', 'gem', 'uninstall', spec.name, '--version', spec.version.to_s
37
+ args = RbConfig::CONFIG['ruby_install_name'], '-S', 'gem', 'uninstall', spec.name, '--version', spec.version.to_s
38
38
  args.unshift('sudo') if sudo_needed?
39
39
  sh *args
40
40
  puts "[x] Uninstalled Buildr #{spec.version}"
@@ -44,7 +44,7 @@ end
44
44
  desc "Compile Java libraries used by Buildr"
45
45
  task :compile do
46
46
  puts "Compiling Java libraries ..."
47
- args = Config::CONFIG['ruby_install_name'], File.expand_path(RUBY_PLATFORM[/java/] ? '_jbuildr' : '_buildr'), '--buildfile', 'buildr.buildfile', 'compile'
47
+ args = RbConfig::CONFIG['ruby_install_name'], File.expand_path(RUBY_PLATFORM[/java/] ? '_jbuildr' : '_buildr'), '--buildfile', 'buildr.buildfile', 'compile'
48
48
  args << '--trace' if Rake.application.options.trace
49
49
  sh *args
50
50
  end
@@ -65,19 +65,37 @@ begin
65
65
  desc 'Run all specs with CI reporter'
66
66
  task :ci=>[:load_ci_reporter, :spec]
67
67
 
68
+ def rvm_run_in(version, command)
69
+ if !(Config::CONFIG['host_os'] =~ /mswin|win32|dos/i)
70
+ cmd_prefix = "rvm #{version} exec"
71
+ sh "rm -f Gemfile.lock; #{cmd_prefix} bundle install; #{cmd_prefix} bundle exec #{command}"
72
+ else
73
+ sh "#{version =~ /jruby/ ? "j" : ""}ruby -S #{command}"
74
+ end
75
+ end
76
+
68
77
  # Useful for testing with JRuby when using Ruby and vice versa.
69
78
  namespace :spec do
70
- desc "Run all specs specifically with Ruby"
71
- task :ruby do
79
+ desc "Run all specs specifically with Ruby 1.9"
80
+ task :ruby_1_9 do
72
81
  puts "Running test suite using Ruby ..."
73
- sh 'ruby -S rake spec'
82
+ rvm_run_in("ruby-1.9.2-p320@buildr", "rake spec")
83
+ end
84
+
85
+ desc "Run all specs specifically with Ruby 1.8"
86
+ task :ruby_1_8 do
87
+ puts "Running test suite using Ruby ..."
88
+ rvm_run_in("ruby-1.8.7-p358@buildr", "rake spec")
74
89
  end
75
90
 
76
91
  desc "Run all specs specifically with JRuby"
77
92
  task :jruby do
78
93
  puts "Running test suite using JRuby ..."
79
- sh 'jruby -S rake spec'
94
+ rvm_run_in("jruby-1.6.7@buildr", "rake spec")
80
95
  end
96
+
97
+ desc "Run all specs across various rubies"
98
+ task :all => [:jruby, :ruby_1_8, :ruby_1_9]
81
99
  end
82
100
 
83
101
  task :clobber do
@@ -13,13 +13,15 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
-
16
+ require 'rubyforge'
17
17
  require 'digest/md5'
18
18
  require 'digest/sha1'
19
19
 
20
20
  gpg_cmd = 'gpg2'
21
21
 
22
22
  task :prepare do |task, args|
23
+ gpg_arg = args.gpg || ENV['gpg']
24
+
23
25
  # Make sure we're doing a release from checked code.
24
26
  lambda do
25
27
  puts "Checking there are no local changes ... "
@@ -41,24 +43,24 @@ task :prepare do |task, args|
41
43
 
42
44
  # Need GPG to sign the packages.
43
45
  lambda do
44
- args.gpg or fail "Please run with gpg=<argument for gpg --local-user>"
45
- gpg_ok = `gpg2 --list-keys #{args.gpg}`
46
+ gpg_arg or fail "Please run with gpg=<argument for gpg --local-user>"
47
+ gpg_ok = `gpg2 --list-keys #{gpg_arg}` rescue nil
46
48
  if !$?.success?
47
- gpg_ok = `gpg --list-keys #{args.gpg}`
49
+ gpg_ok = `gpg --list-keys #{gpg_arg}`
48
50
  gpg_cmd = 'gpg'
49
51
  end
50
- fail "No GPG user #{args.gpg}" if gpg_ok.empty?
52
+ fail "No GPG user #{gpg_arg}" if gpg_ok.empty?
51
53
  end.call
52
54
 
53
55
  task(:license).invoke
54
56
 
55
57
  # Need JRuby, Scala and Groovy installed to run all the specs.
56
58
  lambda do
57
- puts "Checking that we have JRuby, Scala and Groovy available ... "
58
- sh 'jruby --version'
59
- sh 'scala -version'
59
+ puts "Checking that we have Scala and Groovy available ... "
60
+ `scala -version`
61
+ $?.exitstatus == 1 or fail "Scala is not installed"
60
62
  sh 'groovy -version'
61
- puts "[X] We have JRuby, Scala and Groovy"
63
+ puts "[X] We have Scala and Groovy"
62
64
  end.call
63
65
 
64
66
  # Need Prince to generate PDF
@@ -77,11 +79,13 @@ task :prepare do |task, args|
77
79
  end.call
78
80
 
79
81
  # We will be speccing in one platform, so also spec the other one.
80
- task(RUBY_PLATFORM =~ /java/ ? 'spec:ruby' : 'spec:jruby').invoke # Test the *other* platform
82
+ task('spec:ruby_1_9').invoke unless RUBY_VERSION >= '1.9' && !RUBY_PLATFORM[/java/]
83
+ task('spec:ruby_1_8').invoke unless RUBY_VERSION >= '1.8.7' && !RUBY_PLATFORM[/java/]
84
+ task('spec:jruby').invoke unless RUBY_PLATFORM[/java/]
81
85
  end
82
86
 
83
-
84
87
  task :stage=>[:clobber, :prepare] do |task, args|
88
+ gpg_arg = args.gpg || ENV['gpg']
85
89
  mkpath '_staged'
86
90
 
87
91
  # Start by figuring out what has changed.
@@ -110,7 +114,7 @@ task :stage=>[:clobber, :prepare] do |task, args|
110
114
  bytes = File.open(pkg, 'rb') { |file| file.read }
111
115
  File.open(pkg + '.md5', 'w') { |file| file.write Digest::MD5.hexdigest(bytes) << ' ' << File.basename(pkg) }
112
116
  File.open(pkg + '.sha1', 'w') { |file| file.write Digest::SHA1.hexdigest(bytes) << ' ' << File.basename(pkg) }
113
- sh gpg_cmd, '--local-user', args.gpg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
117
+ sh gpg_cmd, '--local-user', gpg_arg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
114
118
  end
115
119
  cp 'etc/KEYS', '_staged/dist'
116
120
  puts "[X] Created and signed release packages in _staged/dist"
@@ -133,7 +133,7 @@ describe Buildr::Application do
133
133
  write 'build.yaml', <<-YAML
134
134
  gems:
135
135
  - rake
136
- - rspec ~> 2.1.0
136
+ - rspec ~> 2.9.0
137
137
  YAML
138
138
  Buildr.application.should_receive(:listed_gems).and_return([[Gem.loaded_specs['rspec'],Gem.loaded_specs['rake']],[]])
139
139
  Buildr.application.load_gems
@@ -92,21 +92,29 @@ describe Buildr::CCTask do
92
92
  foo.cc.invoke
93
93
  rescue => e
94
94
  p "unexpected exception #{e.inspect}"
95
- p e.backtrace.join("\n").inspect
95
+ p e.backtrace.join("\n")
96
96
  end
97
97
  end
98
98
 
99
- sleep 1
99
+ #Ick! Try to get the sleeping enough on each platform that the tests reliably pass
100
+ sleep 1 if RUBY_VERSION >= '1.9' && !RUBY_PLATFORM[/java/]
101
+ sleep 5 if RUBY_VERSION >= '1.8.7' && !RUBY_PLATFORM[/java/]
102
+ sleep 1 if RUBY_PLATFORM[/java/]
100
103
 
101
104
  foo.compile.run_count.should == 1
102
105
  foo.test.compile.run_count.should == 1
103
106
  foo.resources.run_count.should == 1
104
107
 
105
- sleep 1 # Wait one sec as the timestamp needs to be different.
108
+ # Wait some time as the timestamp needs to be different on files.
109
+ sleep 3 if Buildr::Util.win_os?
110
+ sleep 1 unless Buildr::Util.win_os?
106
111
 
107
112
  touch File.join(Dir.pwd, 'src/main/java/Example.java')
108
113
 
109
- sleep 1
114
+ #Ick! Try to get the sleeping enough on each platform that the tests reliably pass
115
+ sleep 1 if RUBY_VERSION >= '1.9' && !RUBY_PLATFORM[/java/]
116
+ sleep 5 if RUBY_VERSION >= '1.8.7' && !RUBY_PLATFORM[/java/]
117
+ sleep 1 if RUBY_PLATFORM[/java/]
110
118
 
111
119
  foo.compile.run_count.should == 2
112
120
  foo.test.compile.run_count.should == 2
@@ -124,7 +124,7 @@ describe Project, '#doc' do
124
124
  compile.using(:javac)
125
125
  doc.include included
126
126
  end
127
- project('foo').doc.source_files.should include(included)
127
+ project('foo').doc.source_files.should include(File.expand_path(included))
128
128
  end
129
129
 
130
130
  it 'should respond to exclude() and return self' do
@@ -27,13 +27,20 @@ describe Project, :run do
27
27
  project('foo').run.should be_kind_of(Run::RunTask)
28
28
  end
29
29
 
30
- it 'should include compile and test.compile dependencies' do
30
+ it 'should include compile dependencies' do
31
31
  define('foo') do
32
32
  compile.using(:javac).with 'group:compile:jar:1.0'
33
33
  test.compile.using(:javac).with 'group:test:jar:1.0'
34
34
  end
35
35
  project('foo').run.classpath.should include(artifact('group:compile:jar:1.0'))
36
- project('foo').run.classpath.should include(artifact('group:test:jar:1.0'))
36
+ end
37
+
38
+ it 'should not include test dependencies' do
39
+ define('foo') do
40
+ compile.using(:javac).with 'group:compile:jar:1.0'
41
+ test.compile.using(:javac).with 'group:test:jar:1.0'
42
+ end
43
+ project('foo').run.classpath.should_not include(artifact('group:test:jar:1.0'))
37
44
  end
38
45
 
39
46
  it 'should respond to using() and return self' do
@@ -63,11 +70,17 @@ describe Project, :run do
63
70
  end
64
71
  project('foo').run.runner.should be_a(Run::JavaRunner)
65
72
  end
73
+
74
+ it "should run with the project resources" do
75
+ write 'src/main/java/Test.java', 'class Test {}'
76
+ write 'src/main/resources/test.properties', ''
77
+ define 'foo'
78
+ project('foo').run.classpath.should include project('foo').resources.target
79
+ end
66
80
 
67
- it 'should depend on project''s compile and test.compile task' do
81
+ it 'should depend on project''s compile task' do
68
82
  define 'foo'
69
83
  project('foo').run.prerequisites.should include(project('foo').compile)
70
- project('foo').run.prerequisites.should include(project('foo').test)
71
84
  end
72
85
 
73
86
  it 'should be local task' do
@@ -747,9 +747,11 @@ describe Rake::Task, 'test' do
747
747
  end
748
748
 
749
749
  it 'should stop at first failure' do
750
- define('foo') { test { fail } }
751
- define('bar') { test { fail } }
752
- lambda { task('test').invoke rescue nil }.should run_tasks('foo:test').but_not('bar:test')
750
+ define('myproject') do
751
+ define('foo') { test { fail } }
752
+ define('bar') { test { fail } }
753
+ end
754
+ lambda { task('test').invoke rescue nil }.should run_tasks('myproject:bar:test').but_not('myproject:foo:test')
753
755
  end
754
756
 
755
757
  it 'should ignore failure if options.test is :all' do
@@ -331,7 +331,7 @@ describe Buildr::IntellijIdea do
331
331
 
332
332
  xml.RunnerSettings(:RunnerId => "Run")
333
333
  xml.ConfigurationWrapper(:RunnerId => "Run")
334
- xml.method()
334
+ xml.tag! :method
335
335
  end
336
336
  ipr.add_configuration("Run Planner.html", "GWT.ConfigurationType", "GWT Configuration") do |xml|
337
337
  xml.module(:name => project.iml.id)
@@ -341,7 +341,7 @@ describe Buildr::IntellijIdea do
341
341
 
342
342
  xml.RunnerSettings(:RunnerId => "Run")
343
343
  xml.ConfigurationWrapper(:RunnerId => "Run")
344
- xml.method()
344
+ xml.tag! :method
345
345
  end
346
346
  end
347
347
  invoke_generate_task
@@ -15,6 +15,8 @@
15
15
 
16
16
 
17
17
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_coverage_helper'))
18
+ if ENV_JAVA['java.version'] < "1.7"
19
+
18
20
  Sandbox.require_optional_extension 'buildr/java/cobertura'
19
21
  artifacts(Buildr::Cobertura::dependencies).map(&:invoke)
20
22
 
@@ -110,3 +112,5 @@ JAVA
110
112
  end
111
113
  end
112
114
  end
115
+
116
+ end
@@ -13,8 +13,9 @@
13
13
  # License for the specific language governing permissions and limitations under
14
14
  # the License.
15
15
 
16
-
17
16
  require File.expand_path(File.join(File.dirname(__FILE__), 'test_coverage_helper'))
17
+ if ENV_JAVA['java.version'] < "1.7"
18
+
18
19
  Sandbox.require_optional_extension 'buildr/java/emma'
19
20
  artifacts(Buildr::Emma::dependencies).map(&:invoke)
20
21
 
@@ -119,3 +120,5 @@ describe Buildr::Emma do
119
120
  end
120
121
  end
121
122
  end
123
+
124
+ end
@@ -22,7 +22,7 @@ unless RUBY_PLATFORM =~ /java/
22
22
  before do
23
23
  @old_home, ENV['JAVA_HOME'] = ENV['JAVA_HOME'], nil
24
24
  @old_env_java = Object.module_eval { remove_const :ENV_JAVA }
25
- Config::CONFIG.should_receive(:[]).with('host_os').and_return('darwin0.9')
25
+ RbConfig::CONFIG.should_receive(:[]).with('host_os').and_return('darwin0.9')
26
26
  end
27
27
 
28
28
  it 'should point to default JVM' do
@@ -0,0 +1,125 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
17
+ require 'fileutils'
18
+
19
+ describe Buildr::POM do
20
+ before do
21
+ repositories.remote = 'http://example.com'
22
+ @app = 'group:pomapp:jar:1.0'
23
+ write artifact(@app).pom.to_s, <<-XML
24
+ <project>
25
+ <artifactId>pomapp</artifactId>
26
+ <groupId>group</groupId>
27
+ <dependencies>
28
+ <dependency>
29
+ <artifactId>library</artifactId>
30
+ <groupId>org.example</groupId>
31
+ <version>1.1</version>
32
+ <scope>runtime</scope>
33
+ <exclusions>
34
+ <exclusion>
35
+ <groupId>javax.mail</groupId>
36
+ <artifactId>mail</artifactId>
37
+ </exclusion>
38
+ </exclusions>
39
+ </dependency>
40
+ </dependencies>
41
+ </project>
42
+ XML
43
+ @library = 'org.example:library:jar:1.1'
44
+ write artifact(@library).pom.to_s, <<-XML
45
+ <project>
46
+ <artifactId>pomapp</artifactId>
47
+ <groupId>group</groupId>
48
+ <dependencies>
49
+ <dependency>
50
+ <artifactId>mail</artifactId>
51
+ <groupId>javax.mail</groupId>
52
+ <version>1.0</version>
53
+ </dependency>
54
+ <dependency>
55
+ <artifactId>foo</artifactId>
56
+ <groupId>org.example</groupId>
57
+ <version>2.0</version>
58
+ </dependency>
59
+ </dependencies>
60
+ </project>
61
+ XML
62
+ end
63
+
64
+ it 'should respect exclusions when computing transitive dependencies' do
65
+ pom = POM.load(artifact(@app).pom)
66
+ specs = [ 'org.example:library:jar:1.1', 'org.example:foo:jar:2.0' ]
67
+ pom.dependencies.should eql(specs)
68
+ end
69
+ end
70
+
71
+ describe Buildr::POM do
72
+ before do
73
+ repositories.remote = 'http://example.com'
74
+ @app = 'group:app:jar:1.0'
75
+ write artifact(@app).pom.to_s, <<-XML
76
+ <project>
77
+ <properties>
78
+ <a.version>${b.version}</a.version>
79
+ <b.version>1.1</b.version>
80
+ </properties>
81
+ <artifactId>app</artifactId>
82
+ <groupId>group</groupId>
83
+ <dependencies>
84
+ <dependency>
85
+ <artifactId>library</artifactId>
86
+ <groupId>org.example</groupId>
87
+ <version>${a.version}</version>
88
+ <scope>runtime</scope>
89
+ <exclusions>
90
+ <exclusion>
91
+ <groupId>javax.mail</groupId>
92
+ <artifactId>mail</artifactId>
93
+ </exclusion>
94
+ </exclusions>
95
+ </dependency>
96
+ </dependencies>
97
+ </project>
98
+ XML
99
+ @library = 'org.example:library:jar:1.1'
100
+ write artifact(@library).pom.to_s, <<-XML
101
+ <project>
102
+ <artifactId>app</artifactId>
103
+ <groupId>group</groupId>
104
+ <dependencies>
105
+ <dependency>
106
+ <artifactId>mail</artifactId>
107
+ <groupId>javax.mail</groupId>
108
+ <version>1.0</version>
109
+ </dependency>
110
+ <dependency>
111
+ <artifactId>foo</artifactId>
112
+ <groupId>org.example</groupId>
113
+ <version>2.0</version>
114
+ </dependency>
115
+ </dependencies>
116
+ </project>
117
+ XML
118
+ end
119
+
120
+ it 'should respect exclusions when computing transitive dependencies when the pom includes properties' do
121
+ pom = POM.load(artifact(@app).pom)
122
+ specs = {"a.version"=>"1.1", "b.version"=>"1.1", "project.groupId"=>"group", "pom.groupId"=>"group", "groupId"=>"group", "project.artifactId"=>"app", "pom.artifactId"=>"app", "artifactId"=>"app"}
123
+ pom.properties.should eql(specs)
124
+ end
125
+ end