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.
- data/CHANGELOG +153 -8
- data/README.rdoc +1 -1
- data/addon/buildr/antlr.rb +5 -5
- data/addon/buildr/drb.rb +18 -18
- data/addon/buildr/hibernate.rb +18 -14
- data/addon/buildr/javacc.rb +4 -4
- data/addon/buildr/jetty.rb +5 -5
- data/addon/buildr/nailgun.rb +23 -23
- data/addon/buildr/openjpa.rb +1 -1
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/protobuf.rb +75 -0
- data/addon/buildr/xmlbeans.rb +5 -5
- data/buildr.buildfile +2 -2
- data/buildr.gemspec +8 -7
- data/doc/_layouts/default.html +2 -2
- data/doc/artifacts.textile +4 -4
- data/doc/building.textile +35 -3
- data/doc/contributing.textile +5 -0
- data/doc/download.textile +16 -5
- data/doc/extending.textile +38 -12
- data/doc/installing.textile +6 -5
- data/doc/languages.textile +182 -42
- data/doc/more_stuff.textile +2 -2
- data/doc/packaging.textile +14 -15
- data/doc/projects.textile +7 -2
- data/doc/quick_start.textile +4 -4
- data/doc/scripts/buildr-git.rb +63 -63
- data/doc/scripts/gitflow.rb +21 -21
- data/doc/settings_profiles.textile +9 -2
- data/doc/testing.textile +16 -5
- data/etc/KEYS +38 -0
- data/lib/buildr.rb +1 -1
- data/lib/buildr/core.rb +1 -0
- data/lib/buildr/core/application.rb +33 -27
- data/lib/buildr/core/build.rb +41 -28
- data/lib/buildr/core/cc.rb +172 -0
- data/lib/buildr/core/checks.rb +1 -1
- data/lib/buildr/core/common.rb +7 -6
- data/lib/buildr/core/compile.rb +7 -8
- data/lib/buildr/core/doc.rb +263 -0
- data/lib/buildr/core/environment.rb +6 -6
- data/lib/buildr/core/filter.rb +77 -35
- data/lib/buildr/core/generate.rb +7 -7
- data/lib/buildr/core/help.rb +1 -1
- data/lib/buildr/core/osx.rb +6 -6
- data/lib/buildr/core/progressbar.rb +4 -4
- data/lib/buildr/core/project.rb +144 -36
- data/lib/buildr/core/shell.rb +34 -34
- data/lib/buildr/core/test.rb +89 -20
- data/lib/buildr/core/transports.rb +8 -7
- data/lib/buildr/core/util.rb +77 -23
- data/lib/buildr/groovy/bdd.rb +5 -5
- data/lib/buildr/groovy/compiler.rb +19 -15
- data/lib/buildr/groovy/shell.rb +6 -6
- data/lib/buildr/ide/eclipse.rb +148 -75
- data/lib/buildr/ide/eclipse/java.rb +3 -3
- data/lib/buildr/ide/eclipse/plugin.rb +8 -5
- data/lib/buildr/ide/eclipse/scala.rb +4 -2
- data/lib/buildr/ide/idea.rb +2 -2
- data/lib/buildr/ide/idea7x.rb +23 -4
- data/lib/buildr/java.rb +1 -0
- data/lib/buildr/java/ant.rb +4 -4
- data/lib/buildr/java/bdd.rb +51 -54
- data/lib/buildr/java/cobertura.rb +57 -35
- data/lib/buildr/java/commands.rb +14 -5
- data/lib/buildr/java/compiler.rb +3 -217
- data/lib/buildr/java/deprecated.rb +4 -4
- data/lib/buildr/java/doc.rb +70 -0
- data/lib/buildr/java/emma.rb +22 -22
- data/lib/buildr/java/jruby.rb +4 -4
- data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
- data/lib/buildr/java/packaging.rb +30 -29
- data/lib/buildr/java/pom.rb +4 -4
- data/lib/buildr/java/rjb.rb +6 -6
- data/lib/buildr/java/test_result.rb +61 -85
- data/lib/buildr/java/tests.rb +44 -27
- data/lib/buildr/java/version_requirement.rb +8 -8
- data/lib/buildr/packaging/archive.rb +55 -22
- data/lib/buildr/packaging/artifact.rb +75 -36
- data/lib/buildr/packaging/artifact_namespace.rb +90 -78
- data/lib/buildr/packaging/artifact_search.rb +5 -5
- data/lib/buildr/packaging/gems.rb +11 -7
- data/lib/buildr/packaging/package.rb +10 -7
- data/lib/buildr/packaging/tar.rb +14 -14
- data/lib/buildr/packaging/version_requirement.rb +30 -10
- data/lib/buildr/packaging/ziptask.rb +51 -13
- data/lib/buildr/scala.rb +1 -0
- data/lib/buildr/scala/bdd.rb +25 -20
- data/lib/buildr/scala/compiler.rb +87 -40
- data/lib/buildr/scala/doc.rb +106 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +14 -9
- data/lib/buildr/scala/tests.rb +33 -26
- data/lib/buildr/shell.rb +33 -33
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +1 -1
- data/rakelib/doc.rake +7 -0
- data/rakelib/package.rake +1 -1
- data/rakelib/release.rake +9 -6
- data/rakelib/rspec.rake +26 -7
- data/rakelib/setup.rake +15 -3
- data/rakelib/stage.rake +18 -11
- data/spec/addon/drb_spec.rb +25 -25
- data/spec/core/application_spec.rb +111 -21
- data/spec/core/build_spec.rb +16 -15
- data/spec/core/cc_spec.rb +174 -0
- data/spec/core/checks_spec.rb +34 -34
- data/spec/core/common_spec.rb +51 -5
- data/spec/core/compile_spec.rb +89 -14
- data/spec/core/extension_spec.rb +127 -19
- data/spec/core/generate_spec.rb +2 -2
- data/spec/core/project_spec.rb +10 -10
- data/spec/core/test_spec.rb +144 -35
- data/spec/core/transport_spec.rb +8 -8
- data/spec/core/util_spec.rb +63 -5
- data/spec/groovy/bdd_spec.rb +5 -5
- data/spec/groovy/compiler_spec.rb +29 -18
- data/spec/ide/eclipse_spec.rb +185 -9
- data/spec/ide/idea7x_spec.rb +22 -10
- data/spec/java/ant_spec.rb +9 -5
- data/spec/java/bdd_spec.rb +29 -37
- data/spec/java/cobertura_spec.rb +12 -12
- data/spec/java/commands_spec.rb +34 -0
- data/spec/java/compiler_spec.rb +53 -53
- data/spec/java/emma_spec.rb +11 -11
- data/spec/java/java_spec.rb +10 -10
- data/spec/java/packaging_spec.rb +67 -20
- data/spec/java/test_coverage_helper.rb +18 -18
- data/spec/java/tests_spec.rb +13 -9
- data/spec/packaging/archive_spec.rb +187 -20
- data/spec/packaging/artifact_namespace_spec.rb +172 -83
- data/spec/packaging/artifact_spec.rb +83 -18
- data/spec/packaging/packaging_spec.rb +41 -14
- data/spec/sandbox.rb +23 -12
- data/spec/scala/bdd_spec.rb +13 -8
- data/spec/scala/compiler_spec.rb +18 -13
- data/spec/scala/scala.rb +3 -3
- data/spec/scala/tests_spec.rb +46 -24
- data/spec/spec_helpers.rb +28 -10
- data/spec/version_requirement_spec.rb +25 -11
- metadata +148 -132
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
- data/rakelib/stage.rake~ +0 -213
@@ -74,11 +74,11 @@ describe Artifact do
|
|
74
74
|
it 'should have one POM artifact for all classifiers' do
|
75
75
|
@classified.pom.to_hash.should == @classified.to_hash.merge(:type=>:pom).except(:classifier)
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
it 'should have associated sources artifact' do
|
79
79
|
@artifact.sources_artifact.to_hash.should == @artifact.to_hash.merge(:classifier=>'sources')
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
it 'should download file if file does not exist' do
|
83
83
|
lambda { @artifact.invoke }.should raise_error(Exception, /No remote repositories/)
|
84
84
|
lambda { @classified.invoke }.should raise_error(Exception, /No remote repositories/)
|
@@ -112,7 +112,7 @@ describe Artifact do
|
|
112
112
|
end
|
113
113
|
|
114
114
|
it 'should not download file if dry-run' do
|
115
|
-
dryrun do
|
115
|
+
dryrun do
|
116
116
|
lambda { @artifact.invoke }.should_not raise_error
|
117
117
|
lambda { @classified.invoke }.should_not raise_error
|
118
118
|
end
|
@@ -169,6 +169,23 @@ describe Repositories, 'local' do
|
|
169
169
|
YAML
|
170
170
|
repositories.local.should eql(File.expand_path('my_repo'))
|
171
171
|
end
|
172
|
+
|
173
|
+
it 'should not override custom install methods defined when extending an object' do
|
174
|
+
class MyOwnInstallTask
|
175
|
+
|
176
|
+
attr_accessor :result
|
177
|
+
|
178
|
+
def install
|
179
|
+
result = true
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
183
|
+
task = MyOwnInstallTask.new
|
184
|
+
task.result = "maybe"
|
185
|
+
task.extend ActsAsArtifact
|
186
|
+
task.install
|
187
|
+
task.result.should be_true
|
188
|
+
end
|
172
189
|
end
|
173
190
|
|
174
191
|
|
@@ -239,11 +256,11 @@ describe Repositories, 'remote' do
|
|
239
256
|
it 'should deal well with repositories URL that have the last slash' do
|
240
257
|
repositories.remote = 'http://example.com/base/'
|
241
258
|
uri = nil
|
242
|
-
URI.should_receive(:download).twice.and_return { |_uri, args|
|
259
|
+
URI.should_receive(:download).twice.and_return { |_uri, args| uri = _uri }
|
243
260
|
artifact('group:id:jar:1.0').invoke
|
244
261
|
uri.to_s.should eql('http://example.com/base/group/id/1.0/id-1.0.pom')
|
245
262
|
end
|
246
|
-
|
263
|
+
|
247
264
|
it 'should resolve m2-style deployed snapshots' do
|
248
265
|
metadata = <<-XML
|
249
266
|
<?xml version='1.0' encoding='UTF-8'?>
|
@@ -270,7 +287,7 @@ describe Repositories, 'remote' do
|
|
270
287
|
lambda { artifact('com.example:library:jar:2.1-SNAPSHOT').invoke }.
|
271
288
|
should change { File.exist?(File.join(repositories.local, 'com/example/library/2.1-SNAPSHOT/library-2.1-SNAPSHOT.jar')) }.to(true)
|
272
289
|
end
|
273
|
-
|
290
|
+
|
274
291
|
it 'should handle missing maven metadata by reporting the artifact unavailable' do
|
275
292
|
repositories.remote = 'http://example.com'
|
276
293
|
URI.should_receive(:download).with(uri(/2.1-SNAPSHOT\/library-2.1-SNAPSHOT.jar$/), anything()).
|
@@ -280,7 +297,7 @@ describe Repositories, 'remote' do
|
|
280
297
|
lambda { artifact('com.example:library:jar:2.1-SNAPSHOT').invoke }.should raise_error(RuntimeError, /Failed to download/)
|
281
298
|
File.exist?(File.join(repositories.local, 'com/example/library/2.1-SNAPSHOT/library-2.1-SNAPSHOT.jar')).should be_false
|
282
299
|
end
|
283
|
-
|
300
|
+
|
284
301
|
it 'should handle missing m2 snapshots by reporting the artifact unavailable' do
|
285
302
|
metadata = <<-XML
|
286
303
|
<?xml version='1.0' encoding='UTF-8'?>
|
@@ -399,7 +416,7 @@ describe Buildr, '#artifact' do
|
|
399
416
|
it 'should complain about invalid key' do
|
400
417
|
lambda { artifact(@spec.merge(:error=>true)) }.should raise_error(ArgumentError, /no such option/i)
|
401
418
|
end
|
402
|
-
|
419
|
+
|
403
420
|
it 'should use JAR type by default' do
|
404
421
|
artifact(@spec.merge(:type=>nil)).should respond_to(:invoke)
|
405
422
|
end
|
@@ -409,7 +426,7 @@ describe Buildr, '#artifact' do
|
|
409
426
|
end
|
410
427
|
|
411
428
|
it 'should reject partial string specifier' do
|
412
|
-
artifact('com.example:library::2.0')
|
429
|
+
artifact('com.example:library::2.0')
|
413
430
|
lambda { artifact('com.example:library:jar') }.should raise_error
|
414
431
|
lambda { artifact('com.example:library:jar:') }.should raise_error
|
415
432
|
lambda { artifact('com.example:library::2.0') }.should_not raise_error
|
@@ -429,9 +446,43 @@ describe Buildr, '#artifact' do
|
|
429
446
|
lambda { artifact.invoke }.should change { File.exist?(artifact.to_s) }.to(true)
|
430
447
|
end
|
431
448
|
|
449
|
+
it 'should use from method to install artifact from a file task' do
|
450
|
+
test_jar = file('test.jar')
|
451
|
+
test_jar.enhance do
|
452
|
+
#nothing...
|
453
|
+
end
|
454
|
+
write 'test.jar'
|
455
|
+
artifact = artifact('group:id:jar:1.0').from(test_jar)
|
456
|
+
lambda { artifact.invoke }.should change { File.exist?(artifact.to_s) }.to(true)
|
457
|
+
end
|
458
|
+
|
459
|
+
it 'should invoke the artifact associated file task if the file doesnt exist' do
|
460
|
+
test_jar = file('test.jar')
|
461
|
+
called = false
|
462
|
+
test_jar.enhance do
|
463
|
+
write 'test.jar'
|
464
|
+
called = true
|
465
|
+
end
|
466
|
+
artifact = artifact('group:id:jar:1.0').from(test_jar)
|
467
|
+
artifact.invoke
|
468
|
+
unless called
|
469
|
+
raise "The file task was not called."
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
it 'should not invoke the artifact associated file task if the file already exists' do
|
474
|
+
test_jar = file('test.jar')
|
475
|
+
test_jar.enhance do
|
476
|
+
raise 'the test.jar file is created again!'
|
477
|
+
end
|
478
|
+
write 'test.jar'
|
479
|
+
artifact = artifact('group:id:jar:1.0').from(test_jar)
|
480
|
+
artifact.invoke
|
481
|
+
end
|
482
|
+
|
432
483
|
it 'should reference artifacts defined on build.yaml by using ruby symbols' do
|
433
484
|
write 'build.yaml', <<-YAML
|
434
|
-
artifacts:
|
485
|
+
artifacts:
|
435
486
|
j2ee: geronimo-spec:geronimo-spec-j2ee:jar:1.4-rc4
|
436
487
|
YAML
|
437
488
|
Buildr.application.send(:load_artifact_ns)
|
@@ -507,14 +558,20 @@ describe Buildr, '#group' do
|
|
507
558
|
list.should include(artifact('saxon:saxon-xpath:jar:8.4'))
|
508
559
|
list.size.should be(3)
|
509
560
|
end
|
510
|
-
|
561
|
+
|
511
562
|
it 'should accept a type' do
|
512
563
|
list = group('struts-bean', 'struts-html', :under=>'struts', :type=>'tld', :version=>'1.1')
|
513
564
|
list.should include(artifact('struts:struts-bean:tld:1.1'))
|
514
565
|
list.should include(artifact('struts:struts-html:tld:1.1'))
|
515
566
|
list.size.should be(2)
|
516
567
|
end
|
517
|
-
|
568
|
+
|
569
|
+
it 'should accept a classifier' do
|
570
|
+
list = group('camel-core', :under=>'org.apache.camel', :version=>'2.2.0', :classifier=>'spring3')
|
571
|
+
list.should include(artifact('org.apache.camel:camel-core:jar:spring3:2.2.0'))
|
572
|
+
list.size.should be(1)
|
573
|
+
end
|
574
|
+
|
518
575
|
end
|
519
576
|
|
520
577
|
describe Buildr, '#install' do
|
@@ -538,6 +595,14 @@ describe Buildr, '#install' do
|
|
538
595
|
lambda { install.invoke }.should change { File.exist?(artifact(@spec).to_s) }.to(true)
|
539
596
|
end
|
540
597
|
|
598
|
+
it 'should re-install artifact when "from" is newer' do
|
599
|
+
install artifact(@spec).from(@file)
|
600
|
+
write artifact(@spec).to_s # install a version of the artifact
|
601
|
+
old_mtime = File.mtime(artifact(@spec).to_s)
|
602
|
+
sleep 1; write @file # make sure the "from" file has newer modification time
|
603
|
+
lambda { install.invoke }.should change { File.exist?(artifact(@spec).to_s) and old_mtime < File.mtime(artifact(@spec).to_s) }.to(true)
|
604
|
+
end
|
605
|
+
|
541
606
|
it 'should install POM alongside artifact' do
|
542
607
|
write @file
|
543
608
|
install artifact(@spec).from(@file)
|
@@ -648,30 +713,30 @@ describe Rake::Task, ' artifacts:sources' do
|
|
648
713
|
task('artifacts:sources').clear
|
649
714
|
repositories.remote = 'http://example.com'
|
650
715
|
end
|
651
|
-
|
716
|
+
|
652
717
|
it 'should download sources for all specified artifacts' do
|
653
718
|
artifact 'group:id:jar:1.0'
|
654
719
|
URI.should_receive(:download).any_number_of_times.and_return { |uri, target| write target }
|
655
720
|
lambda { task('artifacts:sources').invoke }.should change { File.exist?('home/.m2/repository/group/id/1.0/id-1.0-sources.jar') }.to(true)
|
656
721
|
end
|
657
|
-
|
722
|
+
|
658
723
|
it "should not try to download sources for the project's artifacts" do
|
659
724
|
define('foo', :version=>'1.0') { package(:jar) }
|
660
725
|
URI.should_not_receive(:download)
|
661
726
|
task('artifacts:sources').invoke
|
662
727
|
end
|
663
|
-
|
728
|
+
|
664
729
|
describe 'when the source artifact does not exist' do
|
665
|
-
|
730
|
+
|
666
731
|
before do
|
667
732
|
artifact 'group:id:jar:1.0'
|
668
733
|
URI.should_receive(:download).any_number_of_times.and_raise(URI::NotFoundError)
|
669
734
|
end
|
670
|
-
|
735
|
+
|
671
736
|
it 'should not fail' do
|
672
737
|
lambda { task('artifacts:sources').invoke }.should_not raise_error
|
673
738
|
end
|
674
|
-
|
739
|
+
|
675
740
|
it 'should inform the user' do
|
676
741
|
lambda { task('artifacts:sources').invoke }.should show_info('Failed to download group:id:jar:sources:1.0. Skipping it.')
|
677
742
|
end
|
@@ -169,7 +169,7 @@ describe Project, '#package' do
|
|
169
169
|
end
|
170
170
|
|
171
171
|
it 'should call package_as_foo when using package(:foo)' do
|
172
|
-
class Buildr::Project
|
172
|
+
class Buildr::Project
|
173
173
|
def package_as_foo(file_name)
|
174
174
|
file(file_name) do |t|
|
175
175
|
mkdir_p File.dirname(t.to_s)
|
@@ -185,7 +185,7 @@ describe Project, '#package' do
|
|
185
185
|
end
|
186
186
|
|
187
187
|
it 'should allow to respec package(:sources) using package_as_sources_spec()' do
|
188
|
-
class Buildr::Project
|
188
|
+
class Buildr::Project
|
189
189
|
def package_as_sources_spec(spec)
|
190
190
|
spec.merge({ :type=>:jar, :classifier=>'sources' })
|
191
191
|
end
|
@@ -195,25 +195,25 @@ describe Project, '#package' do
|
|
195
195
|
package(:sources).classifier.should eql('sources')
|
196
196
|
end
|
197
197
|
end
|
198
|
-
|
198
|
+
|
199
199
|
it 'should produce different packages for different specs' do
|
200
|
-
class Buildr::Project
|
200
|
+
class Buildr::Project
|
201
201
|
def package_as_foo(file_name)
|
202
|
-
file(file_name)
|
202
|
+
file(file_name)
|
203
203
|
end
|
204
|
-
|
204
|
+
|
205
205
|
def package_as_foo_spec(spec)
|
206
206
|
spec.merge(:type => :zip)
|
207
207
|
end
|
208
|
-
|
208
|
+
|
209
209
|
def package_as_bar(file_name)
|
210
210
|
file(file_name)
|
211
211
|
end
|
212
|
-
|
212
|
+
|
213
213
|
def package_as_bar_spec(spec)
|
214
214
|
spec.merge(:type => :zip, :classifier => "foobar")
|
215
215
|
end
|
216
|
-
|
216
|
+
|
217
217
|
end
|
218
218
|
define('foo', :version => '1.0') do
|
219
219
|
package(:foo).type.should eql(:zip)
|
@@ -244,7 +244,7 @@ describe Project, '#package' do
|
|
244
244
|
|
245
245
|
it 'should return a file task' do
|
246
246
|
define('foo', :version=>'1.0') { package(:jar) }
|
247
|
-
project('foo').package(:jar).should be_kind_of(Rake::FileTask)
|
247
|
+
project('foo').package(:jar).should be_kind_of(Rake::FileTask)
|
248
248
|
end
|
249
249
|
|
250
250
|
it 'should return a task that acts as artifact' do
|
@@ -283,6 +283,15 @@ describe Project, '#package' do
|
|
283
283
|
project('foo').packages.uniq.size.should be(3)
|
284
284
|
end
|
285
285
|
|
286
|
+
it 'should create different tasks for specs with matching type' do
|
287
|
+
define 'foo', :version=>'1.0' do
|
288
|
+
javadoc("foo").into( "foo" )
|
289
|
+
package(:javadoc)
|
290
|
+
package(:zip)
|
291
|
+
end
|
292
|
+
project('foo').packages.uniq.size.should be(2)
|
293
|
+
end
|
294
|
+
|
286
295
|
it 'should return the same task for subsequent calls' do
|
287
296
|
define 'foo', :version=>'1.0' do
|
288
297
|
package.should eql(package)
|
@@ -616,9 +625,9 @@ end
|
|
616
625
|
|
617
626
|
describe Rake::Task, ' upload' do
|
618
627
|
before do
|
619
|
-
repositories.release_to = "file://#{File.expand_path('remote')}"
|
628
|
+
repositories.release_to = URI.escape("file://#{File.expand_path('remote')}")
|
620
629
|
end
|
621
|
-
|
630
|
+
|
622
631
|
it 'should be local task' do
|
623
632
|
define 'foo', :version=>'1.0' do
|
624
633
|
package
|
@@ -645,14 +654,32 @@ describe Rake::Task, ' upload' do
|
|
645
654
|
read(upload).should eql(read(package))
|
646
655
|
end
|
647
656
|
end
|
657
|
+
|
658
|
+
it 'should not upload twice the pom when artifacts are uploaded from a project' do
|
659
|
+
write 'src/main/java/Foo.java', 'public class Foo {}'
|
660
|
+
repositories.release_to = 'sftp://example.com/base'
|
661
|
+
define 'foo' do
|
662
|
+
project.group = "attached"
|
663
|
+
project.version = "1.0"
|
664
|
+
package(:jar)
|
665
|
+
package(:sources)
|
666
|
+
end
|
667
|
+
URI.should_receive(:upload).exactly(:once).
|
668
|
+
with(URI.parse('sftp://example.com/base/attached/foo/1.0/foo-1.0-sources.jar'), project("foo").package(:sources).to_s, anything)
|
669
|
+
URI.should_receive(:upload).exactly(:once).
|
670
|
+
with(URI.parse('sftp://example.com/base/attached/foo/1.0/foo-1.0.jar'), project("foo").package(:jar).to_s, anything)
|
671
|
+
URI.should_receive(:upload).exactly(:once).
|
672
|
+
with(URI.parse('sftp://example.com/base/attached/foo/1.0/foo-1.0.pom'), project("foo").package(:jar).pom.to_s, anything)
|
673
|
+
verbose(false) { project("foo").upload.invoke }
|
674
|
+
end
|
648
675
|
|
649
676
|
it 'should upload signatures for artifact and POM' do
|
650
677
|
define('foo', :version=>'1.0') { package :jar }
|
651
678
|
task('upload').invoke
|
652
679
|
{ 'remote/foo/foo/1.0/foo-1.0.jar'=>project('foo').package(:jar),
|
653
680
|
'remote/foo/foo/1.0/foo-1.0.pom'=>project('foo').package(:jar).pom }.each do |upload, package|
|
654
|
-
read("#{upload}.md5").split.first.should eql(Digest::MD5.hexdigest(read(package)))
|
655
|
-
read("#{upload}.sha1").split.first.should eql(Digest::SHA1.hexdigest(read(package)))
|
681
|
+
read("#{upload}.md5").split.first.should eql(Digest::MD5.hexdigest(read(package, "rb")))
|
682
|
+
read("#{upload}.sha1").split.first.should eql(Digest::SHA1.hexdigest(read(package, "rb")))
|
656
683
|
end
|
657
684
|
end
|
658
685
|
end
|
data/spec/sandbox.rb
CHANGED
@@ -21,18 +21,20 @@ Buildr.application.instance_eval { @rakefile = File.expand_path('buildfile') }
|
|
21
21
|
repositories.remote << 'http://repo1.maven.org/maven2'
|
22
22
|
repositories.remote << 'http://scala-tools.org/repo-releases'
|
23
23
|
|
24
|
+
# Force Scala 2.7.7 for specs; don't want to rely on SCALA_HOME
|
25
|
+
Buildr.settings.build['scala.version'] = "2.7.7"
|
26
|
+
|
24
27
|
# Add a 'require' here only for optional extensions, not for extensions that should be loaded by default.
|
25
28
|
require 'buildr/groovy'
|
26
29
|
require 'buildr/scala'
|
27
30
|
|
28
31
|
Java.load # Anything added to the classpath.
|
29
|
-
artifacts(TestFramework.frameworks.map(&:dependencies).flatten, JUnit.ant_taskdef).each do |path|
|
32
|
+
artifacts(TestFramework.frameworks.map(&:dependencies).flatten, JUnit.ant_taskdef, Buildr::Groovy::Groovyc.dependencies).each do |path|
|
30
33
|
file(path).invoke
|
31
34
|
end
|
32
|
-
# JtestR currently requires JUnit 4.4
|
33
|
-
file(artifact("junit:junit:jar:4.4")).invoke
|
34
35
|
|
35
36
|
ENV['HOME'] = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tmp', 'home'))
|
37
|
+
mkpath ENV['HOME']
|
36
38
|
|
37
39
|
# We need to run all tests inside a _sandbox, tacking a snapshot of Buildr before the test,
|
38
40
|
# and restoring everything to its previous state after the test. Damn state changes.
|
@@ -45,14 +47,14 @@ module Sandbox
|
|
45
47
|
spec.before(:each) { sandbox }
|
46
48
|
spec.after(:each) { reset }
|
47
49
|
end
|
48
|
-
|
50
|
+
|
49
51
|
# Require an optional extension without letting its callbacks pollute the Project class.
|
50
52
|
def require_optional_extension(extension_require_path)
|
51
|
-
project_callbacks_without_extension = Project.class_eval { @
|
53
|
+
project_callbacks_without_extension = Project.class_eval { @global_callbacks }.dup
|
52
54
|
begin
|
53
55
|
require extension_require_path
|
54
56
|
ensure
|
55
|
-
Project.class_eval { @
|
57
|
+
Project.class_eval { @global_callbacks = project_callbacks_without_extension }
|
56
58
|
end
|
57
59
|
end
|
58
60
|
end
|
@@ -71,7 +73,7 @@ module Sandbox
|
|
71
73
|
|
72
74
|
def sandbox
|
73
75
|
@_sandbox = {}
|
74
|
-
|
76
|
+
|
75
77
|
# Create a temporary directory where we can create files, e.g,
|
76
78
|
# for projects, compilation. We need a place that does not depend
|
77
79
|
# on the current directory.
|
@@ -88,10 +90,11 @@ module Sandbox
|
|
88
90
|
|
89
91
|
@_sandbox[:load_path] = $LOAD_PATH.clone
|
90
92
|
#@_sandbox[:loaded_features] = $LOADED_FEATURES.clone
|
91
|
-
|
93
|
+
|
92
94
|
# Later on we'll want to lose all the on_define created during the test.
|
93
95
|
@_sandbox[:on_define] = Project.class_eval { (@on_define || []).dup }
|
94
|
-
@_sandbox[:
|
96
|
+
@_sandbox[:extension_modules] = Project.class_eval { (@extension_modules || []).dup }
|
97
|
+
@_sandbox[:global_callbacks] = Project.class_eval { (@global_callbacks || []).dup }
|
95
98
|
@_sandbox[:layout] = Layout.default.clone
|
96
99
|
|
97
100
|
# Create a local repository we can play with. However, our local repository will be void
|
@@ -120,14 +123,22 @@ module Sandbox
|
|
120
123
|
def reset
|
121
124
|
# Get rid of all the projects and the on_define blocks we used.
|
122
125
|
Project.clear
|
126
|
+
|
123
127
|
on_define = @_sandbox[:on_define]
|
124
|
-
|
125
|
-
|
126
|
-
|
128
|
+
extension_modules = @_sandbox[:extension_modules]
|
129
|
+
global_callbacks = @_sandbox[:global_callbacks]
|
130
|
+
|
131
|
+
Project.class_eval do
|
132
|
+
@on_define = on_define
|
133
|
+
@global_callbacks = global_callbacks
|
134
|
+
@extension_modules = extension_modules
|
135
|
+
end
|
136
|
+
|
127
137
|
Layout.default = @_sandbox[:layout].clone
|
128
138
|
|
129
139
|
$LOAD_PATH.replace @_sandbox[:load_path]
|
130
140
|
FileUtils.rm_rf @temp
|
141
|
+
mkpath ENV['HOME']
|
131
142
|
|
132
143
|
# Get rid of all artifacts.
|
133
144
|
@_sandbox[:artifacts].tap { |artifacts| Artifact.class_eval { @artifacts = artifacts } }
|
data/spec/scala/bdd_spec.rb
CHANGED
@@ -15,9 +15,14 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
18
|
-
require 'buildr/scala'
|
19
18
|
|
20
19
|
describe Buildr::Scala::Specs do
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
# Force Scala 2.7.7 for specs; don't want to rely on SCALA_HOME
|
23
|
+
Buildr.settings.build['scala.version'] = "2.7.7"
|
24
|
+
end
|
25
|
+
|
21
26
|
it 'should be the default when tests in src/spec/scala' do
|
22
27
|
write 'src/spec/scala/com/example/MySpecs.scala', <<-SCALA
|
23
28
|
package com.example
|
@@ -33,13 +38,13 @@ describe Buildr::Scala::Specs do
|
|
33
38
|
define 'foo'
|
34
39
|
project('foo').test.framework.should eql(:specs)
|
35
40
|
end
|
36
|
-
|
41
|
+
|
37
42
|
it 'should include Specs dependencies' do
|
38
43
|
define('foo') { test.using(:specs) }
|
39
44
|
project('foo').test.compile.dependencies.should include(*artifacts(Scala::Specs.dependencies))
|
40
45
|
project('foo').test.dependencies.should include(*artifacts(Scala::Specs.dependencies))
|
41
46
|
end
|
42
|
-
|
47
|
+
|
43
48
|
it 'should include ScalaCheck dependencies' do
|
44
49
|
define('foo') { test.using(:specs) }
|
45
50
|
project('foo').test.compile.dependencies.should include(*artifacts(Scala::Check.dependencies))
|
@@ -65,7 +70,7 @@ describe Buildr::Scala::Specs do
|
|
65
70
|
}
|
66
71
|
SCALA
|
67
72
|
define('foo').test.invoke
|
68
|
-
project('foo').test.tests.should include('com.example.MySpecs
|
73
|
+
project('foo').test.tests.should include('com.example.MySpecs')
|
69
74
|
end
|
70
75
|
|
71
76
|
it 'should include public objects extending org.specs.Specification even with companion classes' do
|
@@ -82,7 +87,7 @@ describe Buildr::Scala::Specs do
|
|
82
87
|
class MySpecs extends org.specs.runner.JUnit4(MySpecs)
|
83
88
|
SCALA
|
84
89
|
define('foo').test.invoke
|
85
|
-
project('foo').test.tests.should include('com.example.MySpecs
|
90
|
+
project('foo').test.tests.should include('com.example.MySpecs')
|
86
91
|
end
|
87
92
|
|
88
93
|
it 'should pass when spec passes' do
|
@@ -98,12 +103,12 @@ describe Buildr::Scala::Specs do
|
|
98
103
|
SCALA
|
99
104
|
lambda { define('foo').test.invoke }.should_not raise_error
|
100
105
|
end
|
101
|
-
|
106
|
+
|
102
107
|
it 'should fail when spec fails' do
|
103
108
|
write 'src/spec/scala/StringSpecs.scala', <<-SCALA
|
104
109
|
import org.specs._
|
105
110
|
import org.specs.runner._
|
106
|
-
|
111
|
+
|
107
112
|
object StringSpecs extends Specification {
|
108
113
|
"empty string" should {
|
109
114
|
"have a zero length" in {
|
@@ -114,6 +119,6 @@ describe Buildr::Scala::Specs do
|
|
114
119
|
SCALA
|
115
120
|
define('foo')
|
116
121
|
project('foo').test.invoke rescue
|
117
|
-
project('foo').test.failed_tests.should include('StringSpecs
|
122
|
+
project('foo').test.failed_tests.should include('StringSpecs')
|
118
123
|
end
|
119
124
|
end
|