Return-Path: X-Original-To: apmail-buildr-commits-archive@www.apache.org Delivered-To: apmail-buildr-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 03EF011CE3 for ; Thu, 31 Jul 2014 05:12:16 +0000 (UTC) Received: (qmail 69809 invoked by uid 500); 31 Jul 2014 05:12:15 -0000 Delivered-To: apmail-buildr-commits-archive@buildr.apache.org Received: (qmail 69729 invoked by uid 500); 31 Jul 2014 05:12:15 -0000 Mailing-List: contact commits-help@buildr.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@buildr.apache.org Delivered-To: mailing list commits@buildr.apache.org Received: (qmail 69623 invoked by uid 99); 31 Jul 2014 05:12:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jul 2014 05:12:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 72F139BAF01; Thu, 31 Jul 2014 05:12:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: donaldp@apache.org To: commits@buildr.apache.org Date: Thu, 31 Jul 2014 05:12:21 -0000 Message-Id: <6e65d2e022cd4ab88136a7b9921c3a64@git.apache.org> In-Reply-To: <01e1a44f64ba40ab842130f10e0eafc9@git.apache.org> References: <01e1a44f64ba40ab842130f10e0eafc9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [07/50] git commit: Attempt to work around sequencing issues relating to the order in which resources are copied. If a user defines a task that generates assets then these assets should be copied first and all the non-filtered resources should come after Attempt to work around sequencing issues relating to the order in which resources are copied. If a user defines a task that generates assets then these assets should be copied first and all the non-filtered resources should come after git-svn-id: https://svn.apache.org/repos/asf/buildr/trunk@1535340 13f79535-47bb-0310-9956-ffa450edef68 Project: http://git-wip-us.apache.org/repos/asf/buildr/repo Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/8f1d8d38 Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/8f1d8d38 Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/8f1d8d38 Branch: refs/heads/master Commit: 8f1d8d38bad031d8cf301de69ec2530f48efc2d2 Parents: 445505d Author: Peter Donald Authored: Thu Oct 24 11:04:16 2013 +0000 Committer: Peter Donald Committed: Thu Oct 24 11:04:16 2013 +0000 ---------------------------------------------------------------------- lib/buildr/core/assets.rb | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/buildr/blob/8f1d8d38/lib/buildr/core/assets.rb ---------------------------------------------------------------------- diff --git a/lib/buildr/core/assets.rb b/lib/buildr/core/assets.rb index bfd3b22..4a9466d 100644 --- a/lib/buildr/core/assets.rb +++ b/lib/buildr/core/assets.rb @@ -40,6 +40,11 @@ module Buildr #:nodoc: def initialize(*args) #:nodoc: super + end + + private + + def add_enhance_actions enhance do paths = self.paths.flatten.compact if paths.size > 0 @@ -49,14 +54,21 @@ module Buildr #:nodoc: end.each do |a| a.invoke if a.respond_to?(:invoke) end.each do |asset| - cp_r Dir["#{asset}/*"], "#{name}/" + source_dir = asset.to_s + Dir["#{source_dir}/*"].each do |f| + f = f[source_dir.length + 1, 10000] + source = "#{asset}/#{f}" + target = "#{name}/#{f}" + if !File.exist?(target) || File.mtime(name.to_s) < File.mtime(source) + mkdir_p File.dirname(target) + cp source, target + end + end end end end end - private - def out_of_date?(stamp) super || self.paths.any? { |n| n.respond_to?(:needed?) && n.needed? } @@ -77,6 +89,10 @@ module Buildr #:nodoc: project.assets.paths end + after_define do |project| + project.assets.send(:add_enhance_actions) + end + # Access the asset task def assets if @assets.nil?