summaryrefslogtreecommitdiff
path: root/xmake/core/project/package.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-08 23:28:02 +0800
committerruki <[email protected]>2025-01-08 23:28:02 +0800
commit7dec01ba2840236fc975d9213842108ed13e858d (patch)
tree81a647bbf3fece33bcdc87cec3a0f0df2faf26e8 /xmake/core/project/package.lua
parent4ad00835a9070c32b6ce17248e5702ef0eae5a37 (diff)
get packages with namespace
Diffstat (limited to 'xmake/core/project/package.lua')
-rw-r--r--xmake/core/project/package.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/xmake/core/project/package.lua b/xmake/core/project/package.lua
index 70f89a1f8..67000bdc6 100644
--- a/xmake/core/project/package.lua
+++ b/xmake/core/project/package.lua
@@ -69,6 +69,12 @@ function _instance:name()
return self._NAME
end
+-- get the full name
+function _instance:fullname()
+ local namespace = self:namespace()
+ return namespace and namespace .. "::" .. self:name() or self:name()
+end
+
-- get the package version
function _instance:version()
@@ -107,6 +113,11 @@ function _instance:requirestr()
return self:get("__requirestr")
end
+-- get the namespace
+function _instance:namespace()
+ return self:get("__namespace")
+end
+
-- get the require configuration from the given name
--
-- e.g.
@@ -369,7 +380,7 @@ end
-- we need to sort package set keys by this string
-- @see https://github.com/xmake-io/xmake/pull/2971#issuecomment-1290052169
function _instance:__tostring()
- return "<package: " .. self:name() .. ">"
+ return "<package: " .. self:fullname() .. ">"
end
-- get cache