diff options
| author | ruki <[email protected]> | 2025-01-07 22:45:32 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-01-07 22:45:32 +0800 |
| commit | e5ea7bc6347ce4c4a62468138753cedea663bfa9 (patch) | |
| tree | bcf7ff39f3b3124cf25aa6867a3f9f5ee5fec17a /xmake/core/package/package.lua | |
| parent | c184146581f86d95536dafcadd64e8ae000341f2 (diff) | |
add package for namespace
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 068e95ab6..d3032f15b 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -56,7 +56,12 @@ local sandbox_module = require("sandbox/modules/import/core/sandbox/module") function _instance.new(name, info, opt) opt = opt or {} local instance = table.inherit(_instance) - instance._NAME = name + local parts = name:split("::", {plain = true}) + instance._NAME = parts[#parts] + table.remove(parts) + if #parts > 0 then + instance._NAMESPACE = table.concat(parts, "::") + end instance._INFO = info instance._REPO = opt.repo instance._SCRIPTDIR = opt.scriptdir and path.absolute(opt.scriptdir) @@ -78,6 +83,17 @@ function _instance:name() return self._NAME end +-- get the namespace +function _instance:namespace() + return self._NAMESPACE +end + +-- get the full name +function _instance:fullname() + local namespace = self:namespace() + return namespace and namespace .. "::" .. self:name() or self:name() +end + -- get the type: package function _instance:type() return "package" @@ -1276,6 +1292,7 @@ function _instance:toolchains() local toolchain_opt = project and project.extraconf("target.toolchains", name) or {} toolchain_opt.plat = self:plat() toolchain_opt.arch = self:arch() + toolchain_opt.namespace = self:namespace() local toolchain_inst, errors = toolchain.load(name, toolchain_opt) if not toolchain_inst and project then toolchain_inst = project.toolchain(name, toolchain_opt) |
