buildr 1.3.5-java → 1.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/CHANGELOG +153 -8
  2. data/README.rdoc +1 -1
  3. data/addon/buildr/antlr.rb +5 -5
  4. data/addon/buildr/drb.rb +18 -18
  5. data/addon/buildr/hibernate.rb +18 -14
  6. data/addon/buildr/javacc.rb +4 -4
  7. data/addon/buildr/jetty.rb +5 -5
  8. data/addon/buildr/nailgun.rb +23 -23
  9. data/addon/buildr/openjpa.rb +1 -1
  10. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  11. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  12. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  13. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  14. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  15. data/addon/buildr/protobuf.rb +75 -0
  16. data/addon/buildr/xmlbeans.rb +5 -5
  17. data/buildr.buildfile +2 -2
  18. data/buildr.gemspec +8 -7
  19. data/doc/_layouts/default.html +2 -2
  20. data/doc/artifacts.textile +4 -4
  21. data/doc/building.textile +35 -3
  22. data/doc/contributing.textile +5 -0
  23. data/doc/download.textile +16 -5
  24. data/doc/extending.textile +38 -12
  25. data/doc/installing.textile +6 -5
  26. data/doc/languages.textile +182 -42
  27. data/doc/more_stuff.textile +2 -2
  28. data/doc/packaging.textile +14 -15
  29. data/doc/projects.textile +7 -2
  30. data/doc/quick_start.textile +4 -4
  31. data/doc/scripts/buildr-git.rb +63 -63
  32. data/doc/scripts/gitflow.rb +21 -21
  33. data/doc/settings_profiles.textile +9 -2
  34. data/doc/testing.textile +16 -5
  35. data/etc/KEYS +38 -0
  36. data/lib/buildr.rb +1 -1
  37. data/lib/buildr/core.rb +1 -0
  38. data/lib/buildr/core/application.rb +33 -27
  39. data/lib/buildr/core/build.rb +41 -28
  40. data/lib/buildr/core/cc.rb +172 -0
  41. data/lib/buildr/core/checks.rb +1 -1
  42. data/lib/buildr/core/common.rb +7 -6
  43. data/lib/buildr/core/compile.rb +7 -8
  44. data/lib/buildr/core/doc.rb +263 -0
  45. data/lib/buildr/core/environment.rb +6 -6
  46. data/lib/buildr/core/filter.rb +77 -35
  47. data/lib/buildr/core/generate.rb +7 -7
  48. data/lib/buildr/core/help.rb +1 -1
  49. data/lib/buildr/core/osx.rb +6 -6
  50. data/lib/buildr/core/progressbar.rb +4 -4
  51. data/lib/buildr/core/project.rb +144 -36
  52. data/lib/buildr/core/shell.rb +34 -34
  53. data/lib/buildr/core/test.rb +89 -20
  54. data/lib/buildr/core/transports.rb +8 -7
  55. data/lib/buildr/core/util.rb +77 -23
  56. data/lib/buildr/groovy/bdd.rb +5 -5
  57. data/lib/buildr/groovy/compiler.rb +19 -15
  58. data/lib/buildr/groovy/shell.rb +6 -6
  59. data/lib/buildr/ide/eclipse.rb +148 -75
  60. data/lib/buildr/ide/eclipse/java.rb +3 -3
  61. data/lib/buildr/ide/eclipse/plugin.rb +8 -5
  62. data/lib/buildr/ide/eclipse/scala.rb +4 -2
  63. data/lib/buildr/ide/idea.rb +2 -2
  64. data/lib/buildr/ide/idea7x.rb +23 -4
  65. data/lib/buildr/java.rb +1 -0
  66. data/lib/buildr/java/ant.rb +4 -4
  67. data/lib/buildr/java/bdd.rb +51 -54
  68. data/lib/buildr/java/cobertura.rb +57 -35
  69. data/lib/buildr/java/commands.rb +14 -5
  70. data/lib/buildr/java/compiler.rb +3 -217
  71. data/lib/buildr/java/deprecated.rb +4 -4
  72. data/lib/buildr/java/doc.rb +70 -0
  73. data/lib/buildr/java/emma.rb +22 -22
  74. data/lib/buildr/java/jruby.rb +4 -4
  75. data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
  76. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  77. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
  78. data/lib/buildr/java/packaging.rb +30 -29
  79. data/lib/buildr/java/pom.rb +4 -4
  80. data/lib/buildr/java/rjb.rb +6 -6
  81. data/lib/buildr/java/test_result.rb +61 -85
  82. data/lib/buildr/java/tests.rb +44 -27
  83. data/lib/buildr/java/version_requirement.rb +8 -8
  84. data/lib/buildr/packaging/archive.rb +55 -22
  85. data/lib/buildr/packaging/artifact.rb +75 -36
  86. data/lib/buildr/packaging/artifact_namespace.rb +90 -78
  87. data/lib/buildr/packaging/artifact_search.rb +5 -5
  88. data/lib/buildr/packaging/gems.rb +11 -7
  89. data/lib/buildr/packaging/package.rb +10 -7
  90. data/lib/buildr/packaging/tar.rb +14 -14
  91. data/lib/buildr/packaging/version_requirement.rb +30 -10
  92. data/lib/buildr/packaging/ziptask.rb +51 -13
  93. data/lib/buildr/scala.rb +1 -0
  94. data/lib/buildr/scala/bdd.rb +25 -20
  95. data/lib/buildr/scala/compiler.rb +87 -40
  96. data/lib/buildr/scala/doc.rb +106 -0
  97. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  98. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  99. data/lib/buildr/scala/shell.rb +14 -9
  100. data/lib/buildr/scala/tests.rb +33 -26
  101. data/lib/buildr/shell.rb +33 -33
  102. data/rakelib/all-in-one.rake +113 -0
  103. data/rakelib/checks.rake +1 -1
  104. data/rakelib/doc.rake +7 -0
  105. data/rakelib/package.rake +1 -1
  106. data/rakelib/release.rake +9 -6
  107. data/rakelib/rspec.rake +26 -7
  108. data/rakelib/setup.rake +15 -3
  109. data/rakelib/stage.rake +18 -11
  110. data/spec/addon/drb_spec.rb +25 -25
  111. data/spec/core/application_spec.rb +111 -21
  112. data/spec/core/build_spec.rb +16 -15
  113. data/spec/core/cc_spec.rb +174 -0
  114. data/spec/core/checks_spec.rb +34 -34
  115. data/spec/core/common_spec.rb +51 -5
  116. data/spec/core/compile_spec.rb +89 -14
  117. data/spec/core/extension_spec.rb +127 -19
  118. data/spec/core/generate_spec.rb +2 -2
  119. data/spec/core/project_spec.rb +10 -10
  120. data/spec/core/test_spec.rb +144 -35
  121. data/spec/core/transport_spec.rb +8 -8
  122. data/spec/core/util_spec.rb +63 -5
  123. data/spec/groovy/bdd_spec.rb +5 -5
  124. data/spec/groovy/compiler_spec.rb +29 -18
  125. data/spec/ide/eclipse_spec.rb +185 -9
  126. data/spec/ide/idea7x_spec.rb +22 -10
  127. data/spec/java/ant_spec.rb +9 -5
  128. data/spec/java/bdd_spec.rb +29 -37
  129. data/spec/java/cobertura_spec.rb +12 -12
  130. data/spec/java/commands_spec.rb +34 -0
  131. data/spec/java/compiler_spec.rb +53 -53
  132. data/spec/java/emma_spec.rb +11 -11
  133. data/spec/java/java_spec.rb +10 -10
  134. data/spec/java/packaging_spec.rb +67 -20
  135. data/spec/java/test_coverage_helper.rb +18 -18
  136. data/spec/java/tests_spec.rb +13 -9
  137. data/spec/packaging/archive_spec.rb +187 -20
  138. data/spec/packaging/artifact_namespace_spec.rb +172 -83
  139. data/spec/packaging/artifact_spec.rb +83 -18
  140. data/spec/packaging/packaging_spec.rb +41 -14
  141. data/spec/sandbox.rb +23 -12
  142. data/spec/scala/bdd_spec.rb +13 -8
  143. data/spec/scala/compiler_spec.rb +18 -13
  144. data/spec/scala/scala.rb +3 -3
  145. data/spec/scala/tests_spec.rb +46 -24
  146. data/spec/spec_helpers.rb +28 -10
  147. data/spec/version_requirement_spec.rb +25 -11
  148. metadata +148 -132
  149. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  150. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
  151. data/rakelib/stage.rake~ +0 -213
