diff options
| author | ruki <[email protected]> | 2017-08-14 21:52:15 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-08-14 21:52:15 +0800 |
| commit | fc36f863208e53585aab9832ca7768b4b28b3c71 (patch) | |
| tree | 19fa7d8984801968eb7c53059e39eafa37420cef | |
| parent | 9bad556336c54ad9a9ac1804e9f7d70c2f645c81 (diff) | |
fix target:add and option:add bug
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | xmake/core/project/option.lua | 10 | ||||
| -rw-r--r-- | xmake/core/project/target.lua | 8 | ||||
| -rw-r--r-- | xmake/core/tool/builder.lua | 2 |
4 files changed, 12 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b1c11c551..2179dfca7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Bugs fixed * Fix target deps +* Fix `target:add` and `option:add` bug ## v2.1.5 @@ -339,6 +340,7 @@ ### Bugs修复 * 修复目标级联依赖问题 +* 修复`target:add`和`option:add`问题 ## v2.1.5 diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua index ea5d7f98c..164d570a2 100644 --- a/xmake/core/project/option.lua +++ b/xmake/core/project/option.lua @@ -114,7 +114,7 @@ function option:_cx_check() end end end - + -- ok return true end @@ -258,11 +258,11 @@ function option:set(name_or_info, ...) if type(name_or_info) == "string" then local args = ... if args ~= nil then - self._INFO[name_or_info] = table.unique({...}) + self._INFO[name_or_info] = table.unique(table.join(...)) else self._INFO[name_or_info] = nil end - elseif type(name_or_info) == "table" and #name_or_info == 0 then + elseif table.is_dictionary(name_or_info) then for name, info in pairs(table.join(name_or_info, ...)) do self:set(name, info) end @@ -273,8 +273,8 @@ end function option:add(name_or_info, ...) if type(name_or_info) == "string" then local info = table.wrap(self._INFO[name_or_info]) - self._INFO[name_or_info] = table.unique(table.append(info, ...)) - elseif type(name_or_info) == "table" and #name_or_info == 0 then + self._INFO[name_or_info] = table.unique(table.join(info, ...)) + elseif table.is_dictionary(name_or_info) then for name, info in pairs(table.join(name_or_info, ...)) do self:add(name, info) end diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua index 2e98206c6..4c78b56c3 100644 --- a/xmake/core/project/target.lua +++ b/xmake/core/project/target.lua @@ -77,11 +77,11 @@ function target:set(name_or_info, ...) if type(name_or_info) == "string" then local args = ... if args ~= nil then - self._INFO[name_or_info] = table.unique({...}) + self._INFO[name_or_info] = table.unique(table.join(...)) else self._INFO[name_or_info] = nil end - elseif type(name_or_info) == "table" and #name_or_info == 0 then + elseif table.is_dictionary(name_or_info) then for name, info in pairs(table.join(name_or_info, ...)) do self:set(name, info) end @@ -92,8 +92,8 @@ end function target:add(name_or_info, ...) if type(name_or_info) == "string" then local info = table.wrap(self._INFO[name_or_info]) - self._INFO[name_or_info] = table.unique(table.append(info, ...)) - elseif type(name_or_info) == "table" and #name_or_info == 0 then + self._INFO[name_or_info] = table.unique(table.join(info, ...)) + elseif table.is_dictionary(name_or_info) then for name, info in pairs(table.join(name_or_info, ...)) do self:add(name, info) end diff --git a/xmake/core/tool/builder.lua b/xmake/core/tool/builder.lua index 627df9d5c..d67d407ce 100644 --- a/xmake/core/tool/builder.lua +++ b/xmake/core/tool/builder.lua @@ -316,7 +316,7 @@ function builder:_addflags_from_language(flags, target, getters) -- add the flags for _, flagvalue in ipairs(table.wrap(getter(flagname))) do - + -- map and check flag local flag = mapper(self:_tool(), flagvalue, target, self:_targetkind()) if flag and flag ~= "" and (not checkstate or self:has_flags(flag)) then |
