assaf-buildr 1.3.3
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 +887 -0
- data/DISCLAIMER +7 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +146 -0
- data/Rakefile +62 -0
- data/_buildr +38 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/cobertura.rb +236 -0
- data/addon/buildr/emma.rb +238 -0
- data/addon/buildr/hibernate.rb +142 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jdepend.rb +60 -0
- data/addon/buildr/jetty.rb +248 -0
- data/addon/buildr/jibx.rb +86 -0
- data/addon/buildr/nailgun.rb +817 -0
- data/addon/buildr/openjpa.rb +90 -0
- 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/BuildrNail.java +41 -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/org/apache/buildr/JettyWrapper.java +144 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +28 -0
- data/buildr.buildfile +53 -0
- data/buildr.gemspec +58 -0
- data/doc/css/default.css +228 -0
- data/doc/css/print.css +100 -0
- data/doc/css/syntax.css +52 -0
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/pages/artifacts.textile +207 -0
- data/doc/pages/building.textile +240 -0
- data/doc/pages/contributing.textile +208 -0
- data/doc/pages/download.textile +62 -0
- data/doc/pages/extending.textile +175 -0
- data/doc/pages/getting_started.textile +273 -0
- data/doc/pages/index.textile +42 -0
- data/doc/pages/languages.textile +407 -0
- data/doc/pages/mailing_lists.textile +17 -0
- data/doc/pages/more_stuff.textile +286 -0
- data/doc/pages/packaging.textile +427 -0
- data/doc/pages/projects.textile +274 -0
- data/doc/pages/recipes.textile +103 -0
- data/doc/pages/settings_profiles.textile +274 -0
- data/doc/pages/testing.textile +212 -0
- data/doc/pages/troubleshooting.textile +103 -0
- data/doc/pages/whats_new.textile +323 -0
- data/doc/print.haml +51 -0
- data/doc/print.toc.yaml +29 -0
- data/doc/scripts/buildr-git.rb +412 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +64 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/site.haml +56 -0
- data/doc/site.toc.yaml +47 -0
- data/etc/KEYS +151 -0
- data/etc/git-svn-authors +16 -0
- data/lib/buildr.rb +35 -0
- data/lib/buildr/core.rb +27 -0
- data/lib/buildr/core/application.rb +489 -0
- data/lib/buildr/core/application_cli.rb +139 -0
- data/lib/buildr/core/build.rb +311 -0
- data/lib/buildr/core/checks.rb +382 -0
- data/lib/buildr/core/common.rb +154 -0
- data/lib/buildr/core/compile.rb +596 -0
- data/lib/buildr/core/environment.rb +120 -0
- data/lib/buildr/core/filter.rb +362 -0
- data/lib/buildr/core/generate.rb +195 -0
- data/lib/buildr/core/help.rb +118 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/buildr/core/project.rb +892 -0
- data/lib/buildr/core/test.rb +715 -0
- data/lib/buildr/core/transports.rb +558 -0
- data/lib/buildr/core/util.rb +289 -0
- data/lib/buildr/groovy.rb +18 -0
- data/lib/buildr/groovy/bdd.rb +105 -0
- data/lib/buildr/groovy/compiler.rb +138 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/ide/eclipse.rb +212 -0
- data/lib/buildr/ide/idea.ipr.template +300 -0
- data/lib/buildr/ide/idea.rb +189 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +210 -0
- data/lib/buildr/java.rb +23 -0
- data/lib/buildr/java/ant.rb +92 -0
- data/lib/buildr/java/bdd.rb +449 -0
- data/lib/buildr/java/commands.rb +211 -0
- data/lib/buildr/java/compiler.rb +348 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/jruby.rb +117 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +119 -0
- data/lib/buildr/java/packaging.rb +713 -0
- data/lib/buildr/java/pom.rb +178 -0
- data/lib/buildr/java/rjb.rb +155 -0
- data/lib/buildr/java/test_result.rb +308 -0
- data/lib/buildr/java/tests.rb +324 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +21 -0
- data/lib/buildr/packaging/artifact.rb +730 -0
- data/lib/buildr/packaging/artifact_namespace.rb +972 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +102 -0
- data/lib/buildr/packaging/package.rb +233 -0
- data/lib/buildr/packaging/tar.rb +104 -0
- data/lib/buildr/packaging/zip.rb +722 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +19 -0
- data/lib/buildr/scala/compiler.rb +109 -0
- data/lib/buildr/scala/tests.rb +203 -0
- data/rakelib/apache.rake +191 -0
- data/rakelib/changelog.rake +57 -0
- data/rakelib/doc.rake +103 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +65 -0
- data/rakelib/rspec.rake +83 -0
- data/rakelib/rubyforge.rake +53 -0
- data/rakelib/scm.rake +49 -0
- data/rakelib/setup.rake +86 -0
- data/rakelib/stage.rake +48 -0
- data/spec/addon/cobertura_spec.rb +77 -0
- data/spec/addon/emma_spec.rb +120 -0
- data/spec/addon/test_coverage_spec.rb +255 -0
- data/spec/core/application_spec.rb +412 -0
- data/spec/core/artifact_namespace_spec.rb +646 -0
- data/spec/core/build_spec.rb +415 -0
- data/spec/core/checks_spec.rb +537 -0
- data/spec/core/common_spec.rb +664 -0
- data/spec/core/compile_spec.rb +566 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +754 -0
- data/spec/core/test_spec.rb +1091 -0
- data/spec/core/transport_spec.rb +500 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +239 -0
- data/spec/ide/eclipse_spec.rb +243 -0
- data/spec/java/ant.rb +28 -0
- data/spec/java/bdd_spec.rb +358 -0
- data/spec/java/compiler_spec.rb +446 -0
- data/spec/java/java_spec.rb +88 -0
- data/spec/java/packaging_spec.rb +1103 -0
- data/spec/java/tests_spec.rb +466 -0
- data/spec/packaging/archive_spec.rb +503 -0
- data/spec/packaging/artifact_spec.rb +754 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +589 -0
- data/spec/sandbox.rb +137 -0
- data/spec/scala/compiler_spec.rb +228 -0
- data/spec/scala/tests_spec.rb +215 -0
- data/spec/spec_helpers.rb +304 -0
- data/spec/version_requirement_spec.rb +123 -0
- metadata +369 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
13
|
+
# License for the specific language governing permissions and limitations under
|
|
14
|
+
# the License.
|
|
15
|
+
|
|
16
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
describe Buildr::Groovy::EasyB do
|
|
20
|
+
|
|
21
|
+
def foo(*args, &prc)
|
|
22
|
+
define('foo', *args) do
|
|
23
|
+
test.using :easyb
|
|
24
|
+
if prc
|
|
25
|
+
instance_eval(&prc)
|
|
26
|
+
else
|
|
27
|
+
self
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'should apply to a project having EasyB sources' do
|
|
33
|
+
define('one', :base_dir => 'one') do
|
|
34
|
+
write _('src/spec/groovy/SomeBehaviour.groovy'), 'true;'
|
|
35
|
+
Buildr::Groovy::EasyB.applies_to?(self).should be_true
|
|
36
|
+
end
|
|
37
|
+
define('two', :base_dir => 'two') do
|
|
38
|
+
write _('src/test/groovy/SomeBehaviour.groovy'), 'true;'
|
|
39
|
+
Buildr::Groovy::EasyB.applies_to?(self).should be_false
|
|
40
|
+
end
|
|
41
|
+
define('three', :base_dir => 'three') do
|
|
42
|
+
write _('src/spec/groovy/SomeStory.groovy'), 'true;'
|
|
43
|
+
Buildr::Groovy::EasyB.applies_to?(self).should be_true
|
|
44
|
+
end
|
|
45
|
+
define('four', :base_dir => 'four') do
|
|
46
|
+
write _('src/test/groovy/SomeStory.groovy'), 'true;'
|
|
47
|
+
Buildr::Groovy::EasyB.applies_to?(self).should be_false
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'should be selected by :easyb name' do
|
|
52
|
+
foo { test.framework.should eql(:easyb) }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'should select a java compiler if java sources are found' do
|
|
56
|
+
foo do
|
|
57
|
+
write _('src/spec/java/SomeBehavior.java'), 'public class SomeBehavior {}'
|
|
58
|
+
test.compile.language.should eql(:java)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'should include src/spec/groovy/*Behavior.groovy' do
|
|
63
|
+
foo do
|
|
64
|
+
spec = _('src/spec/groovy/SomeBehavior.groovy')
|
|
65
|
+
write spec, 'true'
|
|
66
|
+
test.invoke
|
|
67
|
+
test.tests.should include(spec)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'should include src/spec/groovy/*Story.groovy' do
|
|
72
|
+
foo do
|
|
73
|
+
spec = _('src/spec/groovy/SomeStory.groovy')
|
|
74
|
+
write spec, 'true'
|
|
75
|
+
test.invoke
|
|
76
|
+
test.tests.should include(spec)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end # EasyB
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
13
|
+
# License for the specific language governing permissions and limitations under
|
|
14
|
+
# the License.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
18
|
+
|
|
19
|
+
describe 'groovyc compiler' do
|
|
20
|
+
|
|
21
|
+
it 'should identify itself from groovy source directories' do
|
|
22
|
+
write 'src/main/groovy/some/Hello.groovy', 'println "Hello Groovy"'
|
|
23
|
+
write 'src/test/groovy/some/Hello.groovy', 'println "Hello Groovy"'
|
|
24
|
+
define('foo') do
|
|
25
|
+
compile.compiler.should eql(:groovyc)
|
|
26
|
+
test.compile.compiler.should eql(:groovyc)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'should identify if groovy sources are found on java directories' do
|
|
31
|
+
write 'src/main/java/some/Hello.groovy', 'println "Hello Groovy"'
|
|
32
|
+
write 'src/test/java/some/Hello.groovy', 'println "Hello Groovy"'
|
|
33
|
+
define('foo') do
|
|
34
|
+
compile.compiler.should eql(:groovyc)
|
|
35
|
+
test.compile.compiler.should eql(:groovyc)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'should identify itself even if groovy and java sources are found' do
|
|
40
|
+
write 'src/main/java/some/Empty.java', 'package some; public interface Empty {}'
|
|
41
|
+
write 'src/main/groovy/some/Hello.groovy', 'println "Hello Groovy"'
|
|
42
|
+
write 'src/test/java/some/Empty.java', 'package some; public interface Empty {}'
|
|
43
|
+
write 'src/test/groovy/some/Hello.groovy', 'println "Hello Groovy"'
|
|
44
|
+
define('foo') do
|
|
45
|
+
compile.compiler.should eql(:groovyc)
|
|
46
|
+
test.compile.compiler.should eql(:groovyc)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'should identify from custom layout' do
|
|
51
|
+
write 'groovy/Hello.groovy', 'println "Hello world"'
|
|
52
|
+
write 'testing/Hello.groovy', 'println "Hello world"'
|
|
53
|
+
custom = Layout.new
|
|
54
|
+
custom[:source, :main, :groovy] = 'groovy'
|
|
55
|
+
custom[:source, :test, :groovy] = 'testing'
|
|
56
|
+
define 'foo', :layout=>custom do
|
|
57
|
+
compile.compiler.should eql(:groovyc)
|
|
58
|
+
test.compile.compiler.should eql(:groovyc)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
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"'
|
|
65
|
+
define 'foo' do
|
|
66
|
+
lambda { compile.from 'src' }.should change { compile.compiler }.to(:groovyc)
|
|
67
|
+
lambda { test.compile.from 'testing' }.should change { test.compile.compiler }.to(:groovyc)
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'should report the multi-language as :groovy, :java' do
|
|
72
|
+
define('foo').compile.using(:groovyc).language.should == :groovy
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it 'should set the target directory to target/classes' do
|
|
76
|
+
define 'foo' do
|
|
77
|
+
lambda { compile.using(:groovyc) }.should change { compile.target.to_s }.to(File.expand_path('target/classes'))
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it 'should not override existing target directory' do
|
|
82
|
+
define 'foo' do
|
|
83
|
+
compile.into('classes')
|
|
84
|
+
lambda { compile.using(:groovyc) }.should_not change { compile.target }
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it 'should not change existing list of sources' do
|
|
89
|
+
define 'foo' do
|
|
90
|
+
compile.from('sources')
|
|
91
|
+
lambda { compile.using(:groovyc) }.should_not change { compile.sources }
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
it 'should compile groovy sources' do
|
|
96
|
+
write 'src/main/groovy/some/Example.groovy', 'package some; class Example { static main(args) { println "Hello" } }'
|
|
97
|
+
define('foo').compile.invoke
|
|
98
|
+
file('target/classes/some/Example.class').should exist
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it 'should include as classpath dependency' do
|
|
102
|
+
write 'src/bar/groovy/some/Foo.groovy', 'package some; interface Foo {}'
|
|
103
|
+
write 'src/main/groovy/some/Example.groovy', 'package some; class Example implements Foo { }'
|
|
104
|
+
define('bar', :version => '1.0') do
|
|
105
|
+
compile.from('src/bar/groovy').into('target/bar')
|
|
106
|
+
package(:jar)
|
|
107
|
+
end
|
|
108
|
+
lambda { define('foo').compile.with(project('bar').package(:jar)).invoke }.should run_task('foo:compile')
|
|
109
|
+
file('target/classes/some/Example.class').should exist
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
it 'should cross compile java sources' do
|
|
113
|
+
write 'src/main/java/some/Foo.java', 'package some; public interface Foo { public void hello(); }'
|
|
114
|
+
write 'src/main/java/some/Baz.java', 'package some; public class Baz extends Bar { }'
|
|
115
|
+
write 'src/main/groovy/some/Bar.groovy', 'package some; class Bar implements Foo { def void hello() { } }'
|
|
116
|
+
define('foo').compile.invoke
|
|
117
|
+
%w{Foo Bar Baz}.each { |f| file("target/classes/some/#{f}.class").should exist }
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
it 'should cross compile test java sources' do
|
|
121
|
+
write 'src/test/java/some/Foo.java', 'package some; public interface Foo { public void hello(); }'
|
|
122
|
+
write 'src/test/java/some/Baz.java', 'package some; public class Baz extends Bar { }'
|
|
123
|
+
write 'src/test/groovy/some/Bar.groovy', 'package some; class Bar implements Foo { def void hello() { } }'
|
|
124
|
+
define('foo').test.compile.invoke
|
|
125
|
+
%w{Foo Bar Baz}.each { |f| file("target/test/classes/some/#{f}.class").should exist }
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
it 'should package classes into a jar file' do
|
|
129
|
+
write 'src/main/groovy/some/Example.groovy', 'package some; class Example { }'
|
|
130
|
+
define('foo', :version => '1.0').package.invoke
|
|
131
|
+
file('target/foo-1.0.jar').should exist
|
|
132
|
+
Zip::ZipFile.open(project('foo').package(:jar).to_s) do |jar|
|
|
133
|
+
jar.file.exist?('some/Example.class').should be_true
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
describe 'groovyc compiler options' do
|
|
140
|
+
|
|
141
|
+
def groovyc(&prc)
|
|
142
|
+
define('foo') do
|
|
143
|
+
compile.using(:groovyc)
|
|
144
|
+
@compiler = compile.instance_eval { @compiler }
|
|
145
|
+
class << @compiler
|
|
146
|
+
public :groovyc_options, :javac_options
|
|
147
|
+
end
|
|
148
|
+
if block_given?
|
|
149
|
+
instance_eval(&prc)
|
|
150
|
+
else
|
|
151
|
+
return compile
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
it 'should set warning option to false by default' do
|
|
157
|
+
groovyc do
|
|
158
|
+
compile.options.warnings.should be_false
|
|
159
|
+
@compiler.javac_options[:nowarn].should be_true
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
it 'should set warning option to true when running with --verbose option' do
|
|
164
|
+
verbose true
|
|
165
|
+
groovyc do
|
|
166
|
+
compile.options.warnings.should be_true
|
|
167
|
+
@compiler.javac_options[:nowarn].should be_false
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it 'should not set verbose option by default' do
|
|
172
|
+
groovyc.options.verbose.should be_false
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
it 'should set verbose option when running with --trace option' do
|
|
176
|
+
trace true
|
|
177
|
+
groovyc.options.verbose.should be_true
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
it 'should set debug option to false based on Buildr.options' do
|
|
181
|
+
Buildr.options.debug = false
|
|
182
|
+
groovyc.options.debug.should be_false
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
it 'should set debug option to false based on debug environment variable' do
|
|
186
|
+
ENV['debug'] = 'no'
|
|
187
|
+
groovyc.options.debug.should be_false
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
it 'should set debug option to false based on DEBUG environment variable' do
|
|
191
|
+
ENV['DEBUG'] = 'no'
|
|
192
|
+
groovyc.options.debug.should be_false
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
it 'should set deprecation option to false by default' do
|
|
196
|
+
groovyc.options.deprecation.should be_false
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
it 'should use deprecation argument when deprecation is true' do
|
|
200
|
+
groovyc do
|
|
201
|
+
compile.using(:deprecation=>true)
|
|
202
|
+
compile.options.deprecation.should be_true
|
|
203
|
+
@compiler.javac_options[:deprecation].should be_true
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
it 'should not use deprecation argument when deprecation is false' do
|
|
208
|
+
groovyc do
|
|
209
|
+
compile.using(:deprecation=>false)
|
|
210
|
+
compile.options.deprecation.should be_false
|
|
211
|
+
@compiler.javac_options[:deprecation].should_not be_true
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
it 'should set optimise option to false by default' do
|
|
216
|
+
groovyc.options.optimise.should be_false
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
it 'should use optimize argument when deprecation is true' do
|
|
220
|
+
groovyc do
|
|
221
|
+
compile.using(:optimise=>true)
|
|
222
|
+
@compiler.javac_options[:optimize].should be_true
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
it 'should not use optimize argument when deprecation is false' do
|
|
227
|
+
groovyc do
|
|
228
|
+
compile.using(:optimise=>false)
|
|
229
|
+
@compiler.javac_options[:optimize].should be_false
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
after do
|
|
234
|
+
Buildr.options.debug = nil
|
|
235
|
+
ENV.delete "debug"
|
|
236
|
+
ENV.delete "DEBUG"
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
end
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
13
|
+
# License for the specific language governing permissions and limitations under
|
|
14
|
+
# the License.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
require File.join(File.dirname(__FILE__), '../spec_helpers')
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
module EclipseHelper
|
|
21
|
+
def classpath_xml_elements
|
|
22
|
+
task('eclipse').invoke
|
|
23
|
+
REXML::Document.new(File.open('.classpath')).root.elements
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def classpath_sources attribute='path'
|
|
27
|
+
classpath_xml_elements.collect("classpathentry[@kind='src']") { |n| n.attributes[attribute] }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# <classpathentry path="PATH" output="RETURNED_VALUE"/>
|
|
31
|
+
def classpath_specific_output path
|
|
32
|
+
specific_output = classpath_xml_elements.collect("classpathentry[@path='#{path}']") { |n| n.attributes['output'] }
|
|
33
|
+
raise "expected: one output attribute for path '#{path}, got: #{specific_output.inspect}" if specific_output.length > 1
|
|
34
|
+
specific_output[0]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# <classpathentry path="RETURNED_VALUE" kind="output"/>
|
|
38
|
+
def classpath_default_output
|
|
39
|
+
default_output = classpath_xml_elements.collect("classpathentry[@kind='output']") { |n| n.attributes['path'] }
|
|
40
|
+
raise "expected: one path attribute for kind='output', got: #{default_output.inspect}" if default_output.length > 1
|
|
41
|
+
default_output[0]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def project_xml_elements
|
|
45
|
+
task('eclipse').invoke
|
|
46
|
+
REXML::Document.new(File.open('.project')).root.elements
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
describe Buildr::Eclipse do
|
|
52
|
+
include EclipseHelper
|
|
53
|
+
|
|
54
|
+
describe "eclipse's .project file" do
|
|
55
|
+
|
|
56
|
+
describe 'scala project' do
|
|
57
|
+
|
|
58
|
+
SCALA_NATURE = 'ch.epfl.lamp.sdt.core.scalanature'
|
|
59
|
+
JAVA_NATURE = 'org.eclipse.jdt.core.javanature'
|
|
60
|
+
|
|
61
|
+
SCALA_BUILDER = 'ch.epfl.lamp.sdt.core.scalabuilder'
|
|
62
|
+
JAVA_BUILDER = 'org.eclipse.jdt.core.javabuilder'
|
|
63
|
+
|
|
64
|
+
def project_natures
|
|
65
|
+
project_xml_elements.collect("natures/nature") { |n| n.text }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def build_commands
|
|
69
|
+
project_xml_elements.collect("buildSpec/buildCommand/name") { |n| n.text }
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
before do
|
|
73
|
+
write 'buildfile'
|
|
74
|
+
write 'src/main/scala/Main.scala'
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'should have Scala nature before Java nature' do
|
|
78
|
+
define('foo')
|
|
79
|
+
project_natures.should include(SCALA_NATURE)
|
|
80
|
+
project_natures.should include(JAVA_NATURE)
|
|
81
|
+
project_natures.index(SCALA_NATURE).should < project_natures.index(JAVA_NATURE)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it 'should have Scala build command and no Java build command' do
|
|
85
|
+
define('foo')
|
|
86
|
+
build_commands.should include(SCALA_BUILDER)
|
|
87
|
+
build_commands.should_not include(JAVA_BUILDER)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
describe "eclipse's .classpath file" do
|
|
93
|
+
|
|
94
|
+
describe 'scala project' do
|
|
95
|
+
|
|
96
|
+
SCALA_CONTAINER = 'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER'
|
|
97
|
+
JAVA_CONTAINER = 'org.eclipse.jdt.launching.JRE_CONTAINER'
|
|
98
|
+
|
|
99
|
+
def classpath_containers attribute='path'
|
|
100
|
+
classpath_xml_elements.collect("classpathentry[@kind='con']") { |n| n.attributes[attribute] }
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
before do
|
|
104
|
+
write 'buildfile'
|
|
105
|
+
write 'src/main/scala/Main.scala'
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
it 'should have SCALA_CONTAINER before JRE_CONTAINER' do
|
|
109
|
+
define('foo')
|
|
110
|
+
classpath_containers.should include(SCALA_CONTAINER)
|
|
111
|
+
classpath_containers.should include(JAVA_CONTAINER)
|
|
112
|
+
classpath_containers.index(SCALA_CONTAINER).should < classpath_containers.index(JAVA_CONTAINER)
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
describe 'source folders' do
|
|
117
|
+
|
|
118
|
+
before do
|
|
119
|
+
write 'buildfile'
|
|
120
|
+
write 'src/main/java/Main.java'
|
|
121
|
+
write 'src/test/java/Test.java'
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
describe 'source', :shared=>true do
|
|
125
|
+
it 'should ignore CVS and SVN files' do
|
|
126
|
+
define('foo')
|
|
127
|
+
classpath_sources('excluding').each do |excluding_attribute|
|
|
128
|
+
excluding = excluding_attribute.split('|')
|
|
129
|
+
excluding.should include('**/.svn/')
|
|
130
|
+
excluding.should include('**/CVS/')
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
describe 'main code' do
|
|
136
|
+
it_should_behave_like 'source'
|
|
137
|
+
|
|
138
|
+
it 'should accept to come from the default directory' do
|
|
139
|
+
define('foo')
|
|
140
|
+
classpath_sources.should include('src/main/java')
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it 'should accept to come from a user-defined directory' do
|
|
144
|
+
define('foo') { compile path_to('src/java') }
|
|
145
|
+
classpath_sources.should include('src/java')
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
it 'should accept a file task as a main source folder' do
|
|
149
|
+
define('foo') { compile apt }
|
|
150
|
+
classpath_sources.should include('target/generated/apt')
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it 'should go to the default target directory' do
|
|
154
|
+
define('foo')
|
|
155
|
+
classpath_specific_output('src/main/java').should be(nil)
|
|
156
|
+
classpath_default_output.should == 'target/classes'
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
describe 'test code' do
|
|
161
|
+
it_should_behave_like 'source'
|
|
162
|
+
|
|
163
|
+
it 'should accept to come from the default directory' do
|
|
164
|
+
define('foo')
|
|
165
|
+
classpath_sources.should include('src/test/java')
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
it 'should accept to come from a user-defined directory' do
|
|
169
|
+
define('foo') { test.compile path_to('src/test') }
|
|
170
|
+
classpath_sources.should include('src/test')
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
it 'should go to the default target directory' do
|
|
174
|
+
define('foo')
|
|
175
|
+
classpath_specific_output('src/test/java').should == 'target/test/classes'
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
describe 'main resources' do
|
|
180
|
+
it_should_behave_like 'source'
|
|
181
|
+
|
|
182
|
+
before do
|
|
183
|
+
write 'src/main/resources/config.xml'
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
it 'should accept to come from the default directory' do
|
|
187
|
+
define('foo')
|
|
188
|
+
classpath_sources.should include('src/main/resources')
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
it 'should share a classpath entry if it comes from a directory with code' do
|
|
192
|
+
write 'src/main/java/config.properties'
|
|
193
|
+
define('foo') { resources.from('src/main/java').exclude('**/*.java') }
|
|
194
|
+
classpath_sources.select { |path| path == 'src/main/java'}.length.should == 1
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
it 'should go to the default target directory' do
|
|
198
|
+
define('foo')
|
|
199
|
+
classpath_specific_output('src/main/resources').should == 'target/resources'
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
describe 'test resources' do
|
|
204
|
+
it_should_behave_like 'source'
|
|
205
|
+
|
|
206
|
+
before do
|
|
207
|
+
write 'src/test/resources/config-test.xml'
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
it 'should accept to come from the default directory' do
|
|
211
|
+
define('foo')
|
|
212
|
+
classpath_sources.should include('src/test/resources')
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
it 'should share a classpath entry if it comes from a directory with code' do
|
|
216
|
+
write 'src/test/java/config-test.properties'
|
|
217
|
+
define('foo') { test.resources.from('src/test/java').exclude('**/*.java') }
|
|
218
|
+
classpath_sources.select { |path| path == 'src/test/java'}.length.should == 1
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
it 'should go to the default target directory' do
|
|
222
|
+
define('foo')
|
|
223
|
+
classpath_specific_output('src/test/resources').should == 'target/test/resources'
|
|
224
|
+
end
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
describe 'project depending on another project' do
|
|
228
|
+
|
|
229
|
+
it 'should have the underlying project in its classpath' do
|
|
230
|
+
mkdir 'bar'
|
|
231
|
+
define('myproject') {
|
|
232
|
+
project.version = '1.0'
|
|
233
|
+
define('foo') { package :jar }
|
|
234
|
+
define('bar') { compile.using(:javac).with project('foo'); }
|
|
235
|
+
}
|
|
236
|
+
task('eclipse').invoke
|
|
237
|
+
REXML::Document.new(File.open(File.join('bar', '.classpath'))).root.
|
|
238
|
+
elements.collect("classpathentry[@kind='src']") { |n| n.attributes['path'] }.should include('/myproject-foo')
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
end
|