summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-12-18 00:34:54 +0800
committerruki <[email protected]>2018-12-17 21:29:25 +0800
commit3974d32f512af461362f9c2f32893c7e67b75db8 (patch)
tree77ac05cf718174d4031701066895aab72fe651e9
parentef7e5b09d88102ffec235af47380e14418e0acc5 (diff)
improve download tips
-rw-r--r--xmake/actions/require/impl/action/download.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/xmake/actions/require/impl/action/download.lua b/xmake/actions/require/impl/action/download.lua
index 038ebb46b..df8a75bfc 100644
--- a/xmake/actions/require/impl/action/download.lua
+++ b/xmake/actions/require/impl/action/download.lua
@@ -52,6 +52,7 @@ function _checkout(package, url, sourcedir, url_alias)
-- clean the previous build files
git.clean({repodir = packagedir, force = true})
+ printf("\r" .. _emptychars() .. "\r")
return
end
@@ -95,8 +96,12 @@ function _download(package, url, sourcedir, url_alias, url_excludes)
assert(sha256, "cannot get sha256 of %s in package(%s)", url, package:name())
-- the package file have been downloaded?
+ local cached = true
if option.get("force") or not os.isfile(packagefile) or sha256 ~= hash.sha256(packagefile) then
+ -- no cached
+ cached = false
+
-- attempt to remove package file first
os.rm(packagefile)
@@ -125,8 +130,12 @@ function _download(package, url, sourcedir, url_alias, url_excludes)
package:originfile_set(path.absolute(packagefile))
-- trace
- printf("\r" .. _emptychars())
- cprint("\r${yellow} => ${clear}download %s .. ${green}ok", url)
+ if not cached then
+ printf("\r" .. _emptychars())
+ cprint("\r${yellow} => ${clear}download %s .. ${green}ok", url)
+ else
+ printf("\r" .. _emptychars() .. "\r")
+ end
end
-- get sorted urls