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.
- data/CHANGELOG +76 -0
- data/NOTICE +1 -1
- data/README.rdoc +9 -21
- data/Rakefile +17 -34
- data/_buildr +3 -12
- data/{doc/print.toc.yaml → _jbuildr} +14 -14
- data/addon/buildr/cobertura.rb +5 -219
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +5 -221
- data/addon/buildr/nailgun.rb +93 -689
- data/bin/buildr +0 -9
- data/buildr.buildfile +4 -4
- data/buildr.gemspec +27 -21
- data/doc/_layouts/default.html +82 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/{pages/artifacts.textile → artifacts.textile} +82 -42
- data/doc/{pages/building.textile → building.textile} +89 -47
- data/doc/{pages/contributing.textile → contributing.textile} +53 -45
- data/doc/css/default.css +6 -5
- data/doc/css/print.css +17 -24
- data/doc/css/syntax.css +7 -36
- data/doc/download.textile +68 -0
- data/doc/{pages/extending.textile → extending.textile} +45 -24
- data/doc/{pages/getting_started.textile → getting_started.textile} +158 -88
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/note.png +0 -0
- data/doc/index.textile +47 -0
- data/doc/{pages/languages.textile → languages.textile} +108 -54
- data/doc/mailing_lists.textile +25 -0
- data/doc/{pages/more_stuff.textile → more_stuff.textile} +152 -73
- data/doc/{pages/packaging.textile → packaging.textile} +181 -96
- data/doc/preface.textile +28 -0
- data/doc/{pages/projects.textile → projects.textile} +55 -40
- data/doc/scripts/buildr-git.rb +364 -264
- data/doc/scripts/gitflow.rb +296 -0
- data/doc/scripts/install-jruby.sh +2 -2
- data/doc/scripts/install-linux.sh +6 -6
- data/doc/scripts/install-osx.sh +2 -2
- data/doc/{pages/settings_profiles.textile → settings_profiles.textile} +83 -45
- data/doc/{pages/testing.textile → testing.textile} +77 -41
- data/lib/buildr.rb +5 -5
- data/lib/buildr/core.rb +2 -0
- data/lib/buildr/core/application.rb +321 -151
- data/lib/buildr/core/build.rb +298 -167
- data/lib/buildr/core/checks.rb +4 -132
- data/lib/buildr/core/common.rb +1 -5
- data/lib/buildr/core/compile.rb +3 -9
- data/lib/buildr/core/environment.rb +12 -3
- data/lib/buildr/core/filter.rb +20 -18
- data/lib/buildr/core/generate.rb +36 -36
- data/lib/buildr/core/help.rb +2 -1
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +1 -1
- data/lib/buildr/core/project.rb +7 -34
- data/lib/buildr/core/test.rb +12 -6
- data/lib/buildr/core/transports.rb +13 -11
- data/lib/buildr/core/util.rb +14 -23
- data/lib/buildr/groovy/bdd.rb +3 -2
- data/lib/buildr/groovy/compiler.rb +1 -1
- data/lib/buildr/ide/eclipse.rb +31 -21
- data/lib/buildr/ide/idea.rb +3 -2
- data/lib/buildr/ide/idea7x.rb +6 -4
- data/lib/buildr/java/ant.rb +3 -1
- data/lib/buildr/java/bdd.rb +9 -7
- data/lib/buildr/java/cobertura.rb +243 -0
- data/lib/buildr/java/compiler.rb +5 -4
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/packaging.rb +11 -8
- data/lib/buildr/java/pom.rb +0 -4
- data/lib/buildr/java/rjb.rb +1 -1
- data/lib/buildr/java/test_result.rb +5 -7
- data/lib/buildr/java/tests.rb +17 -11
- data/lib/buildr/packaging.rb +5 -2
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +48 -29
- data/lib/buildr/packaging/artifact_namespace.rb +6 -6
- data/lib/buildr/packaging/gems.rb +4 -4
- data/lib/buildr/packaging/package.rb +3 -2
- data/lib/buildr/packaging/tar.rb +85 -3
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +24 -682
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/scala.rb +5 -0
- data/lib/buildr/scala/bdd.rb +100 -0
- data/lib/buildr/scala/compiler.rb +45 -4
- data/lib/buildr/scala/tests.rb +12 -59
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +58 -68
- data/rakelib/jekylltask.rb +110 -0
- data/rakelib/package.rake +35 -37
- data/rakelib/release.rake +119 -35
- data/rakelib/rspec.rake +29 -39
- data/rakelib/setup.rake +21 -59
- data/rakelib/stage.rake +184 -26
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +32 -25
- data/spec/core/build_spec.rb +336 -126
- data/spec/core/checks_spec.rb +292 -310
- data/spec/core/common_spec.rb +8 -2
- data/spec/core/compile_spec.rb +17 -1
- data/spec/core/generate_spec.rb +3 -3
- data/spec/core/project_spec.rb +18 -10
- data/spec/core/test_spec.rb +8 -1
- data/spec/core/transport_spec.rb +40 -3
- data/spec/core/util_spec.rb +67 -0
- data/spec/ide/eclipse_spec.rb +96 -28
- data/spec/ide/idea7x_spec.rb +84 -0
- data/spec/java/ant.rb +5 -0
- data/spec/java/bdd_spec.rb +12 -3
- data/spec/{addon → java}/cobertura_spec.rb +6 -6
- data/spec/{addon → java}/emma_spec.rb +5 -6
- data/spec/java/java_spec.rb +12 -2
- data/spec/java/packaging_spec.rb +31 -2
- data/spec/{addon → java}/test_coverage_spec.rb +3 -3
- data/spec/java/tests_spec.rb +5 -0
- data/spec/packaging/archive_spec.rb +11 -1
- data/spec/{core → packaging}/artifact_namespace_spec.rb +10 -2
- data/spec/packaging/artifact_spec.rb +44 -3
- data/spec/packaging/packaging_spec.rb +1 -1
- data/spec/sandbox.rb +17 -14
- data/spec/scala/bdd_spec.rb +150 -0
- data/spec/scala/compiler_spec.rb +27 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +78 -33
- data/spec/spec_helpers.rb +29 -5
- data/spec/version_requirement_spec.rb +6 -0
- metadata +176 -172
- data/DISCLAIMER +0 -7
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/pages/download.textile +0 -51
- data/doc/pages/index.textile +0 -42
- data/doc/pages/mailing_lists.textile +0 -17
- data/doc/pages/recipes.textile +0 -103
- data/doc/pages/troubleshooting.textile +0 -103
- data/doc/pages/whats_new.textile +0 -323
- data/doc/print.haml +0 -51
- data/doc/site.haml +0 -56
- data/doc/site.toc.yaml +0 -47
- data/etc/git-svn-authors +0 -16
- data/lib/buildr/core/application_cli.rb +0 -139
- data/rakelib/apache.rake +0 -191
- data/rakelib/changelog.rake +0 -57
- data/rakelib/rubyforge.rake +0 -53
- data/rakelib/scm.rake +0 -49
@@ -1,4 +1,8 @@
|
|
1
|
-
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Building
|
4
|
+
---
|
5
|
+
|
2
6
|
|
3
7
|
To remove any confusion, Buildr's build task is actually called @build@. It's also the default task that executes when you run @buildr@ without any task name.
|
4
8
|
|
@@ -7,7 +11,7 @@ The @build@ task runs two other tasks: @compile@ and its associated tasks (that
|
|
7
11
|
Why @build@ and not @compile@? Some projects do more than just compiling. Other projects don't compile at all, but perform other build tasks, for example, creating a database schema or command line scripts. So we want you to get in the practice of running the @build@ task, and help you by making it the default task.
|
8
12
|
|
9
13
|
|
10
|
-
h2. Compiling
|
14
|
+
h2(#compiling). Compiling
|
11
15
|
|
12
16
|
Each project has its own @compile@ task you can invoke directly, by running @buildr compile@ or as part of another build task. (Yes, that @build@).
|
13
17
|
|
@@ -21,35 +25,41 @@ Buildr uses file tasks to handle dependencies, but here we're talking about the
|
|
21
25
|
|
22
26
|
An easier way to specify dependencies is by calling the @compile.with@ method. It takes a list of arguments and adds them to the dependency list. The @compile.with@ method is easier to use, it accepts several type of dependencies. You can use file names, file tasks, projects, artifacts specifications and even pass arrays of dependencies.
|
23
27
|
|
24
|
-
Most dependencies fall into the last three categories. When you pass a project to @compile.with@, it picks up all the packages created by that project. In doing so, it establishes an order of dependency between the two projects (see "Defining the Project":projects.html#
|
28
|
+
Most dependencies fall into the last three categories. When you pass a project to @compile.with@, it picks up all the packages created by that project. In doing so, it establishes an order of dependency between the two projects (see "Defining the Project":projects.html#defining). For example, if you make a change in project _teh-api_ and build _teh-impl_, Buildr will detect that change, recompile and package _teh-api_ before compiling _teh-impl_. You can also select a specific package using the @package@ or @packages@ methods (see "Packaging":packaging.html).
|
25
29
|
|
26
30
|
When you pass an artifact specification to @compile.with@, it creates an @Artifact@ task that will download that artifact from one of the remote repositories, install it in the local repository, and use it in your project. Rake's dependency mechanism is used here to make sure the artifact is downloaded once, when needed. Check the "Artifacts":artifacts.html section for more information about artifact specification and repositories.
|
27
31
|
|
28
32
|
For now let's just show a simple example:
|
29
33
|
|
30
|
-
|
34
|
+
<notextile>
|
35
|
+
{% highlight ruby %}
|
31
36
|
compile.with 'org.apache.axis2:axis2:jar:1.2',
|
32
37
|
'org.apache.derby:derby:jar:10.1.2.1', projects('teh-api', 'teh-impl')
|
33
|
-
}
|
38
|
+
{% endhighlight %}
|
39
|
+
</notextile>
|
34
40
|
|
35
|
-
Passing arrays to @compile.with@ is just a convenient for handling multiple dependencies, we'll show more examples of that when we talk about "Artifacts"
|
41
|
+
Passing arrays to @compile.with@ is just a convenient for handling multiple dependencies, we'll show more examples of that when we talk about "Artifacts":artifacts.html.
|
36
42
|
|
37
43
|
Likewise, the @compile@ task has an array of file tasks that point at the source directories you want to compile from. You can access that array by calling @compile.sources@. You can use @compile.from@ to add new source directories by passing a file name or a file task.
|
38
44
|
|
39
45
|
For example, let's run the APT tool on our annotated source code before compiling it:
|
40
46
|
|
41
|
-
|
47
|
+
<notextile>
|
48
|
+
{% highlight ruby %}
|
42
49
|
compile.from apt
|
43
|
-
}
|
50
|
+
{% endhighlight %}
|
51
|
+
</notextile>
|
44
52
|
|
45
53
|
When you call @apt@ on a project, it returns a file task that points to the @target/generated/apt@ directory. This file task executes by running APT, using the same list of source directories, dependencies and compiler options. It then generates new source files in the target directory. Calling @compile.from@ with that file task includes those additional source files in the list of compiled sources.
|
46
54
|
|
47
55
|
Here's another example:
|
48
56
|
|
49
|
-
|
57
|
+
<notextile>
|
58
|
+
{% highlight ruby %}
|
50
59
|
jjtree = jjtree(_('src/main/jjtree'), :in_package=>'com.acme')
|
51
60
|
compile.from javacc(jjtree, :in_package=>'com.acme'), jjtree
|
52
|
-
}
|
61
|
+
{% endhighlight %}
|
62
|
+
</notextile>
|
53
63
|
|
54
64
|
This time, the variable @jjtree@ is a file task that reads a JJTree source file from the @src/main/jjtree@ directory, and generates additional source files in the @target/generated/jjtree@ directory. The second line creates another file task that takes those source files, runs JavaCC on them, and generates yet more source files in @target/generated/javacc@. Finally, we include both sets of source files in addition to those already in @src/main/java@, and compile the lot.
|
55
65
|
|
@@ -61,10 +71,12 @@ We use method pairs to give you finer control over the compiler, but also a way
|
|
61
71
|
|
62
72
|
For example:
|
63
73
|
|
64
|
-
|
74
|
+
<notextile>
|
75
|
+
{% highlight ruby %}
|
65
76
|
compile.from('srcs').with('org.apache.axis2:axis2:jar:1.2').
|
66
77
|
into('classes').using(:target=>'1.4')
|
67
|
-
}
|
78
|
+
{% endhighlight %}
|
79
|
+
</notextile>
|
68
80
|
|
69
81
|
Buildr uses the method pair and method chaining idiom in many places to make your life easier without sacrificing flexibility.
|
70
82
|
|
@@ -72,22 +84,28 @@ Occasionally, you'll need to post-process the generated bytecode. Since you onl
|
|
72
84
|
|
73
85
|
For example, to run the OpenJPA bytecode enhancer after compiling the source files:
|
74
86
|
|
75
|
-
|
87
|
+
<notextile>
|
88
|
+
{% highlight ruby %}
|
76
89
|
compile { open_jpa_enhance }
|
77
|
-
}
|
90
|
+
{% endhighlight %}
|
91
|
+
</notextile>
|
78
92
|
|
79
93
|
You can change various compile options by calling, you guessed, @compile.options@. For example, to set the compiler to VM compatibility with Java 1.5 and turn on all Lint messages:
|
80
94
|
|
81
|
-
|
95
|
+
<notextile>
|
96
|
+
{% highlight ruby %}
|
82
97
|
compile.options.target = '1.5'
|
83
98
|
compile.options.lint = 'all'
|
84
|
-
}
|
99
|
+
{% endhighlight %}
|
100
|
+
</notextile>
|
85
101
|
|
86
102
|
Or, if you want to chain methods together:
|
87
103
|
|
88
|
-
|
104
|
+
<notextile>
|
105
|
+
{% highlight ruby %}
|
89
106
|
compile.using :target=>'1.5', :lint=>'all'
|
90
|
-
}
|
107
|
+
{% endhighlight %}
|
108
|
+
</notextile>
|
91
109
|
|
92
110
|
|
93
111
|
Sub-projects inherit compile options from their parent project, so you only need to change these settings once in the top project. You can do so, even if the top project itself doesn't compile anything.
|
@@ -96,33 +114,38 @@ The options available to you depend on which compiler you are using for this par
|
|
96
114
|
|
97
115
|
Buildr turns the @warning@ option on by default, but turns it off when you run @buildr --silent@. It also sets the @debug@ option on, but turns it off when making a release. You can also control the @debug@ option from the command line, for example:
|
98
116
|
|
99
|
-
|
117
|
+
<notextile>
|
118
|
+
{% highlight ruby %}
|
100
119
|
# When calling buildr
|
101
120
|
$ buildr compile debug=off
|
102
121
|
|
103
122
|
# Once until we change the variable
|
104
123
|
$ export DEBUG=off
|
105
124
|
$ buildr compile
|
106
|
-
}
|
125
|
+
{% endhighlight %}
|
126
|
+
</notextile>
|
107
127
|
|
108
128
|
The default source and target directories, compiler settings and other options you can use depend on the specific language. You can find more information in the "Languages":languages.html section.
|
109
129
|
|
110
130
|
|
111
|
-
h2. Resources
|
131
|
+
h2(#resources). Resources
|
112
132
|
|
113
133
|
|
114
134
|
The @compile@ task comes bundled with a @resources@ task. It copies files from the @src/main/resources@ directory into @target/resources@. Best used for copying files that you want to included in the generated code, like configuration files, i18n messages, images, etc.
|
115
135
|
|
116
136
|
The @resources@ task uses a filter that can change files as it copies them from source to destination. The most common use is by mapping values using a hash. For example, to substitute "${version}" for the project's version number and "${copyright}" for "Acme Inc (C) 2007" :
|
117
137
|
|
118
|
-
|
138
|
+
<notextile>
|
139
|
+
{% highlight ruby %}
|
119
140
|
resources.filter.using 'version'=>version,
|
120
141
|
'copyright'=>'Acme Inc (C) 2007'
|
121
|
-
}
|
142
|
+
{% endhighlight %}
|
143
|
+
</notextile>
|
122
144
|
|
123
145
|
You can also use "profiles":settings_profiles.html#profiles to supply a name/value map that all @resources@ task should default to, by adding a @filter@ element to each of the profiles. The following examples shows a @profiles.yaml@ file that applies the same filter in development and test environments:
|
124
146
|
|
125
|
-
|
147
|
+
<notextile>
|
148
|
+
{% highlight yaml %}
|
126
149
|
filter: &alpha1
|
127
150
|
version: experimental
|
128
151
|
copyright: Acme Inc (C) 2007
|
@@ -131,42 +154,51 @@ development:
|
|
131
154
|
filter: *alpha1
|
132
155
|
test:
|
133
156
|
filter: *alpha1
|
134
|
-
}
|
157
|
+
{% endhighlight %}
|
158
|
+
</notextile>
|
135
159
|
|
136
160
|
You can specify a different format by passing it as the first argument. Supported formats include:
|
137
161
|
|
138
162
|
|_. Format |_. Usage |
|
139
|
-
| @:ant@ | Map from
|
163
|
+
| @:ant@ | Map from @key@ to value. |
|
140
164
|
| @:maven@ | Map from @${key}@ to value (default). |
|
141
165
|
| @:ruby@ | Map from @#{key}@ to value. |
|
142
166
|
| @Regexp@ | Map using the matched value of the regular expression (e.g. @/=(.*?)=/@). |
|
143
167
|
|
144
168
|
For example, using the @:ruby@ format instead of the default @:maven@ format:
|
145
169
|
|
146
|
-
|
170
|
+
<notextile>
|
171
|
+
{% highlight ruby %}
|
147
172
|
resources.filter.using :ruby, 'version'=>version,
|
148
173
|
'copyright'=>'Acme Inc (C) 2007'
|
149
|
-
}
|
174
|
+
{% endhighlight %}
|
175
|
+
</notextile>
|
150
176
|
|
151
177
|
For more complicated mapping you can also pass a method or a proc. The filter will call it once for each file with the file name and content.
|
152
178
|
|
153
179
|
If you need to copy resource files from other directories, add these source directories by calling the @from@ method, for example:
|
154
180
|
|
155
|
-
|
181
|
+
<notextile>
|
182
|
+
{% highlight ruby %}
|
156
183
|
resources.from _('src/etc')
|
157
|
-
}
|
184
|
+
{% endhighlight %}
|
185
|
+
</notextile>
|
158
186
|
|
159
187
|
You can select to copy only specific files using common file matching patterns. For example, to include only HTML files:
|
160
188
|
|
161
|
-
|
189
|
+
<notextile>
|
190
|
+
{% highlight ruby %}
|
162
191
|
resources.include '*.html'
|
163
|
-
}
|
192
|
+
{% endhighlight %}
|
193
|
+
</notextile>
|
164
194
|
|
165
195
|
To include all files, except for files in the @scratch@ directory:
|
166
196
|
|
167
|
-
|
197
|
+
<notextile>
|
198
|
+
{% highlight ruby %}
|
168
199
|
resources.exclude 'scratch/*'
|
169
|
-
}
|
200
|
+
{% endhighlight %}
|
201
|
+
</notextile>
|
170
202
|
|
171
203
|
The filter always excludes the @CVS@ and @.svn@ directories, and all files ending with @.bak@ or @~@, so no need to worry about these.
|
172
204
|
|
@@ -176,15 +208,17 @@ You can use filters elsewhere. The @filter@ method creates a filter, the @into@
|
|
176
208
|
|
177
209
|
For example:
|
178
210
|
|
179
|
-
|
211
|
+
<notextile>
|
212
|
+
{% highlight ruby %}
|
180
213
|
filter('src/specs').into('target/specs').
|
181
214
|
using('version'=>version, 'created'=>Time.now).run
|
182
|
-
}
|
215
|
+
{% endhighlight %}
|
216
|
+
</notextile>
|
183
217
|
|
184
218
|
The @resources@ task is, in fact, just a wrapper around such a filter that automatically adds the @src/main/resources@ directory as one of the source directories.
|
185
219
|
|
186
220
|
|
187
|
-
h2. More On Building
|
221
|
+
h2(#more). More On Building
|
188
222
|
|
189
223
|
The @build@ task runs the @compile@ (and @resources@) tasks as prerequisites, followed by any actions you add to it, and completes by running the @test@ task. The @build@ task itself is a prerequisite to other tasks, for example, @package@ and @upload@.
|
190
224
|
|
@@ -192,38 +226,44 @@ You can extend the @build@ task in two ways. You can add more prerequisites tha
|
|
192
226
|
|
193
227
|
Let's look at a simple example. Say we want to generate a Derby database from an SQL file and include it in the ZIP package:
|
194
228
|
|
195
|
-
|
229
|
+
<notextile>
|
230
|
+
{% highlight ruby %}
|
196
231
|
db = Derby.create(_('target/derby/db')=>_('src/main/sql/derby.sql'))
|
197
232
|
package(:zip).include db
|
198
|
-
}
|
233
|
+
{% endhighlight %}
|
234
|
+
</notextile>
|
199
235
|
|
200
236
|
There's nothing fundamentally wrong with this code, if that's what you intend to do. But in practice, you don't always run the @package@ task during development, so you won't notice if something is wrong with this task when you build. For example, if it fails to generate the SQL file. In addition, the @package@ task runs after @build@, so you can't use the database in your test cases.
|
201
237
|
|
202
238
|
So let's refactor it. We're going to use the variable @db@ to reference the file task that creates the database, and make it a prerequisite of the @build@ task. And use that same variable again to include the database in the ZIP package:
|
203
239
|
|
204
|
-
|
240
|
+
<notextile>
|
241
|
+
{% highlight ruby %}
|
205
242
|
db = Derby.create(_('target/derby/db')=>_('src/main/sql/derby.sql'))
|
206
243
|
build db
|
207
244
|
package(:zip).include db
|
208
|
-
}
|
245
|
+
{% endhighlight %}
|
246
|
+
</notextile>
|
209
247
|
|
210
248
|
Much better. We're using the same task twice, but since we're using Rake here, it will only execute once. In fact, it will only execute if we don't already have a Derby database, or if it detects a change to the SQL file and needs to recreate the database.
|
211
249
|
|
212
|
-
p(tip). @Derby.create@ is not part of Buildr, you can get "derby.rake":http://svn.apache.org/repos/asf/
|
250
|
+
p(tip). @Derby.create@ is not part of Buildr, you can get "derby.rake":http://svn.apache.org/repos/asf/ode/trunk/tasks/derby.rake here.
|
213
251
|
|
214
252
|
Here's another example. We want to copy some files over as part of the build, and apply a filter to them. This time, we're going to extend the @build@ task:
|
215
253
|
|
216
|
-
|
254
|
+
<notextile>
|
255
|
+
{% highlight ruby %}
|
217
256
|
build do
|
218
257
|
filter('src/specs').into('target/specs').
|
219
258
|
using('version'=>version, 'created'=>Time.now).run
|
220
259
|
end
|
221
|
-
}
|
260
|
+
{% endhighlight %}
|
261
|
+
</notextile>
|
222
262
|
|
223
263
|
The @build@ task is recursive, so running @buildr build@ picks the current project and runs its @build@ task, which in turn runs the @build@ task on each of its sub-projects. One @build@ task to rule them all.
|
224
264
|
|
225
265
|
|
226
|
-
h2. Cleaning
|
266
|
+
h2(#cleaning). Cleaning
|
227
267
|
|
228
268
|
The @build@ task has an evil twin, the @clean@ task. It's the task you use to remove all the files created during the build, especially when you mess things up and want to start all over.
|
229
269
|
|
@@ -231,9 +271,11 @@ It basically erases the target directories, the one called @target@, and if you
|
|
231
271
|
|
232
272
|
For example:
|
233
273
|
|
234
|
-
|
274
|
+
<notextile>
|
275
|
+
{% highlight ruby %}
|
235
276
|
clean { rm_rf _('staged') }
|
236
|
-
}
|
277
|
+
{% endhighlight %}
|
278
|
+
</notextile>
|
237
279
|
|
238
280
|
The @rm_rf@ method deletes the directory and all files in it. It's named after UNIX's infamous @rm -rf@. Use it wisely. This is also a good time to introduce you to @FileUtils@, a standard Ruby library that contains convenient methods for creating and deleting directories, copying and moving files, even comparing two files. They're all free of charge when you use Buildr.
|
239
281
|
|
@@ -1,20 +1,23 @@
|
|
1
|
-
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
title: Contributing
|
4
|
+
---
|
2
5
|
|
3
6
|
Buildr is a community effort, and we welcome all contributors. Here's your chance to get involved and help your fellow developers.
|
4
7
|
|
5
|
-
h2. Getting involved
|
8
|
+
h2(#involved). Getting involved
|
6
9
|
|
7
|
-
All our discussions are done in the open, over "email":mailing_lists.html, and that would be the first place to look for answers, raise ideas, etc. For bug reports, issues and patches, "see below":#
|
10
|
+
All our discussions are done in the open, over "email":mailing_lists.html, and that would be the first place to look for answers, raise ideas, etc. For bug reports, issues and patches, "see below":#bugs.
|
8
11
|
|
9
12
|
|
10
|
-
|
13
|
+
h2(#mailing_lists). Mailing Lists
|
11
14
|
|
12
|
-
We run two mailing lists, the "
|
15
|
+
We run two mailing lists, the "users":http://buildr.markmail.org/search/list:users mailing list for developers working with Buildr, that would be you if you're using Buildr or interested in using it. There's the "dev":http://buildr.markmail.org/search/list:dev mailing list for talking about development of Buildr itself. There's also "commits":http://buildr.markmail.org/search/list:commits mailing list for following SVN commits and JIRA issues.
|
13
16
|
|
14
17
|
Check the "mailing lists":mailing_lists.html page for more information on subscribing, searching and posting to the mailing list.
|
15
18
|
|
16
19
|
|
17
|
-
|
20
|
+
h2(#bugs). Bugs (aka Issues)
|
18
21
|
|
19
22
|
We really do try to keep bugs to a minimum, and anticipate everything you'll ever want to do with Buildr. We're also, not perfect. So you may have found a bug, or have an enhancement in mind, or better yet, a patch to contribute. Here's what you can do.
|
20
23
|
|
@@ -24,25 +27,27 @@ If it needs more attention, start a discussion over on the mailing list. We wil
|
|
24
27
|
|
25
28
|
When reporting a bug, please tell us which version of Ruby, Buildr and Java you are using, and also which operating system you are on:
|
26
29
|
|
27
|
-
|
30
|
+
<notextile>
|
31
|
+
{% highlight sh %}
|
28
32
|
$ ruby --version
|
29
33
|
$ buildr --version
|
30
34
|
$ java --version
|
31
|
-
}
|
35
|
+
{% endhighlight %}
|
36
|
+
</notextile>
|
32
37
|
|
33
38
|
|
34
|
-
|
39
|
+
h2(#wiki). Community Wiki
|
35
40
|
|
36
41
|
Our community Wiki is available at "http://cwiki.apache.org/confluence/display/BUILDR/Index":http://cwiki.apache.org/confluence/display/BUILDR/Index.
|
37
42
|
|
38
43
|
|
39
|
-
|
44
|
+
h2(#code). Contributing Code
|
40
45
|
|
41
46
|
Yes, please.
|
42
47
|
|
43
48
|
If you have a patch to submit, do it through "JIRA":http://issues.apache.org/jira/browse/Buildr. We want to make sure Apache gets the right to use your contribution, and the JIRA upload form includes a simple contribution agreement. Lawyer not included.
|
44
49
|
|
45
|
-
|
50
|
+
h3. The Perfect Patch
|
46
51
|
|
47
52
|
If you want to get your patch accepted quickly:
|
48
53
|
|
@@ -53,34 +58,36 @@ If you want to get your patch accepted quickly:
|
|
53
58
|
|
54
59
|
If you don't know how to fix it, but can at least write a spec for the correct behavior (which, obviously would fail), do just that. A spec is preferred to a fix.
|
55
60
|
|
56
|
-
|
61
|
+
h3. Working on a new feature?
|
57
62
|
|
58
63
|
If you want to work on a cool new feature, but not quite ready to submit a patch, there's still a way you can get the Buildr community involved. We're experimenting with using Git for that. You can use Git to maintain a fork of Buildr that can keep up with changes in the main branch (tip: use @git rebase@), while developing your own changes/features on it.
|
59
64
|
|
60
|
-
That way you can get other people involved, checking out the code, and eventually merge it back with the main branch. Check out the "Git section":#
|
65
|
+
That way you can get other people involved, checking out the code, and eventually merge it back with the main branch. Check out the "Git section":#git below and the post "Git forking for fun and profit":http://blog.labnotes.org/2008/04/30/git-forking-for-fun-and-profit/.
|
61
66
|
|
62
67
|
|
63
|
-
h2. Living on the edge
|
68
|
+
h2(#edge). Living on the edge
|
64
69
|
|
65
70
|
Did we mention Buildr is an open source project? In fact, when you install Buildr you get all the source code, documentation, test case and everything you need to use it, extend it and patch it. Have a look in your Gem directory.
|
66
71
|
|
67
|
-
h3. SVN
|
72
|
+
h3(#svn). SVN
|
68
73
|
|
69
|
-
But if you want to work with the latest and greatest, you'll want to check out "Buildr from SVN":http://svn.apache.org/repos/asf/
|
74
|
+
But if you want to work with the latest and greatest, you'll want to check out "Buildr from SVN":http://svn.apache.org/repos/asf/buildr:
|
70
75
|
|
71
|
-
{
|
72
|
-
$ svn co http://svn.apache.org/repos/asf/
|
73
|
-
}
|
76
|
+
{% highlight sh %}
|
77
|
+
$ svn co http://svn.apache.org/repos/asf/buildr/trunk buildr
|
78
|
+
{% endhighlight %}
|
74
79
|
|
75
|
-
You can also browse the "Buildr repository":http://svn.apache.org/repos/asf/
|
80
|
+
You can also browse the "Buildr repository":http://svn.apache.org/repos/asf/buildr.
|
76
81
|
|
77
|
-
h3. Git
|
82
|
+
h3(#git). Git
|
78
83
|
|
79
|
-
Not a fan SVN? We understand. You can also grab a copy of "Buildr from GitHub":http://github.com/
|
84
|
+
Not a fan SVN? We understand. You can also grab a copy of "Buildr from GitHub":http://github.com/buildr/buildr/tree/master:
|
80
85
|
|
81
|
-
|
82
|
-
|
83
|
-
|
86
|
+
<notextile>
|
87
|
+
{% highlight sh %}
|
88
|
+
$ git clone git://github.com/buildr/buildr.git
|
89
|
+
{% endhighlight %}
|
90
|
+
</notextile>
|
84
91
|
|
85
92
|
If you want to learn more about Git, you can start by watching Scott Chacon’s "Git presentation":http://en.oreilly.com/rails2008/public/asset/attachment/2816 (PDF), or any of the "Git screencasts":http://www.gitcasts.com/. For more, there's also the "Git Internals book":http://peepcode.com/products/git-internals-pdf.
|
86
93
|
|
@@ -92,17 +99,17 @@ h3. Working with Source Code
|
|
92
99
|
|
93
100
|
To install Buildr from the source directory:
|
94
101
|
|
95
|
-
{
|
102
|
+
{% highlight sh %}
|
96
103
|
$ cd buildr
|
97
104
|
$ rake setup install
|
98
|
-
}
|
105
|
+
{% endhighlight %}
|
99
106
|
|
100
107
|
When using Buildr for JRuby:
|
101
108
|
|
102
|
-
{
|
109
|
+
{% highlight sh %}
|
103
110
|
$ cd buildr
|
104
111
|
$ jruby -S rake setup install
|
105
|
-
}
|
112
|
+
{% endhighlight %}
|
106
113
|
|
107
114
|
The _setup_ task takes care of installing all the necessary dependencies used for building, testing and running Buildr. Once in a while we upgrade or add new dependencies, if you're experiencing a missing dependency, simply run @rake setup@ again.
|
108
115
|
|
@@ -115,21 +122,23 @@ h3. Using development build
|
|
115
122
|
|
116
123
|
Occasionally we'll make development builds from the current code in trunk/head. We appreciate if you can take the time to test those out and report any bugs. To install development builds, use the Gem repository at @people.apache.org/~assaf/buildr/snapshot@:
|
117
124
|
|
118
|
-
{
|
125
|
+
{% highlight sh %}
|
119
126
|
gem source --add http://people.apache.org/~assaf/buildr/snapshot/
|
120
|
-
}
|
127
|
+
{% endhighlight %}
|
121
128
|
|
122
129
|
Since Ruby Gems uses version numbers to detect new releases, if you installed Buildr from a snapshot and want to upgrade to a newer snapshot or the latest official release, you need to use @gem install buildr@ rather than @gem upgrade@.
|
123
130
|
|
124
131
|
If you want to go back to using the RubyForge releases:
|
125
132
|
|
126
|
-
|
133
|
+
<notextile>
|
134
|
+
{% highlight sh %}
|
127
135
|
gem source --remove http://people.apache.org/~assaf/buildr/snapshot/
|
128
136
|
gem install buildr
|
129
|
-
}
|
137
|
+
{% endhighlight %}
|
138
|
+
</notextile>
|
130
139
|
|
131
140
|
|
132
|
-
h2. Tested and Documented
|
141
|
+
h2(#testing). Tested and Documented
|
133
142
|
|
134
143
|
Two things we definitely encourage!
|
135
144
|
|
@@ -141,18 +150,18 @@ We test using "RSpec":http://rspec.info/, a Behavior-Driven Development test fra
|
|
141
150
|
|
142
151
|
You can run an individual specifications using the @spec@ command, for example:
|
143
152
|
|
144
|
-
{
|
153
|
+
{% highlight sh %}
|
145
154
|
$ spec spec/compiler_spec.rb
|
146
155
|
$ spec spec/compiler_spec.rb -l 409
|
147
|
-
}
|
156
|
+
{% endhighlight %}
|
148
157
|
|
149
158
|
The first command will run all the specifications in @compiler_spec@, the second command will run only the specification identified by line 409 of that file. You can use line numbers to point at a particular specification (lines starting with @it@), or set of specifications (lines starting with @describe@). You can also use the @-e@ command line option to name a particular specification.
|
150
159
|
|
151
160
|
To make sure your change did not break anything else, you can run all the specifications (be patient, we have a lot of these):
|
152
161
|
|
153
|
-
{
|
162
|
+
{% highlight sh %}
|
154
163
|
$ rake spec
|
155
|
-
}
|
164
|
+
{% endhighlight %}
|
156
165
|
|
157
166
|
If you get any failures, you can use @rake failed@ to run only the failed specs, and repeat until there are no more failed specs to run. The list of failed specs is stored in the file _failed_.
|
158
167
|
|
@@ -160,14 +169,14 @@ We always @rake spec@ before making a release.
|
|
160
169
|
|
161
170
|
For full test coverage:
|
162
171
|
|
163
|
-
{
|
172
|
+
{% highlight sh %}
|
164
173
|
$ rake coverage
|
165
|
-
}
|
174
|
+
{% endhighlight %}
|
166
175
|
|
167
176
|
Specification and coverage reports are HTML files you can view with a Web browser, look for them in the _reports_ directory. You can also check out the "RSpec report":specs.html and "test coverage":coverage/index.html we publish with each release.
|
168
177
|
|
169
178
|
|
170
|
-
|
179
|
+
h2(#docs). Documentation
|
171
180
|
|
172
181
|
Yes, we do make typos, spelling errors and sometimes we write things that don't make sense, so if you find a documentation bug, or want to help make the documentation even better, here's the way to do it.
|
173
182
|
|
@@ -183,11 +192,10 @@ The tool we use for this is called Docter, which we developed specifically for B
|
|
183
192
|
|
184
193
|
If you're thinking of editing the docs, and using @rake html@ to see what the HTML looks like, you may want to try something simpler. Start by running the Docter Web server with @rake docter@ and then point your browser at @http://localhost:3000@. To see your edits, simply refresh the page.
|
185
194
|
|
186
|
-
Generating the PDF is a bit more tricky, we use the HTML in combination with print media CSS stylesheets and run them through the wonderful "PrinceXML":http://www.princexml.com/, so you'll need to install PrinceXML
|
187
|
-
first before you can @rake pdf@.
|
195
|
+
Generating the PDF is a bit more tricky, we use the HTML in combination with print media CSS stylesheets and run them through the wonderful "PrinceXML":http://www.princexml.com/, so you'll need to install PrinceXML first before you can @rake pdf@.
|
188
196
|
|
189
197
|
|
190
|
-
h2. Contributors
|
198
|
+
h2(#contributors). Contributors
|
191
199
|
|
192
200
|
Here is the list of people who are actively working and committing on Buildr:
|
193
201
|
|
@@ -205,4 +213,4 @@ Currently a Java Developer at "http://jwmsolutions.com":http://jwmsolutions.com,
|
|
205
213
|
|
206
214
|
*Lacton* (lacton at apache.org)
|
207
215
|
|
208
|
-
A test-infected developer since 2001, Lacton yearns for a development infrastructure that would shorten feedback loops so much that testing, building, refactoring and committing would feel as easy and natural as breathing air.
|
216
|
+
A test-infected developer since 2001, Lacton yearns for a development infrastructure that would shorten feedback loops so much that testing, building, refactoring and committing would feel as easy and natural as breathing air.
|