buildr 1.3.5-java → 1.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/CHANGELOG +153 -8
  2. data/README.rdoc +1 -1
  3. data/addon/buildr/antlr.rb +5 -5
  4. data/addon/buildr/drb.rb +18 -18
  5. data/addon/buildr/hibernate.rb +18 -14
  6. data/addon/buildr/javacc.rb +4 -4
  7. data/addon/buildr/jetty.rb +5 -5
  8. data/addon/buildr/nailgun.rb +23 -23
  9. data/addon/buildr/openjpa.rb +1 -1
  10. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  11. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  12. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  13. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  14. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  15. data/addon/buildr/protobuf.rb +75 -0
  16. data/addon/buildr/xmlbeans.rb +5 -5
  17. data/buildr.buildfile +2 -2
  18. data/buildr.gemspec +8 -7
  19. data/doc/_layouts/default.html +2 -2
  20. data/doc/artifacts.textile +4 -4
  21. data/doc/building.textile +35 -3
  22. data/doc/contributing.textile +5 -0
  23. data/doc/download.textile +16 -5
  24. data/doc/extending.textile +38 -12
  25. data/doc/installing.textile +6 -5
  26. data/doc/languages.textile +182 -42
  27. data/doc/more_stuff.textile +2 -2
  28. data/doc/packaging.textile +14 -15
  29. data/doc/projects.textile +7 -2
  30. data/doc/quick_start.textile +4 -4
  31. data/doc/scripts/buildr-git.rb +63 -63
  32. data/doc/scripts/gitflow.rb +21 -21
  33. data/doc/settings_profiles.textile +9 -2
  34. data/doc/testing.textile +16 -5
  35. data/etc/KEYS +38 -0
  36. data/lib/buildr.rb +1 -1
  37. data/lib/buildr/core.rb +1 -0
  38. data/lib/buildr/core/application.rb +33 -27
  39. data/lib/buildr/core/build.rb +41 -28
  40. data/lib/buildr/core/cc.rb +172 -0
  41. data/lib/buildr/core/checks.rb +1 -1
  42. data/lib/buildr/core/common.rb +7 -6
  43. data/lib/buildr/core/compile.rb +7 -8
  44. data/lib/buildr/core/doc.rb +263 -0
  45. data/lib/buildr/core/environment.rb +6 -6
  46. data/lib/buildr/core/filter.rb +77 -35
  47. data/lib/buildr/core/generate.rb +7 -7
  48. data/lib/buildr/core/help.rb +1 -1
  49. data/lib/buildr/core/osx.rb +6 -6
  50. data/lib/buildr/core/progressbar.rb +4 -4
  51. data/lib/buildr/core/project.rb +144 -36
  52. data/lib/buildr/core/shell.rb +34 -34
  53. data/lib/buildr/core/test.rb +89 -20
  54. data/lib/buildr/core/transports.rb +8 -7
  55. data/lib/buildr/core/util.rb +77 -23
  56. data/lib/buildr/groovy/bdd.rb +5 -5
  57. data/lib/buildr/groovy/compiler.rb +19 -15
  58. data/lib/buildr/groovy/shell.rb +6 -6
  59. data/lib/buildr/ide/eclipse.rb +148 -75
  60. data/lib/buildr/ide/eclipse/java.rb +3 -3
  61. data/lib/buildr/ide/eclipse/plugin.rb +8 -5
  62. data/lib/buildr/ide/eclipse/scala.rb +4 -2
  63. data/lib/buildr/ide/idea.rb +2 -2
  64. data/lib/buildr/ide/idea7x.rb +23 -4
  65. data/lib/buildr/java.rb +1 -0
  66. data/lib/buildr/java/ant.rb +4 -4
  67. data/lib/buildr/java/bdd.rb +51 -54
  68. data/lib/buildr/java/cobertura.rb +57 -35
  69. data/lib/buildr/java/commands.rb +14 -5
  70. data/lib/buildr/java/compiler.rb +3 -217
  71. data/lib/buildr/java/deprecated.rb +4 -4
  72. data/lib/buildr/java/doc.rb +70 -0
  73. data/lib/buildr/java/emma.rb +22 -22
  74. data/lib/buildr/java/jruby.rb +4 -4
  75. data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
  76. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  77. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
  78. data/lib/buildr/java/packaging.rb +30 -29
  79. data/lib/buildr/java/pom.rb +4 -4
  80. data/lib/buildr/java/rjb.rb +6 -6
  81. data/lib/buildr/java/test_result.rb +61 -85
  82. data/lib/buildr/java/tests.rb +44 -27
  83. data/lib/buildr/java/version_requirement.rb +8 -8
  84. data/lib/buildr/packaging/archive.rb +55 -22
  85. data/lib/buildr/packaging/artifact.rb +75 -36
  86. data/lib/buildr/packaging/artifact_namespace.rb +90 -78
  87. data/lib/buildr/packaging/artifact_search.rb +5 -5
  88. data/lib/buildr/packaging/gems.rb +11 -7
  89. data/lib/buildr/packaging/package.rb +10 -7
  90. data/lib/buildr/packaging/tar.rb +14 -14
  91. data/lib/buildr/packaging/version_requirement.rb +30 -10
  92. data/lib/buildr/packaging/ziptask.rb +51 -13
  93. data/lib/buildr/scala.rb +1 -0
  94. data/lib/buildr/scala/bdd.rb +25 -20
  95. data/lib/buildr/scala/compiler.rb +87 -40
  96. data/lib/buildr/scala/doc.rb +106 -0
  97. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  98. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  99. data/lib/buildr/scala/shell.rb +14 -9
  100. data/lib/buildr/scala/tests.rb +33 -26
  101. data/lib/buildr/shell.rb +33 -33
  102. data/rakelib/all-in-one.rake +113 -0
  103. data/rakelib/checks.rake +1 -1
  104. data/rakelib/doc.rake +7 -0
  105. data/rakelib/package.rake +1 -1
  106. data/rakelib/release.rake +9 -6
  107. data/rakelib/rspec.rake +26 -7
  108. data/rakelib/setup.rake +15 -3
  109. data/rakelib/stage.rake +18 -11
  110. data/spec/addon/drb_spec.rb +25 -25
  111. data/spec/core/application_spec.rb +111 -21
  112. data/spec/core/build_spec.rb +16 -15
  113. data/spec/core/cc_spec.rb +174 -0
  114. data/spec/core/checks_spec.rb +34 -34
  115. data/spec/core/common_spec.rb +51 -5
  116. data/spec/core/compile_spec.rb +89 -14
  117. data/spec/core/extension_spec.rb +127 -19
  118. data/spec/core/generate_spec.rb +2 -2
  119. data/spec/core/project_spec.rb +10 -10
  120. data/spec/core/test_spec.rb +144 -35
  121. data/spec/core/transport_spec.rb +8 -8
  122. data/spec/core/util_spec.rb +63 -5
  123. data/spec/groovy/bdd_spec.rb +5 -5
  124. data/spec/groovy/compiler_spec.rb +29 -18
  125. data/spec/ide/eclipse_spec.rb +185 -9
  126. data/spec/ide/idea7x_spec.rb +22 -10
  127. data/spec/java/ant_spec.rb +9 -5
  128. data/spec/java/bdd_spec.rb +29 -37
  129. data/spec/java/cobertura_spec.rb +12 -12
  130. data/spec/java/commands_spec.rb +34 -0
  131. data/spec/java/compiler_spec.rb +53 -53
  132. data/spec/java/emma_spec.rb +11 -11
  133. data/spec/java/java_spec.rb +10 -10
  134. data/spec/java/packaging_spec.rb +67 -20
  135. data/spec/java/test_coverage_helper.rb +18 -18
  136. data/spec/java/tests_spec.rb +13 -9
  137. data/spec/packaging/archive_spec.rb +187 -20
  138. data/spec/packaging/artifact_namespace_spec.rb +172 -83
  139. data/spec/packaging/artifact_spec.rb +83 -18
  140. data/spec/packaging/packaging_spec.rb +41 -14
  141. data/spec/sandbox.rb +23 -12
  142. data/spec/scala/bdd_spec.rb +13 -8
  143. data/spec/scala/compiler_spec.rb +18 -13
  144. data/spec/scala/scala.rb +3 -3
  145. data/spec/scala/tests_spec.rb +46 -24
  146. data/spec/spec_helpers.rb +28 -10
  147. data/spec/version_requirement_spec.rb +25 -11
  148. metadata +148 -132
  149. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  150. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
  151. data/rakelib/stage.rake~ +0 -213
