buildr 1.3.5 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/CHANGELOG +153 -8
  2. data/README.rdoc +1 -1
  3. data/addon/buildr/antlr.rb +5 -5
  4. data/addon/buildr/drb.rb +18 -18
  5. data/addon/buildr/hibernate.rb +18 -14
  6. data/addon/buildr/javacc.rb +4 -4
  7. data/addon/buildr/jetty.rb +5 -5
  8. data/addon/buildr/nailgun.rb +23 -23
  9. data/addon/buildr/openjpa.rb +1 -1
  10. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  11. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  12. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  13. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  14. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  15. data/addon/buildr/protobuf.rb +75 -0
  16. data/addon/buildr/xmlbeans.rb +5 -5
  17. data/buildr.buildfile +2 -2
  18. data/buildr.gemspec +8 -7
  19. data/doc/_layouts/default.html +2 -2
  20. data/doc/artifacts.textile +4 -4
  21. data/doc/building.textile +35 -3
  22. data/doc/contributing.textile +5 -0
  23. data/doc/download.textile +16 -5
  24. data/doc/extending.textile +38 -12
  25. data/doc/installing.textile +6 -5
  26. data/doc/languages.textile +182 -42
  27. data/doc/more_stuff.textile +2 -2
  28. data/doc/packaging.textile +14 -15
  29. data/doc/projects.textile +7 -2
  30. data/doc/quick_start.textile +4 -4
  31. data/doc/scripts/buildr-git.rb +63 -63
  32. data/doc/scripts/gitflow.rb +21 -21
  33. data/doc/settings_profiles.textile +9 -2
  34. data/doc/testing.textile +16 -5
  35. data/etc/KEYS +38 -0
  36. data/lib/buildr/core/application.rb +33 -27
  37. data/lib/buildr/core/build.rb +41 -28
  38. data/lib/buildr/core/cc.rb +172 -0
  39. data/lib/buildr/core/checks.rb +1 -1
  40. data/lib/buildr/core/common.rb +7 -6
  41. data/lib/buildr/core/compile.rb +7 -8
  42. data/lib/buildr/core/doc.rb +263 -0
  43. data/lib/buildr/core/environment.rb +6 -6
  44. data/lib/buildr/core/filter.rb +77 -35
  45. data/lib/buildr/core/generate.rb +7 -7
  46. data/lib/buildr/core/help.rb +1 -1
  47. data/lib/buildr/core/osx.rb +6 -6
  48. data/lib/buildr/core/progressbar.rb +4 -4
  49. data/lib/buildr/core/project.rb +144 -36
  50. data/lib/buildr/core/shell.rb +34 -34
  51. data/lib/buildr/core/test.rb +89 -20
  52. data/lib/buildr/core/transports.rb +8 -7
  53. data/lib/buildr/core/util.rb +77 -23
  54. data/lib/buildr/core.rb +1 -0
  55. data/lib/buildr/groovy/bdd.rb +5 -5
  56. data/lib/buildr/groovy/compiler.rb +19 -15
  57. data/lib/buildr/groovy/shell.rb +6 -6
  58. data/lib/buildr/ide/eclipse/java.rb +3 -3
  59. data/lib/buildr/ide/eclipse/plugin.rb +8 -5
  60. data/lib/buildr/ide/eclipse/scala.rb +4 -2
  61. data/lib/buildr/ide/eclipse.rb +148 -75
  62. data/lib/buildr/ide/idea.rb +2 -2
  63. data/lib/buildr/ide/idea7x.rb +23 -4
  64. data/lib/buildr/java/ant.rb +4 -4
  65. data/lib/buildr/java/bdd.rb +51 -54
  66. data/lib/buildr/java/cobertura.rb +57 -35
  67. data/lib/buildr/java/commands.rb +14 -5
  68. data/lib/buildr/java/compiler.rb +3 -217
  69. data/lib/buildr/java/deprecated.rb +4 -4
  70. data/lib/buildr/java/doc.rb +70 -0
  71. data/lib/buildr/java/emma.rb +22 -22
  72. data/lib/buildr/java/jruby.rb +4 -4
  73. data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
  74. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  75. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
  76. data/lib/buildr/java/packaging.rb +30 -29
  77. data/lib/buildr/java/pom.rb +4 -4
  78. data/lib/buildr/java/rjb.rb +6 -6
  79. data/lib/buildr/java/test_result.rb +61 -85
  80. data/lib/buildr/java/tests.rb +44 -27
  81. data/lib/buildr/java/version_requirement.rb +8 -8
  82. data/lib/buildr/java.rb +1 -0
  83. data/lib/buildr/packaging/archive.rb +55 -22
  84. data/lib/buildr/packaging/artifact.rb +75 -36
  85. data/lib/buildr/packaging/artifact_namespace.rb +90 -78
  86. data/lib/buildr/packaging/artifact_search.rb +5 -5
  87. data/lib/buildr/packaging/gems.rb +11 -7
  88. data/lib/buildr/packaging/package.rb +10 -7
  89. data/lib/buildr/packaging/tar.rb +14 -14
  90. data/lib/buildr/packaging/version_requirement.rb +30 -10
  91. data/lib/buildr/packaging/ziptask.rb +51 -13
  92. data/lib/buildr/scala/bdd.rb +25 -20
  93. data/lib/buildr/scala/compiler.rb +87 -40
  94. data/lib/buildr/scala/doc.rb +106 -0
  95. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  96. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  97. data/lib/buildr/scala/shell.rb +14 -9
  98. data/lib/buildr/scala/tests.rb +33 -26
  99. data/lib/buildr/scala.rb +1 -0
  100. data/lib/buildr/shell.rb +33 -33
  101. data/lib/buildr.rb +1 -1
  102. data/rakelib/all-in-one.rake +113 -0
  103. data/rakelib/checks.rake +1 -1
  104. data/rakelib/doc.rake +7 -0
  105. data/rakelib/package.rake +1 -1
  106. data/rakelib/release.rake +9 -6
  107. data/rakelib/rspec.rake +26 -7
  108. data/rakelib/setup.rake +15 -3
  109. data/rakelib/stage.rake +18 -11
  110. data/spec/addon/drb_spec.rb +25 -25
  111. data/spec/core/application_spec.rb +111 -21
  112. data/spec/core/build_spec.rb +16 -15
  113. data/spec/core/cc_spec.rb +174 -0
  114. data/spec/core/checks_spec.rb +34 -34
  115. data/spec/core/common_spec.rb +51 -5
  116. data/spec/core/compile_spec.rb +89 -14
  117. data/spec/core/extension_spec.rb +127 -19
  118. data/spec/core/generate_spec.rb +2 -2
  119. data/spec/core/project_spec.rb +10 -10
  120. data/spec/core/test_spec.rb +144 -35
  121. data/spec/core/transport_spec.rb +8 -8
  122. data/spec/core/util_spec.rb +63 -5
  123. data/spec/groovy/bdd_spec.rb +5 -5
  124. data/spec/groovy/compiler_spec.rb +29 -18
  125. data/spec/ide/eclipse_spec.rb +185 -9
  126. data/spec/ide/idea7x_spec.rb +22 -10
  127. data/spec/java/ant_spec.rb +9 -5
  128. data/spec/java/bdd_spec.rb +29 -37
  129. data/spec/java/cobertura_spec.rb +12 -12
  130. data/spec/java/commands_spec.rb +34 -0
  131. data/spec/java/compiler_spec.rb +53 -53
  132. data/spec/java/emma_spec.rb +11 -11
  133. data/spec/java/java_spec.rb +10 -10
  134. data/spec/java/packaging_spec.rb +67 -20
  135. data/spec/java/test_coverage_helper.rb +18 -18
  136. data/spec/java/tests_spec.rb +13 -9
  137. data/spec/packaging/archive_spec.rb +187 -20
  138. data/spec/packaging/artifact_namespace_spec.rb +172 -83
  139. data/spec/packaging/artifact_spec.rb +83 -18
  140. data/spec/packaging/packaging_spec.rb +41 -14
  141. data/spec/sandbox.rb +23 -12
  142. data/spec/scala/bdd_spec.rb +13 -8
  143. data/spec/scala/compiler_spec.rb +18 -13
  144. data/spec/scala/scala.rb +3 -3
  145. data/spec/scala/tests_spec.rb +46 -24
  146. data/spec/spec_helpers.rb +28 -10
  147. data/spec/version_requirement_spec.rb +25 -11
  148. metadata +149 -133
  149. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  150. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
  151. data/rakelib/stage.rake~ +0 -213
