mguymon-buildr 1.4.5-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. data/CHANGELOG +1291 -0
  2. data/LICENSE +176 -0
  3. data/NOTICE +26 -0
  4. data/README.rdoc +134 -0
  5. data/Rakefile +44 -0
  6. data/_buildr +35 -0
  7. data/_jbuildr +35 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/bnd.rb +147 -0
  10. data/addon/buildr/cobertura.rb +22 -0
  11. data/addon/buildr/drb.rb +281 -0
  12. data/addon/buildr/emma.rb +22 -0
  13. data/addon/buildr/hibernate.rb +149 -0
  14. data/addon/buildr/javacc.rb +85 -0
  15. data/addon/buildr/jaxb_xjc.rb +72 -0
  16. data/addon/buildr/jdepend.rb +60 -0
  17. data/addon/buildr/jetty.rb +248 -0
  18. data/addon/buildr/jibx.rb +86 -0
  19. data/addon/buildr/nailgun.rb +221 -0
  20. data/addon/buildr/openjpa.rb +88 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  22. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  23. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  26. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  27. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  28. data/addon/buildr/protobuf.rb +88 -0
  29. data/addon/buildr/xmlbeans.rb +93 -0
  30. data/bin/buildr +19 -0
  31. data/buildr.buildfile +58 -0
  32. data/buildr.gemspec +78 -0
  33. data/doc/_config.yml +1 -0
  34. data/doc/_layouts/default.html +90 -0
  35. data/doc/_layouts/preface.html +22 -0
  36. data/doc/artifacts.textile +217 -0
  37. data/doc/building.textile +276 -0
  38. data/doc/contributing.textile +268 -0
  39. data/doc/css/default.css +236 -0
  40. data/doc/css/print.css +101 -0
  41. data/doc/css/syntax.css +23 -0
  42. data/doc/download.textile +151 -0
  43. data/doc/extending.textile +212 -0
  44. data/doc/images/1442160941-frontcover.jpg +0 -0
  45. data/doc/images/asf-logo.gif +0 -0
  46. data/doc/images/asf-logo.png +0 -0
  47. data/doc/images/buildr-hires.png +0 -0
  48. data/doc/images/buildr.png +0 -0
  49. data/doc/images/favicon.png +0 -0
  50. data/doc/images/growl-icon.tiff +0 -0
  51. data/doc/images/note.png +0 -0
  52. data/doc/images/project-structure.png +0 -0
  53. data/doc/images/tip.png +0 -0
  54. data/doc/images/zbuildr.png +0 -0
  55. data/doc/images/zbuildr.tif +0 -0
  56. data/doc/index.textile +109 -0
  57. data/doc/installing.textile +284 -0
  58. data/doc/languages.textile +599 -0
  59. data/doc/mailing_lists.textile +29 -0
  60. data/doc/more_stuff.textile +845 -0
  61. data/doc/packaging.textile +618 -0
  62. data/doc/preface.textile +54 -0
  63. data/doc/projects.textile +276 -0
  64. data/doc/quick_start.textile +210 -0
  65. data/doc/releasing.textile +117 -0
  66. data/doc/scripts/buildr-git.rb +512 -0
  67. data/doc/scripts/gitflow.rb +296 -0
  68. data/doc/scripts/install-jruby.sh +44 -0
  69. data/doc/scripts/install-linux.sh +73 -0
  70. data/doc/scripts/install-osx.sh +52 -0
  71. data/doc/settings_profiles.textile +287 -0
  72. data/doc/testing.textile +247 -0
  73. data/etc/KEYS +189 -0
  74. data/lib/buildr.rb +44 -0
  75. data/lib/buildr/clojure.rb +34 -0
  76. data/lib/buildr/clojure/shell.rb +52 -0
  77. data/lib/buildr/core.rb +34 -0
  78. data/lib/buildr/core/application.rb +700 -0
  79. data/lib/buildr/core/build.rb +516 -0
  80. data/lib/buildr/core/cc.rb +166 -0
  81. data/lib/buildr/core/checks.rb +253 -0
  82. data/lib/buildr/core/common.rb +151 -0
  83. data/lib/buildr/core/compile.rb +622 -0
  84. data/lib/buildr/core/doc.rb +276 -0
  85. data/lib/buildr/core/environment.rb +129 -0
  86. data/lib/buildr/core/filter.rb +404 -0
  87. data/lib/buildr/core/generate.rb +197 -0
  88. data/lib/buildr/core/help.rb +119 -0
  89. data/lib/buildr/core/jrebel.rb +42 -0
  90. data/lib/buildr/core/linux.rb +30 -0
  91. data/lib/buildr/core/osx.rb +46 -0
  92. data/lib/buildr/core/progressbar.rb +161 -0
  93. data/lib/buildr/core/project.rb +975 -0
  94. data/lib/buildr/core/run.rb +43 -0
  95. data/lib/buildr/core/shell.rb +137 -0
  96. data/lib/buildr/core/test.rb +843 -0
  97. data/lib/buildr/core/transports.rb +575 -0
  98. data/lib/buildr/core/util.rb +537 -0
  99. data/lib/buildr/groovy.rb +20 -0
  100. data/lib/buildr/groovy/bdd.rb +106 -0
  101. data/lib/buildr/groovy/compiler.rb +153 -0
  102. data/lib/buildr/groovy/doc.rb +76 -0
  103. data/lib/buildr/groovy/shell.rb +57 -0
  104. data/lib/buildr/ide.rb +19 -0
  105. data/lib/buildr/ide/eclipse.rb +427 -0
  106. data/lib/buildr/ide/eclipse/java.rb +53 -0
  107. data/lib/buildr/ide/eclipse/plugin.rb +71 -0
  108. data/lib/buildr/ide/eclipse/scala.rb +68 -0
  109. data/lib/buildr/ide/idea.rb +576 -0
  110. data/lib/buildr/java.rb +25 -0
  111. data/lib/buildr/java/ant.rb +94 -0
  112. data/lib/buildr/java/bdd.rb +460 -0
  113. data/lib/buildr/java/cobertura.rb +297 -0
  114. data/lib/buildr/java/commands.rb +223 -0
  115. data/lib/buildr/java/compiler.rb +135 -0
  116. data/lib/buildr/java/deprecated.rb +141 -0
  117. data/lib/buildr/java/doc.rb +86 -0
  118. data/lib/buildr/java/ecj.rb +69 -0
  119. data/lib/buildr/java/emma.rb +244 -0
  120. data/lib/buildr/java/external.rb +73 -0
  121. data/lib/buildr/java/jruby.rb +122 -0
  122. data/lib/buildr/java/jtestr_result.rb +295 -0
  123. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  124. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  125. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
  126. data/lib/buildr/java/packaging.rb +734 -0
  127. data/lib/buildr/java/pom.rb +178 -0
  128. data/lib/buildr/java/rjb.rb +154 -0
  129. data/lib/buildr/java/test_result.rb +101 -0
  130. data/lib/buildr/java/tests.rb +362 -0
  131. data/lib/buildr/java/version_requirement.rb +172 -0
  132. data/lib/buildr/packaging.rb +25 -0
  133. data/lib/buildr/packaging/archive.rb +535 -0
  134. data/lib/buildr/packaging/artifact.rb +904 -0
  135. data/lib/buildr/packaging/artifact_namespace.rb +984 -0
  136. data/lib/buildr/packaging/artifact_search.rb +140 -0
  137. data/lib/buildr/packaging/gems.rb +105 -0
  138. data/lib/buildr/packaging/package.rb +249 -0
  139. data/lib/buildr/packaging/repository_array.rb +108 -0
  140. data/lib/buildr/packaging/tar.rb +189 -0
  141. data/lib/buildr/packaging/version_requirement.rb +192 -0
  142. data/lib/buildr/packaging/zip.rb +178 -0
  143. data/lib/buildr/packaging/ziptask.rb +356 -0
  144. data/lib/buildr/resources/buildr.icns +0 -0
  145. data/lib/buildr/resources/completed.png +0 -0
  146. data/lib/buildr/resources/failed.png +0 -0
  147. data/lib/buildr/resources/icons-license.txt +17 -0
  148. data/lib/buildr/run.rb +195 -0
  149. data/lib/buildr/scala.rb +26 -0
  150. data/lib/buildr/scala/bdd.rb +118 -0
  151. data/lib/buildr/scala/compiler.rb +242 -0
  152. data/lib/buildr/scala/doc.rb +142 -0
  153. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  154. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  155. data/lib/buildr/scala/shell.rb +52 -0
  156. data/lib/buildr/scala/tests.rb +171 -0
  157. data/lib/buildr/shell.rb +185 -0
  158. data/lib/buildr/version.rb +18 -0
  159. data/rakelib/all-in-one.rake +113 -0
  160. data/rakelib/checks.rake +57 -0
  161. data/rakelib/doc.rake +137 -0
  162. data/rakelib/metrics.rake +39 -0
  163. data/rakelib/package.rake +73 -0
  164. data/rakelib/release.rake +160 -0
  165. data/rakelib/rspec.rake +91 -0
  166. data/rakelib/setup.rake +66 -0
  167. data/rakelib/stage.rake +220 -0
  168. data/spec/addon/bnd_spec.rb +330 -0
  169. data/spec/addon/drb_spec.rb +328 -0
  170. data/spec/addon/jaxb_xjc_spec.rb +125 -0
  171. data/spec/core/application_spec.rb +631 -0
  172. data/spec/core/build_spec.rb +837 -0
  173. data/spec/core/cc_spec.rb +224 -0
  174. data/spec/core/checks_spec.rb +519 -0
  175. data/spec/core/common_spec.rb +725 -0
  176. data/spec/core/compile_spec.rb +658 -0
  177. data/spec/core/doc_spec.rb +195 -0
  178. data/spec/core/extension_spec.rb +201 -0
  179. data/spec/core/generate_spec.rb +33 -0
  180. data/spec/core/project_spec.rb +772 -0
  181. data/spec/core/run_spec.rb +93 -0
  182. data/spec/core/shell_spec.rb +146 -0
  183. data/spec/core/test_spec.rb +1320 -0
  184. data/spec/core/transport_spec.rb +544 -0
  185. data/spec/core/util_spec.rb +141 -0
  186. data/spec/groovy/bdd_spec.rb +80 -0
  187. data/spec/groovy/compiler_spec.rb +251 -0
  188. data/spec/groovy/doc_spec.rb +65 -0
  189. data/spec/ide/eclipse_spec.rb +739 -0
  190. data/spec/ide/idea_spec.rb +1145 -0
  191. data/spec/java/ant_spec.rb +37 -0
  192. data/spec/java/bdd_spec.rb +374 -0
  193. data/spec/java/cobertura_spec.rb +112 -0
  194. data/spec/java/commands_spec.rb +93 -0
  195. data/spec/java/compiler_spec.rb +252 -0
  196. data/spec/java/doc_spec.rb +56 -0
  197. data/spec/java/ecj_spec.rb +115 -0
  198. data/spec/java/emma_spec.rb +121 -0
  199. data/spec/java/external_spec.rb +56 -0
  200. data/spec/java/java_spec.rb +132 -0
  201. data/spec/java/packaging_spec.rb +1266 -0
  202. data/spec/java/run_spec.rb +78 -0
  203. data/spec/java/test_coverage_helper.rb +257 -0
  204. data/spec/java/tests_spec.rb +497 -0
  205. data/spec/packaging/archive_spec.rb +775 -0
  206. data/spec/packaging/artifact_namespace_spec.rb +743 -0
  207. data/spec/packaging/artifact_spec.rb +1074 -0
  208. data/spec/packaging/packaging_helper.rb +63 -0
  209. data/spec/packaging/packaging_spec.rb +719 -0
  210. data/spec/packaging/repository_array_spec.rb +109 -0
  211. data/spec/sandbox.rb +165 -0
  212. data/spec/scala/bdd_spec.rb +124 -0
  213. data/spec/scala/compiler_spec.rb +289 -0
  214. data/spec/scala/doc_spec.rb +88 -0
  215. data/spec/scala/scala.rb +38 -0
  216. data/spec/scala/tests_spec.rb +283 -0
  217. data/spec/spec_helpers.rb +369 -0
  218. data/spec/version_requirement_spec.rb +143 -0
  219. data/spec/xpath_matchers.rb +121 -0
  220. metadata +600 -0
