diff options
| -rw-r--r-- | xmake/actions/create/template.lua | 12 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/core/package/repository.lua | 10 |
2 files changed, 13 insertions, 9 deletions
diff --git a/xmake/actions/create/template.lua b/xmake/actions/create/template.lua index 26b4672a0..8b7e4be99 100644 --- a/xmake/actions/create/template.lua +++ b/xmake/actions/create/template.lua @@ -40,14 +40,12 @@ function rootinfos() local results = {} -- get template directories from global repositories - local repos = repository.repositories(true) + local repos = repository.repositories(true, {network = false}) if repos then - local repolist = repos - table.sort(repolist, function (a, b) return a:name() < b:name() end) - for _, repo in ipairs(repolist) do - local dir = path.join(repo:directory(), "templates") - if os.isdir(dir) then - table.insert(results, {kind = "repo", name = repo:name(), url = repo:url(), branch = repo:branch(), dir = dir}) + for _, repo in ipairs(repos) do + local templatesdir = path.join(repo:directory(), "templates") + if os.isdir(templatesdir) then + table.insert(results, {kind = "repo", name = repo:name(), url = repo:url(), branch = repo:branch(), dir = templatesdir}) end end end diff --git a/xmake/core/sandbox/modules/import/core/package/repository.lua b/xmake/core/sandbox/modules/import/core/package/repository.lua index 17ff95b4c..32eee5279 100644 --- a/xmake/core/sandbox/modules/import/core/package/repository.lua +++ b/xmake/core/sandbox/modules/import/core/package/repository.lua @@ -60,7 +60,11 @@ function sandbox_core_package_repository.clear(is_global) end -- get all repositories from global or local directory -function sandbox_core_package_repository.repositories(is_global) +-- +-- opt: +-- - network = false: do not access network resources (skip fasturl sorting) +function sandbox_core_package_repository.repositories(is_global, opt) + opt = opt or {} -- load repositories from repository cache local repositories = {} @@ -113,6 +117,9 @@ function sandbox_core_package_repository.repositories(is_global) if network == nil then network = global.get("network") end + if opt.network == false then + network = "private" + end -- add artifacts urls (only on Windows) if os.is_host("windows") then @@ -184,4 +191,3 @@ end -- return module return sandbox_core_package_repository - |
