summaryrefslogtreecommitdiff
path: root/xmake/core/project
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-07 00:40:57 +0800
committerruki <[email protected]>2025-01-07 00:40:57 +0800
commitae8a596c609e01b21caa5825f3fd2eec0bdb7507 (patch)
tree20ab76b862913222a52c932d5688eb9c0dc176b3 /xmake/core/project
parentf6904d729ce7ca99fad237e5e0641ee015b97faf (diff)
support for inner namespace access
Diffstat (limited to 'xmake/core/project')
-rw-r--r--xmake/core/project/project.lua11
-rw-r--r--xmake/core/project/target.lua12
2 files changed, 20 insertions, 3 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 77793d3e5..f395f5f6b 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -911,9 +911,16 @@ function project.is_loaded()
end
-- get the given target
-function project.target(name)
+function project.target(name, opt)
+ opt = opt or {}
local targets = project.targets()
- return targets and targets[name]
+ if targets then
+ local t = targets[name]
+ if not t and opt.namespace then
+ t = targets[opt.namespace .. "::" .. name]
+ end
+ return t
+ end
end
-- add the given target, @note if the target name is the same, it will be replaced
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 2669875b5..eed55c0bf 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -257,6 +257,9 @@ function _instance:_build_deps()
-- @see https://github.com/xmake-io/xmake/issues/4689
instance_deps.load_deps(self, instances, {}, self._INHERITDEPS, {self:fullname()}, function (t, dep)
local depinherit = t:extraconf("deps", dep:name(), "inherit")
+ if depinherit == nil then
+ depinherit = t:extraconf("deps", dep:fullname(), "inherit")
+ end
return depinherit == nil or depinherit
end)
end
@@ -1107,7 +1110,14 @@ end
function _instance:dep(name)
local deps = self:deps()
if deps then
- return deps[name]
+ local dep = deps[name]
+ if dep == nil then
+ local namespace = self:namespace()
+ if namespace then
+ dep = deps[namespace .. "::" .. name]
+ end
+ end
+ return dep
end
end