summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-11-26 14:35:04 +0800
committerGitHub <[email protected]>2021-11-26 14:35:04 +0800
commit312e6d46f70051ee012bc42bf75d386018d43b51 (patch)
tree975dbb2a033aa642322116405321373bfbb9af00
parentf25a332634cc2af78721212edf8c7713412c71e4 (diff)
Update repository.lua
-rw-r--r--xmake/core/sandbox/modules/import/core/package/repository.lua46
1 files changed, 28 insertions, 18 deletions
diff --git a/xmake/core/sandbox/modules/import/core/package/repository.lua b/xmake/core/sandbox/modules/import/core/package/repository.lua
index 5d8406094..5c21f5de5 100644
--- a/xmake/core/sandbox/modules/import/core/package/repository.lua
+++ b/xmake/core/sandbox/modules/import/core/package/repository.lua
@@ -110,15 +110,20 @@ function sandbox_core_package_repository.repositories(is_global)
-- add artifacts urls
local artifacts_urls = localcache.cache("repository"):get("artifacts_urls")
if not artifacts_urls then
- artifacts_urls = {"https://github.com/xmake-mirror/build-artifacts.git",
- "https://gitlab.com/xmake-mirror/build-artifacts.git",
- "https://gitee.com/xmake-mirror/build-artifacts.git"}
- if global.get("network") ~= "private" then
- import("net.fasturl")
- fasturl.add(artifacts_urls)
- artifacts_urls = fasturl.sort(artifacts_urls)
- localcache.cache("repository"):set("artifacts_urls", artifacts_urls)
- localcache.cache("repository"):save()
+ local binary_repo = os.getenv("XMAKE_BINARY_REPO")
+ if binary_repo then
+ artifacts_urls = {binary_repo}
+ else
+ artifacts_urls = {"https://github.com/xmake-mirror/build-artifacts.git",
+ "https://gitlab.com/xmake-mirror/build-artifacts.git",
+ "https://gitee.com/xmake-mirror/build-artifacts.git"}
+ if global.get("network") ~= "private" then
+ import("net.fasturl")
+ fasturl.add(artifacts_urls)
+ artifacts_urls = fasturl.sort(artifacts_urls)
+ localcache.cache("repository"):set("artifacts_urls", artifacts_urls)
+ localcache.cache("repository"):save()
+ end
end
end
if #artifacts_urls > 0 then
@@ -131,15 +136,20 @@ function sandbox_core_package_repository.repositories(is_global)
-- add main urls
local mainurls = localcache.cache("repository"):get("mainurls")
if not mainurls then
- mainurls = {"https://github.com/xmake-io/xmake-repo.git",
- "https://gitlab.com/tboox/xmake-repo.git",
- "https://gitee.com/tboox/xmake-repo.git"}
- if global.get("network") ~= "private" then
- import("net.fasturl")
- fasturl.add(mainurls)
- mainurls = fasturl.sort(mainurls)
- localcache.cache("repository"):set("mainurls", mainurls)
- localcache.cache("repository"):save()
+ local mainrepo = os.getenv("XMAKE_MAIN_REPO")
+ if mainrepo then
+ mainurls = {mainrepo}
+ else
+ mainurls = {"https://github.com/xmake-io/xmake-repo.git",
+ "https://gitlab.com/tboox/xmake-repo.git",
+ "https://gitee.com/tboox/xmake-repo.git"}
+ if global.get("network") ~= "private" then
+ import("net.fasturl")
+ fasturl.add(mainurls)
+ mainurls = fasturl.sort(mainurls)
+ localcache.cache("repository"):set("mainurls", mainurls)
+ localcache.cache("repository"):save()
+ end
end
end
if #mainurls > 0 then