diff options
| author | ruki <[email protected]> | 2020-06-21 21:56:49 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-06-21 21:56:49 +0800 |
| commit | 575af836f69fc82662882256c3c136f23a5e28d8 (patch) | |
| tree | 59adfbf710e4a7b4c82e5b66aa1aff7032eaf1a8 | |
| parent | b36e99d43690324881aa975d0b4ee7d192ff77c9 (diff) | |
improve to download package
| -rw-r--r-- | xmake/actions/require/impl/action/download.lua | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/xmake/actions/require/impl/action/download.lua b/xmake/actions/require/impl/action/download.lua index b09e77011..92a7c68d0 100644 --- a/xmake/actions/require/impl/action/download.lua +++ b/xmake/actions/require/impl/action/download.lua @@ -21,6 +21,7 @@ -- imports import("core.base.option") import("core.base.tty") +import("core.project.config") import(".utils.filter") import("net.http") import("devel.git") @@ -90,8 +91,12 @@ function _download(package, url, sourcedir, url_alias, url_excludes) os.tryrm(packagefile) -- download or copy package file + local localfile = path.join(config.buildir(), path.filename(url)) if os.isfile(url) then os.cp(url, packagefile) + elseif os.isfile(localfile) then + -- we can download package to build/filename manually if network is too slow + os.cp(localfile, packagefile) else http.download(url, packagefile) end @@ -206,6 +211,7 @@ function main(package) cprint("${yellow} => ${clear}clone %s %s .. ${color.failure}${text.failure}", url, package:version_str()) else cprint("${yellow} => ${clear}download %s .. ${color.failure}${text.failure}", url) + wprint("we can also download ${bright}%s${clear} to ${bright}$(buildir)/%s${clear} manually", url, path.filename(url)) end -- failed? break it |
