ittayd-buildr 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. data/CHANGELOG +62 -9
  2. data/NOTICE +1 -1
  3. data/README.rdoc +9 -21
  4. data/Rakefile +20 -39
  5. data/_buildr +1 -0
  6. data/{spec/java/ant.rb → _jbuildr} +11 -15
  7. metadata +30 -210
  8. data/DISCLAIMER +0 -7
  9. data/addon/buildr/antlr.rb +0 -65
  10. data/addon/buildr/cobertura.rb +0 -22
  11. data/addon/buildr/drb.rb +0 -281
  12. data/addon/buildr/emma.rb +0 -22
  13. data/addon/buildr/hibernate.rb +0 -142
  14. data/addon/buildr/javacc.rb +0 -85
  15. data/addon/buildr/jdepend.rb +0 -60
  16. data/addon/buildr/jetty.rb +0 -248
  17. data/addon/buildr/jibx.rb +0 -86
  18. data/addon/buildr/nailgun.rb +0 -221
  19. data/addon/buildr/openjpa.rb +0 -90
  20. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  22. data/addon/buildr/org/apache/buildr/BuildrNail.java +0 -41
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  26. data/addon/buildr/org/apache/buildr/JettyWrapper.java +0 -144
  27. data/addon/buildr/path.rb +0 -136
  28. data/addon/buildr/xmlbeans.rb +0 -93
  29. data/buildr.buildfile +0 -53
  30. data/buildr.gemspec +0 -58
  31. data/doc/css/default.css +0 -228
  32. data/doc/css/print.css +0 -100
  33. data/doc/css/syntax.css +0 -52
  34. data/doc/images/apache-incubator-logo.png +0 -0
  35. data/doc/images/buildr-hires.png +0 -0
  36. data/doc/images/buildr.png +0 -0
  37. data/doc/images/favicon.png +0 -0
  38. data/doc/images/growl-icon.tiff +0 -0
  39. data/doc/images/note.png +0 -0
  40. data/doc/images/project-structure.png +0 -0
  41. data/doc/images/tip.png +0 -0
  42. data/doc/images/zbuildr.tif +0 -0
  43. data/doc/pages/artifacts.textile +0 -207
  44. data/doc/pages/building.textile +0 -240
  45. data/doc/pages/contributing.textile +0 -208
  46. data/doc/pages/download.textile +0 -62
  47. data/doc/pages/extending.textile +0 -175
  48. data/doc/pages/getting_started.textile +0 -273
  49. data/doc/pages/index.textile +0 -42
  50. data/doc/pages/languages.textile +0 -407
  51. data/doc/pages/mailing_lists.textile +0 -17
  52. data/doc/pages/more_stuff.textile +0 -314
  53. data/doc/pages/packaging.textile +0 -427
  54. data/doc/pages/projects.textile +0 -274
  55. data/doc/pages/recipes.textile +0 -103
  56. data/doc/pages/settings_profiles.textile +0 -274
  57. data/doc/pages/testing.textile +0 -212
  58. data/doc/pages/troubleshooting.textile +0 -103
  59. data/doc/pages/whats_new.textile +0 -323
  60. data/doc/print.haml +0 -51
  61. data/doc/print.toc.yaml +0 -29
  62. data/doc/scripts/buildr-git.rb +0 -412
  63. data/doc/scripts/install-jruby.sh +0 -44
  64. data/doc/scripts/install-linux.sh +0 -64
  65. data/doc/scripts/install-osx.sh +0 -52
  66. data/doc/site.haml +0 -56
  67. data/doc/site.toc.yaml +0 -47
  68. data/etc/KEYS +0 -151
  69. data/etc/git-svn-authors +0 -16
  70. data/lib/buildr.rb +0 -33
  71. data/lib/buildr/core.rb +0 -29
  72. data/lib/buildr/core/application.rb +0 -665
  73. data/lib/buildr/core/build.rb +0 -311
  74. data/lib/buildr/core/checks.rb +0 -254
  75. data/lib/buildr/core/common.rb +0 -150
  76. data/lib/buildr/core/compile.rb +0 -590
  77. data/lib/buildr/core/environment.rb +0 -117
  78. data/lib/buildr/core/filter.rb +0 -366
  79. data/lib/buildr/core/generate.rb +0 -195
  80. data/lib/buildr/core/help.rb +0 -119
  81. data/lib/buildr/core/osx.rb +0 -49
  82. data/lib/buildr/core/progressbar.rb +0 -156
  83. data/lib/buildr/core/project.rb +0 -923
  84. data/lib/buildr/core/test.rb +0 -715
  85. data/lib/buildr/core/transports.rb +0 -560
  86. data/lib/buildr/core/util.rb +0 -294
  87. data/lib/buildr/groovy.rb +0 -18
  88. data/lib/buildr/groovy/bdd.rb +0 -106
  89. data/lib/buildr/groovy/compiler.rb +0 -138
  90. data/lib/buildr/ide.rb +0 -19
  91. data/lib/buildr/ide/eclipse.rb +0 -222
  92. data/lib/buildr/ide/idea.ipr.template +0 -300
  93. data/lib/buildr/ide/idea.rb +0 -190
  94. data/lib/buildr/ide/idea7x.ipr.template +0 -290
  95. data/lib/buildr/ide/idea7x.rb +0 -212
  96. data/lib/buildr/java.rb +0 -23
  97. data/lib/buildr/java/ant.rb +0 -92
  98. data/lib/buildr/java/bdd.rb +0 -451
  99. data/lib/buildr/java/cobertura.rb +0 -236
  100. data/lib/buildr/java/commands.rb +0 -211
  101. data/lib/buildr/java/compiler.rb +0 -348
  102. data/lib/buildr/java/deprecated.rb +0 -141
  103. data/lib/buildr/java/emma.rb +0 -238
  104. data/lib/buildr/java/jruby.rb +0 -117
  105. data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
  106. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  107. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +0 -119
  108. data/lib/buildr/java/packaging.rb +0 -717
  109. data/lib/buildr/java/pom.rb +0 -174
  110. data/lib/buildr/java/rjb.rb +0 -155
  111. data/lib/buildr/java/test_result.rb +0 -307
  112. data/lib/buildr/java/tests.rb +0 -329
  113. data/lib/buildr/java/version_requirement.rb +0 -172
  114. data/lib/buildr/packaging.rb +0 -24
  115. data/lib/buildr/packaging/archive.rb +0 -488
  116. data/lib/buildr/packaging/artifact.rb +0 -759
  117. data/lib/buildr/packaging/artifact_namespace.rb +0 -972
  118. data/lib/buildr/packaging/artifact_search.rb +0 -140
  119. data/lib/buildr/packaging/gems.rb +0 -102
  120. data/lib/buildr/packaging/package.rb +0 -233
  121. data/lib/buildr/packaging/tar.rb +0 -186
  122. data/lib/buildr/packaging/version_requirement.rb +0 -172
  123. data/lib/buildr/packaging/zip.rb +0 -64
  124. data/lib/buildr/packaging/ziptask.rb +0 -313
  125. data/lib/buildr/resources/buildr.icns +0 -0
  126. data/lib/buildr/scala.rb +0 -19
  127. data/lib/buildr/scala/compiler.rb +0 -109
  128. data/lib/buildr/scala/tests.rb +0 -203
  129. data/rakelib/apache.rake +0 -191
  130. data/rakelib/changelog.rake +0 -57
  131. data/rakelib/doc.rake +0 -103
  132. data/rakelib/package.rake +0 -76
  133. data/rakelib/release.rake +0 -65
  134. data/rakelib/rspec.rake +0 -83
  135. data/rakelib/rubyforge.rake +0 -56
  136. data/rakelib/scm.rake +0 -49
  137. data/rakelib/setup.rake +0 -81
  138. data/rakelib/stage.rake +0 -48
  139. data/spec/addon/drb_spec.rb +0 -328
  140. data/spec/core/application_spec.rb +0 -419
  141. data/spec/core/build_spec.rb +0 -423
  142. data/spec/core/checks_spec.rb +0 -519
  143. data/spec/core/common_spec.rb +0 -670
  144. data/spec/core/compile_spec.rb +0 -582
  145. data/spec/core/generate_spec.rb +0 -33
  146. data/spec/core/project_spec.rb +0 -776
  147. data/spec/core/test_spec.rb +0 -1098
  148. data/spec/core/transport_spec.rb +0 -500
  149. data/spec/groovy/bdd_spec.rb +0 -80
  150. data/spec/groovy/compiler_spec.rb +0 -239
  151. data/spec/ide/eclipse_spec.rb +0 -311
  152. data/spec/java/bdd_spec.rb +0 -358
  153. data/spec/java/cobertura_spec.rb +0 -77
  154. data/spec/java/compiler_spec.rb +0 -446
  155. data/spec/java/emma_spec.rb +0 -120
  156. data/spec/java/java_spec.rb +0 -96
  157. data/spec/java/packaging_spec.rb +0 -1120
  158. data/spec/java/test_coverage_spec.rb +0 -255
  159. data/spec/java/tests_spec.rb +0 -471
  160. data/spec/packaging/archive_spec.rb +0 -503
  161. data/spec/packaging/artifact_namespace_spec.rb +0 -646
  162. data/spec/packaging/artifact_spec.rb +0 -795
  163. data/spec/packaging/packaging_helper.rb +0 -63
  164. data/spec/packaging/packaging_spec.rb +0 -589
  165. data/spec/sandbox.rb +0 -139
  166. data/spec/scala/compiler_spec.rb +0 -228
  167. data/spec/scala/tests_spec.rb +0 -215
  168. data/spec/spec_helpers.rb +0 -327
  169. data/spec/version_requirement_spec.rb +0 -123
