summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorruki <[email protected]>2021-11-25 10:22:08 +0800
committerruki <[email protected]>2021-11-25 10:22:08 +0800
commitb7588b6bc50d511154b18bad81c3a659ce3e9437 (patch)
tree0f811deb1bf2beee123ed97f81d14d6f5278a865 /xmake/plugins
parenta3e6076aff9fa5b3ad43ac2a3b1de88c61319a7d (diff)
add mirror for repo
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/repo/main.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/xmake/plugins/repo/main.lua b/xmake/plugins/repo/main.lua
index a4ec01b90..4baa1f540 100644
--- a/xmake/plugins/repo/main.lua
+++ b/xmake/plugins/repo/main.lua
@@ -25,6 +25,7 @@ import("core.project.project")
import("core.platform.platform")
import("core.package.repository")
import("devel.git")
+import("net.proxy")
import("private.async.runjobs")
import("private.action.require.impl.environment")
@@ -45,7 +46,8 @@ function _add(name, url, branch, is_global)
-- clone repository
if not os.isdir(url) then
- git.clone(url, {verbose = option.get("verbose"), branch = branch or "master", outputdir = repodir})
+ local remoteurl = proxy.mirror(url) or url
+ git.clone(remoteurl, {verbose = option.get("verbose"), branch = branch or "master", outputdir = repodir})
end
-- trace
@@ -117,7 +119,8 @@ function _update()
vprint("cloning repository(%s): %s to %s ..", repo:name(), repo:url(), repodir)
-- clone it
- git.clone(repo:url(), {verbose = option.get("verbose"), branch = repo:branch() or "master", outputdir = repodir})
+ local remoteurl = proxy.mirror(repo:url()) or repo:url()
+ git.clone(remoteurl, {verbose = option.get("verbose"), branch = repo:branch() or "master", outputdir = repodir})
-- mark as updated
io.save(path.join(repodir, "updated"), {})