summaryrefslogtreecommitdiff
path: root/xmake/core/project/project.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/project/project.lua')
-rw-r--r--xmake/core/project/project.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index ed9b87bb3..6e670ec3b 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -498,7 +498,7 @@ function project._load_targets()
t._ORDERDEPS = t._ORDERDEPS or {}
project._load_deps(t, targets, t._DEPS, t._ORDERDEPS)
- -- load rules
+ -- load rules from target and language
--
-- .e.g
--
@@ -509,7 +509,15 @@ function project._load_targets()
--
t._RULES = t._RULES or {}
t._ORDERULES = t._ORDERULES or {}
- for _, rulename in ipairs(table.wrap(t:get("rules"))) do
+ local rulenames = {}
+ table.join2(rulenames, t:get("rules"))
+ for _, sourcefile in ipairs(table.wrap(t:get("files"))) do
+ local lang = language.load_ex(path.extension(sourcefile))
+ if lang and lang:rules() then
+ table.join2(rulenames, lang:rules())
+ end
+ end
+ for _, rulename in ipairs(rulenames) do
local r = project.rule(rulename) or rule.rule(rulename)
if r then
t._RULES[rulename] = r
@@ -523,7 +531,6 @@ function project._load_targets()
table.insert(t._ORDERULES, r)
end
end
- deprecated_project._patch_target_rules(t)
-- laod packages
t._PACKAGES = t._PACKAGES or {}