@@ -250,3 +250,8 @@ A test-infected developer since 2001, Lacton yearns for a development infrastruc
250
250
  *"Daniel Spiewak":http://www.codecommit.com/blog* (djspiewak at apache.org)
251
251
 
252
252
  Daniel originally came to Buildr in search of a Scala build tool which was better than Ant. He got more than he bargained for. Now, he works to advance Buildr as the absolute best tool for supporting Scala development.
253
+
254
+ *"Antoine Toulme":http://www.lunar-ocean.com/* (toulmean at apache.org)
255
+
256
+ Antoine used Buildr first as an excuse to evade in Ruby land, creating plugins for Debian packaging, GWT compilation, or the NSIS installer. His main area of interest is the resolving of dependencies in the OSGi world. He works on making Buildr a standalone rock solid tool.
257
+
data/doc/download.textile CHANGED
@@ -20,15 +20,26 @@ The source code is included in both source and binary distribution, the Gem dist
20
20
 
21
21
  h2(#dist). Binaries and Source Code
22
22
 
23
+ h3. buildr 1.3.5 (2009-10-05)
24
+
25
+ |_. Package |_. MD5 Checksum |_. PGP |
26
+ | "buildr-1.3.5.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.3.5/buildr-1.3.5.gem | "5a04d8593f98606f15dd589988afe24d":http://www.apache.org/dist/buildr/1.3.5/buildr-1.3.5.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.5/buildr-1.3.5.gem.asc |
27
+ | "buildr-1.3.5-java.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.3.5/buildr-1.3.5-java.gem | "d930c851196cd8f9ea66b7190d324dd4":http://www.apache.org/dist/buildr/1.3.5/buildr-1.3.5-java.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.5/buildr-1.3.5-java.gem.asc |
28
+ | "buildr-1.3.5-x86-mswin32.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.3.5/buildr-1.3.5-x86-mswin32.gem | "a6dfc07b4c22e1902de6269e5776a32c":http://www.apache.org/dist/buildr/1.3.5/buildr-1.3.5-x86-mswin32.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.5/buildr-1.3.5-x86-mswin32.gem.asc |
29
+ | "buildr-1.3.5.tgz":http://www.apache.org/dyn/closer.cgi/buildr/1.3.5/buildr-1.3.5.tgz | "d246b84d70a5934536a3f0cd8de1abf7":http://www.apache.org/dist/buildr/1.3.5/buildr-1.3.5.tgz.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.5/buildr-1.3.5.tgz.asc |
30
+ | "buildr-1.3.5.zip":http://www.apache.org/dyn/closer.cgi/buildr/1.3.5/buildr-1.3.5.zip | "d05f9a24f488318d22964bd2f443a76c":http://www.apache.org/dist/buildr/1.3.5/buildr-1.3.5.zip.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.5/buildr-1.3.5.zip.asc |
31
+
32
+ p>. ("Release signing keys":http://www.apache.org/dist/buildr/1.3.5/KEYS)
33
+
23
34
  h3. buildr 1.3.4 (2009-04-21)
24
35
 
25
36
  |_. Package |_. MD5 Checksum |_. PGP |
26
- | "buildr-1.3.4.gem":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.gem | "34247286f910be1724f63b9e795e75ed":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.gem.asc |
27
- | "buildr-1.3.4-java.gem":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4-java.gem | "44ed67bf835cf2abdc2b6723b5eceadb":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4-java.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4-java.gem.asc |
28
- | "buildr-1.3.4.tgz":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.tgz | "7d918b88a3bb8139f28f6ff0b39d003c":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.tgz.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.tgz.asc |
29
- | "buildr-1.3.4.zip":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.zip | "8f4cf84dc6e293aac5fba7e2a9cc0776":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.zip.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.zip.asc |
37
+ | "buildr-1.3.4.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.3.4/buildr-1.3.4.gem | "34247286f910be1724f63b9e795e75ed":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.gem.asc |
38
+ | "buildr-1.3.4-java.gem":http://www.apache.org/dyn/closer.cgi/buildr/1.3.4/buildr-1.3.4-java.gem | "44ed67bf835cf2abdc2b6723b5eceadb":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4-java.gem.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4-java.gem.asc |
39
+ | "buildr-1.3.4.tgz":http://www.apache.org/dyn/closer.cgi/buildr/1.3.4/buildr-1.3.4.tgz | "7d918b88a3bb8139f28f6ff0b39d003c":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.tgz.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.tgz.asc |
40
+ | "buildr-1.3.4.zip":http://www.apache.org/dyn/closer.cgi/buildr/1.3.4/buildr-1.3.4.zip | "8f4cf84dc6e293aac5fba7e2a9cc0776":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.zip.md5 | "Sig":http://www.apache.org/dist/buildr/1.3.4/buildr-1.3.4.zip.asc |
30
41
 
31
- p>. ("Release signing keys":http://www.apache.org/dist/buildr/1.3.4/KEYS)
42
+ p>. ("Release signing keys":http://www.apache.org/dist/buildr/KEYS)
32
43
 
33
44
 
34
45
  h3. buildr 1.3.3-incubating (2008-10-08)
@@ -16,7 +16,7 @@ file('derby.sql') do
16
16
  REQUIRES = [
17
17
  'org.apache.openjpa:openjpa-all:jar:0.9.7-incubating',
18
18
  'commons-collections:commons-collections:jar:3.1',
19
- . . .
19
+ . . .
20
20
  'net.sourceforge.serp:serp:jar:1.11.0' ]
21
21
  ant('openjpa') do |ant|
22
22
  ant.taskdef :name=>'mapping',
@@ -48,20 +48,20 @@ But just using functions is not always enough. You end up with a Buildfile cont
48
48
 
49
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
50
 
51
- To summarize, there are several common ways to distribute extensions:
51
+ To summarize, there are several common ways to distribute extensions:
52
52
  * Put them in the same place (e.g. @~/.buildr@) and require them from your
53
53
  @buildfile@
54
54
  * Put them directly in the project, typically under the @tasks@ directory.
55
55
  * Put them in a shared code repository, and link to them from your project's @tasks@ directory
56
56
  * As Ruby gems and specify which gems are used in the settings file
57
57
 
58
- You can also get creative and devise your own way to distribute extensions.
58
+ You can also get creative and devise your own way to distribute extensions.
59
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
60
 
61
61
  h2(#extensions). Creating Extensions
62
62
 
63
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
-
64
+
65
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
66
 
67
67
  {% highlight ruby %}
@@ -91,6 +91,7 @@ This example illustrates how to write a simple extension:
91
91
 
92
92
  {% highlight ruby %}
93
93
  module LinesOfCode
94
+
94
95
  include Extension
95
96
 
96
97
  first_time do
@@ -101,33 +102,58 @@ module LinesOfCode
101
102
 
102
103
  before_define do |project|
103
104
  # Define the loc task for this particular project.
104
- define_task 'loc' do |task|
105
- lines = task.prerequisites.map { |path| Dir["#{path}/**/*"] }.flatten.uniq.
106
- inject(0) { |total, file| total + File.readlines(file).count }
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
+ }
107
114
  puts "Project #{project.name} has #{lines} lines of code"
108
- end
115
+ end
109
116
  end
110
117
 
111
118
  after_define do |project|
112
119
  # Now that we know all the source directories, add them.
113
- task('loc'=>compile.sources + compile.test.sources)
120
+ task('loc' => project.compile.sources + project.test.sources)
114
121
  end
115
122
 
116
123
  # To use this method in your project:
117
- # loc path_1, path_2
124
+ # loc path_1, path_2
118
125
  def loc(*paths)
119
- task('loc'=>paths)
126
+ task('loc' => paths)
120
127
  end
121
128
 
122
129
  end
123
130
 
124
131
  class Buildr::Project
125
- include LinesOfCode
132
+ include LinesOfCode
126
133
  end
127
134
  {% endhighlight %}
128
135
 
129
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.
130
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
+
131
157
  h2(#layouts). Using Alternative Layouts
132
158
 
133
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.
@@ -38,7 +38,7 @@ $ sudo gem update --system
38
38
  On *Ubuntu* you have to install several packages:
39
39
 
40
40
  {% highlight sh %}
41
- $ sudo apt-get install ruby-full ruby1.8-dev libopenssl-ruby build-essential
41
+ $ sudo apt-get install ruby-full ruby1.8-dev libopenssl-ruby build-essential
42
42
  {% endhighlight %}
43
43
 
44
44
  The Debian package for @rubygems@ will not allow you to install Buildr, so you need to install RubyGems from source:
@@ -70,6 +70,8 @@ h2(#osx). Installing on OS X
70
70
 
71
71
  *The easy way:* Use this script to "install Buildr on OS X":scripts/install-osx.sh. This script will install the most recent version of Buildr, or if already installed, upgrade to the most recent version. It will also install Ruby 1.8.6 if not already installed (using MacPorts/Fink) and upgrage RubyGems to 1.3.1 or later.
72
72
 
73
+ You need to have the Apple Development Tools installed. They are available on the Mac OSX installation CD.
74
+
73
75
  <br>
74
76
 
75
77
  *In details:* OS X 10.5 (Leopard) comes with a recent version of Ruby 1.8.6. You do not need to install a different version of Ruby when running OS X 10.5.
@@ -104,7 +106,7 @@ $ sudo env JAVA_HOME=$JAVA_HOME gem install buildr -v 1.3.4
104
106
 
105
107
  h2(#windows). Installing on Windows
106
108
 
107
- *The easy way:* The easiest way to install Ruby is using the "one-click installer":http://rubyinstaller.rubyforge.org/. Once installed, set the @JAVA_HOME@ environment variable and run @gem install buildr@.
109
+ *The easy way:* The easiest way to install Ruby is using the "one-click installer":http://rubyinstaller.rubyforge.org/. Be sure to install Ruby 1.8.6; support for Ruby 1.9.x is still a work in progress. Once installed, set the @JAVA_HOME@ environment variable and run @gem install buildr --platform mswin32@.
108
110
 
109
111
  <br>
110
112
 
@@ -117,17 +119,16 @@ h2(#windows). Installing on Windows
117
119
  Before installing Buildr, please set the @JAVA_HOME@ environment variable to point to your JDK distribution. Next, use Ruby Gem to install Buildr:
118
120
 
119
121
  {% highlight sh %}
120
- > gem install buildr
122
+ > gem install buildr --platform mswin32
121
123
  {% endhighlight %}
122
124
 
123
125
  To upgrade to a new version or install a specific version:
124
126
 
125
127
  {% highlight sh %}
126
128
  > gem update buildr
127
- > gem install buildr -v 1.3.4
129
+ > gem install buildr -v 1.3.4 --platform mswin32
128
130
  {% endhighlight %}
129
131
 
130
-
131
132
  h2(#jruby). Installing for JRuby
132
133
 
133
134
  *The easy way:* Use this bash script to "install Buildr on JRuby":scripts/install-jruby.sh. This script will install the most recent version of Buildr, or if already installed, upgrade to the most recent version. If necessary, it will also install JRuby 1.1.6 in @/opt/jruby@ and update the @PATH@ variable in @~/.bash_profile@ or @~/.profile@.
@@ -101,9 +101,9 @@ testng: 5.7
101
101
  {% endhighlight %}
102
102
 
103
103
 
104
- h4. JBehave
104
+ h4. JBehave
105
105
 
106
- "JBehave":http://jbehave.org/ is a pure Java BDD framework, stories and behaviour specifications are written in the Java language.
106
+ "JBehave":http://jbehave.org/ is a pure Java BDD framework, stories and behaviour specifications are written in the Java language.
107
107
 
108
108
  To use JBehave in your project you can select it with @test.using :jbehave@.
109
109
 
@@ -126,51 +126,75 @@ jbehave: 1.0.1
126
126
  {% endhighlight %}
127
127
 
128
128
 
129
- h2(#scala). Scala
129
+ h3. Documentation
130
130
 
131
- Before using Scala, you must first @require@ the Scala compiler:
131
+ Buildr offers support for using JavaDoc to generate documentation from any Java sources in a project. This is done using the @doc@ task:
132
132
 
133
- {% highlight ruby %}
134
- require 'buildr/scala'
133
+ {% highlight sh %}
134
+ $ buildr doc
135
135
  {% endhighlight %}
136
136
 
137
- By default, Buildr will attempt to use any version of Scala which is already
138
- installed on your system. However, Buildr isn't *quite* smart enough to intuit
139
- such things on its own, so for most cases, it requires the @SCALA_HOME@
140
- environment variable to be set pointing to the root of the Scala installation
141
- (e.g. @/usr/local/scala-2.7.5.final@). The only exception to this is if you have
142
- installed Scala via "MacPorts":http://www.macports.org/ Buildr will look in the
143
- @/opt/local/share/scala/@ directory *before* it uses the @SCALA_HOME@ envar.
137
+ This will use the same @.java@ sources used by the @compile@ task to produce JavaDoc results in the @target/doc/@ directory. By default, these sources are chosen only from the current project. However, it is possible to override this and generate documentation from the sources in a sub-project (potentially more than one):
138
+
139
+ {% highlight ruby %}
140
+ define 'foo' do
141
+ # ...
142
+
143
+ doc.from projects('foo:bar', 'foo')
144
+
145
+ define 'bar' do
146
+ # ...
147
+ end
148
+ end
149
+ {% endhighlight %}
144
150
 
145
- However, if @SCALA_HOME@ is not set, or if it points to an invalid Scala
146
- installation, then Buildr has a fallback option. The Scala compiler and standard
147
- library are both available from the "Scala Tools repository":http://scala-tools.org/.
148
- If no other Scala installation can be found, Buildr will download the appropriate
149
- artifacts and use them instead of a full install. The only drawback to this
150
- approach is the FSC compiler is *not* available when Scala has been downloaded
151
- in this fashion.
151
+ With this configuration, the @doc@ task will use sources from both @foo:bar@ and
152
+ @foo@.
152
153
 
153
- When Scala is downloaded from the Maven2 repository, Buildr will attempt to use
154
- the very latest version (starting from version 2.7.5). If you wish to override
155
- this default, you will need to make use of the @artifact_ns@ construct *before*
156
- you @require@ Scala support in your buildfile:
154
+ The @doc@ task supports any option that the @javadoc@ command does (e.g. @-windowtitle@). To pass an option to the JavaDoc generator, simply specify it using the @doc@ method:
157
155
 
158
156
  {% highlight ruby %}
159
- artifact_ns['Buildr::Compiler::Scalac'].library = '2.7.5'
157
+ define 'foo' do
158
+ # ...
159
+
160
+ doc :windowtitle => 'Abandon All Hope, Ye Who Enter Here', :private => true
161
+ end
162
+ {% endhighlight %}
163
+
164
+
165
+ h2(#scala). Scala
166
+
167
+ Before using Scala, you must first @require@ the Scala compiler:
160
168
 
169
+ {% highlight ruby %}
161
170
  require 'buildr/scala'
162
171
  {% endhighlight %}
163
172
 
164
- This snippet tells Buildr to use exactly version 2.7.5 of Scala when it downloads
165
- the JARs from Scala-Tools, regardless of what the latest version may be.
173
+ By default, Buildr will attempt to use the latest stable release of Scala, which is currently Scala 2.7.7 as of April 2010. Of course you can configure a specific version of Scala for your project by adding the following entry in @build.yaml@:
174
+
175
+ {% highlight yaml %}
176
+ scala.version: 2.8.0.Beta1 # Pick your version
177
+ {% endhighlight %}
178
+
179
+ Or, you can do the same programmatically:
166
180
 
167
- Regardless of how Scala has been obtained, you may determine the version in use
168
- by querying the @Scala.version@ attribute:
181
+ {% highlight yaml %}
182
+ # Must be placed before require 'buildr/scala'
183
+ Buildr.settings.build['scala.version'] = "2.8.0.Beta1"
184
+ {% endhighlight %}
185
+
186
+ You may also determine the version in use by querying the @Scala.version@ attribute:
169
187
 
170
188
  {% highlight ruby %}
171
- Scala.version # => '2.7.5'
189
+ Scala.version # => '2.7.7'
172
190
  {% endhighlight %}
173
191
 
192
+ Regardless of how the Scala version is determined, if you have the same Scala version installed on your system and the SCALA_HOME environment variable points to it, then your local installation will be used. Otherwise, Buildr will download it from the "Scala Tools repository":http://scala-tools.org/ which is automatically enlisted when you @require@ Scala. The only drawback if you don't have a local installation is the FSC compiler won't be available.
193
+
194
+ p(tip). For Mac users, if you have installed Scala via "MacPorts":http://www.macports.org/ Buildr will look in the
195
+ @/opt/local/share/scala/@ directory if you have not set @SCALA_HOME@.
196
+
197
+
174
198
  h3. Compiling Scala
175
199
 
176
200
  The Scala compiler looks for source files in the project's @src/main/scala@ directory, and defaults to compiling them into the @target/classes@ directory. It looks for test cases in the project's @src/test/scala@ and defaults to compile them into the @target/test/classes@ directory.
@@ -190,6 +214,7 @@ The Scala compiler supports the following options:
190
214
  | @:deprecation@ | If true, shows deprecation messages. False by default. |
191
215
  | @:optimise@ | Generates faster bytecode by applying optimisations to the program. |
192
216
  | @:other@ | Array of options passed to the compiler (e.g. @:other=>'-Xprint-types'@). |
217
+ | @:make@ | Make strategy to be used by the compiler (e.g. @:make=>'transitive'@). *Scala 2.8 only* |
193
218
  | @:target@ | Bytecode compatibility (e.g. '1.4'). |
194
219
  | @:warnings@ | Issue warnings when compiling. True when running in verbose mode. |
195
220
  | @:javac@ | A hash of options passed to the @javac@ compiler verbatim. |
@@ -200,10 +225,41 @@ You may use @fsc@, the Fast Scala Compiler, which submits compilation jobs to a
200
225
 
201
226
  h4. Rebuild detection
202
227
 
203
- The Scala compiler task assumes that each @.scala@ source file generates a corresponding @.class@ file under @target/classes@ (or @target/test/classses@ for tests). The source may generate more @.class@ files if it contains more than one class, object, trait or for anonymous functions and closures.
228
+ The Scala 2.7 compiler task assumes that each @.scala@ source file generates a corresponding @.class@ file under @target/classes@ (or @target/test/classses@ for tests). The source may generate more @.class@ files if it contains more than one class, object, trait or for anonymous functions and closures.
204
229
 
205
230
  For example, @src/main/scala/com/example/MyClass.scala@ should generate at least @target/classes/com/example/MyClass.class@. If that it not the case, Buildr will always recompile your sources because it will assume this is a new source file that has never been compiled before.
206
231
 
232
+ Fortunately, Scala 2.8 provides a substantially better interface for implementing change detection. Whenever you use Scala 2.8 (see below), Buildr will auto-detect the version and enable this feature dynamically. After the @compile@ task runs, the relevant target directory will contain a @.scala-deps@ file, generated by the Scala compiler. The manner in which this file is used can be configured using the @:make@ compiler option. The following values are available:
233
+
234
+ * @:all@ - Disables compiler-level change detection
235
+ * @:changed@ - Only build changed files without considering file dependencies
236
+ * @:immediate@ - *unknown*
237
+ * @:transitive@ - Build changed files as well as their transitive file dependencies
238
+ * @:transitivenocp@ - Build changed files as well as their transitive file dependencies (*default*)
239
+
240
+ Please note that there are limits to compiler-level change detection. Most notably, dependencies cannot be tracked across separate compilation targets. This would cause problems in the case where an API has been changed in a main source file. The test suite for the project will *not* be detected as requiring recompilation, potentially resulting in unexpected runtime exceptions. When in doubt, run @clean@ to remove all dependency information. In extreme cases, it is possible to completely disable compiler-level change detection by adding the following statement to your project definition:
241
+
242
+ {% highlight ruby %}
243
+ compile.using :make => :all
244
+ {% endhighlight %}
245
+
246
+ Effectively, this is telling the Scala compiler to ignore the information it has built up regarding source file dependencies. When in this mode, only Buildr's change detection semantics remain in play (as described above).
247
+
248
+ To avoid unusual behavior, compiler-level change detection is disabled whenever the joint Scala-Java compiler is used. Thus, any @.java@ files in a project handled by the Scala compiler will cause the @:make@ option to be ignored and revert to the exclusive use of Buildr's change detection mechanism (as described above).
249
+
250
+ h4. Scala 2.8
251
+
252
+ As of version 1.4, Buildr has *non-default* support for Scala 2.8. If your @SCALA_HOME@ environment variable is pointing to an installation of Scala 2.8, then Buildr will use that compiler and enable 2.8-specific features.
253
+
254
+ As Scala 2.8 is currently pre-release, it is often desirable to maintain an installation of Scala 2.7 concurrently with Scala 2.8, defaulting to the former with the option to select the latter on a project-by-project basis. This is most easily accomplished by setting @SCALA_HOME@ to point to the Scala 2.7 installation and @SCALA28_HOME@ to point to the Scala 2.8 installation. With this configuration in place, Scala 2.8 can be selected for a specific project by dynamically reassigning @SCALA_HOME@ at the top of the buildfile (*before* @require 'buildr/scala'@):
255
+
256
+ {% highlight ruby %}
257
+ ENV['SCALA_HOME'] = ENV['SCALA28_HOME']
258
+
259
+ require 'buildr/scala'
260
+ ...
261
+ {% endhighlight %}
262
+
207
263
  h3. Testing with Scala
208
264
 
209
265
  Buildr supports two main Scala testing frameworks: "ScalaTest":http://www.artima.com/scalatest and "Specs":http://code.google.com/p/specs/. "ScalaCheck":http://code.google.com/p/scalacheck/ is also supported within the confines of either of these two frameworks. Thus, your Specs may use ScalaCheck properties, as may your ScalaTest suites.
@@ -236,17 +292,17 @@ import org.scalatest._
236
292
 
237
293
  class PropertyTestSuite extends FunSuite {
238
294
  var properties = Map[String, Any]()
239
-
295
+
240
296
  test("testProperty") {
241
297
  assert(properties("name") === "value")
242
298
  }
243
299
 
244
- protected override def runTests(testName: Option[String],
245
- reporter: Reporter, stopper: Stopper, includes: Set[String],
300
+ protected override def runTests(testName: Option[String],
301
+ reporter: Reporter, stopper: Stopper, includes: Set[String],
246
302
  excludes: Set[String], properties: Map[String, Any])
247
303
  {
248
- this.properties = properties;
249
- super.runTests(testName, reporter, stopper,
304
+ this.properties = properties;
305
+ super.runTests(testName, reporter, stopper,
250
306
  includes, excludes, properties)
251
307
  }
252
308
  }
@@ -283,7 +339,7 @@ OBJENESIS = 'org.objenesis:objenesis:jar:1.1'
283
339
 
284
340
  define 'killer-app' do
285
341
  ...
286
-
342
+
287
343
  test.with MOCKITO, CGLIB, ASM, OBJENESIS
288
344
  end
289
345
  {% endhighlight %}
@@ -316,6 +372,52 @@ class MySuite extends PropSuite {
316
372
  {% endhighlight %}
317
373
 
318
374
 
375
+ h3. Documentation
376
+
377
+ Buildr offers support for using ScalaDoc or VScalaDoc to generate documentation from any Scala sources in a project. This is done using the @doc@ task:
378
+
379
+ {% highlight sh %}
380
+ $ buildr doc
381
+ {% endhighlight %}
382
+
383
+ This will use the same @.scala@ sources used by the @compile@ task to produce ScalaDoc results in the @target/doc/@ directory. By default, these sources are chosen only from the current project. However, it is possible to override this and generate documentation from the sources in a sub-project (potentially more than one):
384
+
385
+ {% highlight ruby %}
386
+ define 'foo' do
387
+ # ...
388
+
389
+ doc.from projects('foo:bar', 'foo')
390
+
391
+ define 'bar' do
392
+ # ...
393
+ end
394
+ end
395
+ {% endhighlight %}
396
+
397
+ With this configuration, the @doc@ task will use sources from both @foo:bar@ and
398
+ @foo@.
399
+
400
+ The @doc@ task supports any option that the @scaladoc@ command does (e.g. @-windowtitle@). To pass an option to the ScalaDoc (or VScalaDoc) generator, simply specify it using the @doc@ method:
401
+
402
+ {% highlight ruby %}
403
+ define 'foo' do
404
+ # ...
405
+
406
+ doc :windowtitle => 'Abandon All Hope, Ye Who Enter Here', :private => true
407
+ end
408
+ {% endhighlight %}
409
+
410
+ By default, the @doc@ task will use the ScalaDoc generator on Scala projects. To select the VScalaDoc generator, you must use the @doc.using@ invocation:
411
+
412
+ {% highlight ruby %}
413
+ define 'foo' do
414
+ doc.using :vscaladoc
415
+ end
416
+ {% endhighlight %}
417
+
418
+ The @doc@ task is *not* joint-compilation aware. Thus, it will only generate ScalaDoc for mixed-source projects, it will not attempt to generate both JavaDoc and ScalaDoc.
419
+
420
+
319
421
  h2(#groovy). Groovy
320
422
 
321
423
  h3. Compiling Groovy
@@ -357,9 +459,9 @@ h3. Testing with Groovy
357
459
 
358
460
  h4. EasyB
359
461
 
360
- "EasyB":http://www.easyb.org/ is a BDD framework using "Groovy":http://groovy.codehaus.org/.
462
+ "EasyB":http://www.easyb.org/ is a BDD framework using "Groovy":http://groovy.codehaus.org/.
361
463
 
362
- Specifications are written in the Groovy language, of course you get seamless Java integration as with all things groovy.
464
+ Specifications are written in the Groovy language, of course you get seamless Java integration as with all things groovy.
363
465
 
364
466
  To use this framework in your project you can select it with @test.using :easyb@.
365
467
 
@@ -378,6 +480,44 @@ Supports the following options:
378
480
  | @:format@ | Report format, either @:txt@ or @:xml@ |
379
481
 
380
482
 
483
+ h3. Documentation
484
+
485
+ Buildr offers support for using GroovyDoc to generate documentation from any Groovy sources in a project. This is done using the @doc@ task:
486
+
487
+ {% highlight sh %}
488
+ $ buildr doc
489
+ {% endhighlight %}
490
+
491
+ This will use the same @.groovy@ sources used by the @compile@ task to produce GroovyDoc results in the @target/doc/@ directory. By default, these sources are chosen only from the current project. However, it is possible to override this and generate documentation from the sources in a sub-project (potentially more than one):
492
+
493
+ {% highlight ruby %}
494
+ define 'foo' do
495
+ # ...
496
+
497
+ doc.from projects('foo:bar', 'foo')
498
+
499
+ define 'bar' do
500
+ # ...
501
+ end
502
+ end
503
+ {% endhighlight %}
504
+
505
+ With this configuration, the @doc@ task will use sources from both @foo:bar@ and
506
+ @foo@.
507
+
508
+ The @doc@ task supports any option that the @groovydoc@ command does (e.g. @-windowtitle@). To pass an option to the GroovyDoc generator, simply specify it using the @doc@ method:
509
+
510
+ {% highlight ruby %}
511
+ define 'foo' do
512
+ # ...
513
+
514
+ doc :windowtitle => 'Abandon All Hope, Ye Who Enter Here', :private => true
515
+ end
516
+ {% endhighlight %}
517
+
518
+ The @doc@ task is *not* joint-compilation aware. Thus, it will only generate GroovyDoc for mixed-source projects, it will not attempt to generate both JavaDoc and GroovyDoc.
519
+
520
+
381
521
  h2(#ruby). Ruby
382
522
 
383
523
  h3. Testing with Ruby
@@ -390,15 +530,15 @@ Because of the use of JRuby, you will notice that running ruby tests is faster w
390
530
 
391
531
  p(tip). When not running on JRuby, Buildr will use the @JRUBY_HOME@ environment variable to find the JRuby installation directory. If no @JRUBY_HOME@ is set or it points to an empty directory, Buildr will prompt you to either install JRuby manually or let it extract it for you.
392
532
 
393
- You can use the @build.yaml@ settings file to specify a particular version of JRuby (defaults to @1.1.4@). For example:
533
+ You can use the @build.yaml@ settings file to specify a particular version of JRuby (defaults to @1.4.0@ as of Buildr 1.3.5). For example:
394
534
 
395
535
  {% highlight yaml %}
396
- jruby: 1.1.3
536
+ jruby: 1.3.1
397
537
  {% endhighlight %}
398
538
 
399
539
  h4. RSpec
400
540
 
401
- "RSpec":http://rspec.info/ is the de-facto BDD framework for ruby. It's the framework used to test Buildr itself.
541
+ "RSpec":http://rspec.info/ is the de-facto BDD framework for ruby. It's the framework used to test Buildr itself.
402
542
 
403
543
  To use this framework in your project you can select it with @test.using :rspec@.
404
544