diff --git a/xmake/scripts/action/_global.lua b/xmake/scripts/action/_global.lua index 53ed35b08a2..a8fffa0bc85 100644 --- a/xmake/scripts/action/_global.lua +++ b/xmake/scripts/action/_global.lua @@ -45,7 +45,9 @@ end function _global.done() -- probe the global platform configure - platform.probe(true) + if not platform.probe(true) then + return false + end -- clear up the global configure global.clearup() diff --git a/xmake/scripts/action/action.lua b/xmake/scripts/action/action.lua index f3f2a1ba855..1174b140a07 100644 --- a/xmake/scripts/action/action.lua +++ b/xmake/scripts/action/action.lua @@ -103,7 +103,9 @@ function action.done(name) -- probe the platform if _action.need("platform") and (options._ACTION == "config" or config._RECONFIG) then - platform.probe(false) + if not platform.probe(false) then + return false + end end -- merge the default options diff --git a/xmake/scripts/base/utils.lua b/xmake/scripts/base/utils.lua index 58ec6ba60a4..738013a76e2 100644 --- a/xmake/scripts/base/utils.lua +++ b/xmake/scripts/base/utils.lua @@ -224,10 +224,13 @@ function utils.call(funcs, pred, ...) -- exists predicate? if pred and type(pred) == "function" then - if not pred(name, result) then break end + if not pred(name, result) then return false end -- failed? - elseif not result then break end + elseif not result then return false end end + + -- ok + return true end -- return module: utils diff --git a/xmake/scripts/platform/android/prober.lua b/xmake/scripts/platform/android/prober.lua index 6149b54fb2e..bb4abe02363 100644 --- a/xmake/scripts/platform/android/prober.lua +++ b/xmake/scripts/platform/android/prober.lua @@ -205,6 +205,14 @@ function prober._probe_toolpath(configs, kind, cross, name, description) utils.verbose("checking for %s (%s) ... no", description, kind) end + -- failed? + if not toolpath and not configs.get("ndk") then + utils.error("checking for the NDK directory ... no") + utils.error(" - xmake config --ndk=xxx") + utils.error("or - xmake global --ndk=xxx") + return false + end + -- ok return true end @@ -226,6 +234,8 @@ function prober._probe_toolchains(configs) if not prober._probe_toolpath(configs, "ld", prefix, "g++", "the linker") then return false end if not prober._probe_toolpath(configs, "ar", prefix, "ar", "the static library linker") then return false end if not prober._probe_toolpath(configs, "sh", prefix, "g++", "the shared library linker") then return false end + + -- ok return true end @@ -233,13 +243,13 @@ end function prober.config() -- call all probe functions - utils.call( { prober._probe_arch - , prober._probe_make - , prober._probe_ccache - , prober._probe_ndk_sdkver - , prober._probe_toolchains} - , nil - , config) + return utils.call( { prober._probe_arch + , prober._probe_make + , prober._probe_ccache + , prober._probe_ndk_sdkver + , prober._probe_toolchains} + , nil + , config) end @@ -247,11 +257,11 @@ end function prober.global() -- call all probe functions - utils.call( { prober._probe_make - , prober._probe_ccache - , prober._probe_ndk_sdkver} - , nil - , global) + return utils.call( { prober._probe_make + , prober._probe_ccache + , prober._probe_ndk_sdkver} + , nil + , global) end -- return module: prober diff --git a/xmake/scripts/platform/iphoneos/prober.lua b/xmake/scripts/platform/iphoneos/prober.lua index 2c28923156f..ae17a74c9ce 100644 --- a/xmake/scripts/platform/iphoneos/prober.lua +++ b/xmake/scripts/platform/iphoneos/prober.lua @@ -247,14 +247,14 @@ end function prober.config() -- call all probe functions - utils.call( { prober._probe_arch - , prober._probe_xcode - , prober._probe_xcode_sdkver - , prober._probe_make - , prober._probe_ccache - , prober._probe_toolchains} - , nil - , config) + return utils.call( { prober._probe_arch + , prober._probe_xcode + , prober._probe_xcode_sdkver + , prober._probe_make + , prober._probe_ccache + , prober._probe_toolchains} + , nil + , config) end @@ -262,11 +262,11 @@ end function prober.global() -- call all probe functions - utils.call( { prober._probe_xcode - , prober._probe_make - , prober._probe_ccache} - , nil - , global) + return utils.call( { prober._probe_xcode + , prober._probe_make + , prober._probe_ccache} + , nil + , global) end -- return module: prober diff --git a/xmake/scripts/platform/iphonesimulator/prober.lua b/xmake/scripts/platform/iphonesimulator/prober.lua index e1002ec3264..ae9754f81bf 100644 --- a/xmake/scripts/platform/iphonesimulator/prober.lua +++ b/xmake/scripts/platform/iphonesimulator/prober.lua @@ -246,25 +246,25 @@ end function prober.config() -- call all probe functions - utils.call( { prober._probe_arch - , prober._probe_xcode - , prober._probe_xcode_sdkver - , prober._probe_make - , prober._probe_ccache - , prober._probe_toolchains} - , nil - , config) + return utils.call( { prober._probe_arch + , prober._probe_xcode + , prober._probe_xcode_sdkver + , prober._probe_make + , prober._probe_ccache + , prober._probe_toolchains} + , nil + , config) end -- probe the global configure function prober.global() -- call all probe functions - utils.call( { prober._probe_xcode - , prober._probe_make - , prober._probe_ccache} - , nil - , global) + return utils.call( { prober._probe_xcode + , prober._probe_make + , prober._probe_ccache} + , nil + , global) end -- return module: prober diff --git a/xmake/scripts/platform/linux/prober.lua b/xmake/scripts/platform/linux/prober.lua index ce23dadb56f..5e5eec9b14e 100644 --- a/xmake/scripts/platform/linux/prober.lua +++ b/xmake/scripts/platform/linux/prober.lua @@ -155,22 +155,22 @@ end function prober.config() -- call all probe functions - utils.call( { prober._probe_arch - , prober._probe_make - , prober._probe_ccache - , prober._probe_toolchains} - , nil - , config) + return utils.call( { prober._probe_arch + , prober._probe_make + , prober._probe_ccache + , prober._probe_toolchains} + , nil + , config) end -- probe the global configure function prober.global() -- call all probe functions - utils.call( { prober._probe_make - , prober._probe_ccache} - , nil - , global) + return utils.call( { prober._probe_make + , prober._probe_ccache} + , nil + , global) end -- return module: prober diff --git a/xmake/scripts/platform/macosx/prober.lua b/xmake/scripts/platform/macosx/prober.lua index 0e126f38c59..d2c397edc4c 100644 --- a/xmake/scripts/platform/macosx/prober.lua +++ b/xmake/scripts/platform/macosx/prober.lua @@ -246,24 +246,24 @@ end function prober.config() -- call all probe functions - utils.call( { prober._probe_arch - , prober._probe_xcode - , prober._probe_xcode_sdkver - , prober._probe_make - , prober._probe_ccache - , prober._probe_toolchains} - , nil - , config) + return utils.call( { prober._probe_arch + , prober._probe_xcode + , prober._probe_xcode_sdkver + , prober._probe_make + , prober._probe_ccache + , prober._probe_toolchains} + , nil + , config) end -- probe the global configure function prober.global() -- call all probe functions - utils.call( { prober._probe_xcode - , prober._probe_ccache} - , nil - , global) + return utils.call( { prober._probe_xcode + , prober._probe_ccache} + , nil + , global) end -- return module: prober diff --git a/xmake/scripts/platform/mingw/prober.lua b/xmake/scripts/platform/mingw/prober.lua index 86fca46abb4..0134c050928 100644 --- a/xmake/scripts/platform/mingw/prober.lua +++ b/xmake/scripts/platform/mingw/prober.lua @@ -168,22 +168,22 @@ end function prober.config() -- call all probe functions - utils.call( { prober._probe_arch - , prober._probe_make - , prober._probe_ccache - , prober._probe_toolchains} - , nil - , config) + return utils.call( { prober._probe_arch + , prober._probe_make + , prober._probe_ccache + , prober._probe_toolchains} + , nil + , config) end -- probe the global configure function prober.global() -- call all probe functions - utils.call( { prober._probe_make - , prober._probe_ccache} - , nil - , global) + return utils.call( { prober._probe_make + , prober._probe_ccache} + , nil + , global) end -- return module: prober diff --git a/xmake/scripts/platform/platform.lua b/xmake/scripts/platform/platform.lua index c2057e246a0..38d482f447d 100644 --- a/xmake/scripts/platform/platform.lua +++ b/xmake/scripts/platform/platform.lua @@ -364,7 +364,7 @@ function platform.probe(is_global) for _, plat in ipairs(plats) do local module = platform._load(plat) if module and module._PROBER and module._PROBER.global and module._HOST and module._HOST == xmake._HOST then - module._PROBER.global() + if not module._PROBER.global() then return false end end end @@ -373,9 +373,12 @@ function platform.probe(is_global) -- probe it local module = platform.module() if module and module._PROBER and module._PROBER.config then - module._PROBER.config() + if not module._PROBER.config() then return false end end end + + -- ok + return true end -- return module: platform diff --git a/xmake/scripts/platform/windows/prober.lua b/xmake/scripts/platform/windows/prober.lua index f4aacf9d250..7c6f3a948a1 100644 --- a/xmake/scripts/platform/windows/prober.lua +++ b/xmake/scripts/platform/windows/prober.lua @@ -251,22 +251,22 @@ end function prober.config() -- call all probe functions - utils.call( { prober._probe_arch - , prober._probe_vs_version - , prober._probe_vs_path - , prober._probe_toolchains} - , nil - , config) + return utils.call( { prober._probe_arch + , prober._probe_vs_version + , prober._probe_vs_path + , prober._probe_toolchains} + , nil + , config) end -- probe the global configure function prober.global() -- call all probe functions - utils.call( { prober._probe_vs_version - , prober._probe_vs_path} - , nil - , global) + return utils.call( { prober._probe_vs_version + , prober._probe_vs_path} + , nil + , global) end -- return module: prober