buildr 1.4.5-java → 1.4.6-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/CHANGELOG +28 -1
  2. data/_buildr +1 -1
  3. data/_jbuildr +1 -1
  4. data/buildr.gemspec +1 -2
  5. data/doc/download.textile +41 -76
  6. data/doc/index.textile +46 -6
  7. data/doc/installing.textile +2 -2
  8. data/doc/languages.textile +3 -3
  9. data/doc/scripts/install-jruby.sh +2 -2
  10. data/lib/buildr/core/shell.rb +1 -1
  11. data/lib/buildr/core/transports.rb +1 -1
  12. data/lib/buildr/ide/eclipse.rb +8 -2
  13. data/lib/buildr/ide/idea.rb +42 -26
  14. data/lib/buildr/java/bdd.rb +8 -5
  15. data/lib/buildr/java/jtestr_result.rb +36 -0
  16. data/lib/buildr/java/tests.rb +4 -4
  17. data/lib/buildr/packaging/artifact.rb +4 -2
  18. data/lib/buildr/packaging/tar.rb +1 -1
  19. data/lib/buildr/packaging/zip.rb +6 -0
  20. data/lib/buildr/scala/bdd.rb +17 -4
  21. data/lib/buildr/scala/compiler.rb +18 -12
  22. data/lib/buildr/scala/doc.rb +1 -1
  23. data/lib/buildr/scala/tests.rb +40 -11
  24. data/lib/buildr/version.rb +1 -1
  25. data/rakelib/checks.rake +9 -9
  26. data/rakelib/doc.rake +1 -1
  27. data/rakelib/package.rake +7 -7
  28. data/rakelib/release.rake +0 -1
  29. data/rakelib/rspec.rake +3 -2
  30. data/rakelib/setup.rake +2 -0
  31. data/rakelib/stage.rake +3 -3
  32. data/spec/core/common_spec.rb +1 -1
  33. data/spec/ide/idea_spec.rb +16 -25
  34. data/spec/java/bdd_spec.rb +1 -1
  35. data/spec/packaging/artifact_spec.rb +51 -0
  36. data/spec/sandbox.rb +41 -5
  37. data/spec/scala/bdd_spec.rb +1 -6
  38. data/spec/scala/compiler_spec.rb +56 -24
  39. data/spec/scala/doc_spec.rb +2 -7
  40. data/spec/scala/scala.rb +1 -8
  41. data/spec/scala/tests_spec.rb +14 -6
  42. metadata +178 -167
  43. data/lib/buildr/core/#application.rb# +0 -700
  44. data/lib/buildr/packaging/#package.rb.rej# +0 -19
  45. data/lib/buildr/scala/#Untitled-2# +0 -7
@@ -45,7 +45,6 @@ task :release do
45
45
 
46
46
  # Upload binary and source packages to RubyForge.
47
47
  lambda do
48
- sh 'rubyforge', 'login'
49
48
  # update rubyforge projects, processors, etc. in local config
50
49
  sh 'rubyforge', 'config'
51
50
  files = FileList["_release/#{spec.version}/dist/*.{gem,tgz,zip}"]
@@ -56,9 +56,10 @@ begin
56
56
  task :load_ci_reporter do
57
57
  gem 'ci_reporter'
58
58
  ENV['CI_REPORTS'] = '_reports/ci'
59
- # CI_Reporter does not quote the path to rspec_loader which causes problems when ruby is installed in C:/Program Files
59
+ # CI_Reporter does not quote the path to rspec_loader which causes problems when ruby is installed in C:/Program Files.
60
+ # However, newer versions of rspec don't like double quotes escaping as well, so removing them for now.
60
61
  ci_rep_path = Gem.loaded_specs['ci_reporter'].full_gem_path
61
- ENV["SPEC_OPTS"] = [ENV["SPEC_OPTS"], default_spec_opts, "--require", "\"#{ci_rep_path}/lib/ci/reporter/rake/rspec_loader.rb\"", "--format", "CI::Reporter::RSpec"].join(" ")
62
+ ENV["SPEC_OPTS"] = [ENV["SPEC_OPTS"], default_spec_opts, "--require", "#{ci_rep_path}/lib/ci/reporter/rake/rspec_loader.rb", "--format", "CI::Reporter::RSpec"].join(" ")
62
63
  end
63
64
 
64
65
  desc 'Run all specs with CI reporter'
