diff options
| author | ruki <[email protected]> | 2025-01-09 10:19:14 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-01-09 10:19:14 +0800 |
| commit | 8e24b5a44dcffbee1444d715909a64014e11e866 (patch) | |
| tree | a2f0aaf7b582dae30d4db636efd199ccb158e0d8 /xmake/modules | |
| parent | 1cf6a7f479837b471a5f91410359d86983828e6a (diff) | |
| parent | 6317ffd0fe312360eb5f6e079320c01c95870ad0 (diff) | |
Merge pull request #6001 from xmake-io/namespace
Support for namespace
Diffstat (limited to 'xmake/modules')
4 files changed, 18 insertions, 2 deletions
diff --git a/xmake/modules/private/action/build/object.lua b/xmake/modules/private/action/build/object.lua index c4c646cba..25bf3385b 100644 --- a/xmake/modules/private/action/build/object.lua +++ b/xmake/modules/private/action/build/object.lua @@ -76,7 +76,11 @@ function _do_build_file(target, sourcefile, opt) -- trace progress info if not opt.quiet then - progress.show(opt.progress, "${color.build.object}%scompiling.$(mode) %s", prefix, sourcefile) + local filepath = sourcefile + if target:namespace() then + filepath = target:namespace() .. "::" .. filepath + end + progress.show(opt.progress, "${color.build.object}%scompiling.$(mode) %s", prefix, filepath) end -- trace verbose info diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua index 30c571592..840814040 100644 --- a/xmake/modules/private/action/require/impl/package.lua +++ b/xmake/modules/private/action/require/impl/package.lua @@ -961,6 +961,12 @@ function _load_package(packagename, requireinfo, opt) local package if os.isfile(os.projectfile()) then package = _load_package_from_project(packagename) + if package and package:namespace() then + packagename = package:namespace() .. "::" .. packagename + if displayname then + displayname = package:namespace() .. "::" .. displayname + end + end end -- load package from repositories diff --git a/xmake/modules/private/action/require/impl/register_packages.lua b/xmake/modules/private/action/require/impl/register_packages.lua index ed6079f29..5f428edf3 100644 --- a/xmake/modules/private/action/require/impl/register_packages.lua +++ b/xmake/modules/private/action/require/impl/register_packages.lua @@ -66,6 +66,11 @@ function _register_required_package_libs(instance, required_package, is_deps) required_package:set("__components_orderlist", instance:components_orderlist()) end + -- save namespace + if instance:namespace() then + required_package:set("__namespace", instance:namespace()) + end + -- merge into the components values local required_components = required_package:get("components") if required_components then diff --git a/xmake/modules/private/utils/rule_groups.lua b/xmake/modules/private/utils/rule_groups.lua index ae7279e78..d64a75d62 100644 --- a/xmake/modules/private/utils/rule_groups.lua +++ b/xmake/modules/private/utils/rule_groups.lua @@ -27,7 +27,8 @@ import("core.project.project") -- get rule -- @note we need to get rule from target first, because we maybe will inject and replace builtin rule in target function get_rule(target, rulename) - local ruleinst = assert(target:rule(rulename) or project.rule(rulename) or rule.rule(rulename), "unknown rule: %s", rulename) + local ruleinst = assert(target:rule(rulename) or project.rule(rulename, {namespace = target:namespace()}) or + rule.rule(rulename), "unknown rule: %s", rulename) return ruleinst end |
