summaryrefslogtreecommitdiff
path: root/xmake/core/package/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-14 00:37:13 +0800
committerruki <[email protected]>2022-04-14 00:37:13 +0800
commit12652bfd524697241b893d4a4e1672ecc3608f2c (patch)
tree6b0aa0ba694723e1bb99b39830a7c8969c71f2a1 /xmake/core/package/package.lua
parenta39818c953e11781d2305e2ad3afe5b551c15eec (diff)
support git commit as require version
Diffstat (limited to 'xmake/core/package/package.lua')
-rw-r--r--xmake/core/package/package.lua16
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