diff options
| author | ruki <[email protected]> | 2022-04-14 00:37:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-04-14 00:37:13 +0800 |
| commit | 12652bfd524697241b893d4a4e1672ecc3608f2c (patch) | |
| tree | 6b0aa0ba694723e1bb99b39830a7c8969c71f2a1 /xmake/core/package/package.lua | |
| parent | a39818c953e11781d2305e2ad3afe5b551c15eec (diff) | |
support git commit as require version
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index c7ae4901b..43d4e1307 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -1016,10 +1016,17 @@ function _instance:version_set(version, source) self._BRANCH = version elseif source == "tag" then self._TAG = version + elseif source == "commit" then + self._COMMIT = version end -- save version string - self._VERSION_STR = version + if source == "commit" then + -- we strip it to avoid long paths + self._VERSION_STR = version:sub(1, 8) + else + self._VERSION_STR = version + end end -- get branch version @@ -1032,9 +1039,14 @@ function _instance:tag() return self._TAG end +-- get commit version +function _instance:commit() + return self._COMMIT +end + -- is git ref? function _instance:gitref() - return self:branch() or self:tag() + return self:branch() or self:tag() or self:commit() end -- get the require info |
