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
8 # http://www.apache.org/licenses/LICENSE-2.0
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
17 require 'rake/gempackagetask'
19 def spec(platform = RUBY_PLATFORM[/java/] || 'ruby')
20 @specs ||= ['ruby', 'java'].inject({}) { |hash, platform|
22 hash.update(platform=>Gem::Specification.load('buildr.gemspec'))
28 desc 'Compile Java libraries used by Buildr'
30 puts 'Compiling Java libraries ...'
31 args = File.expand_path('_buildr'), '--buildfile=buildr.buildfile', 'compile'
32 args << '--trace' if Rake.application.options.trace
36 file Rake::GemPackageTask.new(spec).package_dir=>'compile'
37 file Rake::GemPackageTask.new(spec).package_dir_path=>'compile'
39 # We also need the other package (JRuby if building on Ruby, and vice versa)
40 Rake::GemPackageTask.new spec(RUBY_PLATFORM =~ /java/ ? 'ruby' : 'java') do |task|
41 # Block necessary otherwise doesn't do full job.
45 ENV['incubating'] = 'true'
46 ENV['staging'] = "people.apache.org:~/public_html/#{spec.name}/#{spec.version}"
48 task('apache:license').enhance FileList[spec.files].exclude('.class', '.png', '.jar', '.tif', '.textile', '.icns',
49 'README', 'LICENSE', 'CHANGELOG', 'DISCLAIMER', 'NOTICE', 'etc/KEYS', 'etc/git-svn-authors')
52 print 'Checking that we have JRuby, Scala and Groovy available ... '
53 fail 'Full testing requires JRuby!' unless which('jruby')
54 fail 'Full testing requires Scala!' unless which('scala')
55 fail 'Full testing requires Groovy!' unless which('groovy')
60 # Dependency check for the other platform, i.e. if making a release with Ruby,
61 # run dependency checks with JRuby. (Also, good opportunity to upgrade other
62 # platform's dependencies)
63 sh RUBY_PLATFORM =~ /java/ ? 'ruby' : 'jruby -S rake setup dependency'