summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-10-08 11:56:37 +0800
committerruki <[email protected]>2022-10-08 11:56:37 +0800
commitae84c24d057752b7d3fe2101020e97e697fdd70d (patch)
tree6b4ff0bf55ca59afc1ffc658f394b5c9615eb94b
parentf49f2916627c39a5656417190efd94a0ec690388 (diff)
add some comments for package rule
-rw-r--r--xmake/actions/config/main.lua3
-rw-r--r--xmake/core/project/rule.lua16
2 files changed, 18 insertions, 1 deletions
diff --git a/xmake/actions/config/main.lua b/xmake/actions/config/main.lua
index eb51cb4dc..c8705d945 100644
--- a/xmake/actions/config/main.lua
+++ b/xmake/actions/config/main.lua
@@ -206,6 +206,9 @@ function _load_package_rules_for_target(target)
local r = pkginfo:rule(rulename)
if r then
target:rule_add(r)
+ for _, dep in pairs(r:deps()) do
+ target:rule_add(dep)
+ end
end
end
end
diff --git a/xmake/core/project/rule.lua b/xmake/core/project/rule.lua
index 367107393..4d2a058a0 100644
--- a/xmake/core/project/rule.lua
+++ b/xmake/core/project/rule.lua
@@ -364,7 +364,21 @@ function rule.new(name, info, opt)
instance._INFO = info
instance._PACKAGE = opt.package
if opt.package then
- -- replace deps in package
+ -- replace deps in package, @bar -> @zlib/bar
+ -- @see https://github.com/xmake-io/xmake/issues/2374
+ --
+ -- packages/z/zlib/rules/foo.lua
+ -- @code
+ -- rule("foo")
+ -- add_deps("@bar")
+ -- @endcode
+ --
+ -- package/z/zlib/rules/foo.lua
+ -- @code
+ -- rule("bar")
+ -- ...
+ -- @endcode
+ --
local deps = {}
for _, depname in ipairs(table.wrap(instance:get("deps"))) do
-- @xxx -> @package/xxx