mguymon-buildr 1.4.5-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. data/CHANGELOG +1291 -0
  2. data/LICENSE +176 -0
  3. data/NOTICE +26 -0
  4. data/README.rdoc +134 -0
  5. data/Rakefile +44 -0
  6. data/_buildr +35 -0
  7. data/_jbuildr +35 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/bnd.rb +147 -0
  10. data/addon/buildr/cobertura.rb +22 -0
  11. data/addon/buildr/drb.rb +281 -0
  12. data/addon/buildr/emma.rb +22 -0
  13. data/addon/buildr/hibernate.rb +149 -0
  14. data/addon/buildr/javacc.rb +85 -0
  15. data/addon/buildr/jaxb_xjc.rb +72 -0
  16. data/addon/buildr/jdepend.rb +60 -0
  17. data/addon/buildr/jetty.rb +248 -0
  18. data/addon/buildr/jibx.rb +86 -0
  19. data/addon/buildr/nailgun.rb +221 -0
  20. data/addon/buildr/openjpa.rb +88 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  22. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  23. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  26. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  27. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  28. data/addon/buildr/protobuf.rb +88 -0
  29. data/addon/buildr/xmlbeans.rb +93 -0
  30. data/bin/buildr +19 -0
  31. data/buildr.buildfile +58 -0
  32. data/buildr.gemspec +78 -0
  33. data/doc/_config.yml +1 -0
  34. data/doc/_layouts/default.html +90 -0
  35. data/doc/_layouts/preface.html +22 -0
  36. data/doc/artifacts.textile +217 -0
  37. data/doc/building.textile +276 -0
  38. data/doc/contributing.textile +268 -0
  39. data/doc/css/default.css +236 -0
  40. data/doc/css/print.css +101 -0
  41. data/doc/css/syntax.css +23 -0
  42. data/doc/download.textile +151 -0
  43. data/doc/extending.textile +212 -0
  44. data/doc/images/1442160941-frontcover.jpg +0 -0
  45. data/doc/images/asf-logo.gif +0 -0
  46. data/doc/images/asf-logo.png +0 -0
  47. data/doc/images/buildr-hires.png +0 -0
  48. data/doc/images/buildr.png +0 -0
  49. data/doc/images/favicon.png +0 -0
  50. data/doc/images/growl-icon.tiff +0 -0
  51. data/doc/images/note.png +0 -0
  52. data/doc/images/project-structure.png +0 -0
  53. data/doc/images/tip.png +0 -0
  54. data/doc/images/zbuildr.png +0 -0
  55. data/doc/images/zbuildr.tif +0 -0
  56. data/doc/index.textile +109 -0
  57. data/doc/installing.textile +284 -0
  58. data/doc/languages.textile +599 -0
  59. data/doc/mailing_lists.textile +29 -0
  60. data/doc/more_stuff.textile +845 -0
  61. data/doc/packaging.textile +618 -0
  62. data/doc/preface.textile +54 -0
  63. data/doc/projects.textile +276 -0
  64. data/doc/quick_start.textile +210 -0
  65. data/doc/releasing.textile +117 -0
  66. data/doc/scripts/buildr-git.rb +512 -0
  67. data/doc/scripts/gitflow.rb +296 -0
  68. data/doc/scripts/install-jruby.sh +44 -0
  69. data/doc/scripts/install-linux.sh +73 -0
  70. data/doc/scripts/install-osx.sh +52 -0
  71. data/doc/settings_profiles.textile +287 -0
  72. data/doc/testing.textile +247 -0
  73. data/etc/KEYS +189 -0
  74. data/lib/buildr.rb +44 -0
  75. data/lib/buildr/clojure.rb +34 -0
  76. data/lib/buildr/clojure/shell.rb +52 -0
  77. data/lib/buildr/core.rb +34 -0
  78. data/lib/buildr/core/application.rb +700 -0
  79. data/lib/buildr/core/build.rb +516 -0
  80. data/lib/buildr/core/cc.rb +166 -0
  81. data/lib/buildr/core/checks.rb +253 -0
  82. data/lib/buildr/core/common.rb +151 -0
  83. data/lib/buildr/core/compile.rb +622 -0
  84. data/lib/buildr/core/doc.rb +276 -0
  85. data/lib/buildr/core/environment.rb +129 -0
  86. data/lib/buildr/core/filter.rb +404 -0
  87. data/lib/buildr/core/generate.rb +197 -0
  88. data/lib/buildr/core/help.rb +119 -0
  89. data/lib/buildr/core/jrebel.rb +42 -0
  90. data/lib/buildr/core/linux.rb +30 -0
  91. data/lib/buildr/core/osx.rb +46 -0
  92. data/lib/buildr/core/progressbar.rb +161 -0
  93. data/lib/buildr/core/project.rb +975 -0
  94. data/lib/buildr/core/run.rb +43 -0
  95. data/lib/buildr/core/shell.rb +137 -0
  96. data/lib/buildr/core/test.rb +843 -0
  97. data/lib/buildr/core/transports.rb +575 -0
  98. data/lib/buildr/core/util.rb +537 -0
  99. data/lib/buildr/groovy.rb +20 -0
  100. data/lib/buildr/groovy/bdd.rb +106 -0
  101. data/lib/buildr/groovy/compiler.rb +153 -0
  102. data/lib/buildr/groovy/doc.rb +76 -0
  103. data/lib/buildr/groovy/shell.rb +57 -0
  104. data/lib/buildr/ide.rb +19 -0
  105. data/lib/buildr/ide/eclipse.rb +427 -0
  106. data/lib/buildr/ide/eclipse/java.rb +53 -0
  107. data/lib/buildr/ide/eclipse/plugin.rb +71 -0
  108. data/lib/buildr/ide/eclipse/scala.rb +68 -0
  109. data/lib/buildr/ide/idea.rb +576 -0
  110. data/lib/buildr/java.rb +25 -0
  111. data/lib/buildr/java/ant.rb +94 -0
  112. data/lib/buildr/java/bdd.rb +460 -0
  113. data/lib/buildr/java/cobertura.rb +297 -0
  114. data/lib/buildr/java/commands.rb +223 -0
  115. data/lib/buildr/java/compiler.rb +135 -0
  116. data/lib/buildr/java/deprecated.rb +141 -0
  117. data/lib/buildr/java/doc.rb +86 -0
  118. data/lib/buildr/java/ecj.rb +69 -0
  119. data/lib/buildr/java/emma.rb +244 -0
  120. data/lib/buildr/java/external.rb +73 -0
  121. data/lib/buildr/java/jruby.rb +122 -0
  122. data/lib/buildr/java/jtestr_result.rb +295 -0
  123. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  124. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  125. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
  126. data/lib/buildr/java/packaging.rb +734 -0
  127. data/lib/buildr/java/pom.rb +178 -0
  128. data/lib/buildr/java/rjb.rb +154 -0
  129. data/lib/buildr/java/test_result.rb +101 -0
  130. data/lib/buildr/java/tests.rb +362 -0
  131. data/lib/buildr/java/version_requirement.rb +172 -0
  132. data/lib/buildr/packaging.rb +25 -0
  133. data/lib/buildr/packaging/archive.rb +535 -0
  134. data/lib/buildr/packaging/artifact.rb +904 -0
  135. data/lib/buildr/packaging/artifact_namespace.rb +984 -0
  136. data/lib/buildr/packaging/artifact_search.rb +140 -0
  137. data/lib/buildr/packaging/gems.rb +105 -0
  138. data/lib/buildr/packaging/package.rb +249 -0
  139. data/lib/buildr/packaging/repository_array.rb +108 -0
  140. data/lib/buildr/packaging/tar.rb +189 -0
  141. data/lib/buildr/packaging/version_requirement.rb +192 -0
  142. data/lib/buildr/packaging/zip.rb +178 -0
  143. data/lib/buildr/packaging/ziptask.rb +356 -0
  144. data/lib/buildr/resources/buildr.icns +0 -0
  145. data/lib/buildr/resources/completed.png +0 -0
  146. data/lib/buildr/resources/failed.png +0 -0
  147. data/lib/buildr/resources/icons-license.txt +17 -0
  148. data/lib/buildr/run.rb +195 -0
  149. data/lib/buildr/scala.rb +26 -0
  150. data/lib/buildr/scala/bdd.rb +118 -0
  151. data/lib/buildr/scala/compiler.rb +242 -0
  152. data/lib/buildr/scala/doc.rb +142 -0
  153. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  154. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
  155. data/lib/buildr/scala/shell.rb +52 -0
  156. data/lib/buildr/scala/tests.rb +171 -0
  157. data/lib/buildr/shell.rb +185 -0
  158. data/lib/buildr/version.rb +18 -0
  159. data/rakelib/all-in-one.rake +113 -0
  160. data/rakelib/checks.rake +57 -0
  161. data/rakelib/doc.rake +137 -0
  162. data/rakelib/metrics.rake +39 -0
  163. data/rakelib/package.rake +73 -0
  164. data/rakelib/release.rake +160 -0
  165. data/rakelib/rspec.rake +91 -0
  166. data/rakelib/setup.rake +66 -0
  167. data/rakelib/stage.rake +220 -0
  168. data/spec/addon/bnd_spec.rb +330 -0
  169. data/spec/addon/drb_spec.rb +328 -0
  170. data/spec/addon/jaxb_xjc_spec.rb +125 -0
  171. data/spec/core/application_spec.rb +631 -0
  172. data/spec/core/build_spec.rb +837 -0
  173. data/spec/core/cc_spec.rb +224 -0
  174. data/spec/core/checks_spec.rb +519 -0
  175. data/spec/core/common_spec.rb +725 -0
  176. data/spec/core/compile_spec.rb +658 -0
  177. data/spec/core/doc_spec.rb +195 -0
  178. data/spec/core/extension_spec.rb +201 -0
  179. data/spec/core/generate_spec.rb +33 -0
  180. data/spec/core/project_spec.rb +772 -0
  181. data/spec/core/run_spec.rb +93 -0
  182. data/spec/core/shell_spec.rb +146 -0
  183. data/spec/core/test_spec.rb +1320 -0
  184. data/spec/core/transport_spec.rb +544 -0
  185. data/spec/core/util_spec.rb +141 -0
  186. data/spec/groovy/bdd_spec.rb +80 -0
  187. data/spec/groovy/compiler_spec.rb +251 -0
  188. data/spec/groovy/doc_spec.rb +65 -0
  189. data/spec/ide/eclipse_spec.rb +739 -0
  190. data/spec/ide/idea_spec.rb +1145 -0
  191. data/spec/java/ant_spec.rb +37 -0
  192. data/spec/java/bdd_spec.rb +374 -0
  193. data/spec/java/cobertura_spec.rb +112 -0
  194. data/spec/java/commands_spec.rb +93 -0
  195. data/spec/java/compiler_spec.rb +252 -0
  196. data/spec/java/doc_spec.rb +56 -0
  197. data/spec/java/ecj_spec.rb +115 -0
  198. data/spec/java/emma_spec.rb +121 -0
  199. data/spec/java/external_spec.rb +56 -0
  200. data/spec/java/java_spec.rb +132 -0
  201. data/spec/java/packaging_spec.rb +1266 -0
  202. data/spec/java/run_spec.rb +78 -0
  203. data/spec/java/test_coverage_helper.rb +257 -0
  204. data/spec/java/tests_spec.rb +497 -0
  205. data/spec/packaging/archive_spec.rb +775 -0
  206. data/spec/packaging/artifact_namespace_spec.rb +743 -0
  207. data/spec/packaging/artifact_spec.rb +1074 -0
  208. data/spec/packaging/packaging_helper.rb +63 -0
  209. data/spec/packaging/packaging_spec.rb +719 -0
  210. data/spec/packaging/repository_array_spec.rb +109 -0
  211. data/spec/sandbox.rb +165 -0
  212. data/spec/scala/bdd_spec.rb +124 -0
  213. data/spec/scala/compiler_spec.rb +289 -0
  214. data/spec/scala/doc_spec.rb +88 -0
  215. data/spec/scala/scala.rb +38 -0
  216. data/spec/scala/tests_spec.rb +283 -0
  217. data/spec/spec_helpers.rb +369 -0
  218. data/spec/version_requirement_spec.rb +143 -0
  219. data/spec/xpath_matchers.rb +121 -0
  220. metadata +600 -0
