diff options
| author | ruki <[email protected]> | 2022-01-16 11:14:21 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-01-16 11:14:21 +0800 |
| commit | 3a468796f68fefda636d94985346f9a4b956b3c3 (patch) | |
| tree | b9704562919d6c83b3879f5369e1f7bf197c391e | |
| parent | 027c4dd81f9f47601f228d9b015ae0de64d300a9 (diff) | |
add builtin github mirror
| -rw-r--r-- | xmake/actions/global/xmake.lua | 12 | ||||
| -rw-r--r-- | xmake/modules/net/proxy.lua | 3 | ||||
| -rw-r--r-- | xmake/scripts/pac/github_mirror.lua | 4 |
3 files changed, 18 insertions, 1 deletions
diff --git a/xmake/actions/global/xmake.lua b/xmake/actions/global/xmake.lua index 9765412a0..224bf06fd 100644 --- a/xmake/actions/global/xmake.lua +++ b/xmake/actions/global/xmake.lua @@ -59,7 +59,17 @@ task("global") , " if host == 'github.com' then" , " return true" , " end" - , " end"}, + , " end" + , "" + , "Builtin pac files:" + , function () + local description = {} + local pacfiles = os.files(path.join(os.programdir(), "scripts", "pac", "*.lua")) + for _, pacfile in ipairs(pacfiles) do + table.insert(description, " - " .. path.filename(pacfile)) + end + return description + end}, -- package configuration {category = "Package Configuration"}, diff --git a/xmake/modules/net/proxy.lua b/xmake/modules/net/proxy.lua index 6aac4af4c..809b28352 100644 --- a/xmake/modules/net/proxy.lua +++ b/xmake/modules/net/proxy.lua @@ -60,6 +60,9 @@ function _proxy_pac() end if not pacfile and not path.is_absolute(pac) then pacfile = path.join(global.directory(), pac) + if not os.isfile(pacfile) and os.isfile(path.join(os.programdir(), "scripts", "pac", pac)) then + pacfile = path.join(os.programdir(), "scripts", "pac", pac) + end end end if pacfile and os.isfile(pacfile) then diff --git a/xmake/scripts/pac/github_mirror.lua b/xmake/scripts/pac/github_mirror.lua new file mode 100644 index 000000000..5ab5f9ff5 --- /dev/null +++ b/xmake/scripts/pac/github_mirror.lua @@ -0,0 +1,4 @@ +function mirror(url) + return url:gsub("github.com", "github.com.cnpmjs.org") +end + |
