lib/maven/tools/dsl.rb in maven-tools-1.0.0.rc6 vs lib/maven/tools/dsl.rb in maven-tools-1.0.0
- old
+ new
@@ -146,11 +146,11 @@
end
else
setup_gem_support( options )
jruby_plugin!( :gem ) do
- execute_goal :initialize
+ execute_goal :initialize, :id => 'install gems'
end
end
if pr && pr.dependencies.empty?
@current.profiles.delete( pr )
@@ -160,41 +160,55 @@
profile :gemfile_lock do
activation do
file( :exists => name + '.lock' )
end
locked = GemfileLock.new( lockfile )
- add_scoped_hull( locked, pr.dependencies )
- add_scoped_hull( locked, pr.dependencies, :provided )
- add_scoped_hull( locked, pr.dependencies, :test )
+ done = add_scoped_hull( locked, pr.dependencies )
+ done += add_scoped_hull( locked, pr.dependencies,
+ done, :provided )
+ add_scoped_hull( locked, pr.dependencies, done, :test )
end
end
if @has_path or @has_git
gem 'bundler', VERSIONS[ :bundler_version ], :scope => :provided unless gem? 'bundler'
jruby_plugin! :gem do
- execute_goal :exec, :filename => 'bundle', :args => 'install'
+ execute_goal( :exec,
+ :id => 'bundle install',
+ :filename => 'bundle',
+ :args => 'install' )
end
end
ensure
@inside_gemfile = nil
@gemspec_args = nil
@has_path = nil
@has_git = nil
end
- def add_scoped_hull( locked, deps, scope = nil )
- options = {}
- options[ :scope ] = scope if scope
+ def add_scoped_hull( locked, deps, done = [], scope = nil )
+ result = {}
scope ||= "compile runtime default"
scope = scope.to_s
names = deps.select do |d|
sc = d.scope || 'default'
scope.match /#{sc}/
end.collect { |d| d.artifact_id }
locked.dependency_hull( names ).each do |name, version|
- gem( name, version, options ) unless has_gem( name )
+ result[ name ] = version unless done.member?( name )
end
+ unless result.empty?
+ scope.sub!( / .*$/, '' )
+ jruby_plugin!( :gem ) do
+ execute_goal( :sets,
+ :id => "install gem sets for #{scope}",
+ :phase => :initialize,
+ :scope => scope,
+ :gems => result )
+ end
+ end
+ result.keys
end
private :add_scoped_hull
def has_gem( name )
( model.artifact_id == name && model.group_id == 'rubygems' ) ||
@@ -701,11 +715,32 @@
( @current.build ||= Build.new ).resources << resource
else
@current.resources << resource
end
end
+
+ def build_method( m, val )
+ m = "#{m}=".to_sym
+ if @context == :project
+ ( @current.build ||= Build.new ).send m, val
+ else
+ @current.send m, val
+ end
+ end
+ private :build_method
+ def final_name( val )
+ build_method( __method__, val )
+ end
+
+ def directory( val )
+ build_method( __method__, val )
+ end
+
+ def output_directory( val )
+ build_method( __method__, val )
+ end
def repository( *args, &block )
do_repository( :repository=, *args, &block )
end
def plugin_repository( *args, &block )
@@ -827,11 +862,12 @@
@current.exclusions << ex
ex
end
def setup_jruby_plugins_version
- unless @current.properties.key?( 'jruby.plugins.version' )
+ if not @current.properties.key?( 'jruby.plugins.version' ) and
+ not (@context == :profile and model.properties.key?( 'jruby.plugins.version' ) )
properties( 'jruby.plugins.version' => VERSIONS[ :jruby_plugins ] )
end
end
def do_jruby_plugin( method, *gav, &block )
@@ -851,11 +887,12 @@
do_jruby_plugin( :plugin!, *gav, &block )
end
def plugin!( *gav, &block )
gav, options = plugin_gav( *gav )
+ ga = gav.sub( /:[^:]*$/, '' )
pl = plugins.detect do |p|
- "#{p.group_id}:#{p.artifact_id}:#{p.version}" == gav
+ "#{p.group_id}:#{p.artifact_id}" == ga
end
if pl
do_plugin( false, pl, options, &block )
else
plugin = fill_gav( @context == :reporting ? ReportPlugin : Plugin,