buildr-gemjar 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.braids +8 -0
- data/.gitignore +5 -0
- data/.rvmrc +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/README.md +98 -0
- data/Rakefile +8 -0
- data/buildr-gemjar.gemspec +42 -0
- data/lib/buildr-gemjar.rb +162 -0
- data/lib/buildr-gemjar/version.rb +3 -0
- data/meta.rakefile +30 -0
- data/spec/buildr-gemjar/version_spec.rb +11 -0
- data/spec/buildr-gemjar_spec.rb +179 -0
- data/spec/repo_builder.rb +59 -0
- data/spec/spec_helper.rb +44 -0
- data/vendor/buildr/.gitignore +17 -0
- data/vendor/buildr/CHANGELOG +1283 -0
- data/vendor/buildr/Gemfile +4 -0
- data/vendor/buildr/LICENSE +176 -0
- data/vendor/buildr/NOTICE +26 -0
- data/vendor/buildr/README.rdoc +134 -0
- data/vendor/buildr/Rakefile +44 -0
- data/vendor/buildr/_buildr +35 -0
- data/vendor/buildr/_jbuildr +35 -0
- data/vendor/buildr/addon/buildr/antlr.rb +65 -0
- data/vendor/buildr/addon/buildr/bnd.rb +147 -0
- data/vendor/buildr/addon/buildr/cobertura.rb +22 -0
- data/vendor/buildr/addon/buildr/drb.rb +281 -0
- data/vendor/buildr/addon/buildr/emma.rb +22 -0
- data/vendor/buildr/addon/buildr/hibernate.rb +149 -0
- data/vendor/buildr/addon/buildr/javacc.rb +85 -0
- data/vendor/buildr/addon/buildr/jaxb_xjc.rb +72 -0
- data/vendor/buildr/addon/buildr/jdepend.rb +60 -0
- data/vendor/buildr/addon/buildr/jetty.rb +248 -0
- data/vendor/buildr/addon/buildr/jibx.rb +86 -0
- data/vendor/buildr/addon/buildr/nailgun.rb +221 -0
- data/vendor/buildr/addon/buildr/openjpa.rb +88 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/vendor/buildr/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/vendor/buildr/addon/buildr/protobuf.rb +88 -0
- data/vendor/buildr/addon/buildr/xmlbeans.rb +93 -0
- data/vendor/buildr/all-in-one/_buildr +19 -0
- data/vendor/buildr/all-in-one/buildr +368 -0
- data/vendor/buildr/all-in-one/buildr.cmd +1 -0
- data/vendor/buildr/bin/buildr +19 -0
- data/vendor/buildr/buildr.buildfile +58 -0
- data/vendor/buildr/buildr.gemspec +74 -0
- data/vendor/buildr/doc/_config.yml +1 -0
- data/vendor/buildr/doc/_layouts/default.html +90 -0
- data/vendor/buildr/doc/_layouts/preface.html +22 -0
- data/vendor/buildr/doc/artifacts.textile +217 -0
- data/vendor/buildr/doc/building.textile +276 -0
- data/vendor/buildr/doc/contributing.textile +268 -0
- data/vendor/buildr/doc/css/default.css +236 -0
- data/vendor/buildr/doc/css/print.css +101 -0
- data/vendor/buildr/doc/css/syntax.css +23 -0
- data/vendor/buildr/doc/download.textile +138 -0
- data/vendor/buildr/doc/extending.textile +212 -0
- data/vendor/buildr/doc/images/1442160941-frontcover.jpg +0 -0
- data/vendor/buildr/doc/images/asf-logo.gif +0 -0
- data/vendor/buildr/doc/images/asf-logo.png +0 -0
- data/vendor/buildr/doc/images/buildr-hires.png +0 -0
- data/vendor/buildr/doc/images/buildr.png +0 -0
- data/vendor/buildr/doc/images/favicon.png +0 -0
- data/vendor/buildr/doc/images/growl-icon.tiff +0 -0
- data/vendor/buildr/doc/images/note.png +0 -0
- data/vendor/buildr/doc/images/project-structure.png +0 -0
- data/vendor/buildr/doc/images/tip.png +0 -0
- data/vendor/buildr/doc/images/zbuildr.png +0 -0
- data/vendor/buildr/doc/images/zbuildr.tif +0 -0
- data/vendor/buildr/doc/index.textile +69 -0
- data/vendor/buildr/doc/installing.textile +284 -0
- data/vendor/buildr/doc/languages.textile +599 -0
- data/vendor/buildr/doc/mailing_lists.textile +29 -0
- data/vendor/buildr/doc/more_stuff.textile +845 -0
- data/vendor/buildr/doc/packaging.textile +618 -0
- data/vendor/buildr/doc/preface.textile +54 -0
- data/vendor/buildr/doc/projects.textile +276 -0
- data/vendor/buildr/doc/quick_start.textile +210 -0
- data/vendor/buildr/doc/releasing.textile +117 -0
- data/vendor/buildr/doc/scripts/buildr-git.rb +512 -0
- data/vendor/buildr/doc/scripts/gitflow.rb +296 -0
- data/vendor/buildr/doc/scripts/install-jruby.sh +44 -0
- data/vendor/buildr/doc/scripts/install-linux.sh +73 -0
- data/vendor/buildr/doc/scripts/install-osx.sh +52 -0
- data/vendor/buildr/doc/settings_profiles.textile +287 -0
- data/vendor/buildr/doc/testing.textile +247 -0
- data/vendor/buildr/etc/KEYS +189 -0
- data/vendor/buildr/lib/buildr.rb +44 -0
- data/vendor/buildr/lib/buildr/clojure.rb +34 -0
- data/vendor/buildr/lib/buildr/clojure/shell.rb +52 -0
- data/vendor/buildr/lib/buildr/core.rb +34 -0
- data/vendor/buildr/lib/buildr/core/application.rb +700 -0
- data/vendor/buildr/lib/buildr/core/build.rb +516 -0
- data/vendor/buildr/lib/buildr/core/cc.rb +166 -0
- data/vendor/buildr/lib/buildr/core/checks.rb +253 -0
- data/vendor/buildr/lib/buildr/core/common.rb +151 -0
- data/vendor/buildr/lib/buildr/core/compile.rb +622 -0
- data/vendor/buildr/lib/buildr/core/doc.rb +276 -0
- data/vendor/buildr/lib/buildr/core/environment.rb +129 -0
- data/vendor/buildr/lib/buildr/core/filter.rb +404 -0
- data/vendor/buildr/lib/buildr/core/generate.rb +197 -0
- data/vendor/buildr/lib/buildr/core/help.rb +119 -0
- data/vendor/buildr/lib/buildr/core/jrebel.rb +42 -0
- data/vendor/buildr/lib/buildr/core/linux.rb +30 -0
- data/vendor/buildr/lib/buildr/core/osx.rb +46 -0
- data/vendor/buildr/lib/buildr/core/progressbar.rb +161 -0
- data/vendor/buildr/lib/buildr/core/project.rb +975 -0
- data/vendor/buildr/lib/buildr/core/run.rb +43 -0
- data/vendor/buildr/lib/buildr/core/shell.rb +137 -0
- data/vendor/buildr/lib/buildr/core/test.rb +843 -0
- data/vendor/buildr/lib/buildr/core/transports.rb +565 -0
- data/vendor/buildr/lib/buildr/core/util.rb +537 -0
- data/vendor/buildr/lib/buildr/groovy.rb +20 -0
- data/vendor/buildr/lib/buildr/groovy/bdd.rb +106 -0
- data/vendor/buildr/lib/buildr/groovy/compiler.rb +153 -0
- data/vendor/buildr/lib/buildr/groovy/doc.rb +76 -0
- data/vendor/buildr/lib/buildr/groovy/shell.rb +57 -0
- data/vendor/buildr/lib/buildr/ide.rb +19 -0
- data/vendor/buildr/lib/buildr/ide/eclipse.rb +427 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/java.rb +53 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/plugin.rb +71 -0
- data/vendor/buildr/lib/buildr/ide/eclipse/scala.rb +68 -0
- data/vendor/buildr/lib/buildr/ide/idea.rb +576 -0
- data/vendor/buildr/lib/buildr/java.rb +25 -0
- data/vendor/buildr/lib/buildr/java/ant.rb +94 -0
- data/vendor/buildr/lib/buildr/java/bdd.rb +460 -0
- data/vendor/buildr/lib/buildr/java/cobertura.rb +297 -0
- data/vendor/buildr/lib/buildr/java/commands.rb +223 -0
- data/vendor/buildr/lib/buildr/java/compiler.rb +135 -0
- data/vendor/buildr/lib/buildr/java/deprecated.rb +141 -0
- data/vendor/buildr/lib/buildr/java/doc.rb +86 -0
- data/vendor/buildr/lib/buildr/java/ecj.rb +69 -0
- data/vendor/buildr/lib/buildr/java/emma.rb +244 -0
- data/vendor/buildr/lib/buildr/java/external.rb +73 -0
- data/vendor/buildr/lib/buildr/java/jruby.rb +122 -0
- data/vendor/buildr/lib/buildr/java/jtestr_result.rb +295 -0
- data/vendor/buildr/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/vendor/buildr/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +142 -0
- data/vendor/buildr/lib/buildr/java/packaging.rb +734 -0
- data/vendor/buildr/lib/buildr/java/pom.rb +178 -0
- data/vendor/buildr/lib/buildr/java/rjb.rb +154 -0
- data/vendor/buildr/lib/buildr/java/test_result.rb +101 -0
- data/vendor/buildr/lib/buildr/java/tests.rb +362 -0
- data/vendor/buildr/lib/buildr/java/version_requirement.rb +172 -0
- data/vendor/buildr/lib/buildr/packaging.rb +25 -0
- data/vendor/buildr/lib/buildr/packaging/archive.rb +535 -0
- data/vendor/buildr/lib/buildr/packaging/artifact.rb +903 -0
- data/vendor/buildr/lib/buildr/packaging/artifact_namespace.rb +984 -0
- data/vendor/buildr/lib/buildr/packaging/artifact_search.rb +140 -0
- data/vendor/buildr/lib/buildr/packaging/gems.rb +105 -0
- data/vendor/buildr/lib/buildr/packaging/package.rb +249 -0
- data/vendor/buildr/lib/buildr/packaging/tar.rb +189 -0
- data/vendor/buildr/lib/buildr/packaging/version_requirement.rb +192 -0
- data/vendor/buildr/lib/buildr/packaging/zip.rb +178 -0
- data/vendor/buildr/lib/buildr/packaging/ziptask.rb +356 -0
- data/vendor/buildr/lib/buildr/resources/buildr.icns +0 -0
- data/vendor/buildr/lib/buildr/resources/completed.png +0 -0
- data/vendor/buildr/lib/buildr/resources/failed.png +0 -0
- data/vendor/buildr/lib/buildr/resources/icons-license.txt +17 -0
- data/vendor/buildr/lib/buildr/run.rb +195 -0
- data/vendor/buildr/lib/buildr/scala.rb +26 -0
- data/vendor/buildr/lib/buildr/scala/bdd.rb +118 -0
- data/vendor/buildr/lib/buildr/scala/compiler.rb +242 -0
- data/vendor/buildr/lib/buildr/scala/doc.rb +142 -0
- data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/vendor/buildr/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/vendor/buildr/lib/buildr/scala/shell.rb +52 -0
- data/vendor/buildr/lib/buildr/scala/tests.rb +171 -0
- data/vendor/buildr/lib/buildr/shell.rb +185 -0
- data/vendor/buildr/lib/buildr/version.rb +18 -0
- data/vendor/buildr/rakelib/all-in-one.rake +113 -0
- data/vendor/buildr/rakelib/checks.rake +57 -0
- data/vendor/buildr/rakelib/doc.rake +137 -0
- data/vendor/buildr/rakelib/metrics.rake +39 -0
- data/vendor/buildr/rakelib/package.rake +73 -0
- data/vendor/buildr/rakelib/release.rake +161 -0
- data/vendor/buildr/rakelib/rspec.rake +101 -0
- data/vendor/buildr/rakelib/setup.rake +66 -0
- data/vendor/buildr/rakelib/stage.rake +220 -0
- data/vendor/buildr/spec/addon/bnd_spec.rb +330 -0
- data/vendor/buildr/spec/addon/drb_spec.rb +328 -0
- data/vendor/buildr/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/vendor/buildr/spec/core/application_spec.rb +631 -0
- data/vendor/buildr/spec/core/build_spec.rb +837 -0
- data/vendor/buildr/spec/core/cc_spec.rb +224 -0
- data/vendor/buildr/spec/core/checks_spec.rb +519 -0
- data/vendor/buildr/spec/core/common_spec.rb +725 -0
- data/vendor/buildr/spec/core/compile_spec.rb +658 -0
- data/vendor/buildr/spec/core/doc_spec.rb +195 -0
- data/vendor/buildr/spec/core/extension_spec.rb +201 -0
- data/vendor/buildr/spec/core/generate_spec.rb +33 -0
- data/vendor/buildr/spec/core/project_spec.rb +772 -0
- data/vendor/buildr/spec/core/run_spec.rb +93 -0
- data/vendor/buildr/spec/core/shell_spec.rb +146 -0
- data/vendor/buildr/spec/core/test_spec.rb +1320 -0
- data/vendor/buildr/spec/core/transport_spec.rb +544 -0
- data/vendor/buildr/spec/core/util_spec.rb +141 -0
- data/vendor/buildr/spec/groovy/bdd_spec.rb +80 -0
- data/vendor/buildr/spec/groovy/compiler_spec.rb +251 -0
- data/vendor/buildr/spec/groovy/doc_spec.rb +65 -0
- data/vendor/buildr/spec/ide/eclipse_spec.rb +739 -0
- data/vendor/buildr/spec/ide/idea_spec.rb +1144 -0
- data/vendor/buildr/spec/java/ant_spec.rb +37 -0
- data/vendor/buildr/spec/java/bdd_spec.rb +374 -0
- data/vendor/buildr/spec/java/cobertura_spec.rb +112 -0
- data/vendor/buildr/spec/java/commands_spec.rb +93 -0
- data/vendor/buildr/spec/java/compiler_spec.rb +252 -0
- data/vendor/buildr/spec/java/doc_spec.rb +56 -0
- data/vendor/buildr/spec/java/ecj_spec.rb +115 -0
- data/vendor/buildr/spec/java/emma_spec.rb +121 -0
- data/vendor/buildr/spec/java/external_spec.rb +56 -0
- data/vendor/buildr/spec/java/java_spec.rb +132 -0
- data/vendor/buildr/spec/java/packaging_spec.rb +1270 -0
- data/vendor/buildr/spec/java/run_spec.rb +78 -0
- data/vendor/buildr/spec/java/test_coverage_helper.rb +257 -0
- data/vendor/buildr/spec/java/tests_spec.rb +497 -0
- data/vendor/buildr/spec/packaging/archive_spec.rb +775 -0
- data/vendor/buildr/spec/packaging/artifact_namespace_spec.rb +743 -0
- data/vendor/buildr/spec/packaging/artifact_spec.rb +1066 -0
- data/vendor/buildr/spec/packaging/packaging_helper.rb +63 -0
- data/vendor/buildr/spec/packaging/packaging_spec.rb +719 -0
- data/vendor/buildr/spec/sandbox.rb +165 -0
- data/vendor/buildr/spec/scala/bdd_spec.rb +124 -0
- data/vendor/buildr/spec/scala/compiler_spec.rb +289 -0
- data/vendor/buildr/spec/scala/doc_spec.rb +88 -0
- data/vendor/buildr/spec/scala/scala.rb +38 -0
- data/vendor/buildr/spec/scala/tests_spec.rb +283 -0
- data/vendor/buildr/spec/spec_helpers.rb +369 -0
- data/vendor/buildr/spec/version_requirement_spec.rb +143 -0
- data/vendor/buildr/spec/xpath_matchers.rb +121 -0
- data/vendor/buildr/tests/BUILDR-320/Buildfile +29 -0
- data/vendor/buildr/tests/JavaSystemProperty/Buildfile +18 -0
- data/vendor/buildr/tests/JavaSystemProperty/src/test/java/FooTest.java +24 -0
- data/vendor/buildr/tests/compile_with_parent/Buildfile +18 -0
- data/vendor/buildr/tests/compile_with_parent/child/src/main/java/Foo.java +23 -0
- data/vendor/buildr/tests/helloWorld/Buildfile +20 -0
- data/vendor/buildr/tests/helloWorld/src/main/java/HelloWorld.java +23 -0
- data/vendor/buildr/tests/integration_testing.rb +56 -0
- data/vendor/buildr/tests/junit3/Buildfile +9 -0
- data/vendor/buildr/tests/junit3/src/main/java/Foo.java +23 -0
- data/vendor/buildr/tests/junit3/src/test/java/FooTest.java +28 -0
- data/vendor/buildr/tests/package_war_as_jar/Buildfile +15 -0
- data/vendor/buildr/tests/package_war_as_jar/src/main/java/Foo.java +19 -0
- metadata +524 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations 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 failing_examples:failed --format html:_reports/specs.html --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 << '--format documentation'
|
42
|
+
end
|
43
|
+
file('_reports/specs.html') { task(:spec).invoke }
|
44
|
+
|
45
|
+
desc 'Run all failed examples from previous run'
|
46
|
+
RSpec::Core::RakeTask.new :failed 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.rspec_opts << '--format documentation' << '--example failed'
|
52
|
+
end
|
53
|
+
|
54
|
+
desc 'Run RSpec and generate Spec and coverage reports (slow)'
|
55
|
+
RSpec::Core::RakeTask.new :coverage=>['_reports', :compile] do |task|
|
56
|
+
ENV['USE_FSC'] = 'no'
|
57
|
+
task.rspec_files = FileList['spec/**/*_spec.rb']
|
58
|
+
task.rspec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
|
59
|
+
task.rspec_opts = default_spec_opts
|
60
|
+
task.rspec_opts << '--format progress'
|
61
|
+
task.rcov = true
|
62
|
+
task.rcov_opts = %w{-o _reports/coverage --exclude / --include-file ^lib --text-summary}
|
63
|
+
end
|
64
|
+
file('_reports/coverage') { task(:coverage).invoke }
|
65
|
+
|
66
|
+
task :load_ci_reporter do
|
67
|
+
gem 'ci_reporter'
|
68
|
+
ENV['CI_REPORTS'] = '_reports/ci'
|
69
|
+
# CI_Reporter does not quote the path to rspec_loader which causes problems when ruby is installed in C:/Program Files
|
70
|
+
ci_rep_path = Gem.loaded_specs['ci_reporter'].full_gem_path
|
71
|
+
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(" ")
|
72
|
+
end
|
73
|
+
|
74
|
+
desc 'Run all specs with CI reporter'
|
75
|
+
task :ci=>[:load_ci_reporter, :spec]
|
76
|
+
|
77
|
+
# Useful for testing with JRuby when using Ruby and vice versa.
|
78
|
+
namespace :spec do
|
79
|
+
desc "Run all specs specifically with Ruby"
|
80
|
+
task :ruby do
|
81
|
+
puts "Running test suite using Ruby ..."
|
82
|
+
sh 'ruby -S rake spec'
|
83
|
+
end
|
84
|
+
|
85
|
+
desc "Run all specs specifically with JRuby"
|
86
|
+
task :jruby do
|
87
|
+
puts "Running test suite using JRuby ..."
|
88
|
+
sh 'jruby -S rake spec'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
task :clobber do
|
93
|
+
rm_f 'failed'
|
94
|
+
rm_rf '_reports'
|
95
|
+
end
|
96
|
+
|
97
|
+
rescue LoadError => e
|
98
|
+
puts "Buildr uses RSpec. You can install it by running rake setup"
|
99
|
+
task(:setup) { install_gem 'rcov', :version=>'~>0.8' }
|
100
|
+
task(:setup) { install_gem 'win32console' if RUBY_PLATFORM[/win32/] } # Colors for RSpec, only on Windows platform.
|
101
|
+
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'
|
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
|