lib/maven/tools/dsl.rb in maven-tools-1.0.11 vs lib/maven/tools/dsl.rb in maven-tools-1.0.12
- old
+ new
@@ -2,10 +2,11 @@
require 'maven/tools/gemspec_dependencies'
require 'maven/tools/artifact'
require 'maven/tools/jarfile'
require 'maven/tools/versions'
require 'maven/tools/gemfile_lock'
+require 'maven/tools/dsl/jars_lock'
module Maven
module Tools
module DSL
@@ -124,12 +125,16 @@
if name.is_a? Hash
options = name
name = 'Gemfile'
end
name = ::File.join( basedir, name ) unless ::File.exists?( name )
-
- @inside_gemfile = true
+ if @context == :project
+ build do
+ directory '${basedir}/pkg'
+ end
+ end
+ @inside_gemfile = true
# the eval might need those options for gemspec declaration
lockfile = ::File.expand_path( name + '.lock' )
if File.exists? lockfile
pr = profile :gemfile do
activation do
@@ -167,27 +172,31 @@
execute_goal :initialize, :id => 'install gems'
end
end
if pr && pr.dependencies.empty?
- if @current.respond_to? :delete
+ if @current.profiles.respond_to? :delete
@current.profiles.delete( pr )
else
@current.profiles.remove( pr )
end
end
if pr && !pr.dependencies.empty?
+ locked = GemfileLock.new( lockfile )
+ has_bundler = gem?( 'bundler' )
profile :gemfile_lock do
activation do
file( :exists => name + '.lock' )
end
- locked = GemfileLock.new( lockfile )
done = add_scoped_hull( locked, pr.dependencies )
done += add_scoped_hull( locked, pr.dependencies,
done, :provided )
add_scoped_hull( locked, pr.dependencies, done, :test )
+ if locked['bundler'] && ! has_bundler
+ gem( 'bundler', locked['bundler'].version )
+ end
end
end
if @has_path or @has_git
gem 'bundler', VERSIONS[ :bundler_version ], :scope => :provided unless gem? 'bundler'
@@ -196,10 +205,11 @@
:id => 'bundle install',
:filename => 'bundle',
:args => 'install' )
end
end
+ DSL::JarsLock.new(self)
ensure
@inside_gemfile = nil
@gemspec_args = nil
@has_path = nil
@has_git = nil
@@ -627,10 +637,13 @@
# strange behaviour when calling specs from Rakefile
return if @current.nil?
resource = Resource.new
fill_options( resource, options )
nested_block( :test_resource, resource, block ) if block
+ unless resource.directory
+ resource.directory = '${basedir}'
+ end
if @context == :project
( @current.build ||= Build.new ).test_resources << resource
else
@current.test_resources << resource
end
@@ -638,16 +651,33 @@
def resource( options = {}, &block )
resource = Resource.new
fill_options( resource, options )
nested_block( :resource, resource, block ) if block
+ unless resource.directory
+ resource.directory = '${basedir}'
+ end
if @context == :project
( @current.build ||= Build.new ).resources << resource
else
@current.resources << resource
end
end
-
+
+ def packaging( val )
+ @current.packaging = val
+ if val =~ /jruby[WJ]ar/
+ if not @current.properties.key?( 'jruby9.plugins.version' ) and
+ not (@context == :profile and model.properties.key?( 'jruby9.plugins.version' ) )
+ properties( 'jruby9.plugins.version' => VERSIONS[ :jruby9_plugins ] )
+ end
+ extension 'de.saumya.mojo', 'jruby9-extensions', '${jruby9.plugins.version}'
+ build do
+ directory '${basedir}/pkg'
+ end
+ end
+ end
+
def build_method( m, val )
m = "#{m}=".to_sym
if @context == :project
( @current.build ||= Build.new ).send m, val
else