summaryrefslogtreecommitdiff
path: root/xmake/core/package/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-08-18 00:53:03 +0800
committerruki <[email protected]>2021-08-18 00:53:03 +0800
commit723dca1ac294cccd66f5b3dd0661299fd197f476 (patch)
treefdcce708c72ccf1ea8fc008573616fdf8bea3d9a /xmake/core/package/package.lua
parent00107046b0c8eb07185b24783b2d32114f9ed760 (diff)
improve version source
Diffstat (limited to 'xmake/core/package/package.lua')
-rw-r--r--xmake/core/package/package.lua39
1 files changed, 19 insertions, 20 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua
index 5724da656..f7b2b7884 100644
--- a/xmake/core/package/package.lua
+++ b/xmake/core/package/package.lua
@@ -855,22 +855,7 @@ function _instance:version_str()
return self._VERSION_STR
end
--- get branch version
-function _instance:branch()
- return self._BRANCH
-end
-
--- get tag version
-function _instance:tag()
- return self._TAG
-end
-
--- is git ref?
-function _instance:gitref()
- return self:branch() or self:tag()
-end
-
--- set the version, source: branches, tags, versions
+-- set the version, source: branch, tag, version
function _instance:version_set(version, source)
-- save the semver version
@@ -880,17 +865,31 @@ function _instance:version_set(version, source)
end
-- save branch and tag
- if source == "branches" then
+ if source == "branch" then
self._BRANCH = version
- elseif source == "tags" then
+ elseif source == "tag" then
self._TAG = version
end
- -- save source and version string
- self._SOURCE = source
+ -- save version string
self._VERSION_STR = version
end
+-- get branch version
+function _instance:branch()
+ return self._BRANCH
+end
+
+-- get tag version
+function _instance:tag()
+ return self._TAG
+end
+
+-- is git ref?
+function _instance:gitref()
+ return self:branch() or self:tag()
+end
+
-- get the require info
function _instance:requireinfo()
return self._REQUIREINFO