buildr 1.3.5 → 1.4.0
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/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/core.rb +1 -0
- 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/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/eclipse.rb +148 -75
- data/lib/buildr/ide/idea.rb +2 -2
- data/lib/buildr/ide/idea7x.rb +23 -4
- 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/java.rb +1 -0
- 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/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/scala.rb +1 -0
- data/lib/buildr/shell.rb +33 -33
- data/lib/buildr.rb +1 -1
- 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
|
@@ -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
|
data/spec/ide/idea7x_spec.rb
CHANGED
|
@@ -22,15 +22,15 @@ module Idea7xHelper
|
|
|
22
22
|
task('idea7x').invoke
|
|
23
23
|
REXML::Document.new(File.read("#{@project_name}-7x.ipr")).root.elements
|
|
24
24
|
end
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
def ipr_module_elements
|
|
27
27
|
ipr_xml_elements.to_a("//component[@name='ProjectModuleManager']/modules/module")
|
|
28
28
|
end
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
def ipr_module_filepaths
|
|
31
31
|
ipr_module_elements.collect { |m| m.attributes['filepath'] }
|
|
32
32
|
end
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
def ipr_module_fileurls
|
|
35
35
|
ipr_module_elements.collect { |m| m.attributes['fileurl'] }
|
|
36
36
|
end
|
|
@@ -39,20 +39,20 @@ end
|
|
|
39
39
|
|
|
40
40
|
describe Idea7x do
|
|
41
41
|
include Idea7xHelper
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
describe "the project file" do
|
|
44
44
|
before do
|
|
45
45
|
@project_name = 'alphabet'
|
|
46
46
|
end
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
it "includes a module for the root project" do
|
|
49
49
|
# Current behavior is to only generate IMLs for packaged projects
|
|
50
|
-
define(@project_name) { project.version = '0.0.0'; package(:jar) }
|
|
50
|
+
define(@project_name) { project.version = '0.0.0'; package(:jar) }
|
|
51
51
|
ipr_module_elements.should have(1).element
|
|
52
52
|
ipr_module_filepaths.should == ["$PROJECT_DIR$/alphabet-7x.iml"]
|
|
53
53
|
ipr_module_fileurls.should == ["file://$PROJECT_DIR$/alphabet-7x.iml"]
|
|
54
54
|
end
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
it "includes an IML for a subproject" do
|
|
57
57
|
mkpath 'h'
|
|
58
58
|
define(@project_name) do
|
|
@@ -61,12 +61,12 @@ describe Idea7x do
|
|
|
61
61
|
package(:jar)
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
ipr_module_elements.should have(2).elements
|
|
66
66
|
ipr_module_filepaths.should include("$PROJECT_DIR$/h/alphabet-h-7x.iml")
|
|
67
67
|
ipr_module_fileurls.should include("file://$PROJECT_DIR$/h/alphabet-h-7x.iml")
|
|
68
68
|
end
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
it "pays attention to the base_dir for a subproject" do
|
|
71
71
|
mkpath 'aitch'
|
|
72
72
|
define(@project_name) do
|
|
@@ -75,10 +75,22 @@ describe Idea7x do
|
|
|
75
75
|
package(:jar)
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
ipr_module_elements.should have(2).elements
|
|
80
80
|
ipr_module_filepaths.should include("$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
|
|
81
81
|
ipr_module_fileurls.should include("file://$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
|
+
|
|
85
|
+
describe "idea7x:clean" do
|
|
86
|
+
|
|
87
|
+
it "should remove the idea7x project" do
|
|
88
|
+
write "src/main/java/com/example/Hello.java", ""
|
|
89
|
+
write "foo-7x.iml", ""
|
|
90
|
+
foo = define("foo")
|
|
91
|
+
foo.task("idea7x:clean").invoke
|
|
92
|
+
File.exists?("foo-7x.iml").should be_false
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
end
|
|
84
96
|
end
|
data/spec/java/ant_spec.rb
CHANGED
|
@@ -18,13 +18,17 @@ require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
describe Buildr::Ant do
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
it 'should pick Ant version from ant build settings' do
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
begin
|
|
24
|
+
Buildr::Ant.instance_eval { @dependencies = nil }
|
|
25
|
+
write 'build.yaml', 'ant: 1.2.3'
|
|
26
|
+
Buildr::Ant.dependencies.should include("org.apache.ant:ant:jar:1.2.3")
|
|
27
|
+
ensure
|
|
28
|
+
Buildr::Ant.instance_eval { @dependencies = nil }
|
|
29
|
+
end
|
|
26
30
|
end
|
|
27
|
-
|
|
31
|
+
|
|
28
32
|
it 'should have REQUIRES up to version 1.5 since it was deprecated in version 1.3.3' do
|
|
29
33
|
Buildr::VERSION.should < '1.5'
|
|
30
34
|
lambda { Ant::REQUIRES }.should_not raise_error
|
data/spec/java/bdd_spec.rb
CHANGED
|
@@ -17,28 +17,21 @@ require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
|
17
17
|
|
|
18
18
|
describe Buildr::RSpec do
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
define('foo'
|
|
20
|
+
before(:each) do
|
|
21
|
+
define('foo') do
|
|
22
22
|
test.using :rspec, :output => false
|
|
23
|
-
if prc
|
|
24
|
-
instance_eval(&prc)
|
|
25
|
-
else
|
|
26
|
-
self
|
|
27
|
-
end
|
|
28
23
|
end
|
|
29
24
|
end
|
|
30
25
|
|
|
31
26
|
it 'should be selected by :rspec name' do
|
|
32
|
-
foo
|
|
27
|
+
project('foo').test.framework.should eql(:rspec)
|
|
33
28
|
end
|
|
34
29
|
|
|
35
30
|
it 'should read passed specs from result yaml' do
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
foo
|
|
39
|
-
|
|
40
|
-
test.passed_tests.should eql([success])
|
|
41
|
-
end
|
|
31
|
+
write('src/spec/ruby/success_spec.rb', 'describe("success") { it("is true") { nil.should be_nil } }')
|
|
32
|
+
|
|
33
|
+
project('foo').test.invoke
|
|
34
|
+
project('foo').test.passed_tests.should eql([File.expand_path('src/spec/ruby/success_spec.rb')])
|
|
42
35
|
end
|
|
43
36
|
|
|
44
37
|
it 'should read result yaml to obtain the list of failed specs' do
|
|
@@ -48,12 +41,12 @@ describe Buildr::RSpec do
|
|
|
48
41
|
write(failure, 'describe("failure") { it("is false") { true.should == false } }')
|
|
49
42
|
error = File.expand_path('src/spec/ruby/error_spec.rb')
|
|
50
43
|
write(error, 'describe("error") { it("raises") { lambda; } }')
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
|
|
45
|
+
lambda { project('foo').test.invoke }.should raise_error(/Tests failed/)
|
|
46
|
+
project('foo').test.tests.should include(success, failure, error)
|
|
47
|
+
project('foo').test.failed_tests.sort.should eql([failure, error].sort)
|
|
48
|
+
project('foo').test.passed_tests.should eql([success])
|
|
49
|
+
|
|
57
50
|
end
|
|
58
51
|
|
|
59
52
|
end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # RSpec
|
|
@@ -61,9 +54,6 @@ end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # RSpec
|
|
|
61
54
|
describe Buildr::JtestR do
|
|
62
55
|
|
|
63
56
|
before do
|
|
64
|
-
# JtestR currently requires JUnit 4.4
|
|
65
|
-
Buildr.settings.build['junit'] = '4.4'
|
|
66
|
-
|
|
67
57
|
# clear cached dependencies
|
|
68
58
|
Buildr::JUnit.instance_eval { @dependencies = nil }
|
|
69
59
|
Buildr::JtestR.instance_eval { @dependencies = nil }
|
|
@@ -119,7 +109,7 @@ describe Buildr::JtestR do
|
|
|
119
109
|
|
|
120
110
|
it 'should apply to projects having junit sources' do
|
|
121
111
|
define('one', :base_dir => 'one') do
|
|
122
|
-
write _('src/test/java/example/OneTest.java', <<-JAVA
|
|
112
|
+
write _('src/test/java/example/OneTest.java'), <<-JAVA
|
|
123
113
|
package example;
|
|
124
114
|
public class OneTest extends junit.framework.TestCase { }
|
|
125
115
|
JAVA
|
|
@@ -129,9 +119,9 @@ describe Buildr::JtestR do
|
|
|
129
119
|
|
|
130
120
|
it 'should apply to projects having testng sources' do
|
|
131
121
|
define('one', :base_dir => 'one') do
|
|
132
|
-
write _('src/test/java/example/OneTest.java', <<-JAVA
|
|
122
|
+
write _('src/test/java/example/OneTest.java'), <<-JAVA
|
|
133
123
|
package example;
|
|
134
|
-
public class OneTest {
|
|
124
|
+
public class OneTest {
|
|
135
125
|
@org.testng.annotations.Test
|
|
136
126
|
public void testNothing() {}
|
|
137
127
|
}
|
|
@@ -148,7 +138,7 @@ describe Buildr::JtestR do
|
|
|
148
138
|
end
|
|
149
139
|
|
|
150
140
|
it 'should load user jtestr_config.rb' do
|
|
151
|
-
foo do
|
|
141
|
+
foo do
|
|
152
142
|
hello = _('hello')
|
|
153
143
|
write('src/spec/ruby/jtestr_config.rb', "File.open('#{hello}', 'w') { |f| f.write 'HELLO' }")
|
|
154
144
|
write('src/spec/ruby/some_spec.rb')
|
|
@@ -161,13 +151,13 @@ describe Buildr::JtestR do
|
|
|
161
151
|
it 'should run junit tests' do
|
|
162
152
|
write('src/test/java/example/SuccessTest.java', <<-JAVA)
|
|
163
153
|
package example;
|
|
164
|
-
public class SuccessTest extends junit.framework.TestCase {
|
|
154
|
+
public class SuccessTest extends junit.framework.TestCase {
|
|
165
155
|
public void testSuccess() { assertTrue(true); }
|
|
166
156
|
}
|
|
167
157
|
JAVA
|
|
168
158
|
write('src/test/java/example/FailureTest.java', <<-JAVA)
|
|
169
159
|
package example;
|
|
170
|
-
public class FailureTest extends junit.framework.TestCase {
|
|
160
|
+
public class FailureTest extends junit.framework.TestCase {
|
|
171
161
|
public void testFailure() { assertTrue(false); }
|
|
172
162
|
}
|
|
173
163
|
JAVA
|
|
@@ -179,7 +169,7 @@ describe Buildr::JtestR do
|
|
|
179
169
|
end
|
|
180
170
|
end
|
|
181
171
|
|
|
182
|
-
it 'should run testng tests' do
|
|
172
|
+
it 'should run testng tests' do
|
|
183
173
|
write('src/test/java/example/Success.java', <<-JAVA)
|
|
184
174
|
package example;
|
|
185
175
|
public class Success {
|
|
@@ -202,7 +192,7 @@ describe Buildr::JtestR do
|
|
|
202
192
|
end
|
|
203
193
|
end
|
|
204
194
|
|
|
205
|
-
it 'should run test_unit' do
|
|
195
|
+
it 'should run test_unit' do
|
|
206
196
|
success = File.expand_path('src/spec/ruby/success_test.rb')
|
|
207
197
|
write(success, <<-TESTUNIT)
|
|
208
198
|
require 'test/unit'
|
|
@@ -261,7 +251,7 @@ describe Buildr::JtestR do
|
|
|
261
251
|
error = File.expand_path('src/spec/ruby/error_spec.rb')
|
|
262
252
|
write(error, 'describe("error") { it("raises") { lambda; } }')
|
|
263
253
|
pending = File.expand_path('src/spec/ruby/pending_spec.rb')
|
|
264
|
-
write(pending, 'describe("
|
|
254
|
+
write(pending, 'describe("pending") { it "is not implemented" }')
|
|
265
255
|
foo do
|
|
266
256
|
lambda { test.invoke }.should raise_error(/Tests failed/)
|
|
267
257
|
test.tests.should include(success, failure, error)
|
|
@@ -281,7 +271,7 @@ end if RUBY_PLATFORM =~ /java/ || ENV['JRUBY_HOME'] # JtestR
|
|
|
281
271
|
|
|
282
272
|
describe Buildr::JBehave do
|
|
283
273
|
def foo(*args, &prc)
|
|
284
|
-
define('foo', *args) do
|
|
274
|
+
define('foo', *args) do
|
|
285
275
|
test.using :jbehave
|
|
286
276
|
if prc
|
|
287
277
|
instance_eval(&prc)
|
|
@@ -314,7 +304,7 @@ describe Buildr::JBehave do
|
|
|
314
304
|
foo { test.framework.should eql(:jbehave) }
|
|
315
305
|
end
|
|
316
306
|
|
|
317
|
-
it 'should select a java compiler for its sources' do
|
|
307
|
+
it 'should select a java compiler for its sources' do
|
|
318
308
|
write 'src/test/java/SomeBehavior.java', 'public class SomeBehavior {}'
|
|
319
309
|
foo do
|
|
320
310
|
test.compile.language.should eql(:java)
|
|
@@ -330,8 +320,10 @@ describe Buildr::JBehave do
|
|
|
330
320
|
|
|
331
321
|
it 'should include JMock dependencies' do
|
|
332
322
|
foo do
|
|
333
|
-
|
|
334
|
-
|
|
323
|
+
two_or_later = JMock.version[0,1].to_i >= 2
|
|
324
|
+
group = two_or_later ? "org.jmock" : "jmock"
|
|
325
|
+
test.compile.dependencies.should include(artifact("#{group}:jmock:jar:#{JMock.version}"))
|
|
326
|
+
test.dependencies.should include(artifact("#{group}:jmock:jar:#{JMock.version}"))
|
|
335
327
|
end
|
|
336
328
|
end
|
|
337
329
|
|
|
@@ -356,7 +348,7 @@ describe Buildr::JBehave do
|
|
|
356
348
|
it 'should include classes implementing Behaviours' do
|
|
357
349
|
write 'src/spec/java/some/MyBehaviours.java', <<-JAVA
|
|
358
350
|
package some;
|
|
359
|
-
public class MyBehaviours implements
|
|
351
|
+
public class MyBehaviours implements
|
|
360
352
|
org.jbehave.core.behaviour.Behaviours {
|
|
361
353
|
public Class[] getBehaviours() {
|
|
362
354
|
return new Class[] { some.FooBehave.class };
|