@@ -22,15 +22,15 @@ module Idea7xHelper
22
22
  task('idea7x').invoke
23
23
  REXML::Document.new(File.read("#{@project_name}-7x.ipr")).root.elements
24
24
  end
25
-
25
+
26
26
  def ipr_module_elements
27
27
  ipr_xml_elements.to_a("//component[@name='ProjectModuleManager']/modules/module")
28
28
  end
29
-
29
+
30
30
  def ipr_module_filepaths
31
31
  ipr_module_elements.collect { |m| m.attributes['filepath'] }
32
32
  end
33
-
33
+
34
34
  def ipr_module_fileurls
35
35
  ipr_module_elements.collect { |m| m.attributes['fileurl'] }
36
36
  end
@@ -39,20 +39,20 @@ end
39
39
 
40
40
  describe Idea7x do
41
41
  include Idea7xHelper
42
-
42
+
43
43
  describe "the project file" do
44
44
  before do
45
45
  @project_name = 'alphabet'
46
46
  end
47
-
47
+
48
48
  it "includes a module for the root project" do
49
49
  # Current behavior is to only generate IMLs for packaged projects
50
- define(@project_name) { project.version = '0.0.0'; package(:jar) }
50
+ define(@project_name) { project.version = '0.0.0'; package(:jar) }
51
51
  ipr_module_elements.should have(1).element