@@ -1,358 +0,0 @@
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
- describe Buildr::RSpec do
19
-
20
- def foo(*args, &prc)
21
- define('foo', *args) do
22
- test.using :rspec, :output => false
23
- if prc
24
- instance_eval(&prc)
25
- else
26
- self
27
- end
28
- end
29
- end
30
-
31
- it 'should be selected by :rspec name' do
32
- foo { test.framework.should eql(:rspec) }
33
- end
34
-
35
- it 'should run rspecs' 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
- failure = File.expand_path('src/spec/ruby/failure_spec.rb')
39
- write(failure, 'describe("failure") { it("is false") { true.should == false } }')
40
- error = File.expand_path('src/spec/ruby/error_spec.rb')
41
- write(error, 'describe("error") { it("raises") { lambda; } }')
42
- foo do
43
- lambda { test.invoke }.should raise_error(/Tests failed/)
44
- test.tests.should include(success, failure, error)
45
- test.failed_tests.should include(failure, error)
46
- test.passed_tests.should include(success)
47
- end
48
- end
49
-
50
- end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # RSpec
51
-
52
- describe Buildr::JtestR do
53
-
54
- def foo(*args, &prc)
55
- define('foo', *args) do
56
- test.using :jtestr, :output => false
57
- if prc
58
- instance_eval(&prc)
59
- else
60
- self
61
- end
62
- end
63
- end
64
-
65
- it 'should be selected by :jtestr name' do
66
- foo { test.framework.should eql(:jtestr) }
67
- end
68
-
69
- it 'should apply to projects having test_unit sources' do
70
- define('one', :base_dir => 'one') do
71
- write _('src/spec/ruby/one_test.rb')
72
- JtestR.applies_to?(self).should be_true
73
- end
74
- define('two', :base_dir => 'two') do
75
- write _('src/spec/ruby/twoTest.rb')
76
- JtestR.applies_to?(self).should be_true
77
- end
78
- define('three', :base_dir => 'three') do
79
- write _('src/spec/ruby/tc_three.rb')
80
- JtestR.applies_to?(self).should be_true
81
- end
82
- define('four', :base_dir => 'four') do
83
- write _('src/spec/ruby/ts_four.rb')
84
- JtestR.applies_to?(self).should be_true
85
- end
86
- end
87
-
88
- it 'should apply to projects having rspec sources' do
89
- define('one', :base_dir => 'one') do
90
- write _('src/spec/ruby/one_spec.rb')
91
- JtestR.applies_to?(self).should be_true
92
- end
93
- end
94
-
95
- it 'should apply to projects having expectations sources' do
96
- define('one', :base_dir => 'one') do
97
- write _('src/spec/ruby/one_expect.rb')
98
- JtestR.applies_to?(self).should be_true
99
- end
100
- end
101
-
102
- it 'should apply to projects having junit sources' do
103
- define('one', :base_dir => 'one') do
104
- write _('src/test/java/example/OneTest.java', <<-JAVA)
105
- package example;
106
- public class OneTest extends junit.framework.TestCase { }
107
- JAVA
108
- JtestR.applies_to?(self).should be_true
109
- end
110
- end
111
-
112
- it 'should apply to projects having testng sources' do
113
- define('one', :base_dir => 'one') do
114
- write _('src/test/java/example/OneTest.java', <<-JAVA)
115
- package example;
116
- public class OneTest {
117
- @org.testng.annotations.Test
118
- public void testNothing() {}
119
- }
120
- JAVA
121
- JtestR.applies_to?(self).should be_true
122
- end
123
- end
124
-
125
- it 'should use a java compiler if java sources found' do
126
- foo do
127
- write _('src/spec/java/Something.java'), 'public class Something {}'
128
- test.compile.language.should eql(:java)
129
- end
130
- end
131
-
132
- it 'should load user jtestr_config.rb' do
133
- foo do
134
- hello = _('hello')
135
- write('src/spec/ruby/jtestr_config.rb', "File.open('#{hello}', 'w') { |f| f.write 'HELLO' }")
136
- write('src/spec/ruby/some_spec.rb')
137
- test.invoke
138
- File.should be_exist(hello)
139
- File.read(hello).should == 'HELLO'
140
- end
141
- end
142
-
143
- it 'should run junit tests' do
144
- write('src/test/java/example/SuccessTest.java', <<-JAVA)
145
- package example;
146
- public class SuccessTest extends junit.framework.TestCase {
147
- public void testSuccess() { assertTrue(true); }
148
- }
149
- JAVA
150
- write('src/test/java/example/FailureTest.java', <<-JAVA)
151
- package example;
152
- public class FailureTest extends junit.framework.TestCase {
153
- public void testFailure() { assertTrue(false); }
154
- }
155
- JAVA
156
- foo do
157
- lambda { test.invoke }.should raise_error(/Tests failed/)
158
- test.tests.should include('example.SuccessTest', 'example.FailureTest')
159
- test.failed_tests.should include('example.FailureTest')
160
- test.passed_tests.should include('example.SuccessTest')
161
- end
162
- end
163
-
164
- it 'should run testng tests' do
165
- write('src/test/java/example/Success.java', <<-JAVA)
166
- package example;
167
- public class Success {
168
- @org.testng.annotations.Test
169
- public void annotatedSuccess() { org.testng.Assert.assertTrue(true); }
170
- }
171
- JAVA
172
- write('src/test/java/example/Failure.java', <<-JAVA)
173
- package example;
174
- public class Failure {
175
- @org.testng.annotations.Test
176
- public void annotatedFail() { org.testng.Assert.fail("FAIL"); }
177
- }
178
- JAVA
179
- foo do
180
- lambda { test.invoke }.should raise_error(/Tests failed/)
181
- test.tests.should include('example.Success', 'example.Failure')
182
- test.failed_tests.should include('example.Failure')
183
- test.passed_tests.should include('example.Success')
184
- end
185
- end
186
-
187
- it 'should run test_unit' do
188
- success = File.expand_path('src/spec/ruby/success_test.rb')
189
- write(success, <<-TESTUNIT)
190
- require 'test/unit'
191
- class TC_Success < Test::Unit::TestCase
192
- def test_success
193
- assert true
194
- end
195
- end
196
- TESTUNIT
197
- failure = File.expand_path('src/spec/ruby/failure_test.rb')
198
- write(failure, <<-TESTUNIT)
199
- require 'test/unit'
200
- class TC_Failure < Test::Unit::TestCase
201
- def test_failure
202
- assert false
203
- end
204
- end
205
- TESTUNIT
206
- error = File.expand_path('src/spec/ruby/error_test.rb')
207
- write(error, <<-TESTUNIT)
208
- require 'test/unit'
209
- class TC_Error < Test::Unit::TestCase
210
- def test_error
211
- lambda;
212
- end
213
- end
214
- TESTUNIT
215
- foo do
216
- lambda { test.invoke }.should raise_error(/Tests failed/)
217
- test.tests.should include(success, failure, error)
218
- test.failed_tests.should include(failure, error)
219
- test.passed_tests.should include(success)
220
- end
221
- end
222
-
223
- it 'should run expectations' do
224
- success = File.expand_path('src/spec/ruby/success_expect.rb')
225
- write(success, 'Expectations { expect(true) { true } }')
226
- failure = File.expand_path('src/spec/ruby/failure_expect.rb')
227
- write(failure, 'Expectations { expect(true) { false } }')
228
- error = File.expand_path('src/spec/ruby/error_expect.rb')
229
- write(error, 'Expectations { expect(nil) { lambda; } }')
230
- foo do
231
- lambda { test.invoke }.should raise_error(/Tests failed/)
232
- test.tests.should include(success, failure, error)
233
- test.failed_tests.should include(failure, error)
234
- test.passed_tests.should include(success)
235
- end
236
- end
237
-
238
- it 'should run rspecs' do
239
- success = File.expand_path('src/spec/ruby/success_spec.rb')
240
- write(success, 'describe("success") { it("is true") { nil.should be_nil } }')
241
- failure = File.expand_path('src/spec/ruby/failure_spec.rb')
242
- write(failure, 'describe("failure") { it("is false") { true.should == false } }')
243
- error = File.expand_path('src/spec/ruby/error_spec.rb')
244
- write(error, 'describe("error") { it("raises") { lambda; } }')
245
- pending = File.expand_path('src/spec/ruby/pending_spec.rb')
246
- write(pending, 'describe("peding") { it "is not implemented" }')
247
- foo do
248
- lambda { test.invoke }.should raise_error(/Tests failed/)
249
- test.tests.should include(success, failure, error)
250
- test.failed_tests.should include(failure, error)
251
- test.passed_tests.should include(success)
252
- end
253
- end
254
-
255
-
256
- end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # JtestR
257
-
258
- describe Buildr::JBehave do
259
- def foo(*args, &prc)
260
- define('foo', *args) do
261
- test.using :jbehave
262
- if prc
263
- instance_eval(&prc)
264
- else
265
- self
266
- end
267
- end
268
- end
269
-
270
- it 'should apply to projects having JBehave sources' do
271
- define('one', :base_dir => 'one') do
272
- write _('src/spec/java/SomeBehaviour.java'), 'public class SomeBehaviour {}'
273
- JBehave.applies_to?(self).should be_true
274
- end
275
- define('two', :base_dir => 'two') do
276
- write _('src/test/java/SomeBehaviour.java'), 'public class SomeBehaviour {}'
277
- JBehave.applies_to?(self).should be_false
278
- end
279
- define('three', :base_dir => 'three') do
280
- write _('src/spec/java/SomeBehavior.java'), 'public class SomeBehavior {}'
281
- JBehave.applies_to?(self).should be_true
282
- end
283
- define('four', :base_dir => 'four') do
284
- write _('src/test/java/SomeBehavior.java'), 'public class SomeBehavior {}'
285
- JBehave.applies_to?(self).should be_false
286
- end
287
- end
288
-
289
- it 'should be selected by :jbehave name' do
290
- foo { test.framework.should eql(:jbehave) }
291
- end
292
-
293
- it 'should select a java compiler for its sources' do
294
- write 'src/test/java/SomeBehavior.java', 'public class SomeBehavior {}'
295
- foo do
296
- test.compile.language.should eql(:java)
297
- end
298
- end
299
-
300
- it 'should include JBehave dependencies' do
301
- foo do
302
- test.compile.dependencies.should include(artifact("org.jbehave:jbehave:jar::#{JBehave.version}"))
303
- test.dependencies.should include(artifact("org.jbehave:jbehave:jar::#{JBehave.version}"))
304
- end
305
- end
306
-
307
- it 'should include JMock dependencies' do
308
- foo do
309
- test.compile.dependencies.should include(artifact("jmock:jmock:jar:#{JMock.version}"))
310
- test.dependencies.should include(artifact("jmock:jmock:jar:#{JMock.version}"))
311
- end
312
- end
313
-
314
- it 'should include classes whose name ends with Behavior' do
315
- write 'src/spec/java/some/FooBehavior.java', <<-JAVA
316
- package some;
317
- public class FooBehavior {
318
- public void shouldFoo() { assert true; }
319
- }
320
- JAVA
321
- write 'src/spec/java/some/NotATest.java', <<-JAVA
322
- package some;
323
- public class NotATest { }
324
- JAVA
325
- foo.tap do |project|
326
- project.test.invoke
327
- project.test.tests.should include('some.FooBehavior')
328
- end
329
- end
330
-
331
-
332
- it 'should include classes implementing Behaviours' do
333
- write 'src/spec/java/some/MyBehaviours.java', <<-JAVA
334
- package some;
335
- public class MyBehaviours implements
336
- org.jbehave.core.behaviour.Behaviours {
337
- public Class[] getBehaviours() {
338
- return new Class[] { some.FooBehave.class };
339
- }
340
- }
341
- JAVA
342
- write 'src/spec/java/some/FooBehave.java', <<-JAVA
343
- package some;
344
- public class FooBehave {
345
- public void shouldFoo() { assert true; }
346
- }
347
- JAVA
348
- write 'src/spec/java/some/NotATest.java', <<-JAVA
349
- package some;
350
- public class NotATest { }
351
- JAVA
352
- foo.tap do |project|
353
- project.test.invoke
354
- project.test.tests.should include('some.MyBehaviours')
355
- end
356
- end
357
-
358
- end # JBehave
@@ -1,77 +0,0 @@
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
-
17
- require File.join(File.dirname(__FILE__), 'test_coverage_spec')
18
- Sandbox.require_optional_extension 'buildr/java/cobertura'
19
-
20
- Buildr::Cobertura::requires
21
-
22
-
23
- describe Buildr::Cobertura do
24
- before do
25
- # Reloading the extension because the sandbox removes all its actions
26
- load File.expand_path('../lib/buildr/java/cobertura.rb')
27
- @tool_module = Buildr::Cobertura
28
- end
29
-
30
- it_should_behave_like 'test coverage tool'
31
-
32
- describe 'project-specific' do
33
-
34
- describe 'data file' do
35
- it 'should have a default value' do
36
- define('foo').cobertura.data_file.should point_to_path('reports/cobertura.ser')
37
- end
38
-
39
- it 'should be overridable' do
40
- define('foo') { cobertura.data_file = path_to('target/data.cobertura') }
41
- project('foo').cobertura.data_file.should point_to_path('target/data.cobertura')
42
- end
43
-
44
- it 'should be created during instrumentation' do
45
- write 'src/main/java/Foo.java', 'public class Foo {}'
46
- define('foo')
47
- task('foo:cobertura:instrument').invoke
48
- file(project('foo').cobertura.data_file).should exist
49
- end
50
- end
51
-
52
- describe 'instrumentation' do
53
- before do
54
- ['Foo', 'Bar'].each { |cls| write File.join('src/main/java', "#{cls}.java"), "public class #{cls} {}" }
55
- end
56
-
57
- it 'should instrument only included classes' do
58
- define('foo') { cobertura.include 'Foo' }
59
- task("foo:cobertura:instrument").invoke
60
- Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Foo.class'] }
61
- end
62
-
63
- it 'should not instrument excluded classes' do
64
- define('foo') { cobertura.exclude 'Foo' }
65
- task("foo:cobertura:instrument").invoke
66
- Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Bar.class'] }
67
- end
68
-
69
- it 'should instrument classes that are included but not excluded' do
70
- write 'src/main/java/Baz.java', 'public class Baz {}'
71
- define('foo') { cobertura.include('Ba').exclude('ar') }
72
- task("foo:cobertura:instrument").invoke
73
- Dir.chdir('target/instrumented/classes') { Dir.glob('*').sort.should == ['Baz.class'] }
74
- end
75
- end
76
- end
77
- end
@@ -1,446 +0,0 @@
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
-
17
- require File.join(File.dirname(__FILE__), '../spec_helpers')
18
-
19
-
20
- describe 'javac compiler' do
21
- it 'should identify itself from source directories' do
22
- write 'src/main/java/com/example/Test.java', 'package com.example; class Test {}'
23
- define('foo').compile.compiler.should eql(:javac)
24
- end
25
-
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 {}'
29
- custom = Layout.new
30
- custom[:source, :main, :java] = 'src'
31
- custom[:source, :test, :java] = 'testing'
32
- define 'foo', :layout=>custom do
33
- compile.compiler.should eql(:javac)
34
- test.compile.compiler.should eql(:javac)
35
- end
36
- end
37
-
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 {}'
41
- define 'foo' do
42
- lambda { compile.from 'src' }.should change { compile.compiler }.to(:javac)
43
- lambda { test.compile.from 'testing' }.should change { test.compile.compiler }.to(:javac)
44
- end
45
- end
46
-
47
- it 'should report the language as :java' do
48
- define('foo').compile.using(:javac).language.should eql(:java)
49
- end
50
-
51
- it 'should set the target directory to target/classes' do
52
- define 'foo' do
53
- lambda { compile.using(:javac) }.should change { compile.target.to_s }.to(File.expand_path('target/classes'))
54
- end
55
- end
56
-
57
- it 'should not override existing target directory' do
58
- define 'foo' do
59
- compile.into('classes')
60
- lambda { compile.using(:javac) }.should_not change { compile.target }
61
- end
62
- end
63
-
64
- it 'should not change existing list of sources' do
65
- define 'foo' do
66
- compile.from('sources')
67
- lambda { compile.using(:javac) }.should_not change { compile.sources }
68
- end
69
- end
70
-
71
- it 'should include classpath dependencies' do
72
- write 'src/dependency/Dependency.java', 'class Dependency {}'
73
- define 'dependency', :version=>'1.0' do
74
- compile.from('src/dependency').into('target/dependency')
75
- package(:jar)
76
- end
77
- write 'src/test/DependencyTest.java', 'class DependencyTest { Dependency _var; }'
78
- define('foo').compile.from('src/test').with(project('dependency')).invoke
79
- file('target/classes/DependencyTest.class').should exist
80
- end
81
-
82
- it 'should include tools.jar dependency' do
83
- write 'src/main/java/UseApt.java', <<-JAVA
84
- import com.sun.mirror.apt.AnnotationProcessor;
85
- public class UseApt { }
86
- JAVA
87
- define('foo').compile.invoke
88
- file('target/classes/UseApt.class').should exist
89
- end
90
- end
91
-
92
-
93
- describe 'javac compiler options' do
94
- def compile_task
95
- @compile_task ||= define('foo').compile.using(:javac)
96
- end
97
-
98
- def javac_args
99
- compile_task.instance_eval { @compiler }.send(:javac_args)
100
- end
101
-
102
- it 'should set warnings option to false by default' do
103
- compile_task.options.warnings.should be_false
104
- end
105
-
106
- it 'should set wranings option to true when running with --verbose option' do
107
- verbose true
108
- compile_task.options.warnings.should be_true
109
- end
110
-
111
- it 'should use -nowarn argument when warnings is false' do
112
- compile_task.using(:warnings=>false)
113
- javac_args.should include('-nowarn')
114
- end
115
-
116
- it 'should not use -nowarn argument when warnings is true' do
117
- compile_task.using(:warnings=>true)
118
- javac_args.should_not include('-nowarn')
119
- end
120
-
121
- it 'should not use -verbose argument by default' do
122
- javac_args.should_not include('-verbose')
123
- end
124
-
125
- it 'should use -verbose argument when running with --trace option' do
126
- trace true
127
- javac_args.should include('-verbose')
128
- end
129
-
130
- it 'should set debug option to true by default' do
131
- compile_task.options.debug.should be_true
132
- end
133
-
134
- it 'should set debug option to false based on Buildr.options' do
135
- Buildr.options.debug = false
136
- compile_task.options.debug.should be_false
137
- end
138
-
139
- it 'should set debug option to false based on debug environment variable' do
140
- ENV['debug'] = 'no'
141
- compile_task.options.debug.should be_false
142
- end
143
-
144
- it 'should set debug option to false based on DEBUG environment variable' do
145
- ENV['DEBUG'] = 'no'
146
- compile_task.options.debug.should be_false
147
- end
148
-
149
- it 'should use -g argument when debug option is true' do
150
- compile_task.using(:debug=>true)
151
- javac_args.should include('-g')
152
- end
153
-
154
- it 'should not use -g argument when debug option is false' do
155
- compile_task.using(:debug=>false)
156
- javac_args.should_not include('-g')
157
- end
158
-
159
- it 'should set deprecation option to false by default' do
160
- compile_task.options.deprecation.should be_false
161
- end
162
-
163
- it 'should use -deprecation argument when deprecation is true' do
164
- compile_task.using(:deprecation=>true)
165
- javac_args.should include('-deprecation')
166
- end
167
-
168
- it 'should not use -deprecation argument when deprecation is false' do
169
- compile_task.using(:deprecation=>false)
170
- javac_args.should_not include('-deprecation')
171
- end
172
-
173
- it 'should not set source option by default' do
174
- compile_task.options.source.should be_nil
175
- javac_args.should_not include('-source')
176
- end
177
-
178
- it 'should not set target option by default' do
179
- compile_task.options.target.should be_nil
180
- javac_args.should_not include('-target')
181
- end
182
-
183
- it 'should use -source nn argument if source option set' do
184
- compile_task.using(:source=>'1.5')
185
- javac_args.should include('-source', '1.5')
186
- end
187
-
188
- it 'should use -target nn argument if target option set' do
189
- compile_task.using(:target=>'1.5')
190
- javac_args.should include('-target', '1.5')
191
- end
192
-
193
- it 'should set lint option to false by default' do
194
- compile_task.options.lint.should be_false
195
- end
196
-
197
- it 'should use -lint argument if lint option is true' do
198
- compile_task.using(:lint=>true)
199
- javac_args.should include('-Xlint')
200
- end
201
-
202
- it 'should use -lint argument with value of option' do
203
- compile_task.using(:lint=>'all')
204
- javac_args.should include('-Xlint:all')
205
- end
206
-
207
- it 'should use -lint argument with value of option as array' do
208
- compile_task.using(:lint=>['path', 'serial'])
209
- javac_args.should include('-Xlint:path,serial')
210
- end
211
-
212
- it 'should not set other option by default' do
213
- compile_task.options.other.should be_nil
214
- end
215
-
216
- it 'should pass other argument if other option is string' do
217
- compile_task.using(:other=>'-Xprint')
218
- javac_args.should include('-Xprint')
219
- end
220
-
221
- it 'should pass other argument if other option is array' do
222
- compile_task.using(:other=>['-Xstdout', 'msgs'])
223
- javac_args.should include('-Xstdout', 'msgs')
224
- end
225
-
226
- it 'should complain about options it doesn\'t know' do
227
- write 'source/Test.java', 'class Test {}'
228
- compile_task.using(:unknown=>'option')
229
- lambda { compile_task.from('source').invoke }.should raise_error(ArgumentError, /no such option/i)
230
- end
231
-
232
- it 'should inherit options from parent' do
233
- define 'foo' do
234
- compile.using(:warnings=>true, :debug=>true, :deprecation=>true, :source=>'1.5', :target=>'1.4')
235
- define 'bar' do
236
- compile.using(:javac)
237
- compile.options.warnings.should be_true
238
- compile.options.debug.should be_true
239
- compile.options.deprecation.should be_true
240
- compile.options.source.should eql('1.5')
241
- compile.options.target.should eql('1.4')
242
- end
243
- end
244
- end
245
-
246
- after do
247
- Buildr.options.debug = nil
248
- ENV.delete "debug"
249
- ENV.delete "DEBUG"
250
- end
251
- end
252
-
253
-
254
- describe Project, '#javadoc' do
255
- def sources
256
- @sources ||= (1..3).map { |i| "Test#{i}" }.
257
- each { |name| write "src/main/java/foo/#{name}.java", "package foo; public class #{name}{}" }.
258
- map { |name| "src/main/java/foo/#{name}.java" }
259
- end
260
-
261
- it 'should return the project\'s Javadoc task' do
262
- define('foo') { compile.using(:javac) }
263
- project('foo').javadoc.name.should eql('foo:javadoc')
264
- end
265
-
266
- it 'should return a Javadoc task' do
267
- define('foo') { compile.using(:javac) }
268
- project('foo').javadoc.should be_kind_of(Javadoc::JavadocTask)
269
- end
270
-
271
- it 'should set target directory to target/javadoc' do
272
- define 'foo' do
273
- compile.using(:javac)
274
- javadoc.target.to_s.should point_to_path('target/javadoc')
275
- end
276
- end
277
-
278
- it 'should create file task for target directory' do
279
- define 'foo' do
280
- compile.using(:javac)
281
- javadoc.should_receive(:invoke_prerequisites)
282
- end
283
- project('foo').file('target/javadoc').invoke
284
- end
285
-
286
- it 'should respond to into() and return self' do
287
- define 'foo' do
288
- compile.using(:javac)
289
- javadoc.into('docs').should be(javadoc)
290
- end
291
- end
292
-
293
- it 'should respond to into() and change target directory' do
294
- define 'foo' do
295
- compile.using(:javac)
296
- javadoc.into('docs')
297
- javadoc.should_receive(:invoke_prerequisites)
298
- end
299
- file('docs').invoke
300
- end
301
-
302
- it 'should respond to from() and return self' do
303
- task = nil
304
- define('foo') { task = javadoc.from('srcs') }
305
- task.should be(project('foo').javadoc)
306
- end
307
-
308
- it 'should respond to from() and add sources' do
309
- define 'foo' do
310
- compile.using(:javac)
311
- javadoc.from('srcs').should be(javadoc)
312
- end
313
- end
314
-
315
- it 'should respond to from() and add file task' do
316
- define 'foo' do
317
- compile.using(:javac)
318
- javadoc.from('srcs').should be(javadoc)
319
- end
320
- project('foo').javadoc.source_files.first.should point_to_path('srcs')
321
- end
322
-
323
- it 'should respond to from() and add project\'s sources and dependencies' do
324
- write 'bar/src/main/java/Test.java'
325
- define 'foo' do
326
- compile.using(:javac)
327
- define('bar') { compile.using(:javac).with 'group:id:jar:1.0' }
328
- javadoc.from project('foo:bar')
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')
332
- end
333
-
334
- it 'should generate javadocs from project' do
335
- sources
336
- define('foo') { compile.using(:javac) }
337
- project('foo').javadoc.source_files.sort.should == sources.sort.map { |f| File.expand_path(f) }
338
- end
339
-
340
- it 'should include compile dependencies' do
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')
343
- end
344
-
345
- it 'should respond to include() and return self' do
346
- define 'foo' do
347
- compile.using(:javac)
348
- javadoc.include('srcs').should be(javadoc)
349
- end
350
- end
351
-
352
- it 'should respond to include() and add files' do
353
- included = sources.first
354
- define 'foo' do
355
- compile.using(:javac)
356
- javadoc.include included
357
- end
358
- project('foo').javadoc.source_files.should include(included)
359
- end
360
-
361
- it 'should respond to exclude() and return self' do
362
- define 'foo' do
363
- compile.using(:javac)
364
- javadoc.exclude('srcs').should be(javadoc)
365
- end
366
- end
367
-
368
- it 'should respond to exclude() and ignore files' do
369
- excluded = sources.first
370
- define 'foo' do
371
- compile.using(:javac)
372
- javadoc.exclude excluded
373
- end
374
- sources
375
- project('foo').javadoc.source_files.sort.should == sources[1..-1].map { |f| File.expand_path(f) }
376
- end
377
-
378
- it 'should respond to using() and return self' do
379
- define 'foo' do
380
- compile.using(:javac)
381
- javadoc.using(:windowtitle=>'Fooing').should be(javadoc)
382
- end
383
- end
384
-
385
- it 'should respond to using() and accept options' do
386
- define 'foo' do
387
- compile.using(:javac)
388
- javadoc.using :windowtitle=>'Fooing'
389
- end
390
- project('foo').javadoc.options[:windowtitle].should eql('Fooing')
391
- end
392
-
393
- it 'should pick -windowtitle from project name' do
394
- define 'foo' do
395
- compile.using(:javac)
396
- javadoc.options[:windowtitle].should eql('foo')
397
-
398
- define 'bar' do
399
- compile.using(:javac)
400
- javadoc.options[:windowtitle].should eql('foo:bar')
401
- end
402
- end
403
- end
404
-
405
- it 'should pick -windowtitle from project description' do
406
- desc 'My App'
407
- define 'foo' do
408
- compile.using(:javac)
409
- javadoc.options[:windowtitle].should eql('My App')
410
- end
411
- end
412
-
413
- it 'should produce documentation' do
414
- sources
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 }
418
- end
419
-
420
- it 'should fail on error' do
421
- write 'Test.java', 'class Test {}'
422
- define 'foo' do
423
- compile.using(:javac)
424
- javadoc.include 'Test.java'
425
- end
426
- lambda { project('foo').javadoc.invoke }.should raise_error(RuntimeError, /Failed to generate Javadocs/)
427
- end
428
-
429
- it 'should be local task' do
430
- define 'foo' do
431
- define('bar') { compile.using(:javac) }
432
- end
433
- project('foo:bar').javadoc.should_receive(:invoke_prerequisites)
434
- in_original_dir(project('foo:bar').base_dir) { task('javadoc').invoke }
435
- end
436
-
437
- it 'should not recurse' do
438
- define 'foo' do
439
- compile.using(:javac)
440
- define('bar') { compile.using(:javac) }
441
- end
442
- project('foo:bar').javadoc.should_not_receive(:invoke_prerequisites)
443
- project('foo').javadoc.invoke
444
- end
445
- end
446
-