diff options
| author | ruki <[email protected]> | 2025-01-08 23:30:16 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-01-08 23:30:16 +0800 |
| commit | 6ef0f9be8bb89a2c8cabd6d950ac104fbf3c88d5 (patch) | |
| tree | cba29130af59b8551d87eba284ec9ac40327490f | |
| parent | 7dec01ba2840236fc975d9213842108ed13e858d (diff) | |
improve package name
| -rw-r--r-- | xmake/core/package/package.lua | 24 | ||||
| -rw-r--r-- | xmake/plugins/show/info/target.lua | 6 |
2 files changed, 15 insertions, 15 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index be736d2f0..502a0b0f8 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -90,7 +90,7 @@ function _instance:_memcache() return cache end --- get the package name +-- get the package name without namespace function _instance:name() return self._NAME end @@ -100,12 +100,22 @@ function _instance:namespace() return self._NAMESPACE end --- get the full name +-- get the full name (with namespace) function _instance:fullname() local namespace = self:namespace() return namespace and namespace .. "::" .. self:name() or self:name() end +-- get the display name (with namespace and ~label) +function _instance:displayname() + return self._DISPLAYNAME +end + +-- set the display name +function _instance:displayname_set(fullname) + self._DISPLAYNAME = displayname +end + -- get the type: package function _instance:type() return "package" @@ -1547,16 +1557,6 @@ function _instance:label() return requireinfo and requireinfo.label end --- get the display name -function _instance:displayname() - return self._DISPLAYNAME -end - --- set the display name -function _instance:displayname_set(displayname) - self._DISPLAYNAME = displayname -end - -- invalidate configs function _instance:_invalidate_configs() self._CONFIGS = nil diff --git a/xmake/plugins/show/info/target.lua b/xmake/plugins/show/info/target.lua index e3aa8829d..871ed321a 100644 --- a/xmake/plugins/show/info/target.lua +++ b/xmake/plugins/show/info/target.lua @@ -78,11 +78,11 @@ function _get_values_from_pkgs(target, name) local info = components[component_name] if info then for _, value in ipairs(info[name]) do - values[value] = string.format(" -> package(%s)", pkg:name()) + values[value] = string.format(" -> package(%s)", pkg:fullname()) end else local components_str = table.concat(table.wrap(configinfo.components), ", ") - utils.warning("unknown component(%s) in add_packages(%s, {components = {%s}})", component_name, pkg:name(), components_str) + utils.warning("unknown component(%s) in add_packages(%s, {components = {%s}})", component_name, pkg:fullname(), components_str) end end end @@ -95,7 +95,7 @@ function _get_values_from_pkgs(target, name) else -- get values from the builtin package configs for _, value in ipairs(pkg:get(name)) do - values[value] = string.format(" -> package(%s)", pkg:name()) + values[value] = string.format(" -> package(%s)", pkg:fullname()) end end end |
