diff options
| author | ruki <[email protected]> | 2018-05-03 00:32:17 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-05-02 21:13:47 +0800 |
| commit | cfba205115076f667edaa99bd2d3628a34482065 (patch) | |
| tree | 62a023369f731eb4a97e879b32a4a0bd8ef8dfd4 /xmake/core/project/target.lua | |
| parent | 4bda9b04b16460c93f6342a17c93cf07f191b7cc (diff) | |
fix file rule bug
Diffstat (limited to 'xmake/core/project/target.lua')
| -rw-r--r-- | xmake/core/project/target.lua | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 9ca8c8b44..e497b1573 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -877,7 +877,8 @@ function target:sourcebatches() -- add file rules local builtin_rule = true - for _, filerule in ipairs(self:filerules(sourcefile)) do + local filerules = self:filerules(sourcefile) + for _, filerule in ipairs(filerules) do -- get source kind local sourcekind = "__rule_" .. filerule:name() @@ -912,21 +913,21 @@ function target:sourcebatches() sourcekind = sourcekind_ext end end + if sourcekind then - -- unknown source kind - if not sourcekind then - os.raise("unknown source file: %s", sourcefile) - end + -- make this batch + local sourcebatch = sourcebatches[sourcekind] or {sourcefiles = {}} + sourcebatches[sourcekind] = sourcebatch - -- make this batch - local sourcebatch = sourcebatches[sourcekind] or {sourcefiles = {}} - sourcebatches[sourcekind] = sourcebatch + -- add source kind to this batch + sourcebatch.sourcekind = sourcekind - -- add source kind to this batch - sourcebatch.sourcekind = sourcekind + -- add source file to this batch + table.insert(sourcebatch.sourcefiles, sourcefile) - -- add source file to this batch - table.insert(sourcebatch.sourcefiles, sourcefile) + elseif #filerules == 0 then + os.raise("unknown source file: %s", sourcefile) + end end end |
