buildr 1.3.5-x86-mswin32 → 1.4.0-x86-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +149 -133
- 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
data/spec/core/transport_spec.rb
CHANGED
@@ -20,7 +20,7 @@ require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
20
20
|
describe URI, '#download' do
|
21
21
|
before do
|
22
22
|
write @source = 'source', @content = 'Just a file'
|
23
|
-
@uri = URI("file://#{File.expand_path(@source)}")
|
23
|
+
@uri = URI(URI.escape("file://#{File.expand_path(@source)}"))
|
24
24
|
@target = 'target'
|
25
25
|
end
|
26
26
|
|
@@ -60,7 +60,7 @@ describe URI, '#upload' do
|
|
60
60
|
before do
|
61
61
|
write @source = 'source', @content = 'Just a file'
|
62
62
|
@target = 'target'
|
63
|
-
@uri = URI("file://#{File.expand_path(@target)}")
|
63
|
+
@uri = URI(URI.escape("file://#{File.expand_path(@target)}"))
|
64
64
|
end
|
65
65
|
|
66
66
|
it 'should upload file if found' do
|
@@ -149,7 +149,7 @@ end
|
|
149
149
|
describe URI::FILE, '#read' do
|
150
150
|
before do
|
151
151
|
@filename = 'readme'
|
152
|
-
@uri = URI("file:///#{File.expand_path(@filename)}")
|
152
|
+
@uri = URI(URI.escape("file:///#{File.expand_path(@filename)}"))
|
153
153
|
@content = 'Readme. Please!'
|
154
154
|
write 'readme', @content
|
155
155
|
end
|
@@ -180,7 +180,7 @@ end
|
|
180
180
|
describe URI::FILE, '#write' do
|
181
181
|
before do
|
182
182
|
@filename = 'readme'
|
183
|
-
@uri = URI("file:///#{File.expand_path(@filename)}")
|
183
|
+
@uri = URI(URI.escape("file:///#{File.expand_path(@filename)}"))
|
184
184
|
@content = 'Readme. Please!'
|
185
185
|
end
|
186
186
|
|
@@ -240,7 +240,7 @@ describe URI::HTTP, '#read' do
|
|
240
240
|
@http.should_receive(:use_ssl=).with(true)
|
241
241
|
URI(@uri.to_s.sub(/http/, 'https')).read
|
242
242
|
end
|
243
|
-
|
243
|
+
|
244
244
|
it 'should use proxy from environment variable HTTP_PROXY when using http' do
|
245
245
|
ENV['HTTP_PROXY'] = @proxy
|
246
246
|
Net::HTTP.should_receive(:new).with(*@proxy_args).and_return(@http)
|
@@ -312,7 +312,7 @@ describe URI::HTTP, '#read' do
|
|
312
312
|
request.should_receive(:basic_auth).with('john', 'secret')
|
313
313
|
URI("http://john:secret@#{@host_domain}").read
|
314
314
|
end
|
315
|
-
|
315
|
+
|
316
316
|
it 'should preseve authentication information during a redirect' do
|
317
317
|
Net::HTTP.should_receive(:new).twice.and_return(@http)
|
318
318
|
|
@@ -324,7 +324,7 @@ describe URI::HTTP, '#read' do
|
|
324
324
|
Net::HTTP::Get.should_receive(:new).once.with('/', nil).and_return(request1)
|
325
325
|
request1.should_receive(:basic_auth).with('john', 'secret')
|
326
326
|
@http.should_receive(:request).with(request1).and_yield(redirect)
|
327
|
-
|
327
|
+
|
328
328
|
# The second request will be ok
|
329
329
|
ok = Net::HTTPOK.new(nil, nil, nil)
|
330
330
|
ok.stub!(:read_body)
|
@@ -503,7 +503,7 @@ describe URI::SFTP, '#write' do
|
|
503
503
|
end
|
504
504
|
|
505
505
|
it 'should close all opened directories' do
|
506
|
-
@sftp_session.should_receive(:opendir!).with(anything()).twice do |path|
|
506
|
+
@sftp_session.should_receive(:opendir!).with(anything()).twice do |path|
|
507
507
|
@sftp_session.should_receive(:close).with(handle = Object.new)
|
508
508
|
handle
|
509
509
|
end
|
data/spec/core/util_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe Hash do
|
|
21
21
|
it "should find value for one key" do
|
22
22
|
{:a => 1, :b => 2, :c => 3}.only(:a).should == {:a => 1}
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
it "should find values for multiple keys" do
|
26
26
|
{:a => 1, :b => 2, :c => 3}.only(:b, :c).should == {:b => 2, :c => 3}
|
27
27
|
end
|
@@ -36,19 +36,19 @@ describe OpenObject do
|
|
36
36
|
it "should be kind of Hash" do
|
37
37
|
Hash.should === @obj
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it "should accept block that supplies default value" do
|
41
41
|
obj = OpenObject.new { |hash, key| hash[key] = "New #{key}" }
|
42
42
|
obj[:foo].should == "New foo"
|
43
43
|
obj.keys.should == [:foo]
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
it "should combine initial values from hash argument and from block" do
|
47
47
|
obj = OpenObject.new(:a => 6, :b => 2) { |h, k| h[k] = k.to_s * 2 }
|
48
48
|
obj[:a].should == 6
|
49
49
|
obj[:c].should == 'cc'
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
it "should allow reading a value by calling its name method" do
|
53
53
|
@obj.b.should == 2
|
54
54
|
end
|
@@ -60,8 +60,66 @@ describe OpenObject do
|
|
60
60
|
it "should allow changing a value by calling its name= method" do
|
61
61
|
lambda { @obj.c = 17 }.should change { @obj.c }.to(17)
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
it "should implement only method like a hash" do
|
65
65
|
@obj.only(:a).should == { :a => 1 }
|
66
66
|
end
|
67
67
|
end
|
68
|
+
|
69
|
+
describe File do
|
70
|
+
# Quite a few of the other specs depend on File#utime working correctly.
|
71
|
+
# These specs validate that utime is working as expected.
|
72
|
+
describe "#utime" do
|
73
|
+
it "should update mtime of directories" do
|
74
|
+
mkpath 'tmp'
|
75
|
+
begin
|
76
|
+
creation_time = File.mtime('tmp')
|
77
|
+
|
78
|
+
sleep 1
|
79
|
+
File.utime(nil, nil, 'tmp')
|
80
|
+
|
81
|
+
File.mtime('tmp').should > creation_time
|
82
|
+
ensure
|
83
|
+
Dir.rmdir 'tmp'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should update mtime of files" do
|
88
|
+
FileUtils.touch('tmp')
|
89
|
+
begin
|
90
|
+
creation_time = File.mtime('tmp')
|
91
|
+
|
92
|
+
sleep 1
|
93
|
+
File.utime(nil, nil, 'tmp')
|
94
|
+
|
95
|
+
File.mtime('tmp').should > creation_time
|
96
|
+
ensure
|
97
|
+
File.delete 'tmp'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should be able to set mtime in the past" do
|
102
|
+
FileUtils.touch('tmp')
|
103
|
+
begin
|
104
|
+
time = Time.at((Time.now - 10).to_i)
|
105
|
+
File.utime(time, time, 'tmp')
|
106
|
+
|
107
|
+
File.mtime('tmp').should == time
|
108
|
+
ensure
|
109
|
+
File.delete 'tmp'
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should be able to set mtime in the future" do
|
114
|
+
FileUtils.touch('tmp')
|
115
|
+
begin
|
116
|
+
time = Time.at((Time.now + 10).to_i)
|
117
|
+
File.utime(time, time, 'tmp')
|
118
|
+
|
119
|
+
File.mtime('tmp').should == time
|
120
|
+
ensure
|
121
|
+
File.delete 'tmp'
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
data/spec/groovy/bdd_spec.rb
CHANGED
@@ -17,7 +17,7 @@ require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
17
17
|
|
18
18
|
|
19
19
|
describe Buildr::Groovy::EasyB do
|
20
|
-
|
20
|
+
|
21
21
|
def foo(*args, &prc)
|
22
22
|
define('foo', *args) do
|
23
23
|
test.using :easyb
|
@@ -58,9 +58,9 @@ describe Buildr::Groovy::EasyB do
|
|
58
58
|
test.compile.language.should eql(:java)
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
it 'should include src/spec/groovy/*Specification.groovy' do
|
63
|
-
foo do
|
63
|
+
foo do
|
64
64
|
spec = _('src/spec/groovy/SomeSpecification.groovy')
|
65
65
|
write spec, 'true'
|
66
66
|
test.invoke
|
@@ -69,12 +69,12 @@ describe Buildr::Groovy::EasyB do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
it 'should include src/spec/groovy/*Story.groovy' do
|
72
|
-
foo do
|
72
|
+
foo do
|
73
73
|
spec = _('src/spec/groovy/SomeStory.groovy')
|
74
74
|
write spec, 'true'
|
75
75
|
test.invoke
|
76
76
|
test.tests.should include(spec)
|
77
77
|
end
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
end # EasyB
|
@@ -16,12 +16,12 @@
|
|
16
16
|
|
17
17
|
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
18
18
|
|
19
|
-
describe 'groovyc compiler' do
|
20
|
-
|
19
|
+
describe 'groovyc compiler' do
|
20
|
+
|
21
21
|
it 'should identify itself from groovy source directories' do
|
22
22
|
write 'src/main/groovy/some/Hello.groovy', 'println "Hello Groovy"'
|
23
23
|
write 'src/test/groovy/some/Hello.groovy', 'println "Hello Groovy"'
|
24
|
-
define('foo') do
|
24
|
+
define('foo') do
|
25
25
|
compile.compiler.should eql(:groovyc)
|
26
26
|
test.compile.compiler.should eql(:groovyc)
|
27
27
|
end
|
@@ -30,7 +30,7 @@ describe 'groovyc compiler' do
|
|
30
30
|
it 'should identify if groovy sources are found on java directories' do
|
31
31
|
write 'src/main/java/some/Hello.groovy', 'println "Hello Groovy"'
|
32
32
|
write 'src/test/java/some/Hello.groovy', 'println "Hello Groovy"'
|
33
|
-
define('foo') do
|
33
|
+
define('foo') do
|
34
34
|
compile.compiler.should eql(:groovyc)
|
35
35
|
test.compile.compiler.should eql(:groovyc)
|
36
36
|
end
|
@@ -41,13 +41,13 @@ describe 'groovyc compiler' do
|
|
41
41
|
write 'src/main/groovy/some/Hello.groovy', 'println "Hello Groovy"'
|
42
42
|
write 'src/test/java/some/Empty.java', 'package some; public interface Empty {}'
|
43
43
|
write 'src/test/groovy/some/Hello.groovy', 'println "Hello Groovy"'
|
44
|
-
define('foo') do
|
44
|
+
define('foo') do
|
45
45
|
compile.compiler.should eql(:groovyc)
|
46
46
|
test.compile.compiler.should eql(:groovyc)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
it 'should identify from custom layout' do
|
50
|
+
it 'should identify from custom layout' do
|
51
51
|
write 'groovy/Hello.groovy', 'println "Hello world"'
|
52
52
|
write 'testing/Hello.groovy', 'println "Hello world"'
|
53
53
|
custom = Layout.new
|
@@ -58,10 +58,10 @@ describe 'groovyc compiler' do
|
|
58
58
|
test.compile.compiler.should eql(:groovyc)
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
it 'should identify from compile source directories' do
|
63
|
-
write 'src/com/example/Code.groovy', 'println "monkey code"'
|
64
|
-
write 'testing/com/example/Test.groovy', 'println "some test"'
|
63
|
+
write 'src/com/example/Code.groovy', 'println "monkey code"'
|
64
|
+
write 'testing/com/example/Test.groovy', 'println "some test"'
|
65
65
|
define 'foo' do
|
66
66
|
lambda { compile.from 'src' }.should change { compile.compiler }.to(:groovyc)
|
67
67
|
lambda { test.compile.from 'testing' }.should change { test.compile.compiler }.to(:groovyc)
|
@@ -91,25 +91,36 @@ describe 'groovyc compiler' do
|
|
91
91
|
lambda { compile.using(:groovyc) }.should_not change { compile.sources }
|
92
92
|
end
|
93
93
|
end
|
94
|
-
|
94
|
+
|
95
95
|
it 'should compile groovy sources' do
|
96
96
|
write 'src/main/groovy/some/Example.groovy', 'package some; class Example { static main(args) { println "Hello" } }'
|
97
97
|
define('foo').compile.invoke
|
98
98
|
file('target/classes/some/Example.class').should exist
|
99
99
|
end
|
100
100
|
|
101
|
+
it 'should compile test groovy sources that rely on junit' do
|
102
|
+
write 'src/main/groovy/some/Example.groovy', 'package some; class Example { static main(args) { println "Hello" } }'
|
103
|
+
write 'src/test/groovy/some/ExampleTest.groovy', "package some\n import junit.framework.TestCase\n class ExampleTest extends TestCase { public testHello() { println \"Hello\" } }"
|
104
|
+
foo = define('foo') do
|
105
|
+
test.using :junit
|
106
|
+
end
|
107
|
+
foo.test.compile.invoke
|
108
|
+
file('target/classes/some/Example.class').should exist
|
109
|
+
file('target/test/classes/some/ExampleTest.class').should exist
|
110
|
+
end
|
111
|
+
|
101
112
|
it 'should include as classpath dependency' do
|
102
113
|
write 'src/bar/groovy/some/Foo.groovy', 'package some; interface Foo {}'
|
103
114
|
write 'src/main/groovy/some/Example.groovy', 'package some; class Example implements Foo { }'
|
104
|
-
define('bar', :version => '1.0') do
|
115
|
+
define('bar', :version => '1.0') do
|
105
116
|
compile.from('src/bar/groovy').into('target/bar')
|
106
117
|
package(:jar)
|
107
118
|
end
|
108
119
|
lambda { define('foo').compile.with(project('bar').package(:jar)).invoke }.should run_task('foo:compile')
|
109
120
|
file('target/classes/some/Example.class').should exist
|
110
121
|
end
|
111
|
-
|
112
|
-
it 'should cross compile java sources' do
|
122
|
+
|
123
|
+
it 'should cross compile java sources' do
|
113
124
|
write 'src/main/java/some/Foo.java', 'package some; public interface Foo { public void hello(); }'
|
114
125
|
write 'src/main/java/some/Baz.java', 'package some; public class Baz extends Bar { }'
|
115
126
|
write 'src/main/groovy/some/Bar.groovy', 'package some; class Bar implements Foo { def void hello() { } }'
|
@@ -117,7 +128,7 @@ describe 'groovyc compiler' do
|
|
117
128
|
%w{Foo Bar Baz}.each { |f| file("target/classes/some/#{f}.class").should exist }
|
118
129
|
end
|
119
130
|
|
120
|
-
it 'should cross compile test java sources' do
|
131
|
+
it 'should cross compile test java sources' do
|
121
132
|
write 'src/test/java/some/Foo.java', 'package some; public interface Foo { public void hello(); }'
|
122
133
|
write 'src/test/java/some/Baz.java', 'package some; public class Baz extends Bar { }'
|
123
134
|
write 'src/test/groovy/some/Bar.groovy', 'package some; class Bar implements Foo { def void hello() { } }'
|
@@ -137,7 +148,7 @@ describe 'groovyc compiler' do
|
|
137
148
|
end
|
138
149
|
|
139
150
|
describe 'groovyc compiler options' do
|
140
|
-
|
151
|
+
|
141
152
|
def groovyc(&prc)
|
142
153
|
define('foo') do
|
143
154
|
compile.using(:groovyc)
|
@@ -153,8 +164,8 @@ describe 'groovyc compiler options' do
|
|
153
164
|
end
|
154
165
|
project('foo').compile
|
155
166
|
end
|
156
|
-
|
157
|
-
it 'should set warning option to false by default' do
|
167
|
+
|
168
|
+
it 'should set warning option to false by default' do
|
158
169
|
groovyc do
|
159
170
|
compile.options.warnings.should be_false
|
160
171
|
@compiler.javac_options[:nowarn].should be_true
|
@@ -177,7 +188,7 @@ describe 'groovyc compiler options' do
|
|
177
188
|
trace true
|
178
189
|
groovyc.options.verbose.should be_true
|
179
190
|
end
|
180
|
-
|
191
|
+
|
181
192
|
it 'should set debug option to false based on Buildr.options' do
|
182
193
|
Buildr.options.debug = false
|
183
194
|
groovyc.options.debug.should be_false
|
data/spec/ide/eclipse_spec.rb
CHANGED
@@ -33,7 +33,7 @@ PLUGIN_BUILDERS = Buildr::Eclipse::Plugin::BUILDERS
|
|
33
33
|
module EclipseHelper
|
34
34
|
def classpath_xml_elements
|
35
35
|
task('eclipse').invoke
|
36
|
-
|
36
|
+
File.open('.classpath') { |f| REXML::Document.new(f).root.elements }
|
37
37
|
end
|
38
38
|
|
39
39
|
def classpath_sources(attribute='path')
|
@@ -63,7 +63,7 @@ module EclipseHelper
|
|
63
63
|
|
64
64
|
def project_xml_elements
|
65
65
|
task('eclipse').invoke
|
66
|
-
|
66
|
+
File.open('.project') { |f| REXML::Document.new(f).root.elements }
|
67
67
|
end
|
68
68
|
|
69
69
|
def project_natures
|
@@ -85,6 +85,54 @@ describe Buildr::Eclipse do
|
|
85
85
|
|
86
86
|
describe "eclipse's .project file" do
|
87
87
|
|
88
|
+
describe 'default project' do
|
89
|
+
before do
|
90
|
+
write 'buildfile'
|
91
|
+
write 'src/main/nono/Main.nono'
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should not have natures' do
|
95
|
+
define('foo')
|
96
|
+
project_natures.should be_empty
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'should not have build commands' do
|
100
|
+
define('foo')
|
101
|
+
build_commands.should be_empty
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'should generate a .project file' do
|
105
|
+
define('foo')
|
106
|
+
task('eclipse').invoke
|
107
|
+
File.open('.project') do |f|
|
108
|
+
REXML::Document.new(f).root.
|
109
|
+
elements.collect("name") { |e| e.text }.should == ['foo']
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should not generate a .classpath file' do
|
114
|
+
define('foo')
|
115
|
+
task('eclipse').invoke
|
116
|
+
File.exists?('.classpath').should be_false
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe 'parent project' do
|
121
|
+
before do
|
122
|
+
write 'buildfile'
|
123
|
+
mkpath 'bar'
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'should not generate a .project for the parent project' do
|
127
|
+
define('foo') do
|
128
|
+
define('bar')
|
129
|
+
end
|
130
|
+
task('eclipse').invoke
|
131
|
+
File.exists?('.project').should be_false
|
132
|
+
File.exists?(File.join('bar','.project')).should be_true
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
88
136
|
describe 'java project' do
|
89
137
|
before do
|
90
138
|
write 'buildfile'
|
@@ -111,8 +159,10 @@ describe Buildr::Eclipse do
|
|
111
159
|
define('foo') { compile.using(:javac); package :jar }
|
112
160
|
}
|
113
161
|
task('eclipse').invoke
|
114
|
-
|
115
|
-
|
162
|
+
File.open(File.join('foo', '.project')) do |f|
|
163
|
+
REXML::Document.new(f).root.
|
164
|
+
elements.collect("name") { |e| e.text }.should == ['myproject-foo']
|
165
|
+
end
|
116
166
|
end
|
117
167
|
|
118
168
|
end
|
@@ -201,6 +251,68 @@ describe Buildr::Eclipse do
|
|
201
251
|
build_commands.should include(JAVA_BUILDER)
|
202
252
|
end
|
203
253
|
end
|
254
|
+
|
255
|
+
describe 'Plugin project' do
|
256
|
+
|
257
|
+
before do
|
258
|
+
write 'buildfile'
|
259
|
+
write 'src/main/java/Activator.java'
|
260
|
+
write 'plugin.xml'
|
261
|
+
end
|
262
|
+
|
263
|
+
it 'should have plugin nature before Java nature' do
|
264
|
+
define('foo')
|
265
|
+
project_natures.should include(PLUGIN_NATURE)
|
266
|
+
project_natures.should include(JAVA_NATURE)
|
267
|
+
project_natures.index(PLUGIN_NATURE).should < project_natures.index(JAVA_NATURE)
|
268
|
+
end
|
269
|
+
|
270
|
+
it 'should have plugin build commands and the Java build command' do
|
271
|
+
define('foo')
|
272
|
+
build_commands.should include(PLUGIN_BUILDERS[0])
|
273
|
+
build_commands.should include(PLUGIN_BUILDERS[1])
|
274
|
+
build_commands.should include(JAVA_BUILDER)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
describe 'Plugin project with META-INF/MANIFEST.MF' do
|
279
|
+
|
280
|
+
before do
|
281
|
+
write 'buildfile'
|
282
|
+
write 'src/main/java/Activator.java'
|
283
|
+
end
|
284
|
+
|
285
|
+
it 'should have plugin nature by default if MANIFEST.MF contains "Bundle-SymbolicName:"' do
|
286
|
+
write 'META-INF/MANIFEST.MF', <<-MANIFEST
|
287
|
+
Manifest-Version: 1.0
|
288
|
+
Name: example/
|
289
|
+
Specification-Title: "Examples"
|
290
|
+
Specification-Version: "1.0"
|
291
|
+
Specification-Vendor: "Acme Corp.".
|
292
|
+
Implementation-Title: "example"
|
293
|
+
Implementation-Version: "build57"
|
294
|
+
Implementation-Vendor: "Acme Corp."
|
295
|
+
Bundle-SymbolicName: acme.plugin.example
|
296
|
+
MANIFEST
|
297
|
+
define('foo')
|
298
|
+
project_natures.should include(PLUGIN_NATURE)
|
299
|
+
end
|
300
|
+
|
301
|
+
it 'should not have plugin nature if MANIFEST.MF exists but doesn\'t contain "Bundle-SymbolicName:"' do
|
302
|
+
write 'META-INF/MANIFEST.MF', <<-MANIFEST
|
303
|
+
Manifest-Version: 1.0
|
304
|
+
Name: example/
|
305
|
+
Specification-Title: "Examples"
|
306
|
+
Specification-Version: "1.0"
|
307
|
+
Specification-Vendor: "Acme Corp.".
|
308
|
+
Implementation-Title: "example"
|
309
|
+
Implementation-Version: "build57"
|
310
|
+
Implementation-Vendor: "Acme Corp."
|
311
|
+
MANIFEST
|
312
|
+
define('foo')
|
313
|
+
project_natures.should_not include(PLUGIN_NATURE)
|
314
|
+
end
|
315
|
+
end
|
204
316
|
end
|
205
317
|
|
206
318
|
describe "eclipse's .classpath file" do
|
@@ -348,8 +460,10 @@ describe Buildr::Eclipse do
|
|
348
460
|
define('bar') { compile.using(:javac).with project('foo'); }
|
349
461
|
}
|
350
462
|
task('eclipse').invoke
|
351
|
-
|
352
|
-
|
463
|
+
File.open(File.join('bar', '.classpath')) do |f|
|
464
|
+
REXML::Document.new(f).root.
|
465
|
+
elements.collect("classpathentry[@kind='src']") { |n| n.attributes['path'] }.should include('/myproject-foo')
|
466
|
+
end
|
353
467
|
end
|
354
468
|
end
|
355
469
|
end
|
@@ -359,10 +473,26 @@ describe Buildr::Eclipse do
|
|
359
473
|
write 'lib/some-local.jar'
|
360
474
|
define('foo') { compile.using(:javac).with(_('lib/some-local.jar')) }
|
361
475
|
end
|
362
|
-
|
476
|
+
|
363
477
|
it 'should have a lib artifact reference in the .classpath file' do
|
364
478
|
classpath_xml_elements.collect("classpathentry[@kind='lib']") { |n| n.attributes['path'] }.
|
365
|
-
should include(
|
479
|
+
should include('lib/some-local.jar')
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
describe 'project .classpath' do
|
484
|
+
before do
|
485
|
+
mkdir_p '../libs'
|
486
|
+
write '../libs/some-local.jar'
|
487
|
+
define('foo') do
|
488
|
+
eclipse.classpath_variables :LIBS => '../libs', :LIBS2 => '../libs2'
|
489
|
+
compile.using(:javac).with(_('../libs/some-local.jar'))
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
it 'supports generating library paths with classpath variables' do
|
494
|
+
classpath_xml_elements.collect("classpathentry[@kind='var']") { |n| n.attributes['path'] }.
|
495
|
+
should include('LIBS/some-local.jar')
|
366
496
|
end
|
367
497
|
end
|
368
498
|
|
@@ -371,7 +501,7 @@ describe Buildr::Eclipse do
|
|
371
501
|
write 'lib/some.class'
|
372
502
|
define('foo') { compile.using(:javac).with(_('lib')) }
|
373
503
|
end
|
374
|
-
|
504
|
+
|
375
505
|
it 'should have src reference in the .classpath file' do
|
376
506
|
classpath_xml_elements.collect("classpathentry[@kind='src']") { |n| n.attributes['path'] }.
|
377
507
|
should include('lib')
|
@@ -449,6 +579,13 @@ describe Buildr::Eclipse do
|
|
449
579
|
project('foo:bar').eclipse.natures.should include('foo_nature')
|
450
580
|
project('foo:bar2').eclipse.natures.should include('bar2_nature')
|
451
581
|
end
|
582
|
+
|
583
|
+
it 'should handle arrays correctly' do
|
584
|
+
define('foo') do
|
585
|
+
eclipse.natures ['foo_nature', 'bar_nature']
|
586
|
+
end
|
587
|
+
project('foo').eclipse.natures.should == ['foo_nature', 'bar_nature']
|
588
|
+
end
|
452
589
|
end
|
453
590
|
|
454
591
|
describe 'builders variable' do
|
@@ -473,6 +610,13 @@ describe Buildr::Eclipse do
|
|
473
610
|
project('foo:bar').eclipse.builders.should include('foo_builder')
|
474
611
|
project('foo:bar2').eclipse.builders.should include('bar2_builder')
|
475
612
|
end
|
613
|
+
|
614
|
+
it 'should handle arrays correctly' do
|
615
|
+
define('foo') do
|
616
|
+
eclipse.builders ['foo_builder', 'bar_builder']
|
617
|
+
end
|
618
|
+
project('foo').eclipse.builders.should == ['foo_builder', 'bar_builder']
|
619
|
+
end
|
476
620
|
end
|
477
621
|
|
478
622
|
describe 'classpath_containers variable' do
|
@@ -497,5 +641,37 @@ describe Buildr::Eclipse do
|
|
497
641
|
project('foo:bar').eclipse.classpath_containers.should include('foo_classpath_containers')
|
498
642
|
project('foo:bar2').eclipse.classpath_containers.should include('bar2_classpath_containers')
|
499
643
|
end
|
644
|
+
|
645
|
+
it 'should handle arrays correctly' do
|
646
|
+
define('foo') do
|
647
|
+
eclipse.classpath_containers ['foo_cc', 'bar_cc']
|
648
|
+
end
|
649
|
+
project('foo').eclipse.classpath_containers.should == ['foo_cc', 'bar_cc']
|
650
|
+
end
|
651
|
+
end
|
652
|
+
|
653
|
+
describe 'exclude_libs' do
|
654
|
+
it 'should support artifacts' do
|
655
|
+
define('foo') do
|
656
|
+
compile.using(:javac).with('com.example:library:jar:2.0')
|
657
|
+
eclipse.exclude_libs += [ artifact('com.example:library:jar:2.0') ]
|
658
|
+
end
|
659
|
+
artifact('com.example:library:jar:2.0') { |task| write task.name }
|
660
|
+
|
661
|
+
task('eclipse').invoke
|
662
|
+
classpath_xml_elements.collect("classpathentry[@kind='var']") { |n| n.attributes['path'] }.
|
663
|
+
should_not include('M2_REPO/com/example/library/2.0/library-2.0.jar')
|
664
|
+
end
|
665
|
+
it 'should support string paths' do
|
666
|
+
define('foo') do
|
667
|
+
compile.using(:javac).with _('path/to/library.jar')
|
668
|
+
eclipse.exclude_libs += [ _('path/to/library.jar') ]
|
669
|
+
end
|
670
|
+
write project('foo').path_to('path/to/library.jar')
|
671
|
+
|
672
|
+
task('eclipse').invoke
|
673
|
+
classpath_xml_elements.collect("classpathentry[@kind='lib']") { |n| n.attributes['path'] }.
|
674
|
+
should_not include('path/to/library.jar')
|
675
|
+
end
|
500
676
|
end
|
501
677
|
end
|