buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
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
Date Thu, 31 Jul 2014 05:12:21 GMT
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 <donaldp@apache.org>
Authored: Thu Oct 24 11:04:16 2013 +0000
Committer: Peter Donald <donaldp@apache.org>
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?


Mime
View raw message