@@ -101,9 +101,9 @@ testng: 5.7
101
101
  {% endhighlight %}
102
102
 
103
103
 
104
- h4. JBehave
104
+ h4. JBehave
105
105
 
106
- "JBehave":http://jbehave.org/ is a pure Java BDD framework, stories and behaviour specifications are written in the Java language.
106
+ "JBehave":http://jbehave.org/ is a pure Java BDD framework, stories and behaviour specifications are written in the Java language.
107
107
 
108
108
  To use JBehave in your project you can select it with @test.using :jbehave@.
109
109
 
@@ -126,51 +126,75 @@ jbehave: 1.0.1
126
126
  {% endhighlight %}
127
127
 
128
128
 
129
- h2(#scala). Scala
129
+ h3. Documentation
130
130
 
131
- Before using Scala, you must first @require@ the Scala compiler:
131
+ Buildr offers support for using JavaDoc to generate documentation from any Java sources in a project. This is done using the @doc@ task:
132
132
 
133
- {% highlight ruby %}
134
- require 'buildr/scala'
133
+ {% highlight sh %}
134
+ $ buildr doc
135
135
  {% endhighlight %}
136
136
 
137
- By default, Buildr will attempt to use any version of Scala which is already
138
- installed on your system. However, Buildr isn't *quite* smart enough to intuit
139
- such things on its own, so for most cases, it requires the @SCALA_HOME@
140
- environment variable to be set pointing to the root of the Scala installation
141
- (e.g. @/usr/local/scala-2.7.5.final@). The only exception to this is if you have
142
- installed Scala via "MacPorts":http://www.macports.org/ Buildr will look in the
143
- @/opt/local/share/scala/@ directory *before* it uses the @SCALA_HOME@ envar.
137
+ This will use the same @.java@ sources used by the @compile@ task to produce JavaDoc results in the @target/doc/@ directory. By default, these sources are chosen only from the current project. However, it is possible to override this and generate documentation from the sources in a sub-project (potentially more than one):
138
+
139
+ {% highlight ruby %}
140
+ define 'foo' do
141
+ # ...
142
+
143
+ doc.from projects('foo:bar', 'foo')
144
+
145
+ define 'bar' do
146
+ # ...
147
+ end
148
+ end
149
+ {% endhighlight %}
144
150
 
145
- However, if @SCALA_HOME@ is not set, or if it points to an invalid Scala
146
- installation, then Buildr has a fallback option. The Scala compiler and standard
147
- library are both available from the "Scala Tools repository":http://scala-tools.org/.
148
- If no other Scala installation can be found, Buildr will download the appropriate
149
- artifacts and use them instead of a full install. The only drawback to this
150
- approach is the FSC compiler is *not* available when Scala has been downloaded
151
- in this fashion.
151
+ With this configuration, the @doc@ task will use sources from both @foo:bar@ and
152
+ @foo@.
152
153
 
153
- When Scala is downloaded from the Maven2 repository, Buildr will attempt to use
154
- the very latest version (starting from version 2.7.5). If you wish to override
155
- this default, you will need to make use of the @artifact_ns@ construct *before*
156
- you @require@ Scala support in your buildfile:
154
+ The @doc@ task supports any option that the @javadoc@ command does (e.g. @-windowtitle@). To pass an option to the JavaDoc generator, simply specify it using the @doc@ method:
157
155
 
158
156
  {% highlight ruby %}
159
- artifact_ns['Buildr::Compiler::Scalac'].library = '2.7.5'
157
+ define 'foo' do
158
+ # ...
159
+
160
+ doc :windowtitle => 'Abandon All Hope, Ye Who Enter Here', :private => true
161
+ end
162
+ {% endhighlight %}
163
+
164
+
165
+ h2(#scala). Scala
166
+
167
+ Before using Scala, you must first @require@ the Scala compiler:
160
168
 
169
+ {% highlight ruby %}
161
170
  require 'buildr/scala'
162
171
  {% endhighlight %}
163
172
 
164
- This snippet tells Buildr to use exactly version 2.7.5 of Scala when it downloads
165
- the JARs from Scala-Tools, regardless of what the latest version may be.
173
+ By default, Buildr will attempt to use the latest stable release of Scala, which is currently Scala 2.7.7 as of April 2010. Of course you can configure a specific version of Scala for your project by adding the following entry in @build.yaml@:
174
+
175
+ {% highlight yaml %}
176
+ scala.version: 2.8.0.Beta1 # Pick your version
177
+ {% endhighlight %}
178
+
179
+ Or, you can do the same programmatically:
166
180
 
167
- Regardless of how Scala has been obtained, you may determine the version in use
168
- by querying the @Scala.version@ attribute:
181
+ {% highlight yaml %}
182
+ # Must be placed before require 'buildr/scala'
183
+ Buildr.settings.build['scala.version'] = "2.8.0.Beta1"
184
+ {% endhighlight %}
185
+
186
+ You may also determine the version in use by querying the @Scala.version@ attribute:
169
187
 
170
188
  {% highlight ruby %}
171
- Scala.version # => '2.7.5'
189
+ Scala.version # => '2.7.7'
172
190
  {% endhighlight %}
173
191
 
192
+ Regardless of how the Scala version is determined, if you have the same Scala version installed on your system and the SCALA_HOME environment variable points to it, then your local installation will be used. Otherwise, Buildr will download it from the "Scala Tools repository":http://scala-tools.org/ which is automatically enlisted when you @require@ Scala. The only drawback if you don't have a local installation is the FSC compiler won't be available.
193
+
194
+ p(tip). For Mac users, if you have installed Scala via "MacPorts":http://www.macports.org/ Buildr will look in the
195
+ @/opt/local/share/scala/@ directory if you have not set @SCALA_HOME@.
196
+
197
+
174
198
  h3. Compiling Scala
175
199
 
176
200
  The Scala compiler looks for source files in the project's @src/main/scala@ directory, and defaults to compiling them into the @target/classes@ directory. It looks for test cases in the project's @src/test/scala@ and defaults to compile them into the @target/test/classes@ directory.
@@ -190,6 +214,7 @@ The Scala compiler supports the following options:
190
214
  | @:deprecation@ | If true, shows deprecation messages. False by default. |
191
215
  | @:optimise@ | Generates faster bytecode by applying optimisations to the program. |
192
216
  | @:other@ | Array of options passed to the compiler (e.g. @:other=>'-Xprint-types'@). |
217
+ | @:make@ | Make strategy to be used by the compiler (e.g. @:make=>'transitive'@). *Scala 2.8 only* |
193
218
  | @:target@ | Bytecode compatibility (e.g. '1.4'). |
194
219
  | @:warnings@ | Issue warnings when compiling. True when running in verbose mode. |
195
220
  | @:javac@ | A hash of options passed to the @javac@ compiler verbatim. |
@@ -200,10 +225,41 @@ You may use @fsc@, the Fast Scala Compiler, which submits compilation jobs to a
200
225
 
201
226
  h4. Rebuild detection
202
227
 
203
- The Scala compiler task assumes that each @.scala@ source file generates a corresponding @.class@ file under @target/classes@ (or @target/test/classses@ for tests). The source may generate more @.class@ files if it contains more than one class, object, trait or for anonymous functions and closures.
228
+ The Scala 2.7 compiler task assumes that each @.scala@ source file generates a corresponding @.class@ file under @target/classes@ (or @target/test/classses@ for tests). The source may generate more @.class@ files if it contains more than one class, object, trait or for anonymous functions and closures.
204
229
 
205
230
  For example, @src/main/scala/com/example/MyClass.scala@ should generate at least @target/classes/com/example/MyClass.class@. If that it not the case, Buildr will always recompile your sources because it will assume this is a new source file that has never been compiled before.
206
231
 
232
+ Fortunately, Scala 2.8 provides a substantially better interface for implementing change detection. Whenever you use Scala 2.8 (see below), Buildr will auto-detect the version and enable this feature dynamically. After the @compile@ task runs, the relevant target directory will contain a @.scala-deps@ file, generated by the Scala compiler. The manner in which this file is used can be configured using the @:make@ compiler option. The following values are available:
233
+
234
+ * @:all@ - Disables compiler-level change detection
235
+ * @:changed@ - Only build changed files without considering file dependencies
236
+ * @:immediate@ - *unknown*
237
+ * @:transitive@ - Build changed files as well as their transitive file dependencies
238
+ * @:transitivenocp@ - Build changed files as well as their transitive file dependencies (*default*)
239
+
240
+ Please note that there are limits to compiler-level change detection. Most notably, dependencies cannot be tracked across separate compilation targets. This would cause problems in the case where an API has been changed in a main source file. The test suite for the project will *not* be detected as requiring recompilation, potentially resulting in unexpected runtime exceptions. When in doubt, run @clean@ to remove all dependency information. In extreme cases, it is possible to completely disable compiler-level change detection by adding the following statement to your project definition:
241
+
242
+ {% highlight ruby %}
243
+ compile.using :make => :all
244
+ {% endhighlight %}
245
+
246
+ Effectively, this is telling the Scala compiler to ignore the information it has built up regarding source file dependencies. When in this mode, only Buildr's change detection semantics remain in play (as described above).
247
+
248
+ To avoid unusual behavior, compiler-level change detection is disabled whenever the joint Scala-Java compiler is used. Thus, any @.java@ files in a project handled by the Scala compiler will cause the @:make@ option to be ignored and revert to the exclusive use of Buildr's change detection mechanism (as described above).
249
+
250
+ h4. Scala 2.8
251
+
252
+ As of version 1.4, Buildr has *non-default* support for Scala 2.8. If your @SCALA_HOME@ environment variable is pointing to an installation of Scala 2.8, then Buildr will use that compiler and enable 2.8-specific features.
253
+
254
+ As Scala 2.8 is currently pre-release, it is often desirable to maintain an installation of Scala 2.7 concurrently with Scala 2.8, defaulting to the former with the option to select the latter on a project-by-project basis. This is most easily accomplished by setting @SCALA_HOME@ to point to the Scala 2.7 installation and @SCALA28_HOME@ to point to the Scala 2.8 installation. With this configuration in place, Scala 2.8 can be selected for a specific project by dynamically reassigning @SCALA_HOME@ at the top of the buildfile (*before* @require 'buildr/scala'@):
255
+
256
+ {% highlight ruby %}
257
+ ENV['SCALA_HOME'] = ENV['SCALA28_HOME']
258
+
259
+ require 'buildr/scala'
260
+ ...
261
+ {% endhighlight %}
262
+
207
263
  h3. Testing with Scala
208
264
 
209
265
  Buildr supports two main Scala testing frameworks: "ScalaTest":http://www.artima.com/scalatest and "Specs":http://code.google.com/p/specs/. "ScalaCheck":http://code.google.com/p/scalacheck/ is also supported within the confines of either of these two frameworks. Thus, your Specs may use ScalaCheck properties, as may your ScalaTest suites.
@@ -236,17 +292,17 @@ import org.scalatest._
236
292
 
237
293
  class PropertyTestSuite extends FunSuite {
238
294
  var properties = Map[String, Any]()
239
-
295
+
240
296
  test("testProperty") {
241
297
  assert(properties("name") === "value")
242
298
  }
243
299
 
244
- protected override def runTests(testName: Option[String],
245
- reporter: Reporter, stopper: Stopper, includes: Set[String],
300
+ protected override def runTests(testName: Option[String],
301
+ reporter: Reporter, stopper: Stopper, includes: Set[String],
246
302
  excludes: Set[String], properties: Map[String, Any])
247
303
  {
248
- this.properties = properties;
249
- super.runTests(testName, reporter, stopper,
304
+ this.properties = properties;
305
+ super.runTests(testName, reporter, stopper,
250
306
  includes, excludes, properties)
251
307
  }
252
308
  }
@@ -283,7 +339,7 @@ OBJENESIS = 'org.objenesis:objenesis:jar:1.1'
283
339
 
284
340
  define 'killer-app' do
285
341
  ...
286
-
342
+
287
343
  test.with MOCKITO, CGLIB, ASM, OBJENESIS
288
344
  end
289
345
  {% endhighlight %}
@@ -316,6 +372,52 @@ class MySuite extends PropSuite {
316
372
  {% endhighlight %}
317
373
 
318
374
 
375
+ h3. Documentation
376
+
377
+ Buildr offers support for using ScalaDoc or VScalaDoc to generate documentation from any Scala sources in a project. This is done using the @doc@ task:
378
+
379
+ {% highlight sh %}
380
+ $ buildr doc
381
+ {% endhighlight %}
382
+
383
+ This will use the same @.scala@ sources used by the @compile@ task to produce ScalaDoc results in the @target/doc/@ directory. By default, these sources are chosen only from the current project. However, it is possible to override this and generate documentation from the sources in a sub-project (potentially more than one):
384
+
385
+ {% highlight ruby %}
386
+ define 'foo' do
387
+ # ...
388
+
389
+ doc.from projects('foo:bar', 'foo')
390
+
391
+ define 'bar' do
392
+ # ...
393
+ end
394
+ end
395
+ {% endhighlight %}
396
+
397
+ With this configuration, the @doc@ task will use sources from both @foo:bar@ and
398
+ @foo@.
399
+
400
+ The @doc@ task supports any option that the @scaladoc@ command does (e.g. @-windowtitle@). To pass an option to the ScalaDoc (or VScalaDoc) generator, simply specify it using the @doc@ method:
401
+
402
+ {% highlight ruby %}
403
+ define 'foo' do
404
+ # ...
405
+
406
+ doc :windowtitle => 'Abandon All Hope, Ye Who Enter Here', :private => true
407
+ end
408
+ {% endhighlight %}
409
+
410
+ By default, the @doc@ task will use the ScalaDoc generator on Scala projects. To select the VScalaDoc generator, you must use the @doc.using@ invocation:
411
+
412
+ {% highlight ruby %}
413
+ define 'foo' do
414
+ doc.using :vscaladoc
415
+ end
416
+ {% endhighlight %}
417
+
418
+ The @doc@ task is *not* joint-compilation aware. Thus, it will only generate ScalaDoc for mixed-source projects, it will not attempt to generate both JavaDoc and ScalaDoc.
419
+
420
+
319
421
  h2(#groovy). Groovy
320
422
 
321
423
  h3. Compiling Groovy
@@ -357,9 +459,9 @@ h3. Testing with Groovy
357
459
 
358
460
  h4. EasyB
359
461
 
360
- "EasyB":http://www.easyb.org/ is a BDD framework using "Groovy":http://groovy.codehaus.org/.
462
+ "EasyB":http://www.easyb.org/ is a BDD framework using "Groovy":http://groovy.codehaus.org/.
361
463
 
362
- Specifications are written in the Groovy language, of course you get seamless Java integration as with all things groovy.
464
+ Specifications are written in the Groovy language, of course you get seamless Java integration as with all things groovy.
363
465
 
364
466
  To use this framework in your project you can select it with @test.using :easyb@.
365
467
 
@@ -378,6 +480,44 @@ Supports the following options:
378
480
  | @:format@ | Report format, either @:txt@ or @:xml@ |
379
481
 
380
482
 
483
+ h3. Documentation
484
+
485
+ Buildr offers support for using GroovyDoc to generate documentation from any Groovy sources in a project. This is done using the @doc@ task:
486
+
487
+ {% highlight sh %}
488
+ $ buildr doc
489
+ {% endhighlight %}
490
+
491
+ This will use the same @.groovy@ sources used by the @compile@ task to produce GroovyDoc results in the @target/doc/@ directory. By default, these sources are chosen only from the current project. However, it is possible to override this and generate documentation from the sources in a sub-project (potentially more than one):
492
+
493
+ {% highlight ruby %}
494
+ define 'foo' do
495
+ # ...
496
+
497
+ doc.from projects('foo:bar', 'foo')
498
+
499
+ define 'bar' do
500
+ # ...
501
+ end
502
+ end
503
+ {% endhighlight %}
504
+
505
+ With this configuration, the @doc@ task will use sources from both @foo:bar@ and
506
+ @foo@.
507
+
508
+ The @doc@ task supports any option that the @groovydoc@ command does (e.g. @-windowtitle@). To pass an option to the GroovyDoc generator, simply specify it using the @doc@ method:
509
+
510
+ {% highlight ruby %}
511
+ define 'foo' do
512
+ # ...
513
+
514
+ doc :windowtitle => 'Abandon All Hope, Ye Who Enter Here', :private => true
515
+ end
516
+ {% endhighlight %}
517
+
518
+ The @doc@ task is *not* joint-compilation aware. Thus, it will only generate GroovyDoc for mixed-source projects, it will not attempt to generate both JavaDoc and GroovyDoc.
519
+
520
+
381
521
  h2(#ruby). Ruby
382
522
 
383
523
  h3. Testing with Ruby
@@ -390,15 +530,15 @@ Because of the use of JRuby, you will notice that running ruby tests is faster w
390
530
 
391
531
  p(tip). When not running on JRuby, Buildr will use the @JRUBY_HOME@ environment variable to find the JRuby installation directory. If no @JRUBY_HOME@ is set or it points to an empty directory, Buildr will prompt you to either install JRuby manually or let it extract it for you.
392
532
 
393
- You can use the @build.yaml@ settings file to specify a particular version of JRuby (defaults to @1.1.4@). For example:
533
+ You can use the @build.yaml@ settings file to specify a particular version of JRuby (defaults to @1.4.0@ as of Buildr 1.3.5). For example:
394
534
 
395
535
  {% highlight yaml %}
396
- jruby: 1.1.3
536
+ jruby: 1.3.1
397
537
  {% endhighlight %}
398
538
 
399
539
  h4. RSpec
400
540
 
401
- "RSpec":http://rspec.info/ is the de-facto BDD framework for ruby. It's the framework used to test Buildr itself.
541
+ "RSpec":http://rspec.info/ is the de-facto BDD framework for ruby. It's the framework used to test Buildr itself.
402
542
 
403
543
  To use this framework in your project you can select it with @test.using :rspec@.
404
544
 
@@ -280,7 +280,7 @@ Buildr.application.on_failure do |title, message, ex|
280
280
  end
281
281
  {% endhighlight %}
282
282
 
283
- You can place this code inside @buildr.rb@ in your home directory.
283
+ You can place this code inside @buildr.rb@ in the @.buildr@ directory under your home directory.
284
284
 
285
285
  h2(#eclipse). Eclipse
286
286
 
@@ -390,7 +390,7 @@ require 'buildr/java/emma'
390
390
  require 'buildr/jdepend'
391
391
  {% endhighlight %}
392
392
 
393
- You may want to add those to the Buildfile. Alternatively, you can use these tasks for all your projects without modifying the Buildfile. One convenient method is to add these lines to the @buildr.rb@ file in your home directory.
393
+ You may want to add those to the Buildfile. Alternatively, you can use these tasks for all your projects without modifying the Buildfile. One convenient method is to add these lines to the @buildr.rb@ file in the @.buildr@ directory under your home directory.
394
394
 
395
395
  Another option is to require it from the command line (@--require@ or @-r@), for example:
396
396
 
@@ -101,22 +101,21 @@ The @include@ method accepts files, directories and file tasks. You can also us
101
101
  And the same way you @include@, you can also @exclude@ specific files you don't want showing up in the ZIP. For example, to exclude @.draft@ and @.raw@ files:
102
102
 
103
103
  {% highlight ruby %}
104
- package(:zip).include('target/docs').
105
- exclude('target/docs/**/*.{draft,raw}')
104
+ package(:zip).include(_('target/docs')).exclude('*.draft', '*.raw')
106
105
  {% endhighlight %}
107
106
 
108
107
  So far we've included files under the root of the ZIP. Let's include some files under a given path using the @:path@ option:
109
108
 
110
109
  {% highlight ruby %}
111
- package(:zip).include 'target/docs', :path=>"#{id}-#{version}"
110
+ package(:zip).include _('target/docs'), :path=>"#{id}-#{version}"
112
111
  {% endhighlight %}
113
112
 
114
113
  If you need to use the @:path@ option repeatedly, consider using the @tap@ method instead. For example:
115
114
 
116
115
  {% highlight ruby %}
117
116
  package(:zip).path("#{id}-#{version}").tap do |path|
118
- path.include 'target/docs'
119
- path.include 'README'
117
+ path.include _('target/docs')
118
+ path.include _('README')
120
119
  end
121
120
  {% endhighlight %}
122
121
 
@@ -127,33 +126,33 @@ p(note). To allow you to spread files across different paths, the include/exclud
127
126
  If you need to include a file or directory under a different name, use the @:as@ option. For example:
128
127
 
129
128
  {% highlight ruby %}
130
- package(:zip).include('corporate-logo-350x240.png', :as=>'logo.png')
129
+ package(:zip).include(_('corporate-logo-350x240.png'), :as=>'logo.png')
131
130
  {% endhighlight %}
132
131
 
133
132
  You can also use @:as=>'.'@ to include all files from the given directory. For example:
134
133
 
135
134
  {% highlight ruby %}
136
- package(:zip).include 'target/docs/*'
137
- package(:zip).include 'target/docs', :as=>'.'
135
+ package(:zip).include _('target/docs/*')
136
+ package(:zip).include _('target/docs'), :as=>'.'
138
137
  {% endhighlight %}
139
138
 
140
- These two are almost identical. They both include all the files from the @target/docs@ directory, but not the directory itself. But they operate differently. The first line expands to include all the files in @target/docs@. If you don't already have files in @target/docs@, well, then it won't do anything interesting. Your ZIP will come up empty. The second file includes the directory itself, but strips the path during inclusion. You can define it now, create these files later, and then ZIP them all up.
139
+ These two perform identically. They both include all the files from the @target/docs@ directory, but not the directory itself, and they are both lazy, meaning that the files can be created later and they will still get packaged into the zip package.
141
140
 
142
- For example, when @package :jar@ decides to include all the files from @target/classes@, it's still working on the project definition, and has yet to compile anything. Since @target/classes@ may be empty, may not even exist, it uses @:as=>'.'@.
141
+ For example, when you use @package :jar@, under the hood it specifies to include all the files from @target/classes@ with @:as=>'.'@. Even though this happens during project definition and nothing has been compiled yet (and in fact @target/classes@ may not even exist yet), the .class files generated during compilation are still packaged in the .jar file, as expected.
143
142
 
144
143
  If you need to get rid of all the included files, call the @clean@ method. Some packaging types default to adding various files and directories, for example, JAR packaging will include all the compiled classes and resources.
145
144
 
146
145
  You can also merge two ZIP files together, expanding the content of one ZIP into the other. For example:
147
146
 
148
147
  {% highlight ruby %}
149
- package(:zip).merge 'part1.zip', 'part2.zip'
148
+ package(:zip).merge _('part1.zip'), _('part2.zip')
150
149
  {% endhighlight %}
151
150
 
152
151
  If you need to be more selective, you can apply the include/exclude pattern to the expanded ZIP. For example:
153
152
 
154
153
  {% highlight ruby %}
155
154
  # Everything but the libs
156
- package(:zip).merge('bigbad.war').exclude('libs/**/*')
155
+ package(:zip).merge(_('bigbad.war')).exclude('libs/**/*')
157
156
  {% endhighlight %}
158
157
 
159
158
 
@@ -257,7 +256,7 @@ If you already have WSDL files in the @src/main/axis2@ directory but would like
257
256
  {% highlight ruby %}
258
257
  # Host name depends on environment.
259
258
  host = ENV['ENV'] == 'test' ? 'test.host' : 'ws.example.com'
260
- filter.from('src/main/axis2').into('target').
259
+ filter.from(_('src/main/axis2')).into(_(:target)).
261
260
  include('services.xml', '==*==.wsdl').using('http_port'=>'8080', 'http_host'=>host)
262
261
  package(:aar).wsdls.clear
263
262
  package(:aar).with(:services_xml=>_('target/services.xml'), :wsdls=>_('target/==*==.wsdl'))
@@ -404,11 +403,11 @@ package :sources
404
403
 
405
404
  This one creates a ZIP package with the classifier "sources" that will contain all the source directories in that project, typically @src/main/java@, but also other sources generated from Apt, JavaCC, XMLBeans and friends.
406
405
 
407
- You can also generate a ZIP package with the classifier "javadoc" that contains the JavaDoc documentation for the project. It uses the same set of documentation files generated by the project's @javadoc@ task, so you can use it in combination with the @javadoc@ method. For example:
406
+ You can also generate a ZIP package with the classifier "javadoc" that contains the JavaDoc documentation for the project. It uses the same set of documentation files generated by the project's @doc@ task, so you can use it in combination with the @doc@ method. For example:
408
407
 
409
408
  {% highlight ruby %}
410
409
  package :javadoc
411
- javadoc :windowtitle=>'Buggy but Works'
410
+ doc :windowtitle=>'Buggy but Works'
412
411
  {% endhighlight %}
413
412
 
414
413
  By default Buildr picks the project's description for the window title.
data/doc/projects.textile CHANGED
@@ -13,7 +13,9 @@ Feed it a project definition, and Buildr will set up all these tasks for you. Th
13
13
  The remainder of this guide deals with what it takes to build a project. But first, let's pick up a sample project to work with. We'll call it _killer-app_:
14
14
 
15
15
  {% highlight ruby %}
16
- require 'buildr'
16
+ require "buildr/openjpa"
17
+
18
+ include Buildr::OpenJPA
17
19
 
18
20
  VERSION_NUMBER = '1.0'
19
21
 
@@ -90,7 +92,7 @@ When you start with a new project you won't see the @target@ or @reports@ direct
90
92
 
91
93
  h2(#naming). Naming And Finding Projects
92
94
 
93
- Each project has a given name, the first argument you pass when calling @define@. The project name is just a string, but we advise to stay clear of colon (@:@) and slashes (@/@ and @\@), which could conflict with other task and file names. Also, avoid using common Buildr task names, don't pick @compile@ or @build@ for your project name.
95
+ Each project has a given name, the first argument you pass when calling @define@. The project name is just a string, but we advise to stay clear of colon (@:@) and slashes (@/@ and @\@), which could conflict with other task and file names. Also, avoid using common Buildr task names, don't pick @compile@, @build@ or any existing task name for your project name.
94
96
 
95
97
  Since each project knows its parent project, child projects and siblings, you can reference them from within the project using just the given name. In other cases, you'll need to use the full name. The full name is just @parent:child@. So if you wanted to refer to _teh-impl_, you could do so with either @project('killer-app:teh-impl')@ or @project('killer-app').project('teh-impl')@.
96
98
 
@@ -201,6 +203,9 @@ For example:
201
203
  # Relative to the current project
202
204
  path_to('src', 'main', 'java')
203
205
 
206
+ # the same using symbols
207
+ path_to(:src, :main, :java)
208
+
204
209
  # Exactly the same thing
205
210
  _('src/main/java')
206
211
 
@@ -169,7 +169,7 @@ If there is one area in which Buildr excels, it is defining custom tasks. This
169
169
  define 'killer-app' do
170
170
  project.version = '0.1.0'
171
171
  package :jar
172
-
172
+
173
173
  task :run => :compile do
174
174
  system 'java -cp target/classes org.apache.killer.Main'
175
175
  end
@@ -185,13 +185,13 @@ $ buildr killer-app:run
185
185
  This works, but it's clumsy. The reason we had to give the "@killer-app:@" prefix is because we defined the @run@ task _within_ our project, rather than outside of the @define@ block. However, if we define @run@ outside of the project, then we don't really have access to the @compile@ task (which is project-specific). The solution here is a bit of magic known as @local_task@. This is how tasks like @compile@ and @test@, which are technically project-specific (think: instance methods) can be invoked without the fully-qualified project name:
186
186
 
187
187
  {% highlight ruby %}
188
- local_task :run
188
+ Project.local_task :run
189
189
 
190
190
  define 'killer-app' do
191
191
  project.version '0.1.0'
192
-
192
+
193
193
  package :jar
194
-
194
+
195
195
  task :run => :compile do
196
196
  system 'java -cp target/classes org.apache.killer.Main'
197
197
  end