buildr 1.3.3-java → 1.3.4-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/CHANGELOG +76 -0
  2. data/NOTICE +1 -1
  3. data/README.rdoc +9 -21
  4. data/Rakefile +17 -34
  5. data/_buildr +3 -12
  6. data/{doc/print.toc.yaml → _jbuildr} +14 -14
  7. data/addon/buildr/cobertura.rb +5 -219
  8. data/addon/buildr/drb.rb +281 -0
  9. data/addon/buildr/emma.rb +5 -221
  10. data/addon/buildr/nailgun.rb +93 -689
  11. data/bin/buildr +0 -9
  12. data/buildr.buildfile +4 -4
  13. data/buildr.gemspec +27 -21
  14. data/doc/_layouts/default.html +82 -0
  15. data/doc/_layouts/preface.html +22 -0
  16. data/doc/{pages/artifacts.textile → artifacts.textile} +82 -42
  17. data/doc/{pages/building.textile → building.textile} +89 -47
  18. data/doc/{pages/contributing.textile → contributing.textile} +53 -45
  19. data/doc/css/default.css +6 -5
  20. data/doc/css/print.css +17 -24
  21. data/doc/css/syntax.css +7 -36
  22. data/doc/download.textile +68 -0
  23. data/doc/{pages/extending.textile → extending.textile} +45 -24
  24. data/doc/{pages/getting_started.textile → getting_started.textile} +158 -88
  25. data/doc/images/asf-logo.gif +0 -0
  26. data/doc/images/note.png +0 -0
  27. data/doc/index.textile +47 -0
  28. data/doc/{pages/languages.textile → languages.textile} +108 -54
  29. data/doc/mailing_lists.textile +25 -0
  30. data/doc/{pages/more_stuff.textile → more_stuff.textile} +152 -73
  31. data/doc/{pages/packaging.textile → packaging.textile} +181 -96
  32. data/doc/preface.textile +28 -0
  33. data/doc/{pages/projects.textile → projects.textile} +55 -40
  34. data/doc/scripts/buildr-git.rb +364 -264
  35. data/doc/scripts/gitflow.rb +296 -0
  36. data/doc/scripts/install-jruby.sh +2 -2
  37. data/doc/scripts/install-linux.sh +6 -6
  38. data/doc/scripts/install-osx.sh +2 -2
  39. data/doc/{pages/settings_profiles.textile → settings_profiles.textile} +83 -45
  40. data/doc/{pages/testing.textile → testing.textile} +77 -41
  41. data/lib/buildr.rb +5 -5
  42. data/lib/buildr/core.rb +2 -0
  43. data/lib/buildr/core/application.rb +321 -151
  44. data/lib/buildr/core/build.rb +298 -167
  45. data/lib/buildr/core/checks.rb +4 -132
  46. data/lib/buildr/core/common.rb +1 -5
  47. data/lib/buildr/core/compile.rb +3 -9
  48. data/lib/buildr/core/environment.rb +12 -3
  49. data/lib/buildr/core/filter.rb +20 -18
  50. data/lib/buildr/core/generate.rb +36 -36
  51. data/lib/buildr/core/help.rb +2 -1
  52. data/lib/buildr/core/osx.rb +46 -0
  53. data/lib/buildr/core/progressbar.rb +1 -1
  54. data/lib/buildr/core/project.rb +7 -34
  55. data/lib/buildr/core/test.rb +12 -6
  56. data/lib/buildr/core/transports.rb +13 -11
  57. data/lib/buildr/core/util.rb +14 -23
  58. data/lib/buildr/groovy/bdd.rb +3 -2
  59. data/lib/buildr/groovy/compiler.rb +1 -1
  60. data/lib/buildr/ide/eclipse.rb +31 -21
  61. data/lib/buildr/ide/idea.rb +3 -2
  62. data/lib/buildr/ide/idea7x.rb +6 -4
  63. data/lib/buildr/java/ant.rb +3 -1
  64. data/lib/buildr/java/bdd.rb +9 -7
  65. data/lib/buildr/java/cobertura.rb +243 -0
  66. data/lib/buildr/java/compiler.rb +5 -4
  67. data/lib/buildr/java/emma.rb +244 -0
  68. data/lib/buildr/java/packaging.rb +11 -8
  69. data/lib/buildr/java/pom.rb +0 -4
  70. data/lib/buildr/java/rjb.rb +1 -1
  71. data/lib/buildr/java/test_result.rb +5 -7
  72. data/lib/buildr/java/tests.rb +17 -11
  73. data/lib/buildr/packaging.rb +5 -2
  74. data/lib/buildr/packaging/archive.rb +488 -0
  75. data/lib/buildr/packaging/artifact.rb +48 -29
  76. data/lib/buildr/packaging/artifact_namespace.rb +6 -6
  77. data/lib/buildr/packaging/gems.rb +4 -4
  78. data/lib/buildr/packaging/package.rb +3 -2
  79. data/lib/buildr/packaging/tar.rb +85 -3
  80. data/lib/buildr/packaging/version_requirement.rb +172 -0
  81. data/lib/buildr/packaging/zip.rb +24 -682
  82. data/lib/buildr/packaging/ziptask.rb +313 -0
  83. data/lib/buildr/scala.rb +5 -0
  84. data/lib/buildr/scala/bdd.rb +100 -0
  85. data/lib/buildr/scala/compiler.rb +45 -4
  86. data/lib/buildr/scala/tests.rb +12 -59
  87. data/rakelib/checks.rake +57 -0
  88. data/rakelib/doc.rake +58 -68
  89. data/rakelib/jekylltask.rb +110 -0
  90. data/rakelib/package.rake +35 -37
  91. data/rakelib/release.rake +119 -35
  92. data/rakelib/rspec.rake +29 -39
  93. data/rakelib/setup.rake +21 -59
  94. data/rakelib/stage.rake +184 -26
  95. data/spec/addon/drb_spec.rb +328 -0
  96. data/spec/core/application_spec.rb +32 -25
  97. data/spec/core/build_spec.rb +336 -126
  98. data/spec/core/checks_spec.rb +292 -310
  99. data/spec/core/common_spec.rb +8 -2
  100. data/spec/core/compile_spec.rb +17 -1
  101. data/spec/core/generate_spec.rb +3 -3
  102. data/spec/core/project_spec.rb +18 -10
  103. data/spec/core/test_spec.rb +8 -1
  104. data/spec/core/transport_spec.rb +40 -3
  105. data/spec/core/util_spec.rb +67 -0
  106. data/spec/ide/eclipse_spec.rb +96 -28
  107. data/spec/ide/idea7x_spec.rb +84 -0
  108. data/spec/java/ant.rb +5 -0
  109. data/spec/java/bdd_spec.rb +12 -3
  110. data/spec/{addon → java}/cobertura_spec.rb +6 -6
  111. data/spec/{addon → java}/emma_spec.rb +5 -6
  112. data/spec/java/java_spec.rb +12 -2
  113. data/spec/java/packaging_spec.rb +31 -2
  114. data/spec/{addon → java}/test_coverage_spec.rb +3 -3
  115. data/spec/java/tests_spec.rb +5 -0
  116. data/spec/packaging/archive_spec.rb +11 -1
  117. data/spec/{core → packaging}/artifact_namespace_spec.rb +10 -2
  118. data/spec/packaging/artifact_spec.rb +44 -3
  119. data/spec/packaging/packaging_spec.rb +1 -1
  120. data/spec/sandbox.rb +17 -14
  121. data/spec/scala/bdd_spec.rb +150 -0
  122. data/spec/scala/compiler_spec.rb +27 -0
  123. data/spec/scala/scala.rb +38 -0
  124. data/spec/scala/tests_spec.rb +78 -33
  125. data/spec/spec_helpers.rb +29 -5
  126. data/spec/version_requirement_spec.rb +6 -0
  127. metadata +176 -172
  128. data/DISCLAIMER +0 -7
  129. data/doc/images/apache-incubator-logo.png +0 -0
  130. data/doc/pages/download.textile +0 -51
  131. data/doc/pages/index.textile +0 -42
  132. data/doc/pages/mailing_lists.textile +0 -17
  133. data/doc/pages/recipes.textile +0 -103
  134. data/doc/pages/troubleshooting.textile +0 -103
  135. data/doc/pages/whats_new.textile +0 -323
  136. data/doc/print.haml +0 -51
  137. data/doc/site.haml +0 -56
  138. data/doc/site.toc.yaml +0 -47
  139. data/etc/git-svn-authors +0 -16
  140. data/lib/buildr/core/application_cli.rb +0 -139
  141. data/rakelib/apache.rake +0 -191
  142. data/rakelib/changelog.rake +0 -57
  143. data/rakelib/rubyforge.rake +0 -53
  144. data/rakelib/scm.rake +0 -49