data/doc/css/print.css ADDED
@@ -0,0 +1,101 @@
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
14
+ * under the License.
15
+ */
16
+
17
+
18
+ @media print {
19
+ @page { size: letter; }
20
+ @page:first {
21
+ @top-left { content: normal }
22
+ @top-right { content: normal }
23
+ }
24
+ @page:right {
25
+ margin: 1.25in 1in 1.5in 1.5in;
26
+ font: normal 10pt "Gill Sans" !important;
27
+ @top-left { content: string(pagetitle); }
28
+ @top-right { content: counter(page); }
29
+ }
30
+ @page:left {
31
+ margin: 1.25in 1.5in 1.5in 1in;
32
+ font: normal 10pt "Gill Sans" !important;
33
+ @top-left { content: counter(page); }
34
+ @top-right { content: string(pagetitle); }
35
+ }
36
+
37
+ title { string-set: doctitle content(); }
38
+
39
+ body {
40
+ font-family: "Palatino";
41
+ margin: 0;
42
+ color: black;
43
+ background: white;
44
+ font-size: 11pt;
45
+ }
46
+
47
+ h1 {
48
+ string-set: pagetitle content();
49
+ page-break-before: always;
50
+ }
51
+ h1:first-child { page-break-before: avoid; }
52
+ h1, h2, h3 {
53
+ font-family: "Gill Sans";
54
+ }
55
+ pre, p, blockquote { page-break-inside: avoid; }
56
+ pre, code {
57
+ font-family: "Monaco", "DejaVu Sans Mono", "Courier New", "Courier";
58
+ font-size: 9pt;
59
+ }
60
+ pre br {
61
+ display: none;
62
+ }
63
+ a:link, a:visited {
64
+ background: transparent;
65
+ text-decoration: none;
66
+ }
67
+
68
+
69
+ #header, #pages, #footer { display: none }
70
+ #wrap, #content {
71
+ float: none !important;
72
+ color: black;
73
+ background: transparent;
74
+ width: auto !important;
75
+ margin: 0;
76
+ padding: 0;
77
+ border: 0;
78
+ }
79
+
80
+ ol.toc a:link, ol.toc a:visited { text-decoration: none; }
81
+ ol.toc a:after { content: leader('.') target-counter(attr(href), page); }
82
+
83
+ .title {
84
+ page-break-before: always;
85
+ border: none;
86
+ }
87
+ .title img {
88
+ display: block;
89
+ width: 80%;
90
+ margin: 2em auto 4em auto;
91
+ }
92
+ p.preface {
93
+ page-break-before: always;
94
+ padding-top: 1.5in;
95
+ }
96
+ div.preface.quotes {
97
+ page-break-before: always;
98
+ padding-top: 1in;
99
+ }
100
+
101
+ }
@@ -0,0 +1,23 @@
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
14
+ * under the License.
15
+ */
16
+
17
+ .highlight .k, .highlight .kp { color: blue } /* keyword */
18
+ .highlight .no { color: darkblue } /* constant */
19
+ .highlight .s1 { color: green } /* string */
20
+ .highlight .n { color: black } /* identifier */
21
+ .highlight .o, .highlight .p { color: darkblue } /* = + */
22
+ .highlight .ss { color: darkblue } /* symbol */
23
+ .highlight .c1 { color: gray } /* comment */
@@ -0,0 +1,151 @@
1
+ ---
2
+ layout: default
3
+ title: Download
4
+ ---
5
+
6
+
7
+ h2(#install). Installing Buildr
8
+
9
+ *The easy way:* Follow the "quick installation instructions":installing.html to get Buildr up and running in a matter of minutes.
10
+
11
+
12
+ h2(#dists). Official & Unofficial Distributions
13
+
14
+ The official Apache distribution consists of the digitally signed binaries (gems) and source packages "available below":#dist. To install these binaries, you must first download them to disk and then install them using the @gem install@ command (or @rake install@ for a source distribution).
15
+
16
+ In addition, contributors to this project maintain a separate distribution over on "RubyForge":http://rubyforge.org/projects/buildr. Using this distribution, you're able to install Buildr directly from the remote gem repository and to automatically upgrade when a new release comes out. The RubyForge distribution is *not* an official Apache distribution.
17
+
18
+ The source code is included in both source and binary distribution, the Gem distribution expands the source code into your local Gem repository. That's in addition to getting the source code directly from "SVN":http://svn.apache.org/repos/asf/buildr or "GitHub":http://github.com/buildr/buildr/tree/master. Learn more about working with source code and "living on the edge":contributing.html#edge.
19
+
20
+
21
+ h2(#dist). Binaries and Source Code
22
+
23
+ h3. buildr 1.4.5 (2011-02-21)
24
+
25
+ |_. Package |_. MD5 Checksum |_. PGP |
26
+ | "buildr-1.4.5.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.4.5/buildr-1.4.5.gem | "57cccec175e0b1b682a36f75e54d15cf":http://www.apache.org/dist/buildr/1.4.5/buildr-1.4.5.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.5/buildr-1.4.5.gem.asc |
27
+ | "buildr-1.4.5-x86-mswin32.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.4.5/buildr-1.4.5-x86-mswin32.gem | "d24b11446eaa01e24b9ec1be4b6d93d1":http://www.apache.org/dist/buildr/1.4.5/buildr-1.4.5-x86-mswin32.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.5/buildr-1.4.5-x86-mswin32.gem.asc |
28
+ | "buildr-1.4.5-java.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.4.5/buildr-1.4.5-java.gem | "c167e67e33e7c3b4bf2316d7405eb11e":http://www.apache.org/dist/buildr/1.4.5/buildr-1.4.5-java.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.5/buildr-1.4.5-java.gem.asc |
29
+ | "buildr-1.4.5.tgz":http://www.apache.org/dyn/closer.cgi/buildr/1.4.5/buildr-1.4.5.tgz | "9b335479ce006caf109c4786d83aa00c":http://www.apache.org/dist/buildr/1.4.5/buildr-1.4.5.tgz.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.5/buildr-1.4.5.tgz.asc |
30
+ | "buildr-1.4.5.zip":http://www.apache.org/dyn/closer.cgi/buildr/1.4.5/buildr-1.4.5.zip | "0d3b3b474a3c90c717bdc953aab8e626":http://www.apache.org/dist/buildr/1.4.5/buildr-1.4.5.zip.md5 | "Sig":http://www.apache.org/dist/buildr/1.4.5/buildr-1.4.5.zip.asc |
31
+
32
+ p>. ("Release signing keys":http://www.apache.org/dist/buildr/1.4.5/KEYS)
33
+
34
+
35
+ h3. buildr 1.4.4 (2010-11-16)
36
+
37
+ |_. Package |_. MD5 Checksum |_. PGP |
38
+ | "buildr-1.4.4-x86-mswin32.gem":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4-x86-mswin32.gem | "7d9cfb91a15dfcebc2abaa7f0cc18512":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4-x86-mswin32.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4-x86-mswin32.gem.asc |
39
+ | "buildr-1.4.4.gem":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4.gem | "581e7951c07607f0437a924ec131a706":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4.gem.asc |
40
+ | "buildr-1.4.4-java.gem":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4-java.gem | "0076cdb62e248b525d71916713f5b290":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4-java.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4-java.gem.asc |
41
+ | "buildr-1.4.4.tgz":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4.tgz | "246208815e2efc29fad0df1cee031830":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4.tgz.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4.tgz.asc |
42
+ | "buildr-1.4.4.zip":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4.zip | "a932b66401102bf9814e77a3c5541d73":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4.zip.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.4/buildr-1.4.4.zip.asc |
43
+
44
+ p>. ("Release signing keys":http://archive.apache.org/dist/buildr/1.4.4/KEYS)
45
+
46
+
47
+ h3. buildr 1.4.3 (2010-10-15)
48
+
49
+ |_. Package |_. MD5 Checksum |_. PGP |
50
+ | "buildr-1.4.3-x86-mswin32.gem":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3-x86-mswin32.gem | "7d21269d4dc6d04c81637eec3a97dd89":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3-x86-mswin32.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3-x86-mswin32.gem.asc |
51
+ | "buildr-1.4.3-java.gem":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3-java.gem | "5e12a84fbb8a5ffdd9f995995fa78d77":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3-java.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3-java.gem.asc |
52
+ | "buildr-1.4.3.gem":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3.gem | "b8ff992f07f8d400902e74d5d0e488b8":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3.gem.asc |
53
+ | "buildr-1.4.3.tgz":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3.tgz | "01514479fad89e6a44f4f4d9fc5d0198":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3.tgz.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3.tgz.asc |
54
+ | "buildr-1.4.3.zip":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3.zip | "2b2e996775e6152c618308901b6815be":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3.zip.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.3/buildr-1.4.3.zip.asc |
55
+
56
+ p>. ("Release signing keys":http://archive.apache.org/dist/buildr/1.4.3/KEYS)
57
+
58
+
59
+ h3. buildr 1.4.2 (2010-09-18)
60
+
61
+ |_. Package |_. MD5 Checksum |_. PGP |
62
+ | "buildr-1.4.2-java.gem":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2-java.gem | "481b5dffac34ef368352f9dea095ad42":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2-java.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2-java.gem.asc |
63
+ | "buildr-1.4.2-x86-mswin32.gem":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2-x86-mswin32.gem | "ddd6d1bee497b514bc17507f411b57c9":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2-x86-mswin32.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2-x86-mswin32.gem.asc |
64
+ | "buildr-1.4.2.gem":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2.gem | "5f3a83491b1e7ea372fd2f7d5331195b":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2.gem.asc |
65
+ | "buildr-1.4.2.tgz":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2.tgz | "15fbb3b1fa46d6e0c99f08f169f380dc":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2.tgz.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2.tgz.asc |
66
+ | "buildr-1.4.2.zip":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2.zip | "33f1c15537bb5b28cb05244d8696e70b":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2.zip.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.2/buildr-1.4.2.zip.asc |
67
+
68
+ p>. ("Release signing keys":http://archive.apache.org/dist/buildr/1.4.2/KEYS)
69
+
70
+
71
+ h3. buildr 1.4.0 (2010-06-18)
72
+
73
+ |_. Package |_. MD5 Checksum |_. PGP |
74
+ | "buildr-1.4.0-java.gem":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0-java.gem | "6304234b3e4b49ffb95dd5f155442935":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0-java.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0-java.gem.asc |
75
+ | "buildr-1.4.0-x86-mswin32.gem":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0-x86-mswin32.gem | "6a4b0ab7cc651128c25a4b7cc4867479":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0-x86-mswin32.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0-x86-mswin32.gem.asc |
76
+ | "buildr-1.4.0.gem":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0.gem | "96c4c4d56ac4baffbaa1980af39c2220":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0.gem.asc |
77
+ | "buildr-1.4.0.tgz":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0.tgz | "f025d57e1a71e40bb02def291eb02363":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0.tgz.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0.tgz.asc |
78
+ | "buildr-1.4.0.zip":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0.zip | "a7c39d799e0e7f31827d803d788927f0":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0.zip.md5 | "Sig":http://archive.apache.org/dist/buildr/1.4.0/buildr-1.4.0.zip.asc |
79
+
80
+ p>. ("Release signing keys":http://archive.apache.org/dist/buildr/1.4.0/KEYS)
81
+
82
+
83
+ h3. buildr 1.3.5 (2009-10-05)
84
+
85
+ |_. Package |_. MD5 Checksum |_. PGP |
86
+ | "buildr-1.3.5.gem":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5.gem | "5a04d8593f98606f15dd589988afe24d":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5.gem.asc |
87
+ | "buildr-1.3.5-java.gem":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5-java.gem | "d930c851196cd8f9ea66b7190d324dd4":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5-java.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5-java.gem.asc |
88
+ | "buildr-1.3.5-x86-mswin32.gem":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5-x86-mswin32.gem | "a6dfc07b4c22e1902de6269e5776a32c":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5-x86-mswin32.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5-x86-mswin32.gem.asc |
89
+ | "buildr-1.3.5.tgz":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5.tgz | "d246b84d70a5934536a3f0cd8de1abf7":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5.tgz.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5.tgz.asc |
90
+ | "buildr-1.3.5.zip":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5.zip | "d05f9a24f488318d22964bd2f443a76c":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5.zip.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.5/buildr-1.3.5.zip.asc |
91
+
92
+ p>. ("Release signing keys":http://archive.apache.org/dist/buildr/1.3.5/KEYS)
93
+
94
+ h3. buildr 1.3.4 (2009-04-21)
95
+
96
+ |_. Package |_. MD5 Checksum |_. PGP |
97
+ | "buildr-1.3.4.gem":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4.gem | "34247286f910be1724f63b9e795e75ed":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4.gem.asc |
98
+ | "buildr-1.3.4-java.gem":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4-java.gem | "44ed67bf835cf2abdc2b6723b5eceadb":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4-java.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4-java.gem.asc |
99
+ | "buildr-1.3.4.tgz":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4.tgz | "7d918b88a3bb8139f28f6ff0b39d003c":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4.tgz.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4.tgz.asc |
100
+ | "buildr-1.3.4.zip":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4.zip | "8f4cf84dc6e293aac5fba7e2a9cc0776":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4.zip.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.4/buildr-1.3.4.zip.asc |
101
+
102
+ p>. ("Release signing keys":http://www.apache.org/dist/buildr/KEYS)
103
+
104
+
105
+ h3. buildr 1.3.3-incubating (2008-10-08)
106
+
107
+ |_. Package |_. MD5 Checksum |_. PGP |
108
+ | "buildr-1.3.3-incubating.gem":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-incubating.gem | "7192dad45441630cbf07b85af5f9069a":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-incubating.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-incubating.gem.asc |
109
+ | "buildr-1.3.3-java-incubating.gem":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-java-incubating.gem | "71ad4f0f8bfa951fa129db67a06b608a":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-java-incubating.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-java-incubating.gem.asc |
110
+ | "buildr-1.3.3-incubating.tgz":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-incubating.tgz | "e5ee6fe5b86386520c91a9633d02814b":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-incubating.tgz.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-incubating.tgz.asc |
111
+ | "buildr-1.3.3-incubating.zip":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-incubating.zip | "baab601fd46a877ee8e408891d68c842":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-incubating.zip.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.3-incubating/buildr-1.3.3-incubating.zip.asc |
112
+
113
+ p>. ("Release signing keys":http://archive.apache.org/dist/buildr/1.3.3-incubating/KEYS)
114
+
115
+
116
+ h3. buildr 1.3.2-incubating (2008-07-18)
117
+
118
+ |_. Package |_. MD5 Checksum |_. PGP |
119
+ | "buildr-1.3.2-incubating.gem":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-incubating.gem | "225504bc195334c4eb9d6dec814d9db1":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-incubating.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-incubating.gem.asc |
120
+ | "buildr-1.3.2-java-incubating.gem":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-java-incubating.gem | "d7d8394c7aed887987be0e813e1e4cee":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-java-incubating.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-java-incubating.gem.asc |
121
+ | "buildr-1.3.2-incubating.tgz":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-incubating.tgz | "611e97df1bc76382ecbe6b60e9340f2b":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-incubating.tgz.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-incubating.tgz.asc |
122
+ | "buildr-1.3.2-incubating.zip":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-incubating.zip | "d65d20005f603338c0aedd4f17d0bc90":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-incubating.zip.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.2-incubating/buildr-1.3.2-incubating.zip.asc |
123
+
124
+ p>. ("Release signing keys":http://archive.apache.org/dist/buildr/1.3.2-incubating/KEYS)
125
+
126
+
127
+
128
+ h3. buildr 1.3.1-incubating (2008-05-19)
129
+
130
+ |_. Package |_. MD5 Checksum |_. PGP |
131
+ | "buildr-1.3.1-incubating.gem":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-incubating.gem | "476436429b9a6c4ed178009ba17dd724":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-incubating.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-incubating.gem.asc |
132
+ | "buildr-1.3.1-java-incubating.gem":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-java-incubating.gem | "7af37acc10621b18d4b870119c36d998":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-java-incubating.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-java-incubating.gem.asc |
133
+ | "buildr-1.3.1-incubating.tgz":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-incubating.tgz | "ad6694416fc2e6eb22ab1042dcc41411":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-incubating.tgz.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-incubating.tgz.asc |
134
+ | "buildr-1.3.1-incubating.zip":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-incubating.zip | "0470349978b93e645ca2e9607e304ed1":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-incubating.zip.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.1-incubating/buildr-1.3.1-incubating.zip.asc |
135
+
136
+ p>. ("Release signing keys":http://archive.apache.org/dist/buildr/1.3.1-incubating/KEYS)
137
+
138
+
139
+ h3. buildr 1.3.0-incubating (2008-05-01)
140
+
141
+ |_. Package |_. MD5 Checksum |_. PGP |
142
+ | "buildr-1.3.0-incubating.gem":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-incubating.gem | "37758d0a8dabc570799b0a58d23d19f0":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-incubating.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-incubating.gem.asc |
143
+ | "buildr-1.3.0-java-incubating.gem":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-java-incubating.gem | "6a3a86740077f739c111514e0e2b9e06":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-java-incubating.gem.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-java-incubating.gem.asc |
144
+ | "buildr-1.3.0-incubating.tgz":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-incubating.tgz | "acd84ad8c5031962e65b0036f3bc2e76":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-incubating.tgz.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-incubating.tgz.asc |
145
+ | "buildr-1.3.0-incubating.zip":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-incubating.zip | "d85945f05efd0e512e6d769e3dd1cc98":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-incubating.zip.md5 | "Sig":http://archive.apache.org/dist/buildr/1.3.0-incubating/buildr-1.3.0-incubating.zip.asc |
146
+
147
+ p>. ("Release signing keys":http://archive.apache.org/dist/buildr/1.3.0-incubating/KEYS)
148
+
149
+
150
+ p(note). When downloading from files please check the "md5sum":http://www.apache.org/dev/release-signing#md5 and verify the "OpenPGP":http://www.apache.org/dev/release-signing#openpgp compatible signature from the main Apache site. This "KEYS":http://www.apache.org/dist/buildr/KEYS file contains the public keys used for signing releases. It is recommended that (when possible) a web of trust is used to confirm the identity of these keys. For more information, please see the "Apache Release FAQ":http://www.apache.org/dev/release.html.
151
+
@@ -0,0 +1,212 @@
1
+ ---
2
+ layout: default
3
+ title: Extending Buildr
4
+ ---
5
+
6
+ h2(#tasks). Organizing Tasks
7
+
8
+ A couple of things we learned while working on Buildr. Being able to write your own Rake tasks is a very powerful feature. But if you find yourself doing the same thing over and over, you might also want to consider functions. They give you a lot more power and easy abstractions.
9
+
10
+ For example, we use OpenJPA in several projects. It's a very short task, but each time I have to go back to the OpenJPA documentation to figure out how to set the Ant MappingTool task, tell Ant how to define it. After the second time, you're recognizing a pattern and it's just easier to write a function that does all that for you.
11
+
12
+ Compare this:
13
+
14
+ {% highlight ruby %}
15
+ file('derby.sql') do
16
+ REQUIRES = [
17
+ 'org.apache.openjpa:openjpa-all:jar:0.9.7-incubating',
18
+ 'commons-collections:commons-collections:jar:3.1',
19
+ . . .
20
+ 'net.sourceforge.serp:serp:jar:1.11.0' ]
21
+ ant('openjpa') do |ant|
22
+ ant.taskdef :name=>'mapping',
23
+ :classname=>'org.apache.openjpa.jdbc.ant.MappingToolTask',
24
+ :classpath=>REQUIRES.join(File::PATH_SEPARATOR)
25
+ ant.mapping :schemaAction=>'build', :sqlFile=>task.name,
26
+ :ignoreErrors=>true do
27
+ ant.config :propertiesFile=>_('src/main/sql/derby.xml')
28
+ ant.classpath :path=>projects('store', 'utils' ).
29
+ flatten.map(&:to_s).join(File::PATH_SEPARATOR)
30
+ end
31
+ end
32
+ end
33
+ {% endhighlight %}
34
+
35
+ To this:
36
+
37
+ {% highlight ruby %}
38
+ file('derby.sql') do
39
+ mapping_tool :action=>'build', :sql=>task.name,
40
+ :properties=>_('src/main/sql/derby.xml'),
41
+ :classpath=>projects('store', 'utils')
42
+ end
43
+ {% endhighlight %}
44
+
45
+ I prefer the second. It's easier to look at the Buildfile and understand what it does. It's easier to maintain when you only have to look at the important information.
46
+
47
+ But just using functions is not always enough. You end up with a Buildfile containing a lot of code that clearly doesn't belong there. For starters, I recommend putting it in the @tasks@ directory. Write it into a file with a @.rake@ extension and place that in the @tasks@ directory next to the Buildfile. Buildr will automatically pick it up and load it for you.
48
+
49
+ If you want to share these pre-canned definitions between projects, you have a few more options. You can share the @tasks@ directory using SVN externals, Git modules, or whichever cross-repository feature your source control system supports. Another mechanism with better version control is to package all these tasks, functions and modules into a "Gem":http://rubygems.org/ and require it from your Buildfile. You can run your own internal Gem server for that.
50
+
51
+ To summarize, there are several common ways to distribute extensions:
52
+ * Put them in the same place (e.g. @~/.buildr@) and require them from your
53
+ @buildfile@
54
+ * Put them directly in the project, typically under the @tasks@ directory.
55
+ * Put them in a shared code repository, and link to them from your project's @tasks@ directory
56
+ * As Ruby gems and specify which gems are used in the settings file
57
+
58
+ You can also get creative and devise your own way to distribute extensions.
59
+ "Sake":http://errtheblog.com/post/6069 is a good example of such initiative that lets you deploy Rake tasks on a system-wide basis.
60
+
61
+ h2(#extensions). Creating Extensions
62
+
63
+ The basic mechanism for extending projects in Buildr are Ruby modules. In fact, base features like compiling and testing are all developed in the form of modules, and then added to the core Project class.
64
+
65
+ A module defines instance methods that are then mixed into the project and become instance methods of the project. There are two general ways for extending projects. You can extend all projects by including the module in Project:
66
+
67
+ {% highlight ruby %}
68
+ class Project
69
+ include MyExtension
70
+ end
71
+ {% endhighlight %}
72
+
73
+ You can also extend a given project instance and only that instance by extending it with the module:
74
+
75
+ {% highlight ruby %}
76
+ define 'foo' do
77
+ extend MyExtension
78
+ end
79
+ {% endhighlight %}
80
+
81
+ Some extensions require tighter integration with the project, specifically for setting up tasks and properties, or for configuring tasks based on the project definition. You can do that by adding callbacks to the process.
82
+
83
+ The easiest way to add callbacks is by incorporating the Extension module in your own extension, and using the various class methods to define callback behavior.
84
+
85
+ |_. Method |_. Usage |
86
+ | @first_time@ | This block will be called once for any particular extension. You can use this to setup top-level and local tasks. |
87
+ | @before_define@ | This block is called once for the project with the project instance, right before running the project definition. You can use this to add tasks and set properties that will be used in the project definition. |
88
+ | @after_define@ | This block is called once for the project with the project instance, right after running the project definition. You can use this to do any post-processing that depends on the project definition. |
89
+
90
+ This example illustrates how to write a simple extension:
91
+
92
+ {% highlight ruby %}
93
+ module LinesOfCode
94
+
95
+ include Extension
96
+
97
+ first_time do
98
+ # Define task not specific to any projet.
99
+ desc 'Count lines of code in current project'
100
+ Project.local_task('loc')
101
+ end
102
+
103
+ before_define do |project|
104
+ # Define the loc task for this particular project.
105
+ project.recursive_task 'loc' do |task|
106
+ lines = task.prerequisites.map { |path|
107
+ Dir["#{path}/**/*"]
108
+ }.flatten.uniq.inject(0) { |total, file|
109
+ total = 0 if total.nil?
110
+ if File.file? file then
111
+ total + File.readlines(file).count
112
+ end
113
+ }
114
+ puts "Project #{project.name} has #{lines} lines of code"
115
+ end
116
+ end
117
+
118
+ after_define do |project|
119
+ # Now that we know all the source directories, add them.
120
+ task('loc' => project.compile.sources + project.test.sources)
121
+ end
122
+
123
+ # To use this method in your project:
124
+ # loc path_1, path_2
125
+ def loc(*paths)
126
+ task('loc' => paths)
127
+ end
128
+
129
+ end
130
+
131
+ class Buildr::Project
132
+ include LinesOfCode
133
+ end
134
+ {% endhighlight %}
135
+
136
+ You may find interesting that this Extension API is used pervasively inside Buildr itself. Many of the standard tasks such as @compile@, @test@, @package@ are extensions to a very small core.
137
+
138
+ Starting with Buildr 1.4, it's possible to define ordering between @before_define@ and @after_define@ code blocks in a way similar to Rake's dependencies. For example, if you wanted to override @project.test.compile.from@ in @after_define@, you could do so by in
139
+
140
+ {% highlight ruby %}
141
+ after_define(:functional_tests) do |project|
142
+ # Change project.test.compile.from if it's not already pointing
143
+ # to a location with Java sources
144
+ if Dir["#{project.test.compile.from}/**/*.java"].size == 0 &&
145
+ Dir["#{project._(:src, 'test-functional', :java)}/**/*.java"].size > 0
146
+ project.test.compile.from project._(:src, 'test-functional', :java)
147
+ end
148
+ end
149
+
150
+ # make sure project.test.compile.from is updated before the
151
+ # compile extension picks up its value
152
+ after_define(:compile => :functional_test)
153
+ {% endhighlight %}
154
+
155
+ Core extensions provide the following named callbacks: @compile@, @test@, @build@, @package@ and @check@.
156
+
157
+ h2(#layouts). Using Alternative Layouts
158
+
159
+ Buildr follows a common convention for project layouts: Java source files appear in @src/main/java@ and compile to @target/classes@, resources are copied over from @src/main/resources@ and so forth. Not all projects follow this convention, so it's now possible to specify an alternative project layout.
160
+
161
+ The default layout is available in @Layout.default@, and all projects inherit it. You can set @Layout.default@ to your own layout, or define a project with a given layout (recommended) by setting the @:layout@ property. Projects inherit the layout from their parent projects. For example:
162
+
163
+ {% highlight ruby %}
164
+ define 'foo', :layout=>my_layout do
165
+ ...
166
+ end
167
+ {% endhighlight %}
168
+
169
+ A layout is an object that implements the @expand@ method. The easiest way to define a custom layout is to create a new @Layout@ object and specify mapping between names used by Buildr and actual paths within the project. For example:
170
+
171
+ {% highlight ruby %}
172
+ my_layout = Layout.new
173
+ my_layout[:source, :main, :java] = 'java'
174
+ my_layout[:source, :main, :resources] = 'resources'
175
+ {% endhighlight %}
176
+
177
+ Partial expansion also works, so you can specify the above layout using:
178
+
179
+ {% highlight ruby %}
180
+ my_layout = Layout.new
181
+ my_layout[:source, :main] = ''
182
+ {% endhighlight %}
183
+
184
+ If you need anything more complex, you can always subclass @Layout@ and add special handling in the @expand@ method, you'll find one such example in the API documentation.
185
+
186
+ The built-in tasks expand lists of symbols into relative paths, using the following convention:
187
+
188
+ |_. Path |_. Expands to |
189
+ | @:source, :main, <lang/usage>@ | Directory containing source files for a given language or usage, for example, @:java@, @:resources@, @:webapp@. |
190
+ | @:source, :test, <lang/usage>@ | Directory containing test files for a given language or usage, for example, @:java@, @:resources@. |
191
+ | @:target, :generated@ | Target directory for generated code (typically source code). |
192
+ | @:target, :main, <lang/usage>@ | Target directory for compiled code, for example, @:classes@, @:resources@. |
193
+ | @:target, :test, <lang/usage>@ | Target directory for compile test cases, for example, @:classes@, @:resources@. |
194
+ | @:reports, <framework/usage>@ | Target directory for generated reports, for example, @:junit@, @:coverage@. |
195
+
196
+ All tasks are encouraged to use the same convention, and whenever possible, we recommend using the project's @path_to@ method to expand a list of symbols into a path, or use the appropriate path when available. For example:
197
+
198
+ {% highlight ruby %}
199
+ define 'bad' do
200
+ # This may not be the real target.
201
+ puts 'Compiling to ' + path_to('target/classes')
202
+ # This will break with different layouts.
203
+ package(:jar).include 'src/main/etc/*'
204
+ end
205
+
206
+ define 'good' do
207
+ # This is always the compiler's target.
208
+ puts 'Compiling to ' + compile.target.to_s
209
+ # This will work with different layouts.
210
+ package(:jar).include path_to(:source, :main, :etc, '*')
211
+ end
212
+ {% endhighlight %}