summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-06-21 20:28:39 +0800
committerruki <[email protected]>2020-06-21 20:28:39 +0800
commitb36e99d43690324881aa975d0b4ee7d192ff77c9 (patch)
treedcec219007943e37e045995c5b71e2d1e437d7ac
parent47dc42384030e04d7eabf8eda2bb58a72dad4b23 (diff)
improve codes
-rw-r--r--xmake/core/sandbox/modules/import/core/project/project.lua29
1 files changed, 13 insertions, 16 deletions
diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua
index b89c19f93..1ea9c96b5 100644
--- a/xmake/core/sandbox/modules/import/core/project/project.lua
+++ b/xmake/core/sandbox/modules/import/core/project/project.lua
@@ -116,22 +116,19 @@ function sandbox_core_project.check()
-- check toolchains configuration for all target in the current project
-- @note we must check targets after loading options
- local targets = project.targets()
- if targets then
- for _, target in pairs(targets) do
- if target:get("enabled") ~= false and (target:get("toolchains") or target:plat() ~= config.get("plat")) then
- for _, toolchain_inst in pairs(target:toolchains()) do
- -- check toolchains for `target/set_toolchains()`
- if target:get("toolchains") then
- if not toolchain_inst:check() then
- raise("toolchain(\"%s\"): not found!", toolchain_inst:name())
- end
- else
- -- check platform toolchains for `target/set_plat()`
- local ok, errors = target:platform():check()
- if not ok then
- raise(errors)
- end
+ for _, target in pairs(table.wrap(targets)) do
+ if target:get("enabled") ~= false and (target:get("toolchains") or target:plat() ~= config.get("plat")) then
+ for _, toolchain_inst in pairs(target:toolchains()) do
+ -- check toolchains for `target/set_toolchains()`
+ if target:get("toolchains") then
+ if not toolchain_inst:check() then
+ raise("toolchain(\"%s\"): not found!", toolchain_inst:name())
+ end
+ else
+ -- check platform toolchains for `target/set_plat()`
+ local ok, errors = target:platform():check()
+ if not ok then
+ raise(errors)
end
end
end