buildr 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/CHANGELOG +76 -0
  2. data/NOTICE +1 -1
  3. data/README.rdoc +9 -21
  4. data/Rakefile +20 -37
  5. data/_buildr +3 -12
  6. data/{doc/print.toc.yaml → _jbuildr} +14 -14
  7. data/addon/buildr/cobertura.rb +5 -219
  8. data/addon/buildr/drb.rb +281 -0
  9. data/addon/buildr/emma.rb +5 -221
  10. data/addon/buildr/nailgun.rb +93 -689
  11. data/bin/buildr +0 -9
  12. data/buildr.buildfile +4 -4
  13. data/buildr.gemspec +27 -21
  14. data/doc/_layouts/default.html +82 -0
  15. data/doc/_layouts/preface.html +22 -0
  16. data/doc/{pages/artifacts.textile → artifacts.textile} +82 -42
  17. data/doc/{pages/building.textile → building.textile} +89 -47
  18. data/doc/{pages/contributing.textile → contributing.textile} +53 -45
  19. data/doc/css/default.css +6 -5
  20. data/doc/css/print.css +17 -24
  21. data/doc/css/syntax.css +7 -36
  22. data/doc/download.textile +78 -0
  23. data/doc/{pages/extending.textile → extending.textile} +45 -24
  24. data/doc/{pages/getting_started.textile → getting_started.textile} +146 -88
  25. data/doc/images/asf-logo.gif +0 -0
  26. data/doc/images/note.png +0 -0
  27. data/doc/index.textile +47 -0
  28. data/doc/{pages/languages.textile → languages.textile} +108 -54
  29. data/doc/mailing_lists.textile +25 -0
  30. data/doc/{pages/more_stuff.textile → more_stuff.textile} +152 -73
  31. data/doc/{pages/packaging.textile → packaging.textile} +181 -96
  32. data/doc/preface.textile +28 -0
  33. data/doc/{pages/projects.textile → projects.textile} +55 -40
  34. data/doc/scripts/buildr-git.rb +364 -264
  35. data/doc/scripts/gitflow.rb +296 -0
  36. data/doc/scripts/install-jruby.sh +2 -2
  37. data/doc/scripts/install-linux.sh +6 -6
  38. data/doc/scripts/install-osx.sh +2 -2
  39. data/doc/{pages/settings_profiles.textile → settings_profiles.textile} +83 -45
  40. data/doc/{pages/testing.textile → testing.textile} +77 -41
  41. data/lib/buildr.rb +5 -5
  42. data/lib/buildr/core.rb +2 -0
  43. data/lib/buildr/core/application.rb +321 -151
  44. data/lib/buildr/core/build.rb +298 -167
  45. data/lib/buildr/core/checks.rb +4 -132
  46. data/lib/buildr/core/common.rb +1 -5
  47. data/lib/buildr/core/compile.rb +3 -9
  48. data/lib/buildr/core/environment.rb +12 -3
  49. data/lib/buildr/core/filter.rb +20 -18
  50. data/lib/buildr/core/generate.rb +36 -36
  51. data/lib/buildr/core/help.rb +2 -1
  52. data/lib/buildr/core/osx.rb +46 -0
  53. data/lib/buildr/core/progressbar.rb +1 -1
  54. data/lib/buildr/core/project.rb +7 -34
  55. data/lib/buildr/core/test.rb +12 -6
  56. data/lib/buildr/core/transports.rb +13 -11
  57. data/lib/buildr/core/util.rb +14 -23
  58. data/lib/buildr/groovy/bdd.rb +3 -2
  59. data/lib/buildr/groovy/compiler.rb +1 -1
  60. data/lib/buildr/ide/eclipse.rb +31 -21
  61. data/lib/buildr/ide/idea.rb +3 -2
  62. data/lib/buildr/ide/idea7x.rb +6 -4
  63. data/lib/buildr/java/ant.rb +3 -1
  64. data/lib/buildr/java/bdd.rb +9 -7
  65. data/lib/buildr/java/cobertura.rb +243 -0
  66. data/lib/buildr/java/compiler.rb +5 -4
  67. data/lib/buildr/java/emma.rb +244 -0
  68. data/lib/buildr/java/packaging.rb +11 -8
  69. data/lib/buildr/java/pom.rb +0 -4
  70. data/lib/buildr/java/rjb.rb +1 -1
  71. data/lib/buildr/java/test_result.rb +5 -7
  72. data/lib/buildr/java/tests.rb +17 -11
  73. data/lib/buildr/packaging.rb +5 -2
  74. data/lib/buildr/packaging/archive.rb +488 -0
  75. data/lib/buildr/packaging/artifact.rb +48 -29
  76. data/lib/buildr/packaging/artifact_namespace.rb +6 -6
  77. data/lib/buildr/packaging/gems.rb +4 -4
  78. data/lib/buildr/packaging/package.rb +3 -2
  79. data/lib/buildr/packaging/tar.rb +85 -3
  80. data/lib/buildr/packaging/version_requirement.rb +172 -0
  81. data/lib/buildr/packaging/zip.rb +24 -682
  82. data/lib/buildr/packaging/ziptask.rb +313 -0
  83. data/lib/buildr/scala.rb +5 -0
  84. data/lib/buildr/scala/bdd.rb +100 -0
  85. data/lib/buildr/scala/compiler.rb +45 -4
  86. data/lib/buildr/scala/tests.rb +12 -59
  87. data/rakelib/checks.rake +57 -0
  88. data/rakelib/doc.rake +58 -68
  89. data/rakelib/jekylltask.rb +110 -0
  90. data/rakelib/package.rake +35 -37
  91. data/rakelib/release.rake +119 -35
  92. data/rakelib/rspec.rake +29 -39
  93. data/rakelib/setup.rake +21 -59
  94. data/rakelib/stage.rake +184 -26
  95. data/spec/addon/drb_spec.rb +328 -0
  96. data/spec/core/application_spec.rb +32 -25
  97. data/spec/core/build_spec.rb +336 -126
  98. data/spec/core/checks_spec.rb +292 -310
  99. data/spec/core/common_spec.rb +8 -2
  100. data/spec/core/compile_spec.rb +17 -1
  101. data/spec/core/generate_spec.rb +3 -3
  102. data/spec/core/project_spec.rb +18 -10
  103. data/spec/core/test_spec.rb +8 -1
  104. data/spec/core/transport_spec.rb +40 -3
  105. data/spec/core/util_spec.rb +67 -0
  106. data/spec/ide/eclipse_spec.rb +96 -28
  107. data/spec/ide/idea7x_spec.rb +84 -0
  108. data/spec/java/ant.rb +5 -0
  109. data/spec/java/bdd_spec.rb +12 -3
  110. data/spec/{addon → java}/cobertura_spec.rb +6 -6
  111. data/spec/{addon → java}/emma_spec.rb +5 -6
  112. data/spec/java/java_spec.rb +12 -2
  113. data/spec/java/packaging_spec.rb +31 -2
  114. data/spec/{addon → java}/test_coverage_spec.rb +3 -3
  115. data/spec/java/tests_spec.rb +5 -0
  116. data/spec/packaging/archive_spec.rb +11 -1
  117. data/spec/{core → packaging}/artifact_namespace_spec.rb +10 -2
  118. data/spec/packaging/artifact_spec.rb +44 -3
  119. data/spec/packaging/packaging_spec.rb +1 -1
  120. data/spec/sandbox.rb +17 -14
  121. data/spec/scala/bdd_spec.rb +150 -0
  122. data/spec/scala/compiler_spec.rb +27 -0
  123. data/spec/scala/scala.rb +38 -0
  124. data/spec/scala/tests_spec.rb +78 -33
  125. data/spec/spec_helpers.rb +29 -5
  126. data/spec/version_requirement_spec.rb +6 -0
  127. metadata +175 -171
  128. data/DISCLAIMER +0 -7
  129. data/doc/images/apache-incubator-logo.png +0 -0
  130. data/doc/pages/download.textile +0 -51
  131. data/doc/pages/index.textile +0 -42
  132. data/doc/pages/mailing_lists.textile +0 -17
  133. data/doc/pages/recipes.textile +0 -103
  134. data/doc/pages/troubleshooting.textile +0 -103
  135. data/doc/pages/whats_new.textile +0 -323
  136. data/doc/print.haml +0 -51
  137. data/doc/site.haml +0 -56
  138. data/doc/site.toc.yaml +0 -47
  139. data/etc/git-svn-authors +0 -16
  140. data/lib/buildr/core/application_cli.rb +0 -139
  141. data/rakelib/apache.rake +0 -191
  142. data/rakelib/changelog.rake +0 -57
  143. data/rakelib/rubyforge.rake +0 -53
  144. data/rakelib/scm.rake +0 -49
