From 3f5424d4f6e54ad4749cfd13697bb27e9256b8b3 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 7 Jun 2025 22:05:11 +0800 Subject: improve nasm files --- xmake/core/project/project.lua | 3 ++- xmake/core/project/target.lua | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index 5a069f644..043ff3cfa 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -417,7 +417,8 @@ function project._load_targets() for _, sourcefile in ipairs(table.wrap(t:get("files"))) do local extension = path.extension((sourcefile:gsub("|.*$", ""))) if not extensions[extension] then - local lang = language.load_ex(extension) + local sourcekind = t:extraconf("files", sourcefile, "sourcekind") + local lang = sourcekind and language.load_sk(sourcekind) or language.load_ex(extension) if lang and lang:rules() then table.join2(rulenames, lang:rules()) end diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 6f4ad4d89..cda2e612e 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -201,7 +201,8 @@ function _instance:_update_filerules() for _, sourcefile in ipairs(table.wrap(self:get("files"))) do local extension = path.extension((sourcefile:gsub("|.*$", ""))) if not extensions[extension] then - local lang = language.load_ex(extension) + local sourcekind = self:extraconf("files", sourcefile, "sourcekind") + local lang = sourcekind and language.load_sk(sourcekind) or language.load_ex(extension) if lang and lang:rules() then table.join2(rulenames, lang:rules()) end @@ -1809,6 +1810,7 @@ function _instance:filerules(sourcefile) local override = false local fileconfig = self:fileconfig(sourcefile) if fileconfig then + utils.dump(fileconfig) local filerules = fileconfig.rules or fileconfig.rule if filerules then override = filerules.override -- cgit v1.3.1 From 487397fd5424b482af1c4711e97658d8409c91d3 Mon Sep 17 00:00:00 2001 From: ruki Date: Sat, 7 Jun 2025 23:13:04 +0800 Subject: improve sourcekind --- xmake/core/project/target.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index cda2e612e..eb29ed952 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -1810,7 +1810,6 @@ function _instance:filerules(sourcefile) local override = false local fileconfig = self:fileconfig(sourcefile) if fileconfig then - utils.dump(fileconfig) local filerules = fileconfig.rules or fileconfig.rule if filerules then override = filerules.override @@ -1861,7 +1860,8 @@ function _instance:filerules(sourcefile) local filename = path.filename(sourcefile):lower() for _, r in ipairs(table.wrap(key2rules[path.extension(filename, 2)] or key2rules[path.extension(filename)] or - key2rules[self:sourcekind_of(filename)])) do + key2rules[self:sourcekind_of(filename)] or + key2rules[fileconfig and fileconfig.sourcekind])) do -- add_files("*.nasm", {sourcekind = "asm"}) if self:extraconf("rules", r:name(), "override") then table.insert(rules_override, r) else -- cgit v1.3.1