diff options
| author | ruki <[email protected]> | 2017-08-30 11:11:52 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-08-30 11:11:52 +0800 |
| commit | 28e152d756f81976c035ca7db8e1017c6463928c (patch) | |
| tree | 77d07192bf3256f0a4097a0874672e6e71a5a1d9 /xmake/actions/require/install.lua | |
| parent | a08ffe4df25199ca038a768d5dfae96a2a54ee41 (diff) | |
fetch local installed packages
Diffstat (limited to 'xmake/actions/require/install.lua')
| -rw-r--r-- | xmake/actions/require/install.lua | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/xmake/actions/require/install.lua b/xmake/actions/require/install.lua index 4ea72fdad..cd1eda0ba 100644 --- a/xmake/actions/require/install.lua +++ b/xmake/actions/require/install.lua @@ -43,19 +43,34 @@ function main(requires) -- load packages local packages = package.load_packages(requires or project.requires()) - -- download packages + -- fetch packages from local first + local packages_remote = {} + if option.get("force") then + for _, instance in ipairs(packages) do + if instance and not instance:phony() then + table.insert(packages_remote, instance) + end + end + else + process.runjobs(function (index) + local instance = packages[index] + if instance and not instance:phony() and not instance:fetch() then + table.insert(packages_remote, instance) + end + end, #packages) + end + + -- download remote packages local waitindex = 0 local waitchars = {'\\', '|', '/', '-'} process.runjobs(function (index) - local instance = packages[index] + local instance = packages_remote[index] if instance then - - -- download package action.download(instance) end - end, #packages, ifelse(option.get("verbose"), 1, 4), 300, function (indices) + end, #packages_remote, ifelse(option.get("verbose"), 1, 4), 300, function (indices) -- do not print progress info if be verbose if option.get("verbose") then @@ -68,9 +83,9 @@ function main(requires) -- make downloading packages list local downloading = {} for _, index in ipairs(indices) do - local instance = packages[index] + local instance = packages_remote[index] if instance then - table.insert(downloading, instance:name()) + table.insert(downloading, instance:fullname()) end end @@ -80,7 +95,7 @@ function main(requires) end) -- install all required packages from repositories - for _, instance in ipairs(packages) do + for _, instance in ipairs(packages_remote) do action.install(instance) end |
