ittayd-buildr 1.3.4 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. data/CHANGELOG +62 -9
  2. data/NOTICE +1 -1
  3. data/README.rdoc +9 -21
  4. data/Rakefile +20 -39
  5. data/_buildr +1 -0
  6. data/{spec/java/ant.rb → _jbuildr} +11 -15
  7. metadata +30 -210
  8. data/DISCLAIMER +0 -7
  9. data/addon/buildr/antlr.rb +0 -65
  10. data/addon/buildr/cobertura.rb +0 -22
  11. data/addon/buildr/drb.rb +0 -281
  12. data/addon/buildr/emma.rb +0 -22
  13. data/addon/buildr/hibernate.rb +0 -142
  14. data/addon/buildr/javacc.rb +0 -85
  15. data/addon/buildr/jdepend.rb +0 -60
  16. data/addon/buildr/jetty.rb +0 -248
  17. data/addon/buildr/jibx.rb +0 -86
  18. data/addon/buildr/nailgun.rb +0 -221
  19. data/addon/buildr/openjpa.rb +0 -90
  20. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  22. data/addon/buildr/org/apache/buildr/BuildrNail.java +0 -41
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  26. data/addon/buildr/org/apache/buildr/JettyWrapper.java +0 -144
  27. data/addon/buildr/path.rb +0 -136
  28. data/addon/buildr/xmlbeans.rb +0 -93
  29. data/buildr.buildfile +0 -53
  30. data/buildr.gemspec +0 -58
  31. data/doc/css/default.css +0 -228
  32. data/doc/css/print.css +0 -100
  33. data/doc/css/syntax.css +0 -52
  34. data/doc/images/apache-incubator-logo.png +0 -0
  35. data/doc/images/buildr-hires.png +0 -0
  36. data/doc/images/buildr.png +0 -0
  37. data/doc/images/favicon.png +0 -0
  38. data/doc/images/growl-icon.tiff +0 -0
  39. data/doc/images/note.png +0 -0
  40. data/doc/images/project-structure.png +0 -0
  41. data/doc/images/tip.png +0 -0
  42. data/doc/images/zbuildr.tif +0 -0
  43. data/doc/pages/artifacts.textile +0 -207
  44. data/doc/pages/building.textile +0 -240
  45. data/doc/pages/contributing.textile +0 -208
  46. data/doc/pages/download.textile +0 -62
  47. data/doc/pages/extending.textile +0 -175
  48. data/doc/pages/getting_started.textile +0 -273
  49. data/doc/pages/index.textile +0 -42
  50. data/doc/pages/languages.textile +0 -407
  51. data/doc/pages/mailing_lists.textile +0 -17
  52. data/doc/pages/more_stuff.textile +0 -314
  53. data/doc/pages/packaging.textile +0 -427
  54. data/doc/pages/projects.textile +0 -274
  55. data/doc/pages/recipes.textile +0 -103
  56. data/doc/pages/settings_profiles.textile +0 -274
  57. data/doc/pages/testing.textile +0 -212
  58. data/doc/pages/troubleshooting.textile +0 -103
  59. data/doc/pages/whats_new.textile +0 -323
  60. data/doc/print.haml +0 -51
  61. data/doc/print.toc.yaml +0 -29
  62. data/doc/scripts/buildr-git.rb +0 -412
  63. data/doc/scripts/install-jruby.sh +0 -44
  64. data/doc/scripts/install-linux.sh +0 -64
  65. data/doc/scripts/install-osx.sh +0 -52
  66. data/doc/site.haml +0 -56
  67. data/doc/site.toc.yaml +0 -47
  68. data/etc/KEYS +0 -151
  69. data/etc/git-svn-authors +0 -16
  70. data/lib/buildr.rb +0 -33
  71. data/lib/buildr/core.rb +0 -29
  72. data/lib/buildr/core/application.rb +0 -665
  73. data/lib/buildr/core/build.rb +0 -311
  74. data/lib/buildr/core/checks.rb +0 -254
  75. data/lib/buildr/core/common.rb +0 -150
  76. data/lib/buildr/core/compile.rb +0 -590
  77. data/lib/buildr/core/environment.rb +0 -117
  78. data/lib/buildr/core/filter.rb +0 -366
  79. data/lib/buildr/core/generate.rb +0 -195
  80. data/lib/buildr/core/help.rb +0 -119
  81. data/lib/buildr/core/osx.rb +0 -49
  82. data/lib/buildr/core/progressbar.rb +0 -156
  83. data/lib/buildr/core/project.rb +0 -923
  84. data/lib/buildr/core/test.rb +0 -715
  85. data/lib/buildr/core/transports.rb +0 -560
  86. data/lib/buildr/core/util.rb +0 -294
  87. data/lib/buildr/groovy.rb +0 -18
  88. data/lib/buildr/groovy/bdd.rb +0 -106
  89. data/lib/buildr/groovy/compiler.rb +0 -138
  90. data/lib/buildr/ide.rb +0 -19
  91. data/lib/buildr/ide/eclipse.rb +0 -222
  92. data/lib/buildr/ide/idea.ipr.template +0 -300
  93. data/lib/buildr/ide/idea.rb +0 -190
  94. data/lib/buildr/ide/idea7x.ipr.template +0 -290
  95. data/lib/buildr/ide/idea7x.rb +0 -212
  96. data/lib/buildr/java.rb +0 -23
  97. data/lib/buildr/java/ant.rb +0 -92
  98. data/lib/buildr/java/bdd.rb +0 -451
  99. data/lib/buildr/java/cobertura.rb +0 -236
  100. data/lib/buildr/java/commands.rb +0 -211
  101. data/lib/buildr/java/compiler.rb +0 -348
  102. data/lib/buildr/java/deprecated.rb +0 -141
  103. data/lib/buildr/java/emma.rb +0 -238
  104. data/lib/buildr/java/jruby.rb +0 -117
  105. data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
  106. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  107. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +0 -119
  108. data/lib/buildr/java/packaging.rb +0 -717
  109. data/lib/buildr/java/pom.rb +0 -174
  110. data/lib/buildr/java/rjb.rb +0 -155
  111. data/lib/buildr/java/test_result.rb +0 -307
  112. data/lib/buildr/java/tests.rb +0 -329
  113. data/lib/buildr/java/version_requirement.rb +0 -172
  114. data/lib/buildr/packaging.rb +0 -24
  115. data/lib/buildr/packaging/archive.rb +0 -488
  116. data/lib/buildr/packaging/artifact.rb +0 -759
  117. data/lib/buildr/packaging/artifact_namespace.rb +0 -972
  118. data/lib/buildr/packaging/artifact_search.rb +0 -140
  119. data/lib/buildr/packaging/gems.rb +0 -102
  120. data/lib/buildr/packaging/package.rb +0 -233
  121. data/lib/buildr/packaging/tar.rb +0 -186
  122. data/lib/buildr/packaging/version_requirement.rb +0 -172
  123. data/lib/buildr/packaging/zip.rb +0 -64
  124. data/lib/buildr/packaging/ziptask.rb +0 -313
  125. data/lib/buildr/resources/buildr.icns +0 -0
  126. data/lib/buildr/scala.rb +0 -19
  127. data/lib/buildr/scala/compiler.rb +0 -109
  128. data/lib/buildr/scala/tests.rb +0 -203
  129. data/rakelib/apache.rake +0 -191
  130. data/rakelib/changelog.rake +0 -57
  131. data/rakelib/doc.rake +0 -103
  132. data/rakelib/package.rake +0 -76
  133. data/rakelib/release.rake +0 -65
  134. data/rakelib/rspec.rake +0 -83
  135. data/rakelib/rubyforge.rake +0 -56
  136. data/rakelib/scm.rake +0 -49
  137. data/rakelib/setup.rake +0 -81
  138. data/rakelib/stage.rake +0 -48
  139. data/spec/addon/drb_spec.rb +0 -328
  140. data/spec/core/application_spec.rb +0 -419
  141. data/spec/core/build_spec.rb +0 -423
  142. data/spec/core/checks_spec.rb +0 -519
  143. data/spec/core/common_spec.rb +0 -670
  144. data/spec/core/compile_spec.rb +0 -582
  145. data/spec/core/generate_spec.rb +0 -33
  146. data/spec/core/project_spec.rb +0 -776
  147. data/spec/core/test_spec.rb +0 -1098
  148. data/spec/core/transport_spec.rb +0 -500
  149. data/spec/groovy/bdd_spec.rb +0 -80
  150. data/spec/groovy/compiler_spec.rb +0 -239
  151. data/spec/ide/eclipse_spec.rb +0 -311
  152. data/spec/java/bdd_spec.rb +0 -358
  153. data/spec/java/cobertura_spec.rb +0 -77
  154. data/spec/java/compiler_spec.rb +0 -446
  155. data/spec/java/emma_spec.rb +0 -120
  156. data/spec/java/java_spec.rb +0 -96
  157. data/spec/java/packaging_spec.rb +0 -1120
  158. data/spec/java/test_coverage_spec.rb +0 -255
  159. data/spec/java/tests_spec.rb +0 -471
  160. data/spec/packaging/archive_spec.rb +0 -503
  161. data/spec/packaging/artifact_namespace_spec.rb +0 -646
  162. data/spec/packaging/artifact_spec.rb +0 -795
  163. data/spec/packaging/packaging_helper.rb +0 -63
  164. data/spec/packaging/packaging_spec.rb +0 -589
  165. data/spec/sandbox.rb +0 -139
  166. data/spec/scala/compiler_spec.rb +0 -228
  167. data/spec/scala/tests_spec.rb +0 -215
  168. data/spec/spec_helpers.rb +0 -327
  169. data/spec/version_requirement_spec.rb +0 -123
