Author: assaf
Date: Thu Jul 3 16:58:37 2008
New Revision: 673873
URL: http://svn.apache.org/viewvc?rev=673873&view=rev
Log:
BUILDR-83 I has dependency check now
Modified:
incubator/buildr/trunk/.gitignore
incubator/buildr/trunk/Rakefile
incubator/buildr/trunk/rakelib/apache.rake
incubator/buildr/trunk/rakelib/package.rake
Modified: incubator/buildr/trunk/.gitignore
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/.gitignore?rev=673873&r1=673872&r2=673873&view=diff
==============================================================================
--- incubator/buildr/trunk/.gitignore (original)
+++ incubator/buildr/trunk/.gitignore Thu Jul 3 16:58:37 2008
@@ -4,5 +4,6 @@
rdoc
site
print
+snapshot
stage
release
Modified: incubator/buildr/trunk/Rakefile
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/Rakefile?rev=673873&r1=673872&r2=673873&view=diff
==============================================================================
--- incubator/buildr/trunk/Rakefile (original)
+++ incubator/buildr/trunk/Rakefile Thu Jul 3 16:58:37 2008
@@ -27,7 +27,7 @@
spec.add_dependency 'ci_reporter', '1.5.1' # must come after builder
dependency
else
# Place first on the dependency list, otherwise AntWrap picks the latest
RJB.
- spec.dependencies.unshift Gem::Dependency.new('rjb', ['>=1.1.0', '<=
1.1.2'])
+ spec.dependencies.unshift Gem::Dependency.new('rjb', '1.1.2')
end
spec
end
@@ -62,3 +62,5 @@
fail 'Full testing requires Groovy!' unless which('groovy')
puts 'OK'
end
+
+
Modified: incubator/buildr/trunk/rakelib/apache.rake
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/apache.rake?rev=673873&r1=673872&r2=673873&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/apache.rake (original)
+++ incubator/buildr/trunk/rakelib/apache.rake Thu Jul 3 16:58:37 2008
@@ -21,6 +21,20 @@
# Tasks specific to Apache projects (license, release, etc).
namespace 'apache' do
+ desc 'Upload snapshot packages over to people.apache.org'
+ task 'snapshot'=>'package' do
+ rm_rf 'snapshot' # Always start with empty directory
+ puts "Copying existing gems from Apache"
+ sh 'rsync', '--progress', '--recursive',
'people.apache.org:public_html/buildr/snapshot', './'
+ puts "Copying new gems over"
+ cp FileList['pkg/{*.gem,*.tgz,*.zip}'], 'snapshot/gems'
+ puts "Generating gem index ..."
+ sh 'gem', 'generate_index', '--directory', 'snapshot'
+ puts "Copying gem and index back to Apache"
+ sh 'rsync', '--progress', '--recursive', 'snapshot',
'people.apache.org:public_html/buildr/'
+ end
+
+
desc 'Check that source files contain the Apache license'
task 'license' do |task|
print 'Checking that files contain the Apache license ... '
Modified: incubator/buildr/trunk/rakelib/package.rake
URL:
http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/package.rake?rev=673873&r1=673872&r2=673873&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/package.rake (original)
+++ incubator/buildr/trunk/rakelib/package.rake Thu Jul 3 16:58:37 2008
@@ -42,3 +42,31 @@
sh *args
puts 'Done'
end
+
+
+desc 'Look for new dependencies, check transitive dependencies'
+task 'dependency' do
+ # Find if anything has a more recent dependency. These are not errors, just
reports.
+ for dep in spec.dependencies
+ current = Gem::SourceInfoCache.search(dep, true, true).last
+ latest = Gem::SourceInfoCache.search(Gem::Dependency.new(dep.name, '>0'),
true, true).last
+ puts "A new version of #{dep.name} is available, #{latest.version}
replaces #{current.version}" if latest.version > current.version
+ end
+
+ # Returns orderd list of transitive dependencies for the given dependency.
+ transitive = lambda { |depend|
+ dep_spec = Gem::SourceIndex.from_installed_gems.search(depend).last
+ dep_spec.dependencies.map { |trans| transitive[trans].push(trans)
}.flatten.uniq }
+ # For each dependency, make sure *all* its transitive dependencies are listed
+ # as a Buildr dependency, and order is preserved.
+ spec.dependencies.each_with_index do |dep, index|
+ puts "checking #{dep.name}"
+ for trans in transitive[dep]
+ matching = spec.dependencies.find { |existing| trans =~ existing }
+ fail "#{trans} required by #{dep} and missing from spec" unless matching
+ fail "#{trans} must come before #{dep} in dependency list" unless
spec.dependencies.index(matching) < index
+ end
+ end
+end
+
+task 'stage:check'=>'dependency'