summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-10-16 10:53:59 +0800
committerGitHub <[email protected]>2019-10-16 10:53:59 +0800
commit4a6da794c1ca4d8cfc3bce02e388c2e8bfdc1c90 (patch)
treef4fa3bdb22c15884a994b1aabdc88d5a3b04c175
parentcf861167fe8abcf48144c9ac09be676862bd406f (diff)
fix load c++ builtin rules
-rw-r--r--xmake/core/project/project.lua12
1 files changed, 9 insertions, 3 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 31d858c9c..4baa8ab5c 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -520,13 +520,19 @@ function project._load_targets()
t._RULES = t._RULES or {}
t._ORDERULES = t._ORDERULES or {}
local rulenames = {}
+ local extensions = {}
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())
+ local extension = path.extension((sourcefile:gsub("|.*$", "")))
+ if not extensions[extension] then
+ local lang = language.load_ex(extension)
+ if lang and lang:rules() then
+ table.join2(rulenames, lang:rules())
+ end
+ extensions[extension] = true
end
end
+ rulenames = table.unique(rulenames)
for _, rulename in ipairs(rulenames) do
local r = project.rule(rulename) or rule.rule(rulename)
if r then