Binary file
File without changes
@@ -0,0 +1,47 @@
1
+ ---
2
+ layout: default
3
+ title: Welcome
4
+ ---
5
+
6
+ h2(#what_is_apache_buildr). What is Apache Buildr?
7
+
8
+ Apache Buildr is a build system for Java-based applications, including support for Scala, Groovy and a growing number of JVM languages and tools. We wanted something that's simple and intuitive to use, so we only need to tell it what to do, and it takes care of the rest. But also something we can easily extend for those one-off tasks, with a language that's a joy to use. And of course, we wanted it to be fast, reliable and have outstanding dependency management.
9
+
10
+ Here's what we got:
11
+
12
+ * A simple way to specify projects, and build large projects out of smaller sub-projects.
13
+ * Pre-canned tasks that require the least amount of configuration, keeping the build script DRY and simple.
14
+ * Compiling, copying and filtering resources, JUnit/TestNG test cases, APT source code generation, Javadoc and more.
15
+ * A dependency mechanism that only builds what has changed since the last release.
16
+ * A drop-in replacement for Maven 2.0, Buildr uses the same file layout, artifact specifications, local and remote repositories.
17
+ * All your Ant tasks are belong to us! Anything you can do with Ant, you can do with Buildr.
18
+ * No overhead for building "plugins" or configuration. Just write new tasks or functions.
19
+ * Buildr is Ruby all the way down. No one-off task is too demanding when you write code using variables, functions and objects.
20
+ * Simple way to upgrade to new versions.
21
+ * Did we mention fast?
22
+
23
+ So let's get started. You can "read the documentation online":getting_started.html, or "download the PDF":buildr.pdf.
24
+
25
+
26
+ h2(#news). Project News
27
+
28
+ New in Buildr 1.3.4:
29
+
30
+ * We graduated from the Apache Incubator! This is our first release as a top-level Apache project: http://buildr.apache.org. New site, new mailing lists, SVN, Git, etc.
31
+ * Support for Git version control system
32
+ * Improved all-around Scala support, including joint Java-Scala compilation and upgraded to Scala 2.7.3 dependencies: ScalaSpecs 1.4.3, ScalaCheck 1.5 and ScalaTest 0.9.5
33
+ * New 'artifacts:sources' task to download source code for artifact jars
34
+ * Source code attachments for external dependencies in Eclipse and IDEA projects
35
+ * Dependency upgrades such as Rake 0.8.4, Net-SSH 2.0.11, RSpec 1.2.2, JRuby 1.1.6.
36
+ * Documentation now uses "Jekyll":http://github.com/mojombo/jekyll/ to generate web site and PDF document. This replaces Docter so less code to
37
+ maintain and the same Textile/Liquid mechanism as when using Github pages.
38
+ * And 20 or so bug fixes.
39
+
40
+ See the "CHANGELOG":CHANGELOG for full details.
41
+
42
+
43
+ h2(#legal). Legal Notices
44
+
45
+ The Apache Software Foundation is a non-profit organization, consider "sponsoring":http://www.apache.org/foundation/sponsorship.html and check the "thanks":http://www.apache.org/foundation/thanks.html page.
46
+
47
+ "ColorCons":http://www.mouserunner.com/Spheres_ColoCons1_Free_Icons.html, copyright of Ken Saunders. "DejaVu fonts":http://dejavu.sourceforge.net, copyright of Bitstream, Inc.
@@ -1,7 +1,10 @@
1
- h1. Languages
1
+ ---
2
+ layout: default
3
+ title: Languages
4
+ ---
2
5
 
3
6
 
4
- h2. Java
7
+ h2(#java). Java
5
8
 
6
9
 
7
10
  h3. Compiling Java
@@ -43,9 +46,11 @@ The JUnit test framework supports the following options:
43
46
 
44
47
  For example, to pass properties to the test case:
45
48
 
46
- {{{!ruby
49
+ <notextile>
50
+ {% highlight ruby %}
47
51
  test.using :properties=>{ :currency=>'USD' }
48
- }}}
52
+ {% endhighlight %}
53
+ </notextile>
49
54
 
50
55
  There are benefits to running test cases in separate VMs. The default forking mode is @:once@, and you can change it by setting the @:fork@ option.
51
56
 
@@ -58,28 +63,34 @@ You can see your tests running in the console, and if any tests fail, Buildr wil
58
63
 
59
64
  In addition, you can get a consolidated XML or HTML report by running the @junit:report@ task. For example:
60
65
 
61
- {{{!sh
66
+ <notextile>
67
+ {% highlight sh %}
62
68
  $ buildr test junit:report test=all
63
69
  $ firefox report/junit/html/index.html
64
- }}}
70
+ {% endhighlight %}
71
+ </notextile>
65
72
 
66
73
  The @junit:report@ task generates a report from all tests run so far. If you run tests in a couple of projects, it will generate a report only for these two projects. The example above runs tests in all the projects before generating the reports.
67
74
 
68
75
  You can use the @build.yaml@ settings file to specify a particular version of JUnit or JMock. For example, to force your build to use JUnit version 4.4 and JMock 2.0:
69
76
 
70
- {{{!yaml
77
+ <notextile>
78
+ {% highlight yaml %}
71
79
  junit: 4.4
72
80
  jmock: 2.0
73
- }}}
81
+ {% endhighlight %}
82
+ </notextile>
74
83
 
75
84
 
76
85
  h4. TestNG
77
86
 
78
87
  You can use "TestNG":http://testng.org instead of JUnit. To select TestNG as the test framework, add this to your project:
79
88
 
80
- {{{!ruby
89
+ <notextile>
90
+ {% highlight ruby %}
81
91
  test.using :testng
82
- }}}
92
+ {% endhighlight %}
93
+ </notextile>
83
94
 
84
95
  Like all other options you can set with @test.using@, it affects the projects and all its sub-projects, so you only need to do this once at the top-most project to use TestNG throughout. You can also mix TestNG and JUnit by setting different projects to use different frameworks, but you can't mix both frameworks in the same project. (And yes, @test.using :junit@ will switch a project back to using JUnit)
85
96
 
@@ -93,9 +104,11 @@ The TestNG test framework supports the following options:
93
104
 
94
105
  You can use the @build.yaml@ settings file to specify a particular version of TestNG, for example, to force your build to use TestNG 5.7:
95
106
 
96
- {{{!yaml
107
+ <notextile>
108
+ {% highlight yaml %}
97
109
  testng: 5.7
98
- }}}
110
+ {% endhighlight %}
111
+ </notextile>
99
112
 
100
113
 
101
114
  h4. JBehave
@@ -106,9 +119,11 @@ To use JBehave in your project you can select it with @test.using :jbehave@.
106
119
 
107
120
  This framework will search for the following patterns under your project:
108
121
 
109
- {{{
122
+ <notextile>
123
+ {% highlight text %}
110
124
  src/spec/java/**/*Behaviour.java
111
- }}}
125
+ {% endhighlight %}
126
+ </notextile>
112
127
 
113
128
  Supports the following options:
114
129
 
@@ -118,34 +133,52 @@ Supports the following options:
118
133
 
119
134
  You can use the @build.yaml@ settings file to specify a particular version of JBehave, for example, to force your build to use JBehave 1.0.1:
120
135
 
121
- {{{!yaml
136
+ <notextile>
137
+ {% highlight yaml %}
122
138
  jbehave: 1.0.1
123
- }}}
139
+ {% endhighlight %}
140
+ </notextile>
124
141
 
125
142
 
126
- h2. Scala
143
+ h2(#scala). Scala
127
144
 
128
145
  Before using Scala features, you must first set the @SCALA_HOME@ environment variable to point to the root of your Scala distribution.
129
146
 
130
147
  On Windows:
131
148
 
132
- {{{!sh
133
- > set SCALA_HOME=C:\Path\To\Scala-2.7.1
134
- }}}
149
+ <notextile>
150
+ {% highlight sh %}
151
+ > set SCALA_HOME=C:\Path\To\Scala-2.7.3
152
+ {% endhighlight %}
153
+ </notextile>
135
154
 
136
155
  On Linux and other Unix variants,
137
156
 
138
- {{{!sh
139
- > export SCALA_HOME=/path/to/scala-2.7.1
140
- }}}
157
+ <notextile>
158
+ {% highlight sh %}
159
+ > export SCALA_HOME=/path/to/scala-2.7.3
160
+ {% endhighlight %}
161
+ </notextile>
141
162
 
142
- The @SCALA_HOME@ base directory should be such that Scala core libraries are located directly under the "lib" subdirectory, and Scala scripts are under the "bin" directory.
163
+ The @SCALA_HOME@ base directory should be such that Scala core libraries are located directly under the "lib" subdirectory, and Scala scripts are under the "bin" directory. This step is not necessary if you installed Scala using MacPorts (OS X).
164
+
165
+ You must also require the Scala compiler in your buildfile:
166
+
167
+ <notextile>
168
+ {% highlight ruby %}
169
+ require 'buildr/scala'
170
+ {% endhighlight %}
171
+ </notextile>
143
172
 
144
173
  h3. Compiling Scala
145
174
 
146
175
  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.
147
176
 
148
- If you point the @compile@ task at any other source directory, it will use the Scala compiler if any of these directories contains files with the extension @.scala@.
177
+ Any Java source files found in the @src/main/java@ directory will be compiled using the Scala/Java joint compiler into the @target/classes@ directory. Both the Java and the Scala sources are compiled with an inclusive classpath, meaning that you may have a Java class which depends upon a Scala class which depends upon a Java class, all within the same project. The Java sources will be compiled with the same dependencies as the Scala sources with the addition of the @scala-library.jar@ file as required for Scala interop.
178
+
179
+ Note that you cannot use the Groovy *and* the Scala joint compilers in the same project. If both are required, the Groovy joint compiler will take precedence.
180
+ +
181
+ If you point the @compile@ task at any other source directory, it will use the Scala compiler if any of these directories contains files with the extension @.scala@. The joint compilation of Java sources may only be pointed at an alternative directory using the feature to redefine the @_(:src, :main, :java)@ path.
149
182
 
150
183
  When using the Scala compiler, if you don't specify the packaging type, it defaults to JAR.
151
184
 
@@ -158,6 +191,7 @@ The Scala compiler supports the following options:
158
191
  | @:other@ | Array of options passed to the compiler (e.g. @:other=>'-Xprint-types'@). |
159
192
  | @:target@ | Bytecode compatibility (e.g. '1.4'). |
160
193
  | @:warnings@ | Issue warnings when compiling. True when running in verbose mode. |
194
+ | @:javac@ | A hash of options passed to the @javac@ compiler verbatim. |
161
195
 
162
196
  h4. Fast Scala Compiler
163
197
 
@@ -171,34 +205,37 @@ For example, @src/main/scala/com/example/MyClass.scala@ should generate at least
171
205
 
172
206
  h3. Testing with Scala
173
207
 
174
- Buildr supports three Scala testing frameworks: "ScalaTest":http://www.artima.com/scalatest, "ScalaCheck":http://code.google.com/p/scalacheck/ and "Specs":http://code.google.com/p/specs/.
175
-
176
- Scala testing is automatically enabled if you have any @.scala@ source files under @src/test/scala@. If you are not using this convention, you can explicit set the test framework by doing,
208
+ 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.
177
209
 
178
- {{{!ruby
210
+ <notextile>
211
+ {% highlight ruby %}
179
212
  test.using(:scalatest)
180
- }}}
181
-
182
- The @:scalatest@ test framework handles ScalaTest, Specs and ScalaCheck therefore all 3 frameworks may be used within the same project.
213
+ {% endhighlight %}
214
+ </notextile>
183
215
 
184
216
  h4. ScalaTest
185
217
 
218
+ ScalaTest support is activated automatically when there are any @.scala@ source files contained in the @src/test/scala@ directory. If you are not using this directory convention, you may force the test framework by using the @test.using :scalatest@ directive.
219
+
186
220
  Buildr automatically detects and runs tests that extend the @org.scalatest.Suite@ interface.
187
221
 
188
222
  A very simplistic test class might look like,
189
223
 
190
- {{{!scala
224
+ <notextile>
225
+ {% highlight scala %}
191
226
  class MySuite extends org.scalatest.FunSuite {
192
227
  test("addition") {
193
228
  val sum = 1 + 1
194
229
  assert(sum === 2)
195
230
  }
196
231
  }
197
- }}}
232
+ {% endhighlight %}
233
+ </notextile>
198
234
 
199
235
  You can also pass properties to your tests by doing @test.using :properties => { 'name'=>'value' }@, and by overriding the @Suite.runTests@ method in a manner similar to:
200
236
 
201
- {{{!scala
237
+ <notextile>
238
+ {% highlight scala %}
202
239
  import org.scalatest._
203
240
 
204
241
  class PropertyTestSuite extends FunSuite {
@@ -217,15 +254,19 @@ class PropertyTestSuite extends FunSuite {
217
254
  includes, excludes, properties)
218
255
  }
219
256
  }
220
- }}}
257
+ {% endhighlight %}
258
+ </notextile>
221
259
 
222
260
  h4. Specs
223
261
 
224
- The @:scalatest@ framework currently recognizes specifications with class names ending with "Specs", e.g., org.example.StringSpecs.
262
+ Specs is automatically selected whenever there are @.scala@ source files under the @src/spec/scala@ directory. It is also possible to force selection of the test framework by using the @test.using :specs@ directive. This can sometimes be useful when Scala sources may be found in *both* @src/test/scala@ and @src/spec/scala@. Normally in such cases, ScalaTest will have selection precedence, meaning that in case of a conflict between it and Specs, ScalaTest will be chosen.
263
+
264
+ Any objects which extend the @org.specs.Specification@ superclass will be automatically detected and run. Note that any *classes* which extend @Specification@ will also be invoked. As such classes will not have a @main@ method, such an invocation will raise an error.
225
265
 
226
266
  A simple specification might look like this:
227
267
 
228
- {{{!scala
268
+ <notextile>
269
+ {% highlight scala %}
229
270
  import org.specs._
230
271
  import org.specs.runner._
231
272
 
@@ -236,13 +277,15 @@ object StringSpecs extends Specification {
236
277
  }
237
278
  }
238
279
  }
239
- }}}
280
+ {% endhighlight %}
281
+ </notextile>
240
282
 
241
283
  h4. ScalaCheck
242
284
 
243
285
  You may use ScalaCheck inside ScalaTest- and Specs-inherited classes. Here is an example illustrating checks inside a ScalaTest suite,
244
286
 
245
- {{{!scala
287
+ <notextile>
288
+ {% highlight scala %}
246
289
  import org.scalatest.prop.PropSuite
247
290
  import org.scalacheck.Arbitrary._
248
291
  import org.scalacheck.Prop._
@@ -261,18 +304,21 @@ class MySuite extends PropSuite {
261
304
  (a: List[Int], b: List[Int]) => a.size + b.size == (a ::: b).size
262
305
  )
263
306
  }
264
- }}}
307
+ {% endhighlight %}
308
+ </notextile>
265
309
 
266
310
 
267
- h2. Groovy
311
+ h2(#groovy). Groovy
268
312
 
269
313
  h3. Compiling Groovy
270
314
 
271
315
  Before using the Groovy compiler, you must first require it on your buildfile:
272
316
 
273
- {{{!ruby
317
+ <notextile>
318
+ {% highlight ruby %}
274
319
  require 'buildr/java/groovyc'
275
- }}}
320
+ {% endhighlight %}
321
+ </notextile>
276
322
 
277
323
  Once loaded, the groovyc compiler will be automatically selected if any .groovy source files are found under @src/main/groovy@ directory, compiling them by default into the @target/classes@ directory.
278
324
 
@@ -313,10 +359,12 @@ To use this framework in your project you can select it with @test.using :easyb@
313
359
 
314
360
  This framework will search for the following patterns under your project:
315
361
 
316
- {{{
362
+ <notextile>
363
+ {% highlight text %}
317
364
  src/spec/groovy/**/*Behavior.groovy
318
365
  src/spec/groovy/**/*Story.groovy
319
- }}}
366
+ {% endhighlight %}
367
+ </notextile>
320
368
 
321
369
  Supports the following options:
322
370
 
@@ -326,13 +374,13 @@ Supports the following options:
326
374
  | @:format@ | Report format, either @:txt@ or @:xml@ |
327
375
 
328
376
 
329
- h2. Ruby
377
+ h2(#ruby). Ruby
330
378
 
331
379
  h3. Testing with Ruby
332
380
 
333
381
  Buildr provides integration with some ruby testing frameworks, allowing you to test your Java code with state of the art tools.
334
382
 
335
- Testing code is written in "Ruby":http://www.ruby-lang.org/en/ language, and is run by using "JRuby":http://jruby.codehaus.org/.That means you have access to all your Java classes and any Java or Ruby tool out there.
383
+ Testing code is written in "Ruby":http://www.ruby-lang.org/en/ language, and is run by using "JRuby":http://jruby.codehaus.org/. That means you have access to all your Java classes and any Java or Ruby tool out there.
336
384
 
337
385
  Because of the use of JRuby, you will notice that running ruby tests is faster when running Buildr on JRuby, as in this case there's no need to run another JVM.
338
386
 
@@ -340,9 +388,11 @@ p(tip). When not running on JRuby, Buildr will use the @JRUBY_HOME@ environment
340
388
 
341
389
  You can use the @build.yaml@ settings file to specify a particular version of JRuby (defaults to @1.1.4@). For example:
342
390
 
343
- {{{!yaml
391
+ <notextile>
392
+ {% highlight yaml %}
344
393
  jruby: 1.1.3
345
- }}}
394
+ {% endhighlight %}
395
+ </notextile>
346
396
 
347
397
  h4. RSpec
348
398
 
@@ -352,9 +402,11 @@ To use this framework in your project you can select it with @test.using :rspec@
352
402
 
353
403
  This framework will search for the following patterns under your project:
354
404
 
355
- {{{
405
+ <notextile>
406
+ {% highlight text %}
356
407
  src/spec/ruby/**/*_spec.rb
357
- }}}
408
+ {% endhighlight %}
409
+ </notextile>
358
410
 
359
411
  Supports the following options:
360
412
 
@@ -375,9 +427,11 @@ To use this framework in your project you can select it with @test.using :jtestr
375
427
 
376
428
  You can use the @build.yaml@ settings file to specify a particular version of JtestR (defaults to @0.3.1@). For example:
377
429
 
378
- {{{!yaml
430
+ <notextile>
431
+ {% highlight yaml %}
379
432
  jtestr: 0.3.1
380
- }}}
433
+ {% endhighlight %}
434
+ </notextile>
381
435
 
382
436
  To customize TestNG/JUnit versions refer to their respective section.
383
437
 
@@ -0,0 +1,25 @@
1
+ ---
2
+ layout: default
3
+ title: Mailing Lists
4
+ ---
5
+
6
+ <form action="http://buildr.markmail.org/search/">Search all Buildr archives: <input type="text" name="q" size="50"/> <input type="submit" value="Search"/></form><br/>
7
+
8
+ |_. users |_. For developers working with Buildr |
9
+ | Post | "users@buildr.apache.org":mailto:users@buildr.apache.org |
10
+ | Search | "http://buildr.markmail.org/search/list:users":http://buildr.markmail.org/search/list:users |
11
+ | Subscribe | "users-subscribe@buildr.apache.org":mailto:users-subscribe@buildr.apache.org |
12
+ | Unsubscribe | "users-unsubscribe@buildr.apache.org":mailto:users-unsubscribe@buildr.apache.org |
13
+ |_. dev |_. For development of Buildr itself |
14
+ | Post | "dev@buildr.apache.org":mailto:dev@buildr.apache.org |
15
+ | Search | "http://buildr.markmail.org/search/list:dev":http://buildr.markmail.org/search/list:dev |
16
+ | Subscribe | "dev-subscribe@buildr.apache.org":mailto:dev-subscribe@buildr.apache.org |
17
+ | Unsubscribe | "dev-unsubscribe@buildr.apache.org":mailto:dev-unsubscribe@buildr.apache.org |
18
+ |_. commits |_. Commit messages and JIRA status |
19
+ | Search | "http://buildr.markmail.org/search/list:commits":http://buildr.markmail.org/search/list:commits |
20
+ | Subscribe | "commits-subscribe@buildr.apache.org":mailto:commits-subscribe@buildr.apache.org |
21
+ | Unsubscribe | "commits-unsubscribe@buildr.apache.org":mailto:commits-unsubscribe@buildr.apache.org |
22
+
23
+
24
+
25
+
@@ -1,7 +1,10 @@
1
- h1. More Stuff
1
+ ---
2
+ layout: default
3
+ title: More Stuff
4
+ ---
2
5
 
3
6
 
4
- h2. Using Gems
7
+ h2(#gems). Using Gems
5
8
 
6
9
  The purpose of the buildfile is to define your projects, and the various tasks and functions used for building them. Some of these are specific to your projects, others are more general in nature, and you may want to share them across projects.
7
10
 
@@ -15,9 +18,10 @@ You can also set up your own private repository and use it instead or in additio
15
18
 
16
19
  If your build depends on other gems, you will want to specify these dependencies as part of your build and check that configuration into source control. That way you can have a specific environment that will guarantee repeatable builds, whether you're building a particular version, moving between branches, or joining an existing project. Buildr will take care of installing all the necessary dependencies, which you can then manage with the @gem@ command.
17
20
 
18
- Use the @build.yaml@ file to specify these dependencies (see "Build Settings":settings_profiles.html#build_settings for more information), for example:
21
+ Use the @build.yaml@ file to specify these dependencies (see "Build Settings":settings_profiles.html#build for more information), for example:
19
22
 
20
- {{{!yaml
23
+ <notextile>
24
+ {% highlight yaml %}
21
25
  # This project requires the following gems
22
26
  gems:
23
27
  # Suppose we want to notify developers when testcases fail.
@@ -25,7 +29,8 @@ gems:
25
29
  # we test with ruby mock objects
26
30
  - mocha
27
31
  - ci_reporter
28
- }}}
32
+ {% endhighlight %}
33
+ </notextile>
29
34
 
30
35
  Gems contain executable code, and for that reason Buildr will not install gems without your permission. When you run a build that includes any dependencies that are not already installed on your machine, Buildr will ask for permission before installing them. On Unix-based operating systems, you will also need sudo privileges and will be asked for your password before proceeding.
31
36
 
@@ -39,28 +44,32 @@ Buildr will install the latest version that matches the version requirement. To
39
44
 
40
45
  Most gems include documentation that you can access in several forms. You can use the @ri@ command line tool to find out more about a class, module or specific method. For example:
41
46
 
42
- {{{!sh
47
+ <notextile>
48
+ {% highlight sh %}
43
49
  $ ri Buildr::Jetty
44
50
  $ ri Buildr::Jetty.start
45
- }}}
51
+ {% endhighlight %}
52
+ </notextile>
46
53
 
47
54
  You can also access documentation from a Web browser by running @gem server@ and pointing your browser to "http://localhost:8808":http://localhost:8808. Note that after installing a new gem, you will need to restart the gem server to see its documentation.
48
55
 
49
56
 
50
- h2. Using Java Libraries
57
+ h2(#java). Using Java Libraries
51
58
 
52
59
  Buildr runs along side a JVM, using either RJB or JRuby. The Java module allows you to access Java classes and create Java objects.
53
60
 
54
61
  Java classes are accessed as static methods on the @Java@ module, for example:
55
62
 
56
- {{{!ruby
63
+ <notextile>
64
+ {% highlight ruby %}
57
65
  str = Java.java.lang.String.new('hai!')
58
66
  str.toUpperCase
59
67
  => 'HAI!'
60
68
  Java.java.lang.String.isInstance(str)
61
69
  => true
62
70
  Java.com.sun.tools.javac.Main.compile(args)
63
- }}}
71
+ {% endhighlight %}
72
+ </notextile>
64
73
 
65
74
  The @classpath@ attribute allows Buildr to add JARs and directories to the classpath, for example, we use it to load Ant and various Ant tasks, code generators, test frameworks, and so forth.
66
75
 
@@ -68,9 +77,11 @@ When using an artifact specification, Buildr will automatically download and ins
68
77
 
69
78
  For example, Ant is loaded as follows:
70
79
 
71
- {{{!ruby
80
+ <notextile>
81
+ {% highlight ruby %}
72
82
  Java.classpath << 'org.apache.ant:ant:jar:1.7.0'
73
- }}}
83
+ {% endhighlight %}
84
+ </notextile>
74
85
 
75
86
  Artifacts can only be downloaded after the Buildfile has loaded, giving it a chance to specify which remote repositories to use, so adding to classpath does not by itself load any libraries. You must call @Java.load@ before accessing any Java classes to give Buildr a chance to load the libraries specified in the classpath.
76
87
 
@@ -82,39 +93,72 @@ When building an extension, make sure to follow these rules:
82
93
  # Check on a clean build with empty local repository.
83
94
 
84
95
 
85
- h2. Nailgun
96
+ h2(#buildr-server). BuildrServer
86
97
 
87
- "Nailgun":http://www.martiansoftware.com/nailgun/index.html is a client, protocol, and server for running Java programs from the command line without incurring the JVM startup overhead. Nailgun integration is available only when running Buildr within JRuby.
98
+ Buildr provides an addon that allows you start a "dRuby":http://www.ruby-doc.org/stdlib/libdoc/drb/rdoc/index.html server hosting a buildfile, so that you can later invoke tasks on it without having to load the complete buildr runtime again.
88
99
 
89
- Buildr provides a custom nailgun server, allowing you to start a single JVM and let buildr create a queue of runtimes. These JRuby runtimes can be cached (indexed by buildfile path) and are automatically reloaded when the buildfile has been modified. Runtime caching allows you to execute tasks without spending time creating the buildr environment.
100
+ Usage:
101
+
102
+ <notextile>
103
+ {% highlight sh %}
104
+ buildr -r buildr/drb drb:start
105
+ {% endhighlight %}
106
+ </notextile>
107
+
108
+ To stop the BuildrServer simply use Ctrl+C or kill the process.
109
+
110
+ Once the server has been started you can invoke tasks using a simple script:
111
+
112
+ <notextile>
113
+ {% highlight ruby %}
114
+ #!/usr/bin/env ruby
115
+ require 'rubygems'
116
+ require 'buildr/drb'
117
+ Buildr::DRbApplication.run
118
+ {% endhighlight %}
119
+ </notextile>
120
+
121
+ Save this script as @dbuildr@, make it executable and use it to invoke tasks.
122
+
123
+ <notextile>
124
+ {% highlight sh %}
125
+ $ dbuildr clean compile
126
+ {% endhighlight %}
127
+ </notextile>
128
+
129
+ @dbuildr@ will start the BuildrServer if there isn't one already running.
130
+ Subsequent calls to dbuildr will act as the client and invoke the tasks you
131
+ provide to the server.
132
+ If the buildfile has been modified it will be reloaded on the BuildrServer.
133
+
134
+ h3(#nailgun). Nailgun
135
+
136
+ "Nailgun":http://www.martiansoftware.com/nailgun/index.html is a client, protocol, and server for running Java programs from the command line without incurring the JVM startup overhead. Nailgun integration is available only when running Buildr within JRuby.
137
+
138
+ JRuby users need not to create the @dbuildr@ script listed on the previous section, as they can benefit from
139
+ using a nailgun client to invoke tasks without having to wait for JVM+JRuby to load.
90
140
 
91
141
  Start the BuildrServer by executing
92
142
 
93
- {{{!ruby
143
+ <notextile>
144
+ {% highlight sh %}
94
145
  $ jruby -S buildr -rbuildr/nailgun nailgun:start
95
- }}}
146
+ {% endhighlight %}
147
+ </notextile>
96
148
 
97
- Server output will display a message when it becomes ready, you will also see messages when the JRuby runtimes are being created, or when a new buildr environment is being loaded on them. After the runtime queues have been populated, you can start calling buildr as you normally do, by invoking the $NAILGUN_HOME/ng binary:
149
+ To stop the BuildrServer simply use Ctrl+C or kill the process.
98
150
 
99
- {{{!sh
100
- # on another terminal, change directory to a project.
101
- # if this project is the same nailgun:start was invoked on, it's
102
- # runtime has been cached, so no loading is performed unless
103
- # the buildfile has been modified. otherwise the buildfile
104
- # will be loaded on a previously loaded fresh-buildr runtime
105
- # and it will be cached.
106
- cd /some/buildr/project
107
- ng nailgun:help # display nailgun help
108
- ng nailgun:tasks # display overview of ng tasks
109
- ng clean compile # just invoke those two tasks
110
- }}}
151
+ Once the server has been started you can invoke tasks using the nailgun client
152
+ installed on @$JRUBY_HOME/tool/nailgun/ng@
111
153
 
112
- Some nailgun tasks have been provided to manage the cached runtimes, to get an overview of them execute the @nailgun:tasks@ task.
154
+ <notextile>
155
+ {% highlight sh %}
156
+ $ ng clean compile
157
+ {% endhighlight %}
158
+ </notextile>
113
159
 
114
- Be sure to read the nailgun help by executing the @nailgun:help@ task.
115
160
 
116
-
117
- h2. Growl, Qube
161
+ h2(#growl). Growl, Qube
118
162
 
119
163
  For OS X users, Buildr supports "Growl":http://growl.info/ out of the box to send "completed and "failed" notifications to the user.
120
164
 
@@ -125,7 +169,8 @@ For other platforms or if you want to notify the user differently, Buildr offers
125
169
 
126
170
  Here is an example using these extension points to send notifications using "Qube":http://launchpad.net/qube:
127
171
 
128
- {{{!ruby
172
+ <notextile>
173
+ {% highlight ruby %}
129
174
  # Send notifications using Qube
130
175
  notify = lambda do |type, title, message|
131
176
  param = case type
@@ -142,27 +187,40 @@ end
142
187
  Buildr.application.on_failure do |title, message, ex|
143
188
  notify['failed', title, message]
144
189
  end
145
- }}}
190
+ {% endhighlight %}
191
+ </notextile>
146
192
 
147
193
  You can place this code inside @buildr.rb@ in your home directory.
148
194
 
149
- h2. Eclipse, IDEA
195
+ h2(#eclipse_idea). Eclipse, IDEA
150
196
 
151
197
  If you're using Eclipse, you can generate @.classpath@ and @.project@ from your Buildfile and use them to create a project in your workspace:
152
198
 
153
- {{{!sh
199
+ <notextile>
200
+ {% highlight sh %}
154
201
  $ buildr eclipse
155
- }}}
202
+ {% endhighlight %}
203
+ </notextile>
156
204
 
157
205
  The @eclipse@ task will generate a @.classpath@ and @.project@ file for each of projects (and sub-project) that compiles source code. It will not generate files for other projects, for examples, projects you use strictly for packaging a distribution, or creating command line scripts, etc.
158
206
 
159
207
  If you add a new project, change the dependencies, or make any other change to your Buildfile, just run the @eclipse@ task again to re-generate the Eclipse project files.
160
208
 
209
+ To have your libraries' source code available in Eclipse, run:
210
+
211
+ <notextile>
212
+ {% highlight sh %}
213
+ $ buildr artifacts:sources
214
+ {% endhighlight %}
215
+ </notextile>
216
+
161
217
  If you prefer IntelliJ IDEA, you can always:
162
218
 
163
- {{{!sh
219
+ <notextile>
220
+ {% highlight sh %}
164
221
  $ buildr idea
165
- }}}
222
+ {% endhighlight %}
223
+ </notextile>
166
224
 
167
225
  It will generate a @.iml@ file for every project (or subproject) and a @.ipr@ that you can directly open for the root project. To allow IntelliJ Idea to resolve external dependencies properly, you will need to add a @M2_REPO@ variable pointing to your Maven2 repository directory (@Settings / Path Variables@).
168
226
 
@@ -171,64 +229,78 @@ If you're using IDEA 7 or later, use the @buildr idea7x@ task instead. This tas
171
229
  Also, check out the "Buildr plugin for IDEA":http://www.digitalsanctum.com/buildr-plug-in/ (IDEA 7 and later). Once installed, open your project with IDEA. If IDEA finds that you have Buildr installed and finds a buildfile in the project's directory, it will show all the tasks available for that project. To run a task, double-click it. When the task completes, IDEA will show the results in the Buildr Output window.
172
230
 
173
231
 
174
- h2. Cobertura, Emma, JDepend
232
+ h2(#cobertura_emma_jdepend). Cobertura, Emma, JDepend
175
233
 
176
234
  You can use "Cobertura":http://cobertura.sourceforge.net/ or "Emma":http://emma.sourceforge.net/ to instrument your code, run the tests and create a test coverage report in either HTML or XML format.
177
235
 
178
236
  There are two tasks for each tool, both of which generate a test coverage report in the @reports/cobertura@ (respectively @reports/emma@) directory. For example:
179
237
 
180
- {{{!sh
238
+ <notextile>
239
+ {% highlight sh %}
181
240
  $ buildr test cobertura:html
182
- }}}
241
+ {% endhighlight %}
242
+ </notextile>
183
243
 
184
244
  As you can guess, the other tasks are @cobertura:xml@, @emma:html@ and @emma:xml@.
185
245
 
186
246
  If you want to generate a test coverage report only for a specific project, you can do so by using the project name as prefix to the tasks.
187
247
 
188
- {{{!sh
248
+ <notextile>
249
+ {% highlight sh %}
189
250
  $ buildr subModule:cobertura:html
190
- }}}
251
+ {% endhighlight %}
252
+ </notextile>
191
253
 
192
254
  Each project can specify which classes to include or exclude from cobertura instrumentation by giving a class-name regexp to the @cobertura.include@ or @cobertura.exclude@ methods:
193
255
 
194
- {{{!ruby
256
+ <notextile>
257
+ {% highlight ruby %}
195
258
  define 'someModule' do
196
- cobertura.include 'some.package.*'
197
- cobertura.include /some.(foo|bar).*/
259
+ cobertura.include 'some.package.==*=='
260
+ cobertura.include /some.(foo|bar).==*==/
198
261
  cobertura.exclude 'some.foo.util.SimpleUtil'
199
- cobertura.exclude /*.Const(ants)?/i
262
+ cobertura.exclude /==*==.Const(ants)?/i
200
263
  end
201
- }}}
264
+ {% endhighlight %}
265
+ </notextile>
202
266
 
203
267
  Emma has @include@ and @exclude@ methods too, but they take glob patterns instead of regexps.
204
268
 
205
269
  You can use "JDepend":http://clarkware.com/software/JDepend.html on to generate design quality metrics. There are three tasks this time, the eye candy one:
206
270
 
207
- {{{!sh
271
+ <notextile>
272
+ {% highlight sh %}
208
273
  $ buildr jdepend:swing
209
- }}}
274
+ {% endhighlight %}
275
+ </notextile>
210
276
 
211
277
  The other two tasks are @jdepend:text@ and @jdepend:xml@.
212
278
 
213
279
  We want Buildr to load fast, and not everyone cares for these tasks, so we don't include them by default. If you want to use one of them, you need to require it explicitly. The proper way to do it in Ruby:
214
280
 
215
- {{{!ruby
216
- require 'buildr/cobertura'
217
- require 'buildr/emma'
281
+ <notextile>
282
+ {% highlight ruby %}
283
+ require 'buildr/java/cobertura'
284
+ require 'buildr/java/emma'
218
285
  require 'buildr/jdepend'
219
- }}}
286
+ {% endhighlight %}
287
+ </notextile>
220
288
 
221
289
  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.
222
290
 
223
291
  Another option is to require it from the command line (@--require@ or @-r@), for example:
224
292
 
225
- {{{!sh
293
+ <notextile>
294
+ <notextile>
295
+ {% highlight sh %}
226
296
  $ buildr --require buildr/jdepend jdepend:swing
227
- $ buildr -rbuildr/cobertura cobertura:html
228
- }}}
297
+ $ buildr -rbuildr/java/cobertura cobertura:html
298
+ {% endhighlight %}
299
+ </notextile>
300
+ </notextile>
229
301
 
230
302
 
231
- h2. Anything Ruby Can Do
303
+ h2(#anything_ruby). Anything Ruby Can Do
232
304
 
233
305
  Buildr is Ruby code. That's an implementation detail for some, but a useful features for others. You can use Ruby to keep your build scripts simple and DRY, tackle ad hoc tasks and write reusable features without the complexity of "plugins".
234
306
 
@@ -236,21 +308,24 @@ We already showed you one example where Ruby could help. You can use Ruby to ma
236
308
 
237
309
  You can use Ruby to perform ad hoc tasks. For example, Buildr doesn't have any pre-canned task for setting file permissions. But Ruby has a method for that, so it's just a matter of writing a task:
238
310
 
239
- {{{!ruby
240
- bins = file('target/bin'=>FileList[_('src/main/dist/bin/*')]) do |task|
311
+ <notextile>
312
+ {% highlight ruby %}
313
+ bins = file('target/bin'=>FileList[_('src/main/dist/bin/==*==')]) do |task|
241
314
  mkpath task.name
242
315
  cp task.prerequisites, task.name
243
- chmod 0755, FileList[task.name + '/*.sh'], :verbose=>false
316
+ chmod 0755, FileList[task.name + '/==*==.sh'], :verbose=>false
244
317
  end
245
- }}}
318
+ {% endhighlight %}
319
+ </notextile>
246
320
 
247
321
  You can use functions to keep your code simple. For example, in the ODE project we create two binary distributions, both of which contain a common set of files, and one additional file unique to each distribution. We use a method to define the common distribution:
248
322
 
249
- {{{!ruby
323
+ <notextile>
324
+ {% highlight ruby %}
250
325
  def distro(project, id)
251
326
  project.package(:zip, :id=>id).path("#{id}-#{version}").tap do |zip|
252
327
  zip.include meta_inf + ['RELEASE_NOTES', 'README'].map { |f| path_to(f) }
253
- zip.path('examples').include project.path_to(:source, :examples), :as=>'.'
328
+ zip.path('examples').include project.path_to('src/examples'), :as=>'.'
254
329
  zip.merge project('ode:tools-bin').package(:zip)
255
330
  zip.path('lib').include artifacts(COMMONS.logging, COMMONS.codec,
256
331
  COMMONS.httpclient, COMMONS.pool, COMMONS.collections, JAXEN, SAXON,
@@ -262,25 +337,29 @@ def distro(project, id)
262
337
  yield zip
263
338
  end
264
339
  end
265
- }}}
340
+ {% endhighlight %}
341
+ </notextile>
266
342
 
267
343
  And then use it in the project definition:
268
344
 
269
- {{{!ruby
345
+ <notextile>
346
+ {% highlight ruby %}
270
347
  define 'distro-axis2' do
271
348
  parent.distro(self, "#{parent.id}-war") { |zip|
272
349
  zip.include project('ode:axis2-war').package(:war), :as=>'ode.war' }
273
350
  end
274
- }}}
351
+ {% endhighlight %}
352
+ </notextile>
275
353
 
276
354
  Ruby's functional style and blocks make some task extremely easy. For example, let's say we wanted to count how many source files we have, and total number of lines:
277
355
 
278
- {{{!ruby
356
+ <notextile>
357
+ {% highlight ruby %}
279
358
  sources = projects.map { |prj| prj.compile.sources.
280
359
  map { |src| FileList["#{src}/**/*.java"] } }.flatten
281
360
  puts "There are #{source.size} source files"
282
361
  lines = sources.inject(0) { |lines, src| lines += File.readlines(src).size }
283
362
  puts "That contain #{lines} lines"
284
- }}}
285
-
363
+ {% endhighlight %}
364
+ </notextile>
286
365