52
52
  ipr_module_filepaths.should == ["$PROJECT_DIR$/alphabet-7x.iml"]
53
53
  ipr_module_fileurls.should == ["file://$PROJECT_DIR$/alphabet-7x.iml"]
54
54
  end
55
-
55
+
56
56
  it "includes an IML for a subproject" do
57
57
  mkpath 'h'
58
58
  define(@project_name) do
@@ -61,12 +61,12 @@ describe Idea7x do
61
61
  package(:jar)
62
62
  end
63
63
  end
64
-
64
+
65
65
  ipr_module_elements.should have(2).elements
66
66
  ipr_module_filepaths.should include("$PROJECT_DIR$/h/alphabet-h-7x.iml")
67
67
  ipr_module_fileurls.should include("file://$PROJECT_DIR$/h/alphabet-h-7x.iml")
68
68
  end
69
-
69
+
70
70
  it "pays attention to the base_dir for a subproject" do
71
71
  mkpath 'aitch'
72
72
  define(@project_name) do
@@ -75,10 +75,22 @@ describe Idea7x do
75
75
  package(:jar)
76
76
  end
77
77
  end
78
-
78
+
79
79
  ipr_module_elements.should have(2).elements
80
80
  ipr_module_filepaths.should include("$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
81
81
  ipr_module_fileurls.should include("file://$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
82
82
  end
83
83
  end
84
+
85
+ describe "idea7x:clean" do
86
+
87
+ it "should remove the idea7x project" do
88
+ write "src/main/java/com/example/Hello.java", ""
89
+ write "foo-7x.iml", ""
90
+ foo = define("foo")
91
+ foo.task("idea7x:clean").invoke
92
+ File.exists?("foo-7x.iml").should be_false
93
+ end
94
+
95
+ end
84
96
  end
@@ -18,13 +18,17 @@ require File.join(File.dirname(__FILE__), '../spec_helpers')
18
18
 
19
19
 
20
20
  describe Buildr::Ant do
21
-
21
+
22
22
  it 'should pick Ant version from ant build settings' do
23
- Buildr::Ant.instance_eval { @dependencies = nil }
24
- write 'build.yaml', 'ant: 1.2.3'
25
- Buildr::Ant.dependencies.should include("org.apache.ant:ant:jar:1.2.3")
23
+ begin
24
+ Buildr::Ant.instance_eval { @dependencies = nil }
25
+ write 'build.yaml', 'ant: 1.2.3'
26
+ Buildr::Ant.dependencies.should include("org.apache.ant:ant:jar:1.2.3")
27
+ ensure
28
+ Buildr::Ant.instance_eval { @dependencies = nil }
29
+ end
26
30
  end
27
-
31
+
28
32
  it 'should have REQUIRES up to version 1.5 since it was deprecated in version 1.3.3' do
29
33
  Buildr::VERSION.should < '1.5'
30
34
  lambda { Ant::REQUIRES }.should_not raise_error
@@ -17,28 +17,21 @@ require File.join(File.dirname(__FILE__), '../spec_helpers')
17
17
 
18
18
  describe Buildr::RSpec do
19
19
 
20
- def foo(*args, &prc)
21
- define('foo', *args) do
20
+ before(:each) do
21
+ define('foo') do
22
22
  test.using :rspec, :output => false
23
- if prc
24
- instance_eval(&prc)
25
- else
26
- self
27
- end
28
23
  end
29
24
  end
30
25
 
31
26
  it 'should be selected by :rspec name' do
32
- foo { test.framework.should eql(:rspec) }
27
+ project('foo').test.framework.should eql(:rspec)
33
28
  end
34
29
 
35
30
  it 'should read passed specs from result yaml' do
36
- success = File.expand_path('src/spec/ruby/success_spec.rb')
37
- write(success, 'describe("success") { it("is true") { nil.should be_nil } }')
38
- foo do
39
- test.invoke
40
- test.passed_tests.should eql([success])
41
- end
31
+ write('src/spec/ruby/success_spec.rb', 'describe("success") { it("is true") { nil.should be_nil } }')
32
+
33
+ project('foo').test.invoke
34
+ project('foo').test.passed_tests.should eql([File.expand_path('src/spec/ruby/success_spec.rb')])
42
35
  end
43
36
 
44
37
  it 'should read result yaml to obtain the list of failed specs' do
@@ -48,12 +41,12 @@ describe Buildr::RSpec do
48
41
  write(failure, 'describe("failure") { it("is false") { true.should == false } }')
49
42
  error = File.expand_path('src/spec/ruby/error_spec.rb')
50
43
  write(error, 'describe("error") { it("raises") { lambda; } }')
51
- foo do
52
- lambda { test.invoke }.should raise_error(/Tests failed/)
53
- test.tests.should include(success, failure, error)
54
- test.failed_tests.sort.should eql([failure, error].sort)
55
- test.passed_tests.should eql([success])
56
- end
44
+
45
+ lambda { project('foo').test.invoke }.should raise_error(/Tests failed/)
46
+ project('foo').test.tests.should include(success, failure, error)
47
+ project('foo').test.failed_tests.sort.should eql([failure, error].sort)
48
+ project('foo').test.passed_tests.should eql([success])
49
+
57
50
  end
58
51
 
59
52
  end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # RSpec
@@ -61,9 +54,6 @@ end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # RSpec
61
54
  describe Buildr::JtestR do
62
55
 
63
56
  before do
64
- # JtestR currently requires JUnit 4.4
65
- Buildr.settings.build['junit'] = '4.4'
66
-
67
57
  # clear cached dependencies
68
58
  Buildr::JUnit.instance_eval { @dependencies = nil }
69
59
  Buildr::JtestR.instance_eval { @dependencies = nil }
@@ -119,7 +109,7 @@ describe Buildr::JtestR do
119
109
 
120
110
  it 'should apply to projects having junit sources' do
121
111
  define('one', :base_dir => 'one') do
122
- write _('src/test/java/example/OneTest.java', <<-JAVA)
112
+ write _('src/test/java/example/OneTest.java'), <<-JAVA
123
113
  package example;
124
114
  public class OneTest extends junit.framework.TestCase { }
125
115
  JAVA
@@ -129,9 +119,9 @@ describe Buildr::JtestR do
129
119
 
130
120
  it 'should apply to projects having testng sources' do
131
121
  define('one', :base_dir => 'one') do
132
- write _('src/test/java/example/OneTest.java', <<-JAVA)
122
+ write _('src/test/java/example/OneTest.java'), <<-JAVA
133
123
  package example;
134
- public class OneTest {
124
+ public class OneTest {
135
125
  @org.testng.annotations.Test
136
126
  public void testNothing() {}
137
127
  }
@@ -148,7 +138,7 @@ describe Buildr::JtestR do
148
138
  end
149
139
 
150
140
  it 'should load user jtestr_config.rb' do
151
- foo do
141
+ foo do
152
142
  hello = _('hello')
153
143
  write('src/spec/ruby/jtestr_config.rb', "File.open('#{hello}', 'w') { |f| f.write 'HELLO' }")
154
144
  write('src/spec/ruby/some_spec.rb')
@@ -161,13 +151,13 @@ describe Buildr::JtestR do
161
151
  it 'should run junit tests' do
162
152
  write('src/test/java/example/SuccessTest.java', <<-JAVA)
163
153
  package example;
164
- public class SuccessTest extends junit.framework.TestCase {
154
+ public class SuccessTest extends junit.framework.TestCase {
165
155
  public void testSuccess() { assertTrue(true); }
166
156
  }
167
157
  JAVA
168
158
  write('src/test/java/example/FailureTest.java', <<-JAVA)
169
159
  package example;
170
- public class FailureTest extends junit.framework.TestCase {
160
+ public class FailureTest extends junit.framework.TestCase {
171
161
  public void testFailure() { assertTrue(false); }
172
162
  }
173
163
  JAVA
@@ -179,7 +169,7 @@ describe Buildr::JtestR do
179
169
  end
180
170
  end
181
171
 
182
- it 'should run testng tests' do
172
+ it 'should run testng tests' do
183
173
  write('src/test/java/example/Success.java', <<-JAVA)
184
174
  package example;
185
175
  public class Success {
@@ -202,7 +192,7 @@ describe Buildr::JtestR do
202
192
  end
203
193
  end
204
194
 
205
- it 'should run test_unit' do
195
+ it 'should run test_unit' do
206
196
  success = File.expand_path('src/spec/ruby/success_test.rb')
207
197
  write(success, <<-TESTUNIT)
208
198
  require 'test/unit'
@@ -261,7 +251,7 @@ describe Buildr::JtestR do
261
251
  error = File.expand_path('src/spec/ruby/error_spec.rb')
262
252
  write(error, 'describe("error") { it("raises") { lambda; } }')
263
253
  pending = File.expand_path('src/spec/ruby/pending_spec.rb')
264
- write(pending, 'describe("peding") { it "is not implemented" }')
254
+ write(pending, 'describe("pending") { it "is not implemented" }')
265
255
  foo do
266
256
  lambda { test.invoke }.should raise_error(/Tests failed/)
267
257
  test.tests.should include(success, failure, error)
@@ -281,7 +271,7 @@ end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # JtestR
281
271
 
282
272
  describe Buildr::JBehave do
283
273
  def foo(*args, &prc)
284
- define('foo', *args) do
274
+ define('foo', *args) do
285
275
  test.using :jbehave
286
276
  if prc
287
277
  instance_eval(&prc)
@@ -314,7 +304,7 @@ describe Buildr::JBehave do
314
304
  foo { test.framework.should eql(:jbehave) }
315
305
  end
316
306
 
317
- it 'should select a java compiler for its sources' do
307
+ it 'should select a java compiler for its sources' do
318
308
  write 'src/test/java/SomeBehavior.java', 'public class SomeBehavior {}'
319
309
  foo do
320
310
  test.compile.language.should eql(:java)
@@ -330,8 +320,10 @@ describe Buildr::JBehave do
330
320
 
331
321
  it 'should include JMock dependencies' do
332
322
  foo do
333
- test.compile.dependencies.should include(artifact("jmock:jmock:jar:#{JMock.version}"))
334
- test.dependencies.should include(artifact("jmock:jmock:jar:#{JMock.version}"))
323
+ two_or_later = JMock.version[0,1].to_i >= 2
324
+ group = two_or_later ? "org.jmock" : "jmock"
325
+ test.compile.dependencies.should include(artifact("#{group}:jmock:jar:#{JMock.version}"))
326
+ test.dependencies.should include(artifact("#{group}:jmock:jar:#{JMock.version}"))
335
327
  end
336
328
  end
337
329
 
@@ -356,7 +348,7 @@ describe Buildr::JBehave do
356
348
  it 'should include classes implementing Behaviours' do
357
349
  write 'src/spec/java/some/MyBehaviours.java', <<-JAVA
358
350
  package some;
359
- public class MyBehaviours implements
351
+ public class MyBehaviours implements
360
352
  org.jbehave.core.behaviour.Behaviours {
361
353
  public Class[] getBehaviours() {
362
354
  return new Class[] { some.FooBehave.class };
@@ -24,54 +24,54 @@ describe Buildr::Cobertura do
24
24
  # Reloading the extension because the sandbox removes all its actions
25
25
  Buildr.module_eval { remove_const :Cobertura }
26
26
  load File.expand_path('../lib/buildr/java/cobertura.rb')
27
- @tool_module = Buildr::Cobertura
27
+ @tool_module = Buildr::Cobertura
28
28
  end
29
-
29
+
30
30
  it_should_behave_like 'test coverage tool'
31
-
31
+
32
32
  describe 'project-specific' do
33
-
33
+
34
34
  describe 'data file' do
35
35
  it 'should have a default value' do
36
36
  define('foo').cobertura.data_file.should point_to_path('reports/cobertura.ser')
37
37
  end
38
-
38
+
39
39
  it 'should be overridable' do
40
40
  define('foo') { cobertura.data_file = path_to('target/data.cobertura') }
41
41
  project('foo').cobertura.data_file.should point_to_path('target/data.cobertura')
42
42
  end
43
-
43
+
44
44
  it 'should be created during instrumentation' do
45
45
  write 'src/main/java/Foo.java', 'public class Foo {}'
46
46
  define('foo')
47
47
  task('foo:cobertura:instrument').invoke
48
48
  file(project('foo').cobertura.data_file).should exist
49
49
  end
50
-
50
+
51
51
  it 'should not instrument projects which have no sources' do
52
52
  write 'bar/src/main/java/Baz.java', 'public class Baz {}'
53
53
  define('foo') { define('bar') }
54
54
  task('foo:bar:cobertura:instrument').invoke
55
55
  end
56
56
  end
57
-
57
+
58
58
  describe 'instrumentation' do
59
59
  before do
60
60
  ['Foo', 'Bar'].each { |cls| write File.join('src/main/java', "#{cls}.java"), "public class #{cls} {}" }
61
61
  end
62
-
62
+
63
63
  it 'should instrument only included classes' do
64
64
  define('foo') { cobertura.include 'Foo' }
65
65
  task("foo:cobertura:instrument").invoke
66
66
  Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Foo.class'] }
67
67
  end
68
-
68
+
69
69
  it 'should not instrument excluded classes' do
70
70
  define('foo') { cobertura.exclude 'Foo' }
71
71
  task("foo:cobertura:instrument").invoke
72
72
  Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Bar.class'] }
73
73
  end
74
-
74
+
75
75
  it 'should instrument classes that are included but not excluded' do
76
76
  write 'src/main/java/Baz.java', 'public class Baz {}'
77
77
  define('foo') { cobertura.include('Ba').exclude('ar') }
@@ -79,7 +79,7 @@ describe Buildr::Cobertura do
79
79
  Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Baz.class'] }
80
80
  end
81
81
  end
82
-
82
+
83
83
  # TODO add specs for cobertura:check...somehow
84
84
  end
85
85
  end
@@ -0,0 +1,34 @@
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.join(File.dirname(__FILE__), '../spec_helpers')
17
+
18
+
19
+ describe Java::Commands do
20
+
21
+ it "should not be verbose by default" do
22
+ write "build.xml", <<-BUILD
23
+ <project name="MyProject" default="dist" basedir=".">
24
+ <description>
25
+ simple example build file
26
+ </description>
27
+ <target name="dist"/>
28
+ </project>
29
+ BUILD
30
+ lambda { Java::Commands.java("org.apache.tools.ant.Main", :classpath => Buildr::Ant.dependencies) }.should_not show_info(/java/)
31
+ lambda { Java::Commands.java("org.apache.tools.ant.Main", :classpath => Buildr::Ant.dependencies, :verbose => true) }.should show_info(/java/)
32
+ end
33
+
34
+ end
@@ -19,13 +19,13 @@ require File.join(File.dirname(__FILE__), '../spec_helpers')
19
19
 
20
20
  describe 'javac compiler' do
21
21
  it 'should identify itself from source directories' do
22
- write 'src/main/java/com/example/Test.java', 'package com.example; class Test {}'
22
+ write 'src/main/java/com/example/Test.java', 'package com.example; class Test {}'
23
23
  define('foo').compile.compiler.should eql(:javac)
24
24
  end
25
25
 
26
26
  it 'should identify from source directories using custom layout' do
27
- write 'src/com/example/Code.java', 'package com.example; class Code {}'
28
- write 'testing/com/example/Test.java', 'package com.example; class Test {}'
27
+ write 'src/com/example/Code.java', 'package com.example; class Code {}'
28
+ write 'testing/com/example/Test.java', 'package com.example; class Test {}'
29
29
  custom = Layout.new
30
30
  custom[:source, :main, :java] = 'src'
31
31
  custom[:source, :test, :java] = 'testing'
@@ -36,8 +36,8 @@ describe 'javac compiler' do
36
36
  end
37
37
 
38
38
  it 'should identify from compile source directories' do
39
- write 'src/com/example/Code.java', 'package com.example; class Code {}'
40
- write 'testing/com/example/Test.java', 'package com.example; class Test {}'
39
+ write 'src/com/example/Code.java', 'package com.example; class Code {}'
40
+ write 'testing/com/example/Test.java', 'package com.example; class Test {}'
41
41
  define 'foo' do
42
42
  lambda { compile.from 'src' }.should change { compile.compiler }.to(:javac)
43
43
  lambda { test.compile.from 'testing' }.should change { test.compile.compiler }.to(:javac)
@@ -103,28 +103,28 @@ describe 'javac compiler options' do
103
103
  compile_task.options.warnings.should be_false
104
104
  end
105
105
 
106
- it 'should set wranings option to true when running with --verbose option' do
106
+ it 'should set warnings option to true when running with --verbose option' do
107
107
  verbose true
108
- compile_task.options.warnings.should be_true
108
+ compile_task.options.warnings.should be_false
109
109
  end
110
110
 
111
111
  it 'should use -nowarn argument when warnings is false' do
112
112
  compile_task.using(:warnings=>false)
113
- javac_args.should include('-nowarn')
113
+ javac_args.should include('-nowarn')
114
114
  end
115
115
 
116
116
  it 'should not use -nowarn argument when warnings is true' do
117
117
  compile_task.using(:warnings=>true)
118
- javac_args.should_not include('-nowarn')
118
+ javac_args.should_not include('-nowarn')
119
119
  end
120
120
 
121
121
  it 'should not use -verbose argument by default' do
122
- javac_args.should_not include('-verbose')
122
+ javac_args.should_not include('-verbose')
123
123
  end
124
124
 
125
125
  it 'should use -verbose argument when running with --trace option' do
126
126
  trace true
127
- javac_args.should include('-verbose')
127
+ javac_args.should include('-verbose')
128
128
  end
129
129
 
130
130
  it 'should set debug option to true by default' do
@@ -251,7 +251,7 @@ describe 'javac compiler options' do
251
251
  end
252
252
 
253
253
 
254
- describe Project, '#javadoc' do
254
+ describe Project, '#doc' do
255
255
  def sources
256
256
  @sources ||= (1..3).map { |i| "Test#{i}" }.
257
257
  each { |name| write "src/main/java/foo/#{name}.java", "package foo; public class #{name}{}" }.
@@ -260,64 +260,64 @@ describe Project, '#javadoc' do
260
260
 
261
261
  it 'should return the project\'s Javadoc task' do
262
262
  define('foo') { compile.using(:javac) }
263
- project('foo').javadoc.name.should eql('foo:javadoc')
263
+ project('foo').doc.name.should eql('foo:doc')
264
264
  end
265
265
 
266
- it 'should return a Javadoc task' do
266
+ it 'should return a DocTask' do
267
267
  define('foo') { compile.using(:javac) }
268
- project('foo').javadoc.should be_kind_of(Javadoc::JavadocTask)
268
+ project('foo').doc.should be_kind_of(Doc::DocTask)
269
269
  end
270
270
 
271
- it 'should set target directory to target/javadoc' do
271
+ it 'should set target directory to target/doc' do
272
272
  define 'foo' do
273
273
  compile.using(:javac)
274
- javadoc.target.to_s.should point_to_path('target/javadoc')
274
+ doc.target.to_s.should point_to_path('target/doc')
275
275
  end
276
276
  end
277
277
 
278
278
  it 'should create file task for target directory' do
279
279
  define 'foo' do
280
280
  compile.using(:javac)
281
- javadoc.should_receive(:invoke_prerequisites)
281
+ doc.should_receive(:invoke_prerequisites)
282
282
  end
283
- project('foo').file('target/javadoc').invoke
283
+ project('foo').file('target/doc').invoke
284
284
  end
285
285
 
286
286
  it 'should respond to into() and return self' do
287
287
  define 'foo' do
288
288
  compile.using(:javac)
289
- javadoc.into('docs').should be(javadoc)
289
+ doc.into('docs').should be(doc)
290
290
  end
291
291
  end
292
292
 
293
293
  it 'should respond to into() and change target directory' do
294
294
  define 'foo' do
295
295
  compile.using(:javac)
296
- javadoc.into('docs')
297
- javadoc.should_receive(:invoke_prerequisites)
296
+ doc.into('docs')
297
+ doc.should_receive(:invoke_prerequisites)
298
298
  end
299
299
  file('docs').invoke
300
300
  end
301
301
 
302
302
  it 'should respond to from() and return self' do
303
303
  task = nil
304
- define('foo') { task = javadoc.from('srcs') }
305
- task.should be(project('foo').javadoc)
304
+ define('foo') { task = doc.from('srcs') }
305
+ task.should be(project('foo').doc)
306
306
  end
307
307
 
308
308
  it 'should respond to from() and add sources' do
309
309
  define 'foo' do
310
310
  compile.using(:javac)
311
- javadoc.from('srcs').should be(javadoc)
311
+ doc.from('srcs').should be(doc)
312
312
  end
313
313
  end
314
314
 
315
315
  it 'should respond to from() and add file task' do
316
316
  define 'foo' do
317
317
  compile.using(:javac)
318
- javadoc.from('srcs').should be(javadoc)
318
+ doc.from('srcs').should be(doc)
319
319
  end
320
- project('foo').javadoc.source_files.first.should point_to_path('srcs')
320
+ project('foo').doc.source_files.first.should point_to_path('srcs')
321
321
  end
322
322
 
323
323
  it 'should respond to from() and add project\'s sources and dependencies' do
@@ -325,27 +325,27 @@ describe Project, '#javadoc' do
325
325
  define 'foo' do
326
326
  compile.using(:javac)
327
327
  define('bar') { compile.using(:javac).with 'group:id:jar:1.0' }
328
- javadoc.from project('foo:bar')
328
+ doc.from project('foo:bar')
329
329
  end
330
- project('foo').javadoc.source_files.first.should point_to_path('bar/src/main/java/Test.java')
331
- project('foo').javadoc.classpath.map(&:to_spec).should include('group:id:jar:1.0')
330
+ project('foo').doc.source_files.first.should point_to_path('bar/src/main/java/Test.java')
331
+ project('foo').doc.classpath.map(&:to_spec).should include('group:id:jar:1.0')
332
332
  end
333
333
 
334
- it 'should generate javadocs from project' do
334
+ it 'should generate docs from project' do
335
335
  sources
336
336
  define('foo') { compile.using(:javac) }
337
- project('foo').javadoc.source_files.sort.should == sources.sort.map { |f| File.expand_path(f) }
337
+ project('foo').doc.source_files.sort.should == sources.sort.map { |f| File.expand_path(f) }
338
338
  end
339
339
 
340
340
  it 'should include compile dependencies' do
341
341
  define('foo') { compile.using(:javac).with 'group:id:jar:1.0' }
342
- project('foo').javadoc.classpath.map(&:to_spec).should include('group:id:jar:1.0')
342
+ project('foo').doc.classpath.map(&:to_spec).should include('group:id:jar:1.0')
343
343
  end
344
344
 
345
345
  it 'should respond to include() and return self' do
346
346
  define 'foo' do
347
347
  compile.using(:javac)
348
- javadoc.include('srcs').should be(javadoc)
348
+ doc.include('srcs').should be(doc)
349
349
  end
350
350
  end
351
351
 
@@ -353,15 +353,15 @@ describe Project, '#javadoc' do
353
353
  included = sources.first
354
354
  define 'foo' do
355
355
  compile.using(:javac)
356
- javadoc.include included
356
+ doc.include included
357
357
  end
358
- project('foo').javadoc.source_files.should include(included)
358
+ project('foo').doc.source_files.should include(included)
359
359
  end
360
360
 
361
361
  it 'should respond to exclude() and return self' do
362
362
  define 'foo' do
363
363
  compile.using(:javac)
364
- javadoc.exclude('srcs').should be(javadoc)
364
+ doc.exclude('srcs').should be(doc)
365
365
  end
366
366
  end
367
367
 
@@ -369,35 +369,35 @@ describe Project, '#javadoc' do
369
369
  excluded = sources.first
370
370
  define 'foo' do
371
371
  compile.using(:javac)
372
- javadoc.exclude excluded
372
+ doc.exclude excluded
373
373
  end
374
374
  sources
375
- project('foo').javadoc.source_files.sort.should == sources[1..-1].map { |f| File.expand_path(f) }
375
+ project('foo').doc.source_files.sort.should == sources[1..-1].map { |f| File.expand_path(f) }
376
376
  end
377
377
 
378
378
  it 'should respond to using() and return self' do
379
379
  define 'foo' do
380
380
  compile.using(:javac)
381
- javadoc.using(:windowtitle=>'Fooing').should be(javadoc)
381
+ doc.using(:windowtitle=>'Fooing').should be(doc)
382
382
  end
383
383
  end
384
384
 
385
385
  it 'should respond to using() and accept options' do
386
386
  define 'foo' do
387
387
  compile.using(:javac)
388
- javadoc.using :windowtitle=>'Fooing'
388
+ doc.using :windowtitle=>'Fooing'
389
389
  end
390
- project('foo').javadoc.options[:windowtitle].should eql('Fooing')
390
+ project('foo').doc.options[:windowtitle].should eql('Fooing')
391
391
  end
392
392
 
393
393
  it 'should pick -windowtitle from project name' do
394
394
  define 'foo' do
395
395
  compile.using(:javac)
396
- javadoc.options[:windowtitle].should eql('foo')
396
+ doc.options[:windowtitle].should eql('foo')
397
397
 
398
398
  define 'bar' do
399
399
  compile.using(:javac)
400
- javadoc.options[:windowtitle].should eql('foo:bar')
400
+ doc.options[:windowtitle].should eql('foo:bar')
401
401
  end
402
402
  end
403
403
  end
@@ -406,32 +406,32 @@ describe Project, '#javadoc' do
406
406
  desc 'My App'
407
407
  define 'foo' do
408
408
  compile.using(:javac)
409
- javadoc.options[:windowtitle].should eql('My App')
409
+ doc.options[:windowtitle].should eql('My App')
410
410
  end
411
411
  end
412
412
 
413
413
  it 'should produce documentation' do
414
414
  sources
415
415
  define('foo') { compile.using(:javac) }
416
- project('foo').javadoc.invoke
417
- (1..3).map { |i| "target/javadoc/foo/Test#{i}.html" }.each { |f| file(f).should exist }
416
+ project('foo').doc.invoke
417
+ (1..3).map { |i| "target/doc/foo/Test#{i}.html" }.each { |f| file(f).should exist }
418
418
  end
419
419
 
420
420
  it 'should fail on error' do
421
421
  write 'Test.java', 'class Test {}'
422
422
  define 'foo' do
423
423
  compile.using(:javac)
424
- javadoc.include 'Test.java'
424
+ doc.include 'Test.java'
425
425
  end
426
- lambda { project('foo').javadoc.invoke }.should raise_error(RuntimeError, /Failed to generate Javadocs/)
426
+ lambda { project('foo').doc.invoke }.should raise_error(RuntimeError, /Failed to generate Javadocs/)
427
427
  end
428
428
 
429
429
  it 'should be local task' do
430
430
  define 'foo' do
431
431
  define('bar') { compile.using(:javac) }
432
432
  end
433
- project('foo:bar').javadoc.should_receive(:invoke_prerequisites)
434
- in_original_dir(project('foo:bar').base_dir) { task('javadoc').invoke }
433
+ project('foo:bar').doc.should_receive(:invoke_prerequisites)
434
+ in_original_dir(project('foo:bar').base_dir) { task('doc').invoke }
435
435
  end
436
436
 
437
437
  it 'should not recurse' do
@@ -439,8 +439,8 @@ describe Project, '#javadoc' do
439
439
  compile.using(:javac)
440
440
  define('bar') { compile.using(:javac) }
441
441
  end
442
- project('foo:bar').javadoc.should_not_receive(:invoke_prerequisites)
443
- project('foo').javadoc.invoke
442
+ project('foo:bar').doc.should_not_receive(:invoke_prerequisites)
443
+ project('foo').doc.invoke
444
444
  end
445
445
  end
446
446