@@ -1,80 +0,0 @@
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
@@ -1,239 +0,0 @@
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
@@ -1,311 +0,0 @@
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
- # <classpathentry path="PATH" sourcepath="RETURNED_VALUE" kind="var"/>
45
- def sourcepath_for_path path
46
- classpath_xml_elements.collect("classpathentry[@kind='var',@path='#{path}']") do |n|
47
- n.attributes['sourcepath'] || 'no source artifact'
48
- end
49
- end
50
-
51
- def project_xml_elements
52
- task('eclipse').invoke
53
- REXML::Document.new(File.open('.project')).root.elements
54
- end
55
- end
56
-
57
-
58
- describe Buildr::Eclipse do
59
- include EclipseHelper
60
-
61
- describe "eclipse's .project file" do
62
-
63
- JAVA_CONTAINER = 'org.eclipse.jdt.launching.JRE_CONTAINER'
64
- SCALA_CONTAINER = 'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER'
65
-
66
- SCALA_NATURE = 'ch.epfl.lamp.sdt.core.scalanature'
67
- JAVA_NATURE = 'org.eclipse.jdt.core.javanature'
68
-
69
- SCALA_BUILDER = 'ch.epfl.lamp.sdt.core.scalabuilder'
70
- JAVA_BUILDER = 'org.eclipse.jdt.core.javabuilder'
71
-
72
- def project_natures
73
- project_xml_elements.collect("natures/nature") { |n| n.text }
74
- end
75
-
76
- def build_commands
77
- project_xml_elements.collect("buildSpec/buildCommand/name") { |n| n.text }
78
- end
79
-
80
- describe 'java project' do
81
- before do
82
- write 'buildfile'
83
- write 'src/main/java/Main.java'
84
- end
85
-
86
- it 'should have Java nature' do
87
- define('foo')
88
- project_natures.should include(JAVA_NATURE)
89
- end
90
-
91
- it 'should have Java build command' do
92
- define('foo')
93
- build_commands.should include(JAVA_BUILDER)
94
- end
95
- end
96
-
97
- describe 'nested java project' do
98
-
99
- it 'should have name corresponding to its project definition' do
100
- mkdir 'foo'
101
- define('myproject') {
102
- project.version = '1.0'
103
- define('foo') { compile.using(:javac); package :jar }
104
- }
105
- task('eclipse').invoke
106
- REXML::Document.new(File.open(File.join('foo', '.project'))).root.
107
- elements.collect("name") { |e| e.text }.should == ['myproject-foo']
108
- end
109
-
110
- end
111
-
112
- describe 'scala project' do
113
-
114
- before do
115
- write 'buildfile'
116
- write 'src/main/scala/Main.scala'
117
- end
118
-
119
- it 'should have Scala nature before Java nature' do
120
- define('foo')
121
- project_natures.should include(SCALA_NATURE)
122
- project_natures.should include(JAVA_NATURE)
123
- project_natures.index(SCALA_NATURE).should < project_natures.index(JAVA_NATURE)
124
- end
125
-
126
- it 'should have Scala build command and no Java build command' do
127
- define('foo')
128
- build_commands.should include(SCALA_BUILDER)
129
- build_commands.should_not include(JAVA_BUILDER)
130
- end
131
- end
132
- end
133
-
134
- describe "eclipse's .classpath file" do
135
-
136
- describe 'scala project' do
137
-
138
- def classpath_containers attribute='path'
139
- classpath_xml_elements.collect("classpathentry[@kind='con']") { |n| n.attributes[attribute] }
140
- end
141
-
142
- before do
143
- write 'buildfile'
144
- write 'src/main/scala/Main.scala'
145
- end
146
-
147
- it 'should have SCALA_CONTAINER before JAVA_CONTAINER' do
148
- define('foo')
149
- classpath_containers.should include(SCALA_CONTAINER)
150
- classpath_containers.should include(JAVA_CONTAINER)
151
- classpath_containers.index(SCALA_CONTAINER).should < classpath_containers.index(JAVA_CONTAINER)
152
- end
153
- end
154
-
155
- describe 'source folders' do
156
-
157
- before do
158
- write 'buildfile'
159
- write 'src/main/java/Main.java'
160
- write 'src/test/java/Test.java'
161
- end
162
-
163
- describe 'source', :shared=>true do
164
- it 'should ignore CVS and SVN files' do
165
- define('foo')
166
- classpath_sources('excluding').each do |excluding_attribute|
167
- excluding = excluding_attribute.split('|')
168
- excluding.should include('**/.svn/')
169
- excluding.should include('**/CVS/')
170
- end
171
- end
172
- end
173
-
174
- describe 'main code' do
175
- it_should_behave_like 'source'
176
-
177
- it 'should accept to come from the default directory' do
178
- define('foo')
179
- classpath_sources.should include('src/main/java')
180
- end
181
-
182
- it 'should accept to come from a user-defined directory' do
183
- define('foo') { compile path_to('src/java') }
184
- classpath_sources.should include('src/java')
185
- end
186
-
187
- it 'should accept a file task as a main source folder' do
188
- define('foo') { compile apt }
189
- classpath_sources.should include('target/generated/apt')
190
- end
191
-
192
- it 'should go to the default target directory' do
193
- define('foo')
194
- classpath_specific_output('src/main/java').should be(nil)
195
- classpath_default_output.should == 'target/classes'
196
- end
197
- end
198
-
199
- describe 'test code' do
200
- it_should_behave_like 'source'
201
-
202
- it 'should accept to come from the default directory' do
203
- define('foo')
204
- classpath_sources.should include('src/test/java')
205
- end
206
-
207
- it 'should accept to come from a user-defined directory' do
208
- define('foo') { test.compile path_to('src/test') }
209
- classpath_sources.should include('src/test')
210
- end
211
-
212
- it 'should go to the default target directory' do
213
- define('foo')
214
- classpath_specific_output('src/test/java').should == 'target/test/classes'
215
- end
216
-
217
- it 'should accept to be the only code in the project' do
218
- rm 'src/main/java/Main.java'
219
- define('foo')
220
- classpath_sources.should include('src/test/java')
221
- end
222
- end
223
-
224
- describe 'main resources' do
225
- it_should_behave_like 'source'
226
-
227
- before do
228
- write 'src/main/resources/config.xml'
229
- end
230
-
231
- it 'should accept to come from the default directory' do
232
- define('foo')
233
- classpath_sources.should include('src/main/resources')
234
- end
235
-
236
- it 'should share a classpath entry if it comes from a directory with code' do
237
- write 'src/main/java/config.properties'
238
- define('foo') { resources.from('src/main/java').exclude('**/*.java') }
239
- classpath_sources.select { |path| path == 'src/main/java'}.length.should == 1
240
- end
241
-
242
- it 'should go to the default target directory' do
243
- define('foo')
244
- classpath_specific_output('src/main/resources').should == 'target/resources'
245
- end
246
- end
247
-
248
- describe 'test resources' do
249
- it_should_behave_like 'source'
250
-
251
- before do
252
- write 'src/test/resources/config-test.xml'
253
- end
254
-
255
- it 'should accept to come from the default directory' do
256
- define('foo')
257
- classpath_sources.should include('src/test/resources')
258
- end
259
-
260
- it 'should share a classpath entry if it comes from a directory with code' do
261
- write 'src/test/java/config-test.properties'
262
- define('foo') { test.resources.from('src/test/java').exclude('**/*.java') }
263
- classpath_sources.select { |path| path == 'src/test/java'}.length.should == 1
264
- end
265
-
266
- it 'should go to the default target directory' do
267
- define('foo')
268
- classpath_specific_output('src/test/resources').should == 'target/test/resources'
269
- end
270
- end
271
- end
272
-
273
- describe 'project depending on another project' do
274
- it 'should have the underlying project in its classpath' do
275
- mkdir 'foo'
276
- mkdir 'bar'
277
- define('myproject') {
278
- project.version = '1.0'
279
- define('foo') { package :jar }
280
- define('bar') { compile.using(:javac).with project('foo'); }
281
- }
282
- task('eclipse').invoke
283
- REXML::Document.new(File.open(File.join('bar', '.classpath'))).root.
284
- elements.collect("classpathentry[@kind='src']") { |n| n.attributes['path'] }.should include('/myproject-foo')
285
- end
286
- end
287
- end
288
-
289
- describe 'maven2 artifact dependency' do
290
- before do
291
- define('foo') { compile.using(:javac).with('com.example:library:jar:2.0') }
292
- artifact('com.example:library:jar:2.0') { |task| write task.name }
293
- task('eclipse').invoke
294
- end
295
-
296
- it 'should have a reference in the .classpath file relative to the local M2 repo' do
297
- classpath_xml_elements.collect("classpathentry[@kind='var']") { |n| n.attributes['path'] }.
298
- should include('M2_REPO/com/example/library/2.0/library-2.0.jar')
299
- end
300
-
301
- it 'should be downloaded' do
302
- file(artifact('com.example:library:jar:2.0').name).should exist
303
- end
304
-
305
- it 'should have a source artifact reference in the .classpath file' do
306
- sourcepath_for_path('M2_REPO/com/example/library/2.0/library-2.0.jar').
307
- should == ['M2_REPO/com/example/library/2.0/library-2.0-sources.jar']
308
- end
309
- end
310
-
311
- end