buildr 1.4.2-x86-mswin32 → 1.4.3-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +29 -3
- data/LICENSE +0 -0
- data/NOTICE +0 -0
- data/_jbuildr +2 -0
- data/addon/buildr/antlr.rb +0 -0
- data/addon/buildr/cobertura.rb +0 -0
- data/addon/buildr/drb.rb +0 -0
- data/addon/buildr/emma.rb +0 -0
- data/addon/buildr/javacc.rb +0 -0
- data/addon/buildr/jdepend.rb +0 -0
- data/addon/buildr/jetty.rb +0 -0
- data/addon/buildr/jibx.rb +0 -0
- data/addon/buildr/nailgun.rb +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.java +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.java +0 -0
- data/addon/buildr/xmlbeans.rb +0 -0
- data/buildr.gemspec +1 -1
- data/doc/_config.yml +0 -0
- data/doc/_layouts/preface.html +0 -0
- data/doc/css/syntax.css +0 -0
- data/doc/extending.textile +0 -0
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/index.textile +14 -15
- data/doc/mailing_lists.textile +0 -0
- data/doc/more_stuff.textile +54 -1
- data/doc/releasing.textile +17 -16
- data/doc/settings_profiles.textile +13 -13
- data/lib/buildr.rb +1 -0
- data/lib/buildr/core.rb +1 -0
- data/lib/buildr/core/application.rb +8 -3
- data/lib/buildr/core/checks.rb +0 -0
- data/lib/buildr/core/doc.rb +15 -4
- data/lib/buildr/core/environment.rb +0 -0
- data/lib/buildr/core/generate.rb +0 -0
- data/lib/buildr/core/help.rb +0 -0
- data/lib/buildr/core/progressbar.rb +0 -0
- data/lib/buildr/core/run.rb +43 -0
- data/lib/buildr/core/util.rb +21 -3
- data/lib/buildr/ide.rb +0 -0
- data/lib/buildr/ide/idea.ipr.template +0 -0
- data/lib/buildr/ide/idea.rb +0 -0
- data/lib/buildr/ide/idea7x.ipr.template +0 -0
- data/lib/buildr/java/doc.rb +16 -0
- data/lib/buildr/java/packaging.rb +9 -4
- data/lib/buildr/packaging.rb +0 -0
- data/lib/buildr/packaging/archive.rb +4 -4
- data/lib/buildr/packaging/artifact.rb +16 -15
- data/lib/buildr/packaging/artifact_search.rb +0 -0
- data/lib/buildr/packaging/gems.rb +0 -0
- data/lib/buildr/packaging/package.rb +1 -1
- data/lib/buildr/packaging/version_requirement.rb +0 -0
- data/lib/buildr/packaging/ziptask.rb +6 -4
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/run.rb +202 -0
- data/lib/buildr/scala/doc.rb +18 -0
- data/lib/buildr/scala/tests.rb +3 -0
- data/lib/buildr/shell.rb +1 -1
- data/lib/buildr/version.rb +1 -1
- data/rakelib/doc.rake +23 -5
- data/rakelib/release.rake +0 -0
- data/rakelib/setup.rake +2 -2
- data/rakelib/stage.rake +3 -3
- data/spec/addon/drb_spec.rb +0 -0
- data/spec/core/application_spec.rb +65 -27
- data/spec/core/doc_spec.rb +195 -0
- data/spec/core/run_spec.rb +92 -0
- data/spec/java/compiler_spec.rb +0 -194
- data/spec/java/doc_spec.rb +56 -0
- data/spec/java/packaging_spec.rb +30 -14
- data/spec/java/run_spec.rb +78 -0
- data/spec/packaging/archive_spec.rb +20 -5
- data/spec/packaging/artifact_spec.rb +23 -14
- data/spec/packaging/packaging_helper.rb +0 -0
- data/spec/scala/doc_spec.rb +68 -0
- metadata +151 -143
@@ -0,0 +1,92 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
17
|
+
|
18
|
+
describe Project, :run do
|
19
|
+
|
20
|
+
it 'should return the project\'s run task' do
|
21
|
+
define('foo')
|
22
|
+
project('foo').run.name.should eql('foo:run')
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should return a RunTask' do
|
26
|
+
define('foo')
|
27
|
+
project('foo').run.should be_kind_of(Run::RunTask)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should include compile and test.compile dependencies' do
|
31
|
+
define('foo') do
|
32
|
+
compile.using(:javac).with 'group:compile:jar:1.0'
|
33
|
+
test.compile.using(:javac).with 'group:test:jar:1.0'
|
34
|
+
end
|
35
|
+
project('foo').run.classpath.should include(artifact('group:compile:jar:1.0'))
|
36
|
+
project('foo').run.classpath.should include(artifact('group:test:jar:1.0'))
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should respond to using() and return self' do
|
40
|
+
define 'foo' do
|
41
|
+
run.using(:foo=>'Fooing').should be(run)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should respond to using() and accept options' do
|
46
|
+
define 'foo' do
|
47
|
+
run.using :foo=>'Fooing'
|
48
|
+
end
|
49
|
+
project('foo').run.options[:foo].should eql('Fooing')
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should select runner using run.using' do
|
53
|
+
define 'foo' do
|
54
|
+
run.using :java
|
55
|
+
end
|
56
|
+
project('foo').run.runner.should be_a(Run::JavaRunner)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should select runner based on compile language' do
|
60
|
+
write 'src/main/java/Test.java', 'class Test {}'
|
61
|
+
define 'foo' do
|
62
|
+
# compile language detected as :java
|
63
|
+
end
|
64
|
+
project('foo').run.runner.should be_a(Run::JavaRunner)
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should depend on project''s compile and test.compile task' do
|
68
|
+
define 'foo'
|
69
|
+
project('foo').run.prerequisites.should include(project('foo').compile)
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'should be local task' do
|
73
|
+
define 'foo' do
|
74
|
+
define('bar')
|
75
|
+
end
|
76
|
+
project('foo:bar').run.should_receive(:invoke_prerequisites)
|
77
|
+
project('foo:bar').run.should_receive(:run)
|
78
|
+
in_original_dir(project('foo:bar').base_dir) { task('run').invoke }
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should not recurse' do
|
82
|
+
define 'foo' do
|
83
|
+
define('bar') { run.using :java, :main => 'foo' }
|
84
|
+
end
|
85
|
+
project('foo:bar').run.should_not_receive(:invoke_prerequisites)
|
86
|
+
project('foo:bar').run.should_not_receive(:run)
|
87
|
+
project('foo').run.should_receive(:run)
|
88
|
+
project('foo').run.invoke
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
data/spec/java/compiler_spec.rb
CHANGED
@@ -250,197 +250,3 @@ describe 'javac compiler options' do
|
|
250
250
|
end
|
251
251
|
end
|
252
252
|
|
253
|
-
|
254
|
-
describe Project, '#doc' 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').doc.name.should eql('foo:doc')
|
264
|
-
end
|
265
|
-
|
266
|
-
it 'should return a DocTask' do
|
267
|
-
define('foo') { compile.using(:javac) }
|
268
|
-
project('foo').doc.should be_kind_of(Doc::DocTask)
|
269
|
-
end
|
270
|
-
|
271
|
-
it 'should set target directory to target/doc' do
|
272
|
-
define 'foo' do
|
273
|
-
compile.using(:javac)
|
274
|
-
doc.target.to_s.should point_to_path('target/doc')
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
it 'should create file task for target directory' do
|
279
|
-
define 'foo' do
|
280
|
-
compile.using(:javac)
|
281
|
-
doc.should_receive(:invoke_prerequisites)
|
282
|
-
end
|
283
|
-
project('foo').file('target/doc').invoke
|
284
|
-
end
|
285
|
-
|
286
|
-
it 'should respond to into() and return self' do
|
287
|
-
define 'foo' do
|
288
|
-
compile.using(:javac)
|
289
|
-
doc.into('docs').should be(doc)
|
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
|
-
doc.into('docs')
|
297
|
-
doc.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 = doc.from('srcs') }
|
305
|
-
task.should be(project('foo').doc)
|
306
|
-
end
|
307
|
-
|
308
|
-
it 'should respond to from() and add sources' do
|
309
|
-
define 'foo' do
|
310
|
-
compile.using(:javac)
|
311
|
-
doc.from('srcs').should be(doc)
|
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
|
-
doc.from('srcs').should be(doc)
|
319
|
-
end
|
320
|
-
project('foo').doc.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
|
-
doc.from project('foo:bar')
|
329
|
-
end
|
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
|
-
end
|
333
|
-
|
334
|
-
it 'should generate docs from project' do
|
335
|
-
sources
|
336
|
-
define('foo') { compile.using(:javac) }
|
337
|
-
project('foo').doc.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').doc.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
|
-
doc.include('srcs').should be(doc)
|
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
|
-
doc.include included
|
357
|
-
end
|
358
|
-
project('foo').doc.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
|
-
doc.exclude('srcs').should be(doc)
|
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
|
-
doc.exclude excluded
|
373
|
-
end
|
374
|
-
sources
|
375
|
-
project('foo').doc.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
|
-
doc.using(:windowtitle=>'Fooing').should be(doc)
|
382
|
-
end
|
383
|
-
end
|
384
|
-
|
385
|
-
it 'should respond to using() and accept options' do
|
386
|
-
define 'foo' do
|
387
|
-
compile.using(:javac)
|
388
|
-
doc.using :windowtitle=>'Fooing'
|
389
|
-
end
|
390
|
-
project('foo').doc.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
|
-
doc.options[:windowtitle].should eql('foo')
|
397
|
-
|
398
|
-
define 'bar' do
|
399
|
-
compile.using(:javac)
|
400
|
-
doc.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
|
-
doc.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').doc.invoke
|
417
|
-
(1..3).map { |i| "target/doc/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
|
-
doc.include 'Test.java'
|
425
|
-
end
|
426
|
-
lambda { project('foo').doc.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').doc.should_receive(:invoke_prerequisites)
|
434
|
-
in_original_dir(project('foo:bar').base_dir) { task('doc').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').doc.should_not_receive(:invoke_prerequisites)
|
443
|
-
project('foo').doc.invoke
|
444
|
-
end
|
445
|
-
end
|
446
|
-
|
@@ -0,0 +1,56 @@
|
|
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.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
18
|
+
|
19
|
+
describe 'Javadoc' do
|
20
|
+
def sources
|
21
|
+
@sources ||= (1..3).map { |i| "Test#{i}" }.
|
22
|
+
each { |name| write "src/main/java/foo/#{name}.java", "package foo; public class #{name}{}" }.
|
23
|
+
map { |name| "src/main/java/foo/#{name}.java" }
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should pick -windowtitle from project name by default' do
|
27
|
+
define 'foo' do
|
28
|
+
compile.using(:javac)
|
29
|
+
|
30
|
+
define 'bar' do
|
31
|
+
compile.using(:javac)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
project('foo').doc.options[:windowtitle].should eql('foo')
|
36
|
+
project('foo:bar').doc.options[:windowtitle].should eql('foo:bar')
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should pick -windowtitle from project description by default, if available' do
|
40
|
+
desc 'My App'
|
41
|
+
define 'foo' do
|
42
|
+
compile.using(:javac)
|
43
|
+
end
|
44
|
+
project('foo').doc.options[:windowtitle].should eql('My App')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should not override explicit :windowtitle' do
|
48
|
+
define 'foo' do
|
49
|
+
compile.using(:javac)
|
50
|
+
doc.using :windowtitle => 'explicit'
|
51
|
+
end
|
52
|
+
project('foo').doc.options[:windowtitle].should eql('explicit')
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
data/spec/java/packaging_spec.rb
CHANGED
@@ -567,12 +567,19 @@ describe Packaging, 'war' do
|
|
567
567
|
end
|
568
568
|
|
569
569
|
it 'should accept file from :libs option' do
|
570
|
+
write 'lib/foo.jar'
|
571
|
+
define('foo', :version=>'1.0') { package(:war).libs << 'lib/foo.jar' }
|
572
|
+
inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/foo.jar') }
|
573
|
+
end
|
574
|
+
|
575
|
+
|
576
|
+
it 'should accept artifacts from :libs option' do
|
570
577
|
make_jars
|
571
578
|
define('foo', :version=>'1.0') { package(:war).with(:libs=>'group:id:jar:1.0') }
|
572
579
|
inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar') }
|
573
580
|
end
|
574
581
|
|
575
|
-
it 'should accept
|
582
|
+
it 'should accept artifacts from :libs option' do
|
576
583
|
make_jars
|
577
584
|
define('foo', :version=>'1.0') { package(:war).with(:libs=>['group:id:jar:1.0', 'group:id:jar:2.0']) }
|
578
585
|
inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar', 'WEB-INF/lib/id-2.0.jar') }
|
@@ -601,25 +608,25 @@ describe Packaging, 'war' do
|
|
601
608
|
define('foo', :version=>'1.0') { compile.with 'group:id:jar:1.0', 'group:id:jar:2.0' ; package(:war).exclude('**/id-2.0.jar') }
|
602
609
|
inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar') }
|
603
610
|
end
|
604
|
-
|
611
|
+
|
605
612
|
it 'should exclude files regardless of the path where they are included, specifying target path entirely' do
|
606
613
|
make_jars
|
607
614
|
define('foo', :version=>'1.0') { compile.with 'group:id:jar:1.0', 'group:id:jar:2.0' ; package(:war).exclude('WEB-INF/lib/id-2.0.jar') }
|
608
615
|
inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar') }
|
609
616
|
end
|
610
|
-
|
611
|
-
it 'should exclude files regardless of the path where they are included for war files' do
|
612
|
-
write 'src/main/java/com/example/included/Test.java', 'package com.example.included; class Test {}'
|
613
|
-
write 'src/main/java/com/example/excluded/Test.java', 'package com.example.excluded; class Test {}'
|
614
|
-
define('foo', :version=>'1.0') do
|
615
|
-
package(:war).enhance do |war|
|
617
|
+
|
618
|
+
it 'should exclude files regardless of the path where they are included for war files' do
|
619
|
+
write 'src/main/java/com/example/included/Test.java', 'package com.example.included; class Test {}'
|
620
|
+
write 'src/main/java/com/example/excluded/Test.java', 'package com.example.excluded; class Test {}'
|
621
|
+
define('foo', :version=>'1.0') do
|
622
|
+
package(:war).enhance do |war|
|
616
623
|
war.exclude('WEB-INF/classes/com/example/excluded/**.class')
|
617
624
|
end
|
618
|
-
end
|
619
|
-
inspect_war do |files|
|
620
|
-
files.should include('WEB-INF/classes/com/example/included/Test.class')
|
621
|
-
files.should_not include('WEB-INF/classes/com/example/excluded/Test.class')
|
622
|
-
end
|
625
|
+
end
|
626
|
+
inspect_war do |files|
|
627
|
+
files.should include('WEB-INF/classes/com/example/included/Test.class')
|
628
|
+
files.should_not include('WEB-INF/classes/com/example/excluded/Test.class')
|
629
|
+
end
|
623
630
|
end
|
624
631
|
|
625
632
|
it 'should include only specified libraries' do
|
@@ -1106,11 +1113,20 @@ describe Packaging, 'sources' do
|
|
1106
1113
|
end
|
1107
1114
|
end
|
1108
1115
|
|
1109
|
-
it 'should contain source files' do
|
1116
|
+
it 'should contain source and resource files' do
|
1110
1117
|
write 'src/main/java/Source.java'
|
1118
|
+
write 'src/main/resources/foo.properties', 'foo=bar'
|
1111
1119
|
define('foo', :version=>'1.0') { package(:sources) }
|
1112
1120
|
project('foo').task('package').invoke
|
1113
1121
|
project('foo').packages.first.should contain('Source.java')
|
1122
|
+
project('foo').packages.first.should contain('foo.properties')
|
1123
|
+
end
|
1124
|
+
|
1125
|
+
it 'should create sources jar if resources exists (but not sources)' do
|
1126
|
+
write 'src/main/resources/foo.properties', 'foo=bar'
|
1127
|
+
define('foo', :version=>'1.0') { package(:sources) }
|
1128
|
+
project('foo').package(:sources).invoke
|
1129
|
+
project('foo').packages.first.should contain('foo.properties')
|
1114
1130
|
end
|
1115
1131
|
|
1116
1132
|
it 'should be a ZipTask' do
|
@@ -0,0 +1,78 @@
|
|
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.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
|
18
|
+
|
19
|
+
|
20
|
+
describe Run::JavaRunner do
|
21
|
+
|
22
|
+
it 'should fail on error' do
|
23
|
+
define 'foo' do
|
24
|
+
run.using :java, :main => 'org.example.NonExistentMain' # class doesn't exist
|
25
|
+
end
|
26
|
+
lambda { project('foo').run.invoke }.should raise_error(RuntimeError, /Failed to execute java/)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should execute main class' do
|
30
|
+
write 'src/main/java/org/example/Main.java', <<-JAVA
|
31
|
+
package org.example;
|
32
|
+
public class Main {
|
33
|
+
public static void main(String[] args) {
|
34
|
+
System.out.println("Hello, world!");
|
35
|
+
}
|
36
|
+
}
|
37
|
+
JAVA
|
38
|
+
define 'foo' do
|
39
|
+
run.using :main => 'org.example.Main'
|
40
|
+
end
|
41
|
+
project('foo').run.prerequisites.should include(task("foo:compile"))
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should accept :main option as an array including parameters for the main class' do
|
45
|
+
define 'foo' do
|
46
|
+
run.using :java, :main => ['org.example.Main', '-t', 'input.txt']
|
47
|
+
end
|
48
|
+
Java::Commands.should_receive(:java).once.with do |*args|
|
49
|
+
args[0].should == ['org.example.Main', '-t', 'input.txt']
|
50
|
+
end
|
51
|
+
project('foo').run.invoke
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should accept :java_args and pass them to java' do
|
55
|
+
define 'foo' do
|
56
|
+
run.using :java, :main => 'foo', :java_args => ['-server']
|
57
|
+
end
|
58
|
+
Java::Commands.should_receive(:java).once.with do |*args|
|
59
|
+
args[0].should == 'foo'
|
60
|
+
args[1][:java_args].should include('-server')
|
61
|
+
end
|
62
|
+
project('foo').run.invoke
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should accept :properties and pass them as -Dproperty=value to java' do
|
66
|
+
define 'foo' do
|
67
|
+
run.using :java, :main => 'foo', :properties => { :foo => 'one', :bar => 'two' }
|
68
|
+
end
|
69
|
+
Java::Commands.should_receive(:java).once.with do |*args|
|
70
|
+
args[0].should == 'foo'
|
71
|
+
args[1][:properties][:foo].should == 'one'
|
72
|
+
args[1][:properties][:bar].should == 'two'
|
73
|
+
end
|
74
|
+
project('foo').run.invoke
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|