@@ -54,6 +54,7 @@ end
54
54
  # Setup environment for running this Rakefile (RSpec, Jekyll, etc).
55
55
  desc "If you're building from sources, run this task first to setup the necessary dependencies."
56
56
  task :setup do
57
+ =begin
57
58
  missing = spec.dependencies.select { |dep| Gem::SourceIndex.from_installed_gems.search(dep).empty? }
58
59
  missing.each do |dep|
59
60
  if (dep.respond_to? :requirement)
@@ -63,4 +64,5 @@ task :setup do
63
64
  install_gem dep.name, :version=>dep.version_requirements
64
65
  end
65
66
  end
67
+ =end
66
68
  end
@@ -31,8 +31,8 @@ task :prepare do |task, args|
31
31
  puts "Checking there are no local changes ... "
32
32
  svn = `svn status`
33
33
  fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
34
- git = `git status`
35
- #fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^#\t/]
34
+ git = `git status -s`
35
+ fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^ M/] && ENV["IGNORE_GIT"].nil?
36
36
  puts "[X] There are no local changes, everything is in source control"
37
37
  end.call
38
38
 
@@ -50,7 +50,7 @@ task :prepare do |task, args|
50
50
  args.gpg or fail "Please run with gpg=<argument for gpg --local-user>"
51
51
  gpg_ok = `gpg2 --list-keys #{args.gpg}`
52
52
  if !$?.success?
53
- gpg_ok = `gpg --list-keys #{args.gpg}`
53
+ gpg_ok = `gpg --list-keys #{args.gpg}`
54
54
  gpg_cmd = 'gpg'
55
55
  end
56
56
  fail "No GPG user #{args.gpg}" if gpg_ok.empty?
@@ -541,7 +541,7 @@ describe Buildr::Filter do
541
541
  end
542
542
 
543
543
  it 'should preserve mode bits except readable' do
544
- pending "Pending the release of the fix for JRUBY-4927" if RUBY_PLATFORM =~ /java/
544
+ # legacy: pending "Pending the release of the fix for JRUBY-4927" if RUBY_PLATFORM =~ /java/
545
545
  Dir['src/*'].each { |file| File.chmod(0o755, file) }
546
546
  @filter.from('src').into('target').run
547
547
  Dir['target/*'].sort.each do |file|
@@ -20,7 +20,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'xpath_matchers
20
20
  describe Buildr::IntellijIdea do
21
21
 
22
22
  def invoke_generate_task
23
- task('idea:generate').invoke
23
+ task('idea').invoke
24
24
  end
25
25
 
26
26
  def invoke_clean_task
@@ -97,7 +97,7 @@ describe Buildr::IntellijIdea do
97
97
  end
98
98
  end
99
99
 
100
- describe "idea:generate" do
100
+ describe "idea task" do
101
101
 
102
102
  def order_entry_xpath
103
103
  "/module/component[@name='NewModuleRootManager']/orderEntry"
@@ -141,9 +141,9 @@ describe Buildr::IntellijIdea do
141
141
  invoke_generate_task
142
142
  end
143
143
 
144
- it "generates one non-exported 'module-library' orderEntry in IML" do
144
+ it "generates one non-exported test scope 'module-library' orderEntry in IML" do
145
145
  root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @exported]/library/CLASSES/root", 0)
146
- root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library']/library/CLASSES/root", 1)
146
+ root_module_xml(@foo).should have_nodes("#{order_entry_xpath}[@type='module-library' and @scope='TEST']/library/CLASSES/root", 1)
147
147
  end
148
148
  end
149
149
 
@@ -179,6 +179,9 @@ describe Buildr::IntellijIdea do
179
179
 
180
180
  describe "with local_repository_env_override set to nil" do
181
181
  before do
182
+ Buildr.repositories.instance_eval do
183
+ @local = @remote = @release_to = nil
184
+ end
182
185
  artifact('group:id:jar:1.0') { |t| write t.to_s }
183
186
  @foo = define "foo" do
184
187
  iml.local_repository_env_override = nil
@@ -548,7 +551,7 @@ describe Buildr::IntellijIdea do
548
551
  end
549
552
 
550
553
  it "depends on the associated module exactly once" do
551
- @bar_iml.should have_nodes("//orderEntry[@type='module', @module-name='foo']", 1)
554
+ @bar_iml.should have_nodes("//orderEntry[@type='module', @module-name='foo', @exported=""]", 1)
552
555
  end
