summaryrefslogtreecommitdiff
path: root/xmake/actions/require/install.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-17 22:49:31 +0800
committerruki <[email protected]>2020-02-17 10:57:07 +0800
commit82752d654d9f34619e7a8f4e39abb9cbdaf0957a (patch)
tree717adf3b1112ff84471d42d758bbe561fa388ce3 /xmake/actions/require/install.lua
parent8368581d63ff27a0edc3928a8a391b2cf3e1e4bc (diff)
improve to require/install and uninstall
Diffstat (limited to 'xmake/actions/require/install.lua')
-rw-r--r--xmake/actions/require/install.lua25
1 files changed, 19 insertions, 6 deletions
diff --git a/xmake/actions/require/install.lua b/xmake/actions/require/install.lua
index 26c624b8f..75f7ec9db 100644
--- a/xmake/actions/require/install.lua
+++ b/xmake/actions/require/install.lua
@@ -132,12 +132,8 @@ function _check_missing_packages(packages)
_g.optional_missing = optional_missing
end
--- install packages
-function main(requires)
-
- -- avoid to run this task repeatly
- if _g.installed then return end
- _g.installed = true
+-- get requires and extra config
+function _get_requires(requires)
-- init requires
local requires_extra = nil
@@ -167,6 +163,23 @@ function main(requires)
requires_extra[require_str] = extrainfo
end
end
+ return requires, requires_extra
+end
+
+-- install packages
+function main(requires)
+
+ -- avoid to run this task repeatly
+ if _g.installed then return end
+ _g.installed = true
+
+ -- get requires and extra config
+ local requires_extra = nil
+ requires, requires_extra = _get_requires(requires)
+ if not requires or #requires == 0 then
+ raise("requires(%s) not found!", table.concat(requires, " "))
+ return
+ end
-- enter environment
environment.enter()