data/CHANGELOG CHANGED
@@ -1,3 +1,79 @@
1
+ 1.3.4 (2009-04-21)
2
+ * Added: BUILDR-93 Add specs for ScalaCheck integration
3
+ * Added: BUILDR-94 Add specs for Scala Specs integration
4
+ * Added: BUILDR-136 Support Scala/Java Joint Compiler (Daniel Spiewak).
5
+ * Added: BUILDR-159 Improved 'check' to accept both tar and tgz archives.
6
+ * Added: BUILDR-164 New 'artifacts:sources' task to download source code
7
+ for artifact jars.
8
+ * Added: BUILDR-222 Support Git as a version control system
9
+ * Added BUILDR-223 Release Task: customizable commit message
10
+ * Added: BUILDR-242 Include Scala-Tools Repository by Default.
11
+ * Added: BUILDR-268 Allow proxying for https connections (Joel Muzzerall).
12
+ * Added: Info message "Packaging filename.ext" now displayed for packaging tasks
13
+ * Added: Added Scala.version and Scala.version_str
14
+ * Change: require 'buildr/scala' is now officially required to use Scala features
15
+ * Change: Introduced new options from Rake 0.8.3: -I (libdir), -R (rakelib),
16
+ --rules, --no-search, --silent.
17
+ * Change: Upgraded to Rubyforge 1.0.1.
18
+ * Change: Upgraded to use Rake 0.8.4.
19
+ * Change: Upgraded to use Net-SSH 2.0.11.
20
+ * Change: Upgraded to use RSpec 1.2.2.
21
+ * Change: Upgraded to use JRuby 1.1.6 (when auto-installing).
22
+ * Change: Buildr, no longer in incubation (hurray!): new site, mailing list, SVN, Git.
23
+ * Change: BUILDR-171 Eclipse task generates meta-data files for projects with
24
+ test source code but no main source code.
25
+ * Change: BUILDR-177 Moved cobertura and emma extensions to lib directory.
26
+ * Change: BUILDR-187 Source code attachment for Eclipse .classpath.
27
+ * Change: BUILDR-188 Source code attachment for IDEA .iml file (Marko Sibakov).
28
+ * Change: BUILDR-209 Scala Specs Should Use src/specs/scala/
29
+ * Change: BUILDR-237 Use MacPorts Scala on OS X.
30
+ * Change: BUILDR-260 Upgrade to Scala 2.7.3 compatible dependencies:
31
+ ScalaSpecs 1.4.3, ScalaCheck 1.5 and ScalaTest 0.9.5
32
+ * Change: Buildr now uses Jekyll to generate Web site/documentation:
33
+ http://github.com/mojombo/jekyll/ This replaces Docter so less code to
34
+ maintain and the same Textile/Liquid mechanism as when using Github pages.
35
+ * Fixed: Removed double complete/fail messages showing up on console.
36
+ * Fixed: BUILDR-140 Get rid of const_defined? all across the board.
37
+ * Fixed: BUILDR-158 Nailgun is now a delegate for buildr/drb (a pure-ruby dRuby server)
38
+ * Fixed: BUILDR-170 ArtifactNamespace#method_missing has a condition that is never true.
39
+ * Fixed: BUILDR-172 Scala compiler not loaded by default.
40
+ * Fixed: BUILDR-175 Fail to find child project when calling project method inside project definition.
41
+ * Fixed: BUILDR-185 Exception if using artifact names with hyphen (Joel
42
+ Muzzerall).
43
+ * Fixed: BUILDR-192 TestNG report results are overwritten (Alexis Midon).
44
+ * Fixed: BUILDR-193 TestNG uses project name for suite name (not valid file
45
+ name on Windows).
46
+ * Fixed: BUILDR-194 Buildr always adds 'Manifest-Version' to generated manifest file.
47
+ * Fixed: BUILDR-198 Filter#run always calls mkpath with :verbose.
48
+ * Fixed: BUILDR-199 ArchiveTask#needed uses 'each' with no effect (Ittay Dror).
49
+ * Fixed: BUILDR-201 Sample project is not valid (Alexis Midon).
50
+ * Fixed: BUILDR-214 Buildr is stuck uploading to sftp repository (Heikki Hulkko).
51
+ * Fixed: BUILDR-216 Profiles documentation is wrong (Shane Witbeck).
52
+ * Fixed: BUILDR-218 Manifest.from_zip fails if the zip doesn't already have
53
+ META-INF/MANIFEST.MF (Joel Muzzerall).
54
+ * Fixed: BUILDR-226 Release task should use XML output of "svn info" instead
55
+ of human-readable output (Alexis Midon).
56
+ * Fixed: BUILDR-230 release task fails if there's a space in the path to the
57
+ Buildfile.
58
+ * Fixed: BUILDR-235 JRuby download link is broke (Alexis Midon).
59
+ * Fixed: BUILDR-239 HTTP redirects lose authentication information (Joel
60
+ Muzzerall).
61
+ * Fixed: BUILDR-240 Make TestNG print traces in the console (Alex Midon).
62
+ * Fixed: BUILDR-241 IDEA7X IPR generation does not pay attention to base_dir
63
+ for submodules (Rhett Sutphin).
64
+ * Fixed: BUILDR-247 OpenObject does not work with Hash#only (Rhett Sutphin).
65
+ * Fixed: BUILDR-253 ZipTask now uses Zlib::DEFAULT_COMPRESSION instead of NO_COMPRESSION
66
+ * Fixed: BUILDR-255 tasks/*.rake files are loaded more than once.
67
+ * Fixed: BUILDR-261 ScalaSpecs should be run with Scala dependencies
68
+ * Fixed: BUILDR-263 package(:war).merge not working correctly with exclude()
69
+ * Fixed: BUILDR-271 Using buildr --environment leads to "Don't know how to
70
+ build task XXX".
71
+ * Fixed: BUILDR-269 rspec bdd is broken (Jeff Hodges)
72
+ * Fixed: BUILDR-272 'rake gem' does not build gem under JRuby (Clinton R.
73
+ Nixon).
74
+ * Remove: BUILDR-215 buildr:freeze and unfreeze tasks don't work since we're
75
+ no longer running with the rake command.
76
+
1
77
  1.3.3 (2008-10-08)
2
78
  * Added: JtestR support. Implemented pending jtestr specs.
3
79
  * Added: Growl notifications (OS X only).
data/NOTICE CHANGED
@@ -1,5 +1,5 @@
1
1
  Apache Buildr
2
- Copyright 2008 The Apache Software Foundation
2
+ Copyright 2007-2009 The Apache Software Foundation
3
3
 
4
4
  This product includes software developed at
5
5
  The Apache Software Foundation (http://www.apache.org/).
@@ -2,8 +2,7 @@
2
2
 
3
3
  This is Buildr, the build system that doesn't suck.
4
4
 
5
- http://incubator.apache.org/buildr/
6
-
5
+ http://buildr.apache.org/
7
6
 
8
7
  == Get Started
9
8
 
@@ -23,21 +22,21 @@ Make sure to set JAVA_HOME environment variable first, then:
23
22
  (Use sudo for Linux and OS X)
24
23
 
25
24
  More installation and setup instructions available online
26
- http://incubator.apache.org/buildr/
25
+ http://buildr.apache.org/
27
26
 
28
27
 
29
28
  === RTFM
30
29
 
31
- * Buildr documentation: http://incubator.apache.org/buildr/
30
+ * Buildr documentation: http://buildr.apache.org/
32
31
  * More about Rake: http://docs.rubyrake.org
33
32
  * Antwrap documentation: http://antwrap.rubyforge.org
34
33
 
35
34
 
36
35
  === Mailing list
37
36
 
38
- Users: http://mail-archives.apache.org/mod_mbox/incubator-buildr-user/
37
+ Users: users-subscribe@buildr.apache.org http://buildr.markmail.org/search/list:users
39
38
 
40
- Developers: http://mail-archives.apache.org/mod_mbox/incubator-buildr-dev/
39
+ Developers: dev-subscribe@buildr.apache.org http://buildr.markmail.org/search/list:dev
41
40
 
42
41
  Create your own Buildfile and start living the life!
43
42
 
@@ -97,14 +96,14 @@ When prompted for a platform, select ruby.
97
96
 
98
97
  You can check the latest sources from SVN:
99
98
 
100
- svn co http://svn.apache.org/repos/asf/incubator/buildr/trunk
99
+ svn co http://svn.apache.org/repos/asf/buildr/trunk
101
100
 
102
101
  Or browse the SVN repository online:
103
- http://svn.apache.org/repos/asf/incubator/buildr
102
+ http://svn.apache.org/repos/asf/buildr
104
103
 
105
- If you prefer Git, a Git fork is available from http://github.com/vic/buildr/tree/master:
104
+ If you prefer Git, a Git fork is available from http://github.com/buildr/buildr/tree/master:
106
105
 
107
- git clone git://github.com/vic/buildr.git
106
+ git clone git://github.com/buildr/buildr.git
108
107
 
109
108
  To install Buildr locally from source:
110
109
 
@@ -133,14 +132,3 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
133
132
  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
134
133
  License for the specific language governing permissions and limitations under
135
134
  the License.
136
-
137
-
138
- == Disclaimer
139
-
140
- Apache Buildr is an effort undergoing incubation at The Apache Software
141
- Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of
142
- all newly accepted projects until a further review indicates that the
143
- infrastructure, communications, and decision making process have stabilized in
144
- a manner consistent with other successful ASF projects. While incubation status
145
- is not necessarily a reflection of the completeness or stability of the code,
146
- it does indicate that the project has yet to be fully endorsed by the ASF.
data/Rakefile CHANGED
@@ -14,49 +14,32 @@
14
14
  # the License.
15
15
 
16
16
 
17
- require 'rake/gempackagetask'
17
+ # We need JAVA_HOME for most things (setup, spec, etc).
18
+ unless ENV['JAVA_HOME']
19
+ if RUBY_PLATFORM[/java/]
20
+ ENV['JAVA_HOME'] = java.lang.System.getProperty('java.home')
21
+ elsif RUBY_PLATFORM[/darwin/]
22
+ ENV['JAVA_HOME'] = '/System/Library/Frameworks/JavaVM.framework/Home'
23
+ else
24
+ fail "Please set JAVA_HOME first (set JAVA_HOME=... or env JAVA_HOME=... rake ...)"
25
+ end
26
+ end
27
+
18
28
 
29
+ # Load the Gem specification for the current platform (Ruby or JRuby).
19
30
  def spec(platform = RUBY_PLATFORM[/java/] || 'ruby')
20
- @specs ||= ['ruby', 'java'].inject({}) { |hash, platform|
21
- $platform = platform
22
- hash.update(platform=>Gem::Specification.load('buildr.gemspec'))
31
+ @specs ||= ['ruby', 'java'].inject({}) { |hash, spec_platform|
32
+ $platform = spec_platform
33
+ hash.update(spec_platform=>Gem::Specification.load('buildr.gemspec'))
23
34
  }
24
35
  @specs[platform]
25
36
  end
26
37
 
27
-
28
- desc 'Compile Java libraries used by Buildr'
29
- task 'compile' do
30
- puts 'Compiling Java libraries ...'
31
- sh File.expand_path('_buildr'), '--buildfile=buildr.buildfile', 'compile'
32
- puts 'OK'
33
- end
34
- file Rake::GemPackageTask.new(spec).package_dir=>'compile'
35
- file Rake::GemPackageTask.new(spec).package_dir_path=>'compile'
36
-
37
- # We also need the other package (JRuby if building on Ruby, and vice versa)
38
- Rake::GemPackageTask.new spec(RUBY_PLATFORM =~ /java/ ? 'ruby' : 'java') do |task|
39
- # Block necessary otherwise doesn't do full job.
38
+ # Tell us if we need sudo for various commands.
39
+ def sudo_needed?
40
+ Config::CONFIG['host_os'] !~ /windows|cygwin|bccwin|cygwin|djgpp|mingw|mswin|wince/i && !ENV['GEM_HOME']
40
41
  end
41
42
 
42
43
 
43
- ENV['incubating'] = 'true'
44
- ENV['staging'] = "people.apache.org:~/public_html/#{spec.name}/#{spec.version}"
45
-
46
- task('apache:license').enhance FileList[spec.files].exclude('.class', '.png', '.jar', '.tif', '.textile', '.icns',
47
- 'README', 'LICENSE', 'CHANGELOG', 'DISCLAIMER', 'NOTICE', 'etc/KEYS', 'etc/git-svn-authors')
48
-
49
- task 'stage:check' do
50
- print 'Checking that we have JRuby, Scala and Groovy available ... '
51
- fail 'Full testing requires JRuby!' unless which('jruby')
52
- fail 'Full testing requires Scala!' unless which('scala')
53
- fail 'Full testing requires Groovy!' unless which('groovy')
54
- puts 'OK'
55
- end
56
-
57
- task 'stage:check' do
58
- # Dependency check for the other platform, i.e. if making a release with Ruby,
59
- # run dependency checks with JRuby. (Also, good opportunity to upgrade other
60
- # platform's dependencies)
61
- sh RUBY_PLATFORM =~ /java/ ? 'ruby' : 'jruby -S rake setup dependency'
62
- end
44
+ desc 'Clean up all temporary directories used for running tests, creating documentation, packaging, etc.'
45
+ task :clobber
data/_buildr CHANGED
@@ -14,25 +14,16 @@
14
14
  # License for the specific language governing permissions and limitations under
15
15
  # the License.
16
16
 
17
+
17
18
  # Run buildr from source, specifically for testing stuff without doing a rake install.
18
- # The _BUILDR_RB environment variable can be used to set the path to the ruby/jruby executable.
19
- # For example to use jruby:
20
- # export _BUILDR_RB=/path/to/jruby
21
19
 
22
- start = Time.now
23
20
  require 'rubygems'
24
21
  $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib') << File.join(File.dirname(__FILE__), 'addon')
25
22
  spec = Gem::Specification.load(File.join(File.dirname(__FILE__), 'buildr.gemspec'))
26
23
  spec.dependencies.each do |dep|
27
24
  gem dep.name, dep.version_requirements.to_s
28
25
  end
26
+ Gem.loaded_specs['buildr'] = spec # Prevents RubyGem from loading files from installed Buildr gems
27
+
29
28
  require 'buildr'
30
29
  Buildr.application.run
31
- if verbose
32
- elapsed = Time.now - start
33
- real = []
34
- real << ("%ih" % (elapsed / 3600)) if elapsed >= 3600
35
- real << ("%im" % ((elapsed / 60) % 60)) if elapsed >= 60
36
- real << ("%.3fs" % (elapsed % 60))
37
- puts $terminal.color("Completed in #{real.join}", :green)
38
- end
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env jruby
1
2
  # Licensed to the Apache Software Foundation (ASF) under one or more
2
3
  # contributor license agreements. See the NOTICE file distributed with this
3
4
  # work for additional information regarding copyright ownership. The ASF
@@ -13,17 +14,16 @@
13
14
  # License for the specific language governing permissions and limitations under
14
15
  # the License.
15
16
 
16
- - Welcome: index.html
17
- - Getting Started: getting_started.html
18
- - Projects: projects.html
19
- - Building: building.html
20
- - Artifacts: artifacts.html
21
- - Packaging: packaging.html
22
- - Testing: testing.html
23
- - Settings/Profiles: settings_profiles.html
24
- - Languages: languages.html
25
- - More Stuff: more_stuff.html
26
- - Extending: extending.html
27
- - Recipes: recipes.html
28
- - Troubleshooting: troubleshooting.html
29
- - Contributing: contributing.html
17
+
18
+ # Run buildr from source, specifically for testing stuff without doing a rake install.
19
+
20
+ require 'rubygems'
21
+ $LOAD_PATH << File.join(File.dirname(__FILE__), 'lib') << File.join(File.dirname(__FILE__), 'addon')
22
+ spec = Gem::Specification.load(File.join(File.dirname(__FILE__), 'buildr.gemspec'))
23
+ spec.dependencies.each do |dep|
24
+ gem dep.name, dep.version_requirements.to_s
25
+ end
26
+ Gem.loaded_specs['buildr'] = spec # Prevents RubyGem from loading files from installed Buildr gems
27
+
28
+ require 'buildr'
29
+ Buildr.application.run
@@ -14,223 +14,9 @@
14
14
  # the License.
15
15
 
16
16
 
17
- require 'buildr/java'
18
-
19
-
20
- module Buildr
21
-
22
- # Provides the <code>cobertura:html</code> and <code>cobertura:xml</code> tasks.
23
- # Require explicitly using <code>require "buildr/cobertura"</code>.
24
- #
25
- # You can generate cobertura reports for a single project
26
- # using the project name as prefix:
27
- #
28
- # project_name:cobertura:html
29
- #
30
- # You can also specify which classes to include/exclude from instrumentation by
31
- # passing a class name regexp to the <code>cobertura.include</code> or
32
- # <code>cobertura.exclude</code> methods.
33
- #
34
- # define 'someModule' do
35
- # cobertura.include 'some.package.*'
36
- # cobertura.include /some.(foo|bar).*/
37
- # cobertura.exclude 'some.foo.util.SimpleUtil'
38
- # cobertura.exclude /*.Const(ants)?/i
39
- # end
40
- module Cobertura
41
-
42
- class << self
43
-
44
- REQUIRES = ["net.sourceforge.cobertura:cobertura:jar:1.9", "log4j:log4j:jar:1.2.9",
45
- "asm:asm:jar:2.2.1", "asm:asm-tree:jar:2.2.1", "oro:oro:jar:2.0.8"] unless const_defined?('REQUIRES')
46
-
47
- def requires()
48
- @requires ||= Buildr.artifacts(REQUIRES).each(&:invoke).map(&:to_s)
49
- end
50
-
51
- def report_to(file = nil)
52
- File.expand_path(File.join(*["reports/cobertura", file.to_s].compact))
53
- end
54
-
55
- def data_file()
56
- File.expand_path("reports/cobertura.ser")
57
- end
58
-
59
- end
60
-
61
- class CoberturaConfig # :nodoc:
62
-
63
- def initialize(project)
64
- @project = project
65
- end
66
-
67
- attr_reader :project
68
- private :project
69
-
70
- attr_writer :data_file, :instrumented_dir, :report_dir
71
-
72
- def data_file
73
- @data_file ||= project.path_to(:reports, 'cobertura.ser')
74
- end
75
-
76
- def instrumented_dir
77
- @instrumented_dir ||= project.path_to(:target, :instrumented, :classes)
78
- end
79
-
80
- def report_dir
81
- @report_dir ||= project.path_to(:reports, :cobertura)
82
- end
83
-
84
- def report_to(file = nil)
85
- File.expand_path(File.join(*[report_dir, file.to_s].compact))
86
- end
87
-
88
- # :call-seq:
89
- # project.cobertura.include(*classPatterns)
90
- #
91
- def include(*classPatterns)
92
- includes.push(*classPatterns.map { |p| String === p ? Regexp.new(p) : p })
93
- self
94
- end
95
-
96
- def includes
97
- @includeClasses ||= []
98
- end
99
-
100
- # :call-seq:
101
- # project.cobertura.exclude(*classPatterns)
102
- #
103
- def exclude(*classPatterns)
104
- excludes.push(*classPatterns.map { |p| String === p ? Regexp.new(p) : p })
105
- self
106
- end
107
-
108
- def excludes
109
- @excludeClasses ||= []
110
- end
111
-
112
- def sources
113
- project.compile.sources
114
- end
115
- end
116
-
117
- module CoberturaExtension # :nodoc:
118
- include Buildr::Extension
119
-
120
- def cobertura
121
- @cobertura_config ||= CoberturaConfig.new(self)
122
- end
123
-
124
- after_define do |project|
125
- cobertura = project.cobertura
126
-
127
- namespace 'cobertura' do
128
- unless project.compile.target.nil?
129
- # Instrumented bytecode goes in a different directory. This task creates before running the test
130
- # cases and monitors for changes in the generate bytecode.
131
- instrumented = project.file(cobertura.instrumented_dir => project.compile.target) do |task|
132
- mkdir_p task.to_s, :verbose => false
133
- unless project.compile.sources.empty?
134
- info "Instrumenting classes with cobertura data file #{cobertura.data_file}"
135
- Buildr.ant "cobertura" do |ant|
136
- ant.taskdef :classpath=>Cobertura.requires.join(File::PATH_SEPARATOR), :resource=>"tasks.properties"
137
- ant.send "cobertura-instrument", :todir=>task.to_s, :datafile=>cobertura.data_file do
138
- includes, excludes = cobertura.includes, cobertura.excludes
139
-
140
- classes_dir = project.compile.target.to_s
141
- if includes.empty? && excludes.empty?
142
- ant.fileset :dir => classes_dir do
143
- ant.include :name => "**/*.class"
144
- end
145
- else
146
- includes = [//] if includes.empty?
147
- Dir.glob(File.join(classes_dir, "**/*.class")) do |cls|
148
- cls_name = cls.gsub(/#{classes_dir}\/?|\.class$/, '').gsub('/', '.')
149
- if includes.any? { |p| p === cls_name } && !excludes.any? { |p| p === cls_name }
150
- ant.fileset :file => cls
151
- end
152
- end
153
- end
154
- end
155
- end
156
- end
157
- touch task.to_s, :verbose=>false
158
- end
159
-
160
- task 'instrument' => instrumented
161
-
162
- # We now have two target directories with bytecode. It would make sense to remove compile.target
163
- # and add instrumented instead, but apparently Cobertura only creates some of the classes, so
164
- # we need both directories and instrumented must come first.
165
- project.test.dependencies.unshift cobertura.instrumented_dir
166
- project.test.with Cobertura.requires
167
- project.test.options[:properties]["net.sourceforge.cobertura.datafile"] = cobertura.data_file
168
-
169
- [:xml, :html].each do |format|
170
- task format => ['instrument', 'test'] do
171
- info "Creating test coverage reports in #{cobertura.report_to(format)}"
172
- Buildr.ant "cobertura" do |ant|
173
- ant.taskdef :classpath=>Cobertura.requires.join(File::PATH_SEPARATOR), :resource=>"tasks.properties"
174
- ant.send "cobertura-report", :format=>format,
175
- :destdir=>cobertura.report_to(format), :datafile=>cobertura.data_file do
176
- cobertura.sources.flatten.each do |src|
177
- ant.fileset(:dir=>src.to_s) if File.exist?(src.to_s)
178
- end
179
- end
180
- end
181
- end
182
- end
183
- end
184
-
185
- end
186
-
187
- project.clean do
188
- rm_rf [cobertura.report_to, cobertura.data_file, cobertura.instrumented_dir], :verbose=>false
189
- end
190
-
191
- end
192
-
193
- end
194
-
195
- class Buildr::Project
196
- include CoberturaExtension
197
- end
198
-
199
- namespace "cobertura" do
200
-
201
- task "instrument" do
202
- Buildr.projects.each do |project|
203
- project.cobertura.data_file = data_file
204
- project.test.options[:properties]["net.sourceforge.cobertura.datafile"] = data_file
205
- instrument_task ="#{project.name}:cobertura:instrument"
206
- task(instrument_task).invoke if Rake::Task.task_defined?(instrument_task)
207
- end
208
- end
209
-
210
- [:xml, :html].each do |format|
211
- report_target = report_to(format)
212
- desc "Run the test cases and produce code coverage reports in #{report_target}"
213
- task format => ["instrument", "test"] do
214
- info "Creating test coverage reports in #{report_target}"
215
- Buildr.ant "cobertura" do |ant|
216
- ant.taskdef :classpath=>requires.join(File::PATH_SEPARATOR), :resource=>"tasks.properties"
217
- ant.send "cobertura-report", :destdir=>report_target, :format=>format, :datafile=>data_file do
218
- Buildr.projects.map(&:cobertura).map(&:sources).flatten.each do |src|
219
- ant.fileset :dir=>src.to_s if File.exist?(src.to_s)
220
- end
221
- end
222
- end
223
- end
224
- end
225
-
226
- task "clean" do
227
- rm_rf [report_to, data_file], :verbose=>false
228
- end
229
- end
230
-
231
- task "clean" do
232
- task("cobertura:clean").invoke if Dir.pwd == Rake.application.original_dir
233
- end
234
-
235
- end
17
+ if Buildr::VERSION < '1.5'
18
+ Buildr.application.deprecated "'buildr/cobertura', use 'buildr/java/cobertura' instead"
19
+ require 'buildr/java/cobertura'
20
+ else
21
+ raise "#{__FILE__} should be removed since its use is deprecated since version 1.3.4"
236
22
  end