553
556
 
554
557
  it "does not depend on the other project's packaged JAR" do
@@ -559,9 +562,9 @@ describe Buildr::IntellijIdea do
559
562
  @bar_lib_urls.grep(%r{foo/target/classes}).should == []
560
563
  end
561
564
 
562
- it "depends on the the other project's target/resources directory" do
563
- @bar_lib_urls.grep(%r{file://\$MODULE_DIR\$/../foo/target/resources}).size.should == 1
564
- end
565
+ it "does not depend on the the other project's target/resources directory" do
566
+ @bar_lib_urls.grep(%r{file://\$MODULE_DIR\$/../foo/target/resources}).size.should == 0
567
+ end
565
568
  end
566
569
 
567
570
  describe "with a single project definition" do
@@ -1048,12 +1051,12 @@ PROJECT_XML
1048
1051
  end
1049
1052
 
1050
1053
  describe "project extension" do
1051
- it "provides an 'idea:generate' task" do
1052
- Rake::Task.tasks.detect { |task| task.to_s == "idea:generate" }.should_not be_nil
1054
+ it "provides an 'idea' task" do
1055
+ Rake::Task.tasks.detect { |task| task.to_s == "idea" }.should_not be_nil
1053
1056
  end
1054
1057
 
1055
- it "documents the 'idea:generate' task" do
1056
- Rake::Task.tasks.detect { |task| task.to_s == "idea:generate" }.comment.should_not be_nil
1058
+ it "documents the 'idea' task" do
1059
+ Rake::Task.tasks.detect { |task| task.to_s == "idea" }.comment.should_not be_nil
1057
1060
  end
1058
1061
 
1059
1062
  it "provides an 'idea:clean' task" do
@@ -1064,18 +1067,6 @@ PROJECT_XML
1064
1067
  Rake::Task.tasks.detect { |task| task.to_s == "idea:clean" }.comment.should_not be_nil
1065
1068
  end
1066
1069
 
1067
- it "removes the 'idea' task" do
1068
- Rake::Task.tasks.detect { |task| task.to_s == "idea" }.should be_nil
1069
- end
1070
-
1071
- it "removes the 'idea7x' task" do
1072
- Rake::Task.tasks.detect { |task| task.to_s == "idea7x" }.should be_nil
1073
- end
1074
-
1075
- it "removes the 'idea7x:clean' task" do
1076
- Rake::Task.tasks.detect { |task| task.to_s == "idea7x:clean" }.should be_nil
1077
- end
1078
-
1079
1070
  describe "#no_iml" do
1080
1071
  it "makes #iml? false" do
1081
1072
  @foo = define "foo" do
@@ -1142,4 +1133,4 @@ PROJECT_XML
1142
1133
  end
1143
1134
  end
1144
1135
 
1145
- end
1136
+ end
@@ -267,7 +267,7 @@ describe Buildr::JtestR do
267
267
  Buildr::JtestR.instance_eval { @dependencies = nil }
268
268
  end
269
269
 
270
- end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # JtestR
270
+ end if ENV["JTESTR"] && (RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME']) # JtestR
271
271
 
272
272
  describe Buildr::JBehave do
273
273
  def foo(*args, &prc)
@@ -18,6 +18,9 @@ require 'fileutils'
18
18
 
19
19
  describe Artifact do
20
20
  before do
21
+ Buildr.repositories.instance_eval do
22
+ @local = @remote = @release_to = nil
23
+ end
21
24
  @spec = { :group=>'com.example', :id=>'library', :type=>:jar, :version=>'2.0' }
22
25
  @artifact = artifact(@spec)
23
26
  @classified = artifact(@spec.merge(:classifier=>'all'))
@@ -145,6 +148,12 @@ end
145
148
 
146
149
 
147
150
  describe Repositories, 'local' do
151
+ before do
152
+ Buildr.repositories.instance_eval do
153
+ @local = @remote = @release_to = nil
154
+ end
155
+ end
156
+
148
157
  it 'should default to .m2 path' do
149
158
  # For convenience, sandbox actually sets the local repository to a temp directory
150
159
  repositories.local = nil
@@ -203,6 +212,10 @@ end
203
212
 
204
213
  describe Repositories, 'remote' do
205
214
  before do
215
+ Buildr.repositories.instance_eval do
216
+ @local = @remote = @release_to = nil
217
+ end
218
+
206
219
  @repos = [ 'http://www.ibiblio.org/maven2', 'http://repo1.maven.org/maven2' ]
207
220
  end
208
221
 
@@ -300,6 +313,32 @@ describe Repositories, 'remote' do
300
313
  should change { File.exist?(File.join(repositories.local, 'com/example/library/2.1-SNAPSHOT/library-2.1-SNAPSHOT.jar')) }.to(true)
301
314
  end
302
315
 
316
+ it 'should resolve m2-style deployed snapshots with classifiers' do
317
+ metadata = <<-XML
318
+ <?xml version='1.0' encoding='UTF-8'?>
319
+ <metadata>
320
+ <groupId>com.example</groupId>
321
+ <artifactId>library</artifactId>
322
+ <version>2.1-SNAPSHOT</version>
323
+ <versioning>
324
+ <snapshot>
325
+ <timestamp>20071012.190008</timestamp>
326
+ <buildNumber>8</buildNumber>
327
+ </snapshot>
328
+ <lastUpdated>20071012190008</lastUpdated>
329
+ </versioning>
330
+ </metadata>
331
+ XML
332
+ repositories.remote = 'http://example.com'
333
+ URI.should_receive(:download).once.with(uri(/2.1-SNAPSHOT\/library-2.1-20071012.190008-8-classifier.jar$/), anything()).
334
+ and_return { |uri, target, options| write target }
335
+ URI.should_receive(:download).once.with(uri(/2.1-SNAPSHOT\/maven-metadata.xml$/), duck_type(:write)).
336
+ and_return { |uri, target, options| target.write(metadata) }
337
+ puts repositories.local
338
+ lambda { artifact('com.example:library:jar:classifier:2.1-SNAPSHOT').invoke}.
339
+ should change {File.exists?(File.join(repositories.local, 'com/example/library/2.1-SNAPSHOT/library-2.1-SNAPSHOT-classifier.jar')) }.to(true)
340
+ end
341
+
303
342
  it 'should fail resolving m2-style deployed snapshots if a timestamp is missing' do
304
343
  metadata = <<-XML
305
344
  <?xml version='1.0' encoding='UTF-8'?>
@@ -853,6 +892,12 @@ end
853
892
 
854
893
 
855
894
  describe Rake::Task, ' artifacts' do
895
+ before do
896
+ Buildr.repositories.instance_eval do
897
+ @local = @remote = @release_to = nil
898
+ end
899
+ end
900
+
856
901
  it 'should download all specified artifacts' do
857
902
  artifact 'group:id:jar:1.0'
858
903
  repositories.remote = 'http://example.com'
@@ -877,6 +922,9 @@ end
877
922
  describe Rake::Task, ' artifacts:sources' do
878
923
 
879
924
  before do
925
+ Buildr.repositories.instance_eval do
926
+ @local = @remote = @release_to = nil
927
+ end
880
928
  task('artifacts:sources').clear
881
929
  repositories.remote = 'http://example.com'
882
930
  end
@@ -913,6 +961,9 @@ end
913
961
  describe Rake::Task, ' artifacts:javadoc' do
914
962
 
915
963
  before do
964
+ Buildr.repositories.instance_eval do
965
+ @local = @remote = @release_to = nil
966
+ end
916
967
  task('artifacts:javadoc').clear
917
968
  repositories.remote = 'http://example.com'
918
969
  end
@@ -21,8 +21,11 @@ Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
21
21
  repositories.remote << 'http://repo1.maven.org/maven2'
22
22
  repositories.remote << 'http://scala-tools.org/repo-releases'
23
23
 
24
- # Force Scala 2.8.1 for specs; don't want to rely on SCALA_HOME
25
- Buildr.settings.build['scala.version'] = "2.8.1"
24
+ # Force Scala version for specs; don't want to rely on SCALA_HOME
25
+ module Buildr::Scala
26
+ SCALA_VERSION_FOR_SPECS = ENV["SCALA_VERSION"] || "2.8.1"
27
+ end
28
+ Buildr.settings.build['scala.version'] = Buildr::Scala::SCALA_VERSION_FOR_SPECS
26
29
 
27
30
  # Add a 'require' here only for optional extensions, not for extensions that should be loaded by default.
28
31
  require 'buildr/clojure'
@@ -38,6 +41,7 @@ artifacts(
38
41
  Buildr::Groovy.dependencies,
39
42
  Buildr::JaxbXjc.dependencies,
40
43
  Buildr::Bnd.dependencies,
44
+ Buildr::Scala::Scalac.dependencies,
41
45
  Buildr::Scala::Specs.dependencies,
42
46
  Buildr::Shell::BeanShell.artifact,
43
47
  Buildr::Clojure.dependencies
@@ -48,6 +52,25 @@ end
48
52
  ENV['HOME'] = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'home'))
49
53
  mkpath ENV['HOME']
50
54
 
55
+ # Make Scala.version resilient to sandbox reset
56
+ module Buildr::Scala
57
+ DEFAULT_VERSION = SCALA_VERSION_FOR_SPECS
58
+
59
+ class << self
60
+ def version
61
+ SCALA_VERSION_FOR_SPECS
62
+ end
63
+ end
64
+
65
+ class Scalac
66
+ class << self
67
+ def use_installed?
68
+ false
69
+ end
70
+ end
71
+ end
72
+ end
73
+
51
74
  # We need to run all tests inside a _sandbox, tacking a snapshot of Buildr before the test,
52
75
  # and restoring everything to its previous state after the test. Damn state changes.
53
76
  module Sandbox
@@ -101,6 +124,13 @@ module Sandbox
101
124
  Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
102
125
 
103
126
  @_sandbox[:load_path] = $LOAD_PATH.clone
127
+
128
+ # clear RUBYOPT since bundler hooks into it
129
+ # e.g. RUBYOPT=-I/usr/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib -rbundler/setup
130
+ # and so Buildr's own Gemfile configuration taints e.g., JRuby's environment
131
+ @_sandbox[:ruby_opt] = ENV["RUBYOPT"]
132
+ ENV["RUBYOPT"] = nil
133
+
104
134
  #@_sandbox[:loaded_features] = $LOADED_FEATURES.clone
105
135
 
106
136
  # Later on we'll want to lose all the on_define created during the test.
@@ -113,16 +143,18 @@ module Sandbox
113
143
  # of some essential artifacts (e.g. JUnit artifacts required by build task), so we create
114
144
  # these first (see above) and keep them across test cases.
115
145
  @_sandbox[:artifacts] = Artifact.class_eval { @artifacts }.clone
116
- Buildr.repositories.local = File.expand_path('repository')
146
+ @_sandbox[:local_repository] = Buildr.repositories.local
117
147
  ENV['HOME'] = File.expand_path('home')
118
148
  ENV['BUILDR_ENV'] = 'development'
119
149
 
120
150
  @_sandbox[:env_keys] = ENV.keys
121
151
  ['DEBUG', 'TEST', 'HTTP_PROXY', 'HTTPS_PROXY', 'USER'].each { |k| ENV.delete(k) ; ENV.delete(k.downcase) }
122
152
 
123
- # Remove testing local repository, and reset all repository settings.
153
+ # By default, remote repository is user's own local M2 repository
154
+ # since we don't want to remotely download artifacts into the sandbox over and over
124
155
  Buildr.repositories.instance_eval do
125
- @local = @remote = @release_to = nil
156
+ @remote = ["file://" + @local]
157
+ @local = @release_to = nil
126
158
  end
127
159
  Buildr.options.proxy.http = nil
128
160
 
@@ -149,12 +181,16 @@ module Sandbox
149
181
  Layout.default = @_sandbox[:layout].clone
150
182
 
151
183
  $LOAD_PATH.replace @_sandbox[:load_path]
184
+ ENV["RUBYOPT"] = @_sandbox[:ruby_opt]
185
+
152
186
  FileUtils.rm_rf @temp
153
187
  mkpath ENV['HOME']
154
188
 
155
189
  # Get rid of all artifacts.
156
190
  @_sandbox[:artifacts].tap { |artifacts| Artifact.class_eval { @artifacts = artifacts } }
157
191
 
192
+ Buildr.repositories.local = @_sandbox[:local_repository]
193
+
158
194
  # Restore options.
159
195
  Buildr.options.test = nil
160
196
  (ENV.keys - @_sandbox[:env_keys]).each { |key| ENV.delete key }
@@ -17,12 +17,7 @@
17
17
  require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
18
18
 
19
19
  describe Buildr::Scala::Specs do
20
-
21
- before(:each) do
22
- # Force Scala 2.8.1 for specs; don't want to rely on SCALA_HOME
23
- Buildr.settings.build['scala.version'] = "2.8.1"
24
- end
25
-
20
+
26
21
  it 'should be the default when tests in src/spec/scala' do
27
22
  write 'src/spec/scala/com/example/MySpecs.scala', <<-SCALA
28
23
  package com.example
@@ -19,11 +19,6 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers')
19
19
  # need to test both with and without SCALA_HOME
20
20
  share_as :ScalacCompiler do
21
21
 
22
- before(:each) do
23
- # Force Scala 2.8.1 for specs; don't want to rely on SCALA_HOME
24
- Buildr.settings.build['scala.version'] = "2.8.1"
25
- end
26
-
27
22
  it 'should identify itself from source directories' do
28
23
  write 'src/main/scala/com/example/Test.scala', 'package com.example; class Test { val i = 1 }'
29
24
  define('foo').compile.compiler.should eql(:scalac)
@@ -143,15 +138,7 @@ describe 'scala compiler (downloaded from repository)' do
143
138
  end
144
139
  end
145
140
 
146
-
147
- describe 'scalac compiler options' do
148
- def compile_task
149
- @compile_task ||= define('foo').compile.using(:scalac)
150
- end
151
-
152
- def scalac_args
153
- compile_task.instance_eval { @compiler }.send(:scalac_args)
154
- end
141
+ share_as :ScalacCompiler_CommonOptions do
155
142
 
156
143
  it 'should set warnings option to false by default' do
157
144
  compile_task.options.warnings.should be_false
@@ -200,16 +187,6 @@ describe 'scalac compiler options' do
200
187
  compile_task.options.debug.should be_false
201
188
  end
202
189
 
203
- it 'should use -g argument when debug option is true' do
204
- compile_task.using(:debug=>true)
205
- scalac_args.should include('-g')
206
- end
207
-
208
- it 'should not use -g argument when debug option is false' do
209
- compile_task.using(:debug=>false)
210
- scalac_args.should_not include('-g')
211
- end
212
-
213
190
  it 'should set deprecation option to false by default' do
214
191
  compile_task.options.deprecation.should be_false
215
192
  end
@@ -287,3 +264,58 @@ describe 'scalac compiler options' do
287
264
  ENV.delete "DEBUG"
288
265
  end
289
266
  end
267
+
268
+
269
+ describe 'scala compiler 2.8 options' do
270
+
271
+ it_should_behave_like ScalacCompiler_CommonOptions
272
+
273
+ def compile_task
274
+ @compile_task ||= define('foo').compile.using(:scalac)
275
+ end
276
+
277
+ def scalac_args
278
+ compile_task.instance_eval { @compiler }.send(:scalac_args)
279
+ end
280
+
281
+ it 'should use -g argument when debug option is true' do
282
+ compile_task.using(:debug=>true)
283
+ scalac_args.should include('-g')
284
+ end
285
+
286
+ it 'should not use -g argument when debug option is false' do
287
+ compile_task.using(:debug=>false)
288
+ scalac_args.should_not include('-g')
289
+ end
290
+ end if Buildr::Scala.version?(2.8)
291
+
292
+ describe 'scala compiler 2.9 options' do
293
+
294
+ it_should_behave_like ScalacCompiler_CommonOptions
295
+
296
+ def compile_task
297
+ @compile_task ||= define('foo').compile.using(:scalac)
298
+ end
299
+
300
+ def scalac_args
301
+ compile_task.instance_eval { @compiler }.send(:scalac_args)
302
+ end
303
+
304
+ # these specs fail. Somehow the compiler is still in version 2.8
305
+ it 'should use -g:vars argument when debug option is true' do
306
+ compile_task.using(:debug=>true)
307
+ scalac_args.should include('-g:vars')
308
+ end
309
+
310
+ it 'should use -g:whatever argument when debug option is \'whatever\'' do
311
+ compile_task.using(:debug=>:whatever)
312
+ scalac_args.should include('-g:whatever')
313
+ end
314
+
315
+ it 'should not use -g argument when debug option is false' do
316
+ compile_task.using(:debug=>false)
317
+ scalac_args.should_not include('-g')
318
+ end
319
+
320
+ end if Buildr::Scala.version?(2.9)
321
+