You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2014/07/05 04:05:31 UTC

git commit: BUILDR-700 - Ensure SNAPSHOT artifacts, constructed using the download(artifact('group:artifact:jar:1-SNAPSHOT') => ://example.com/...') construct will correctly download the artifacts from configured URL.

Repository: buildr
Updated Branches:
  refs/heads/master 34e65f077 -> 85e45f87e


BUILDR-700 - Ensure SNAPSHOT artifacts, constructed using the
download(artifact('group:artifact:jar:1-SNAPSHOT') => ://example.com/...')
construct will correctly download the artifacts from configured URL.


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/85e45f87
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/85e45f87
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/85e45f87

Branch: refs/heads/master
Commit: 85e45f87e0e637cd9880c2386873c283152ac56b
Parents: 34e65f0
Author: Peter Donald <pe...@realityforge.org>
Authored: Sat Jul 5 12:05:22 2014 +1000
Committer: Peter Donald <pe...@realityforge.org>
Committed: Sat Jul 5 12:05:22 2014 +1000

----------------------------------------------------------------------
 CHANGELOG                 |  4 ++++
 lib/buildr/core/common.rb | 28 ++++++++++++++++++++++++----
 2 files changed, 28 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/85e45f87/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 445e07c..ef92932 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,8 @@
 1.4.19 (Pending)
+* Fixed:  BUILDR-700 - Ensure SNAPSHOT artifacts, constructed using the
+          download(artifact('group:artifact:jar:1-SNAPSHOT') =>
+          'http://example.com/...') construct will correctly download the
+          artifacts from configured URL.
 * Fixed:  BUILDR-700 - Fix bug where buildr was truncating SNAPSHOT files
           that had not changed since last update check and HTTP was returning
           "HTTP Not Modified" status.

http://git-wip-us.apache.org/repos/asf/buildr/blob/85e45f87/lib/buildr/core/common.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/core/common.rb b/lib/buildr/core/common.rb
index 5e2e634..fc46f7a 100644
--- a/lib/buildr/core/common.rb
+++ b/lib/buildr/core/common.rb
@@ -104,12 +104,32 @@ module Buildr #:nodoc:
       # Download to a file created by the task.
       fail unless args.keys.size == 1
       uri = URI.parse(args.values.first.to_s)
-      file(args.keys.first.to_s).tap do |task|
-        task.sources << uri
-        task.enhance { uri.download task.name }
+      key = args.keys.first
+      if key.is_a?(Buildr::Artifact)
+        key.define_singleton_method(:source) do
+          uri
+        end
+        key.define_singleton_method(:download) do
+          trace "Downloading #{to_spec}"
+          begin
+            download_artifact(uri)
+            true
+          rescue URI::NotFoundError
+            false
+          rescue Exception => error
+            info error
+            trace error.backtrace.join("\n")
+            false
+          end || fail_download([])
+        end
+        key
+      else
+        file(key.to_s).tap do |task|
+          task.sources << uri
+          task.enhance { uri.download task.name }
+        end
       end
     end
-
   end
 
   # A file task that concatenates all its prerequisites to create a new file.