diff options
| author | ruki <[email protected]> | 2018-12-01 00:46:28 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-11-30 22:38:53 +0800 |
| commit | 9566d0af2514225130bc4c3d6946d1d1c8c65fe3 (patch) | |
| tree | 7b743d0866749c25c111ec994d99d0774b20f5f5 | |
| parent | 4b5c554e53ca52e80c66f698d41f999a4664c7d4 (diff) | |
fetch require version
| -rw-r--r-- | xmake/core/package/package.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 5220bc76a..47f7eb718 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -539,6 +539,12 @@ function _instance:fetch(opt) return fetchinfo, fetchfrom end + -- fetch the require version + local require_ver = opt.version or self:requireinfo().version + if require_ver == "lastest" then + require_ver = nil + end + -- fetch binary tool? fetchinfo = nil fetchfrom = nil @@ -547,7 +553,7 @@ function _instance:fetch(opt) -- import find_tool self._find_tool = self._find_tool or sandbox_module.import("lib.detect.find_tool", {anonymous = true}) - -- fetch it from the system directories + -- fetch it from the system directories, TODO find the given version fetchinfo = self._find_tool(self:name(), {force = opt.force}) if fetchinfo then fetchfrom = "system" -- ignore self:requireinfo().system @@ -568,6 +574,7 @@ function _instance:fetch(opt) fetchinfo = self._find_package(self:name(), {prefixdirs = self:prefixdir(), system = false, global = self:from("local") and false or nil, + version = require_ver, cachekey = "fetch:prefix", force = opt.force or self:from("local")}) if fetchinfo then fetchfrom = self._FROMKIND end @@ -575,7 +582,7 @@ function _instance:fetch(opt) -- fetch it from the system directories if not fetchinfo and system ~= false then - fetchinfo = self._find_package(self:name(), {force = opt.force, cachekey = "fetch:system", system = true}) + fetchinfo = self._find_package(self:name(), {force = opt.force, version = require_ver, cachekey = "fetch:system", system = true}) if fetchinfo then fetchfrom = "system" end end end |