@@ -0,0 +1,91 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+ begin
17
+ require 'rspec/core/rake_task'
18
+ directory '_reports'
19
+
20
+ def default_spec_opts
21
+ default = %w{--format documentation --out _reports/specs.txt --backtrace}
22
+ default << '--colour' if $stdout.isatty && !(Config::CONFIG['host_os'] =~ /mswin|win32|dos/i)
23
+ default
24
+ end
25
+
26
+ # RSpec doesn't support file exclusion, so hack our own.
27
+ class RSpec::Core::RakeTask
28
+ attr_accessor :rspec_files
29
+ private
30
+ def files_to_run
31
+ @rspec_files
32
+ end
33
+ end
34
+
35
+ desc "Run all specs"
36
+ RSpec::Core::RakeTask.new :spec=>['_reports', :compile] do |task|
37
+ ENV['USE_FSC'] = 'no'
38
+ task.rspec_files = FileList['spec/**/*_spec.rb']
39
+ task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
40
+ task.rspec_opts = default_spec_opts
41
+ task.rspec_opts = %w{--format html --out _reports/specs.html --backtrace}
42
+ end
43
+ file('_reports/specs.html') { task(:spec).invoke }
44
+
45
+ desc 'Run RSpec and generate Spec and coverage reports (slow)'
46
+ RSpec::Core::RakeTask.new :coverage=>['_reports', :compile] do |task|
47
+ ENV['USE_FSC'] = 'no'
48
+ task.rspec_files = FileList['spec/**/*_spec.rb']
49
+ task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
50
+ task.rspec_opts = default_spec_opts
51
+ task.rcov = true
52
+ task.rcov_opts = %w{-o _reports/coverage --exclude / --include-file ^lib --text-summary}
53
+ end
54
+ file('_reports/coverage') { task(:coverage).invoke }
55
+
56
+ task :load_ci_reporter do
57
+ gem 'ci_reporter'
58
+ ENV['CI_REPORTS'] = '_reports/ci'
59
+ # CI_Reporter does not quote the path to rspec_loader which causes problems when ruby is installed in C:/Program Files
60
+ ci_rep_path = Gem.loaded_specs['ci_reporter'].full_gem_path
61
+ ENV["SPEC_OPTS"] = [ENV["SPEC_OPTS"], default_spec_opts, "--require", "\"#{ci_rep_path}/lib/ci/reporter/rake/rspec_loader.rb\"", "--format", "CI::Reporter::RSpec"].join(" ")
62
+ end
63
+
64
+ desc 'Run all specs with CI reporter'
65
+ task :ci=>[:load_ci_reporter, :spec]
66
+
67
+ # Useful for testing with JRuby when using Ruby and vice versa.
68
+ namespace :spec do
69
+ desc "Run all specs specifically with Ruby"
70
+ task :ruby do
71
+ puts "Running test suite using Ruby ..."
72
+ sh 'ruby -S rake spec'
73
+ end
74
+
75
+ desc "Run all specs specifically with JRuby"
76
+ task :jruby do
77
+ puts "Running test suite using JRuby ..."
78
+ sh 'jruby -S rake spec'
79
+ end
80
+ end
81
+
82
+ task :clobber do
83
+ rm_f 'failed'
84
+ rm_rf '_reports'
85
+ end
86
+
87
+ rescue LoadError => e
88
+ puts "Buildr uses RSpec. You can install it by running rake setup"
89
+ task(:setup) { install_gem 'rcov', :version=>'~>0.8' }
90
+ task(:setup) { install_gem 'win32console' if RUBY_PLATFORM[/win32/] } # Colors for RSpec, only on Windows platform.
91
+ end
@@ -0,0 +1,66 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ require 'jruby' if RUBY_PLATFORM[/java/]
18
+ require 'rubygems/source_info_cache' if Gem::VERSION =~ /1.[0-4]/
19
+
20
+ RAKE_SUDO = case (ENV['RAKE_SUDO'] or 'false').strip.downcase
21
+ when 'yes', 'true'
22
+ true
23
+ else
24
+ false
25
+ end
26
+
27
+ # Install the specified gem. Options include:
28
+ # - :version -- Version requirement, e.g. '1.2' or '~> 1.2'
29
+ # - :source -- Gem repository, e.g. 'http://gems.github.com'
30
+ def install_gem(name, options = {})
31
+ dep = Gem::Dependency.new(name, options[:version] || '>0')
32
+ if Gem::SourceIndex.from_installed_gems.search(dep).empty?
33
+ puts "Installing #{name} ..."
34
+ rb_bin = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
35
+ args = []
36
+ args << 'sudo' << 'env' << "JAVA_HOME=#{ENV['JAVA_HOME']}" if sudo_needed? and RAKE_SUDO
37
+ args << rb_bin << '-S' << 'gem' << 'install' << name
38
+
39
+ if (dep.respond_to? :requirement)
40
+ args << '--version' << dep.requirement.to_s
41
+ else
42
+ # Dependency.version_requirements deprecated in rubygems 1.3.6
43
+ args << '--version' << dep.version_requirements.to_s
44
+ end
45
+
46
+ args << '--source' << options[:source] if options[:source]
47
+ args << '--source' << 'http://gems.rubyforge.org'
48
+ args << '--install-dir' << ENV['GEM_HOME'] if ENV['GEM_HOME']
49
+ sh *args
50
+ end
51
+ end
52
+
53
+
54
+ # Setup environment for running this Rakefile (RSpec, Jekyll, etc).
55
+ desc "If you're building from sources, run this task first to setup the necessary dependencies."
56
+ task :setup do
57
+ missing = spec.dependencies.select { |dep| Gem::SourceIndex.from_installed_gems.search(dep).empty? }
58
+ missing.each do |dep|
59
+ if (dep.respond_to? :requirement)
60
+ install_gem dep.name, :version=>dep.requirement
61
+ else
62
+ # Dependency.version_requirements deprecated in rubygems 1.3.6
63
+ install_gem dep.name, :version=>dep.version_requirements
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,220 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ require 'digest/md5'
18
+ require 'digest/sha1'
19
+
20
+ begin # Releases upload Gems to RubyForge.
21
+ require 'rubyforge'
22
+ rescue LoadError
23
+ task(:setup) { install_gem 'rubyforge' }
24
+ end
25
+
26
+ gpg_cmd = 'gpg2'
27
+
28
+ task :prepare do |task, args|
29
+ # Make sure we're doing a release from checked code.
30
+ lambda do
31
+ puts "Checking there are no local changes ... "
32
+ svn = `svn status`
33
+ fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
34
+ git = `git status`
35
+ fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^#\t/]
36
+ puts "[X] There are no local changes, everything is in source control"
37
+ end.call
38
+
39
+ # Make sure we have a valid CHANGELOG entry for this release.
40
+ lambda do
41
+ puts "Checking that CHANGELOG indicates most recent version and today's date ... "
42
+ expecting = "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
43
+ header = File.readlines('CHANGELOG').first.chomp
44
+ fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
45
+ puts "[x] CHANGELOG indicates most recent version and today's date"
46
+ end.call
47
+
48
+ # Need GPG to sign the packages.
49
+ lambda do
50
+ args.gpg or fail "Please run with gpg=<argument for gpg --local-user>"
51
+ gpg_ok = `gpg2 --list-keys #{args.gpg}`
52
+ if !$?.success?
53
+ gpg_ok = `gpg --list-keys #{args.gpg}`
54
+ gpg_cmd = 'gpg'
55
+ end
56
+ fail "No GPG user #{args.gpg}" if gpg_ok.empty?
57
+ end.call
58
+
59
+ task(:license).invoke
60
+ task(:dependency).invoke
61
+
62
+ # Need JRuby, Scala and Groovy installed to run all the specs.
63
+ lambda do
64
+ puts "Checking that we have JRuby, Scala and Groovy available ... "
65
+ sh 'jruby --version'
66
+ sh 'scala -version'
67
+ sh 'groovy -version'
68
+ puts "[X] We have JRuby, Scala and Groovy"
69
+ end.call
70
+
71
+ # Need Prince to generate PDF
72
+ lambda do
73
+ puts "Checking that we have prince available ... "
74
+ sh 'prince --version'
75
+ puts "[X] We have prince available"
76
+ end.call
77
+
78
+ # Need RubyForge to upload new release files.
79
+ lambda do
80
+ puts "[!] Make sure you have admin privileges to make a release on RubyForge"
81
+ rubyforge = RubyForge.new.configure
82
+ rubyforge.login
83
+ rubyforge.scrape_project(spec.name)
84
+ end.call
85
+
86
+ # We will be speccing in one platform, so also spec the other one.
87
+ task(RUBY_PLATFORM =~ /java/ ? 'spec:ruby' : 'spec:jruby').invoke # Test the *other* platform
88
+ end
89
+
90
+
91
+ task :stage=>['setup', 'doc:setup', :clobber, :prepare] do |task, args|
92
+ mkpath '_staged'
93
+
94
+ # Start by figuring out what has changed.
95
+ lambda do
96
+ puts "Looking for changes between this release and previous one ..."
97
+ pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
98
+ changes = File.read('CHANGELOG').scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
99
+ current = changes[spec.version.to_s]
100
+ fail "No changeset found for version #{spec.version}" unless current
101
+ File.open '_staged/CHANGES', 'w' do |file|
102
+ file.write "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})\n"
103
+ file.write current
104
+ end
105
+ puts "[X] Listed most recent changed in _staged/CHANGES"
106
+ end.call
107
+
108
+ # Create the packages (gem, tarball) and sign them. This requires user
109
+ # intervention so the earlier we do it the better.
110
+ lambda do
111
+ puts "Creating and signing release packages ..."
112
+ task(:package).invoke
113
+ mkpath '_staged/dist'
114
+ FileList['pkg/*.{gem,zip,tgz}'].each do |source|
115
+ pkg = source.pathmap('_staged/dist/%n%x')
116
+ cp source, pkg
117
+ bytes = File.open(pkg, 'rb') { |file| file.read }
118
+ File.open(pkg + '.md5', 'w') { |file| file.write Digest::MD5.hexdigest(bytes) << ' ' << File.basename(pkg) }
119
+ File.open(pkg + '.sha1', 'w') { |file| file.write Digest::SHA1.hexdigest(bytes) << ' ' << File.basename(pkg) }
120
+ sh gpg_cmd, '--local-user', args.gpg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
121
+ end
122
+ cp 'etc/KEYS', '_staged/dist'
123
+ puts "[X] Created and signed release packages in _staged/dist"
124
+ end.call
125
+
126
+ # The download page should link to the new binaries/sources, and we
127
+ # want to do that before generating the site/documentation.
128
+ lambda do
129
+ puts "Updating download page with links to release packages ... "
130
+ mirror = "http://www.apache.org/dyn/closer.cgi/#{spec.name}/#{spec.version}"
131
+ official = "http://www.apache.org/dist/#{spec.name}/#{spec.version}"
132
+ rows = FileList['_staged/dist/*.{gem,tgz,zip}'].map { |pkg|
133
+ name, md5 = File.basename(pkg), Digest::MD5.file(pkg).to_s
134
+ %{| "#{name}":#{mirror}/#{name} | "#{md5}":#{official}/#{name}.md5 | "Sig":#{official}/#{name}.asc |}
135
+ }
136
+ textile = <<-TEXTILE
137
+ h3. #{spec.name} #{spec.version} (#{Time.now.strftime('%Y-%m-%d')})
138
+
139
+ |_. Package |_. MD5 Checksum |_. PGP |
140
+ #{rows.join("\n")}
141
+
142
+ p>. ("Release signing keys":#{official}/KEYS)
143
+ TEXTILE
144
+ file_name = 'doc/download.textile'
145
+ print "Adding download links to #{file_name} ... "
146
+ modified = File.read(file_name).sub(/^h2\(#dist\).*$/) { |header| "#{header}\n\n#{textile}" }
147
+ File.open file_name, 'w' do |file|
148
+ file.write modified
149
+ end
150
+ puts "[X] Updated #{file_name}"
151
+ end.call
152
+
153
+
154
+ # Now we can create the Web site, this includes running specs, coverage report, etc.
155
+ # This will take a while, so we want to do it as last step before upload.
156
+ lambda do
157
+ puts "Creating new Web site"
158
+ task(:site).invoke
159
+ cp_r '_site', '_staged/site'
160
+ puts "[X] Created new Web site in _staged/site"
161
+ end.call
162
+
163
+
164
+ # Move everything over to people.apache.org so we can vote on it.
165
+ lambda do
166
+ url = "people.apache.org:~/public_html/#{spec.name}/#{spec.version}"
167
+ puts "Uploading _staged directory to #{url} ..."
168
+ sh 'rsync', '--progress', '--recursive', '_staged/', url
169
+ puts "[X] Uploaded _staged directory to #{url}"
170
+ end.call
171
+
172
+
173
+ # Prepare a release vote email. In the distant future this will also send the
174
+ # email for you and vote on it.
175
+ lambda do
176
+ # Need to know who you are on Apache, local user may be different (see .ssh/config).
177
+ whoami = `ssh people.apache.org whoami`.strip
178
+ base_url = "http://people.apache.org/~#{whoami}/buildr/#{spec.version}"
179
+ # Need changes for this release only.
180
+ changelog = File.read('CHANGELOG').scan(/(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/)
181
+ changes = changelog[0][2]
182
+ previous_version = changelog[1][1]
183
+
184
+ email = <<-EMAIL
185
+ To: dev@buildr.apache.org
186
+ Subject: [VOTE] Buildr #{spec.version} release
187
+
188
+ We're voting on the source distributions available here:
189
+ #{base_url}/dist/
190
+
191
+ Specifically:
192
+ #{base_url}/dist/buildr-#{spec.version}.tgz
193
+ #{base_url}/dist/buildr-#{spec.version}.zip
194
+
195
+ The documentation generated for this release is available here:
196
+ #{base_url}/site/
197
+ #{base_url}/site/buildr.pdf
198
+
199
+ The official specification against which this release was tested:
200
+ #{base_url}/site/specs.html
201
+
202
+ Test coverage report:
203
+ #{base_url}/site/coverage/index.html
204
+
205
+
206
+ The following changes were made since #{previous_version}:
207
+
208
+ #{changes.gsub(/^/, ' ')}
209
+ EMAIL
210
+ File.open 'vote-email.txt', 'w' do |file|
211
+ file.write email
212
+ end
213
+ puts "[X] Created release vote email template in 'vote-email.txt'"
214
+ puts email
215
+ end.call
216
+
217
+ end
218
+
219
+
220
+ task(:clobber) { rm_rf '_staged' }
@@ -0,0 +1,330 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ require File.expand_path('../spec_helpers', File.dirname(__FILE__))
18
+ Sandbox.require_optional_extension 'buildr/bnd'
19
+
20
+ def open_zip_file(file = 'target/foo-2.1.3.jar')
21
+ jar_filename = @foo._(file)
22
+ File.should be_exist(jar_filename)
23
+ Zip::ZipFile.open(jar_filename) do |zip|
24
+ yield zip
25
+ end
26
+ end
27
+
28
+ def open_main_manifest_section(file = 'target/foo-2.1.3.jar')
29
+ jar_filename = @foo._(file)
30
+ File.should be_exist(jar_filename)
31
+ yield Buildr::Packaging::Java::Manifest.from_zip(jar_filename).main
32
+ end
33
+
34
+ describe Buildr::Bnd do
35
+
36
+ describe "package :bundle" do
37
+ describe "with a valid bundle" do
38
+ before do
39
+ write "src/main/java/com/biz/Foo.java", <<SRC
40
+ package com.biz;
41
+ public class Foo {}
42
+ SRC
43
+ write "src/main/resources/IRIS-INF/iris.config", <<SRC
44
+ some=setting
45
+ SRC
46
+ write "bar/src/main/java/com/biz/bar/Bar.java", <<SRC
47
+ package com.biz.bar;
48
+ public class Bar {}
49
+ SRC
50
+ @foo = define "foo" do
51
+ project.version = "2.1.3"
52
+ project.group = "mygroup"
53
+ manifest["Magic-Food"] = "Chocolate"
54
+ manifest["Magic-Drink"] = "Wine"
55
+ package(:bundle).tap do |bnd|
56
+ bnd["Export-Package"] = "com.*"
57
+ end
58
+
59
+ define "bar" do
60
+ project.version = "2.2"
61
+ package(:bundle).tap do |bnd|
62
+ bnd["Magic-Food"] = "Cheese"
63
+ bnd["Export-Package"] = "com.*"
64
+ end
65
+ end
66
+ end
67
+ task('package').invoke
68
+ end
69
+
70
+ it "produces a .bnd in the correct location for root project" do
71
+ File.should be_exist(@foo._("target/foo-2.1.3.bnd"))
72
+ end
73
+
74
+ it "produces a .jar in the correct location for root project" do
75
+ File.should be_exist(@foo._("target/foo-2.1.3.jar"))
76
+ end
77
+
78
+ it "produces a .jar containing correct .class files for root project" do
79
+ open_zip_file do |zip|
80
+ zip.file.exist?('com/biz/Foo.class').should be_true
81
+ end
82
+ end
83
+
84
+ it "produces a .jar containing resoruces from resource directory root project" do
85
+ open_zip_file do |zip|
86
+ zip.file.exist?('IRIS-INF/iris.config').should be_true
87
+ end
88
+ end
89
+
90
+ it "produces a .jar containing expected manifest entries derived from project.bnd for root project" do
91
+ open_main_manifest_section do |attribs|
92
+ attribs['Bundle-Name'].should eql('foo')
93
+ attribs['Bundle-Version'].should eql('2.1.3')
94
+ attribs['Bundle-SymbolicName'].should eql('mygroup.foo')
95
+ attribs['Export-Package'].should eql('com.biz')
96
+ attribs['Import-Package'].should eql('com.biz')
97
+ end
98
+ end
99
+
100
+ it "produces a .jar containing expected manifest entries derived from project.manifest root project" do
101
+ open_main_manifest_section do |attribs|
102
+ attribs['Magic-Drink'].should eql('Wine')
103
+ attribs['Magic-Food'].should eql('Chocolate')
104
+ end
105
+ end
106
+
107
+ it "produces a .bnd in the correct location for subproject project" do
108
+ File.should be_exist(@foo._("bar/target/foo-bar-2.2.bnd"))
109
+ end
110
+
111
+ it "produces a .jar in the correct location for subproject project" do
112
+ File.should be_exist(@foo._("bar/target/foo-bar-2.2.jar"))
113
+ end
114
+
115
+ it "produces a .jar containing correct .class files for subproject project" do
116
+ open_zip_file('bar/target/foo-bar-2.2.jar') do |zip|
117
+ zip.file.exist?('com/biz/bar/Bar.class').should be_true
118
+ end
119
+ end
120
+
121
+ it "produces a .jar containing expected manifest entries derived from project.bnd for subproject project" do
122
+ open_main_manifest_section('bar/target/foo-bar-2.2.jar') do |attribs|
123
+ attribs['Bundle-Name'].should eql('foo:bar')
124
+ attribs['Bundle-Version'].should eql('2.2')
125
+ attribs['Bundle-SymbolicName'].should eql('mygroup.foo.bar')
126
+ attribs['Export-Package'].should eql('com.biz.bar')
127
+ attribs['Import-Package'].should eql('com.biz.bar')
128
+ end
129
+ end
130
+
131
+ it "produces a .jar containing expected manifest entries derived from project.manifest subproject project" do
132
+ open_main_manifest_section('bar/target/foo-bar-2.2.jar') do |attribs|
133
+ attribs['Magic-Drink'].should eql('Wine')
134
+ attribs['Magic-Food'].should eql('Cheese')
135
+ end
136
+ end
137
+ end
138
+
139
+ describe "with an invalid bundle" do
140
+ before do
141
+ # bundle invalid as no source
142
+ @foo = define "foo" do
143
+ project.version = "2.1.3"
144
+ project.group = "mygroup"
145
+ package(:bundle).tap do |bnd|
146
+ bnd["Export-Package"] = "*"
147
+ end
148
+ end
149
+ end
150
+
151
+ it "raise an error if unable to build a valid bundle" do
152
+ lambda { task('package').invoke }.should raise_error
153
+ end
154
+
155
+ it "raise not produce an invalid jar file" do
156
+ lambda { task('package').invoke }.should raise_error
157
+ File.should_not be_exist(@foo._("target/foo-2.1.3.jar"))
158
+ end
159
+ end
160
+
161
+ describe "using classpath_element to specify dependency" do
162
+ before do
163
+ @foo = define "foo" do
164
+ project.version = "2.1.3"
165
+ project.group = "mygroup"
166
+ package(:bundle).tap do |bnd|
167
+ bnd['Export-Package'] = 'org.apache.tools.zip.*'
168
+ Buildr::Ant.dependencies.each do |d|
169
+ bnd.classpath_element d
170
+ end
171
+ end
172
+ end
173
+ end
174
+
175
+ it "should not raise an error during packaging" do
176
+ lambda { task('package').invoke }.should_not raise_error
177
+ end
178
+
179
+ it "should generate package with files exported from dependency" do
180
+ task('package').invoke
181
+ open_main_manifest_section do |attribs|
182
+ attribs['Export-Package'].should eql('org.apache.tools.zip')
183
+ end
184
+ end
185
+ end
186
+
187
+ describe "using classpath to specify dependencies" do
188
+ before do
189
+ write "src/main/java/com/biz/Foo.java", <<SRC
190
+ package com.biz;
191
+ public class Foo {}
192
+ SRC
193
+ write "bar/src/main/java/com/biz/bar/Bar.java", <<SRC
194
+ package com.biz.bar;
195
+ public class Bar {}
196
+ SRC
197
+ @foo = define "foo" do
198
+ project.version = "2.1.3"
199
+ project.group = "mygroup"
200
+ package(:bundle).tap do |bnd|
201
+ bnd['Export-Package'] = 'org.apache.tools.zip.*'
202
+ bnd.classpath = bnd.classpath + Buildr::Ant.dependencies
203
+ end
204
+ end
205
+ end
206
+
207
+ it "should not raise an error during packaging" do
208
+ lambda { task('package').invoke }.should_not raise_error
209
+ end
210
+
211
+ it "should generate package with files exported from dependency" do
212
+ task('package').invoke
213
+ open_main_manifest_section do |attribs|
214
+ attribs['Export-Package'].should eql('org.apache.tools.zip')
215
+ end
216
+ end
217
+ end
218
+
219
+ describe "using compile dependencies to specify dependency" do
220
+ before do
221
+ @foo = define "foo" do
222
+ project.version = "2.1.3"
223
+ project.group = "mygroup"
224
+ compile.with Buildr::Ant.dependencies
225
+ package(:bundle).tap do |bnd|
226
+ bnd['Export-Package'] = 'org.apache.tools.zip.*'
227
+ end
228
+ end
229
+ end
230
+
231
+ it "should not raise an error during packaging" do
232
+ lambda { task('package').invoke }.should_not raise_error
233
+ end
234
+
235
+ it "should generate package with files exported from dependency" do
236
+ task('package').invoke
237
+ open_main_manifest_section do |attribs|
238
+ attribs['Export-Package'].should eql('org.apache.tools.zip')
239
+ end
240
+ end
241
+ end
242
+ end
243
+
244
+ describe "project.bnd defaults" do
245
+
246
+ before do
247
+ write "src/main/java/com/biz/Foo.java", <<SRC
248
+ package com.biz;
249
+ public class Foo {}
250
+ SRC
251
+ write "bar/src/main/java/com/biz/bar/Bar.java", <<SRC
252
+ package com.biz.bar;
253
+ public class Bar {}
254
+ SRC
255
+
256
+ @foo = define "foo" do
257
+ project.version = "2.1.3"
258
+ project.group = "mygroup"
259
+ package :bundle
260
+ compile.with Buildr::Ant.dependencies
261
+ desc "My Bar Project"
262
+ define "bar" do
263
+ package :bundle
264
+ end
265
+ end
266
+ @bar = @foo.project('bar')
267
+ end
268
+
269
+ it "defaults Bundle-Version to project.version" do
270
+ @foo.packages[0].to_params['Bundle-Version'].should eql('2.1.3')
271
+ @bar.packages[0].to_params['Bundle-Version'].should eql('2.1.3')
272
+ end
273
+
274
+ it "defaults -classpath to compile path and dependencies" do
275
+ @foo.packages[0].to_params['-classpath'].should include(@foo.compile.target.to_s)
276
+ @foo.packages[0].to_params['-classpath'].should include(Buildr.artifacts(Buildr::Ant.dependencies[0]).to_s)
277
+ @bar.packages[0].to_params['-classpath'].should include(@bar.compile.target.to_s)
278
+ end
279
+
280
+ it "classpath method returns compile path and dependencies" do
281
+ @foo.packages[0].classpath.should include(@foo.compile.target)
282
+ Buildr::Ant.dependencies.each do |dependency|
283
+ @foo.packages[0].classpath.to_s.should include(Buildr.artifacts(dependency).to_s)
284
+ end
285
+ @bar.packages[0].classpath.should include(@bar.compile.target)
286
+ end
287
+
288
+ it "defaults Bundle-SymbolicName to combination of group and name" do
289
+ @foo.packages[0].to_params['Bundle-SymbolicName'].should eql('mygroup.foo')
290
+ @bar.packages[0].to_params['Bundle-SymbolicName'].should eql('mygroup.foo.bar')
291
+ end
292
+
293
+ it "defaults Export-Package to nil" do
294
+ @foo.packages[0].to_params['Export-Package'].should be_nil
295
+ @bar.packages[0].to_params['Export-Package'].should be_nil
296
+ end
297
+
298
+ it "defaults Import-Package to nil" do
299
+ @foo.packages[0].to_params['Import-Package'].should be_nil
300
+ @bar.packages[0].to_params['Import-Package'].should be_nil
301
+ end
302
+
303
+ it "defaults Bundle-Name to project.name if comment not present" do
304
+ @foo.packages[0].to_params['Bundle-Name'].should eql('foo')
305
+ end
306
+
307
+ it "defaults Bundle-Name to comment if present" do
308
+ @bar.packages[0].to_params['Bundle-Name'].should eql('My Bar Project')
309
+ end
310
+
311
+ it "defaults Bundle-Description to project.full_comment" do
312
+ @foo.packages[0].to_params['Bundle-Description'].should be_nil
313
+ @bar.packages[0].to_params['Bundle-Description'].should eql('My Bar Project')
314
+ end
315
+
316
+ it "defaults -removeheaders to" do
317
+ @foo.packages[0].to_params['-removeheaders'].should eql("Include-Resource,Bnd-LastModified,Created-By,Implementation-Title,Tool")
318
+ end
319
+ end
320
+
321
+ describe "project extension" do
322
+ it "provides an 'bnd:print' task" do
323
+ Rake::Task.tasks.detect { |task| task.to_s == "bnd:print" }.should_not be_nil
324
+ end
325
+
326
+ it "documents the 'bnd:print' task" do
327
+ Rake::Task.tasks.detect { |task| task.to_s == "bnd:print" }.comment.should_not be_nil
328
+ end
329
+ end
330
+ end