lib/buildr/ivy_extension.rb in ivy4r-0.10.3 vs lib/buildr/ivy_extension.rb in ivy4r-0.10.4

- old
+ new

@@ -7,11 +7,11 @@ def setting(*keys) find_setting(Buildr.settings.build['ivy'], *keys) end def user_setting(*keys) - find_setting(Buildr.settings.user['ivy'], *keys) + find_setting(Buildr.settings.user['ivy'], *keys) end private def find_setting(setting, *keys) keys.each { |key| setting = setting[key] unless setting.nil? } @@ -25,10 +25,12 @@ attr_accessor :extension_dir, :resolved attr_reader :post_resolve_task_list + attr_reader :project + # Hash of all artifacts to publish with mapping from artifact name to ivy publish name attr_reader :publish_mappings # Store the current project and initialize ivy ant wrapper def initialize(project) @@ -628,24 +630,26 @@ project.task :build => task end end def add_copy_tasks_for_publish(project) - if project.ivy.own_file? - Buildr.projects.each do |current| - current.packages.each do |pkg| - target_file = current.ivy.name[pkg] || File.basename(pkg.name).gsub(/-#{project.version}/, '') - taskname = current.path_to(project.ivy.publish_from, target_file) - if taskname != pkg.name - project.file taskname => pkg.name do - verbose "Ivy copying '#{pkg.name}' to '#{taskname}' for publishing" - FileUtils.mkdir File.dirname(taskname) unless File.directory?(File.dirname(taskname)) - FileUtils.cp pkg.name, taskname - end - end - project.task 'ivy:publish' => taskname + ivy_project = project + until ivy_project.ivy.own_file? + ivy_project = ivy_project.parent + end + + project.packages.each do |pkg| + target_file = project.ivy.name[pkg] || File.basename(pkg.name).gsub(/-#{project.version}/, '') + taskname = project.path_to(project.ivy.publish_from, target_file) + if taskname != pkg.name + project.file taskname => pkg.name do + verbose "Ivy copying '#{pkg.name}' to '#{taskname}' for publishing" + FileUtils.mkdir_p File.dirname(taskname) unless File.directory?(File.dirname(taskname)) + FileUtils.cp pkg.name, taskname end end + + ivy_project.task 'ivy:publish' => taskname end end end # Returns the +ivy+ configuration for the project. Use this to configure Ivy.