summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShifftC <[email protected]>2025-09-29 18:31:48 +0200
committerShifftC <[email protected]>2025-09-30 15:06:50 +0200
commit4e56895eb7f85db1b79a87395551a2e8625bad70 (patch)
treec99b9de3ea9e4f1ab11f4e41d22eab49c2a910d6
parentfc1bf95c3c39b06571e3f4d686093850890f3934 (diff)
add api checking on download failure
-rw-r--r--xmake/modules/private/action/require/impl/actions/download.lua3
-rw-r--r--xmake/modules/private/action/require/impl/check_api.lua6
-rw-r--r--xmake/modules/private/action/require/impl/package.lua2
3 files changed, 8 insertions, 3 deletions
diff --git a/xmake/modules/private/action/require/impl/actions/download.lua b/xmake/modules/private/action/require/impl/actions/download.lua
index 47690273e..25c9d1b56 100644
--- a/xmake/modules/private/action/require/impl/actions/download.lua
+++ b/xmake/modules/private/action/require/impl/actions/download.lua
@@ -27,6 +27,7 @@ import("core.project.config")
import("core.package.package", {alias = "core_package"})
import("lib.detect.find_file")
import("lib.detect.find_directory")
+import("private.action.require.impl.check_api")
import("private.action.require.impl.utils.filter")
import("private.action.require.impl.utils.url_filename")
import("net.http")
@@ -406,6 +407,8 @@ function main(package, opt)
{
function (errors)
+ check_api(package, {download_failure = true})
+
-- show or save the last errors
if errors then
if (option.get("verbose") or option.get("diagnosis")) then
diff --git a/xmake/modules/private/action/require/impl/check_api.lua b/xmake/modules/private/action/require/impl/check_api.lua
index 7fd5459c1..63637ac25 100644
--- a/xmake/modules/private/action/require/impl/check_api.lua
+++ b/xmake/modules/private/action/require/impl/check_api.lua
@@ -21,10 +21,12 @@
import("private.check.checker")
import("private.check.show")
-function main(package)
+function main(package, opt)
+ opt = opt or {}
+
local checkers = checker.checkers()
for name, info in table.orderpairs(checkers) do
- if info.load then
+ if (info.load and opt.load) or (info.download_failure and opt.download_failure) then
local check = import("private.check.checkers." .. name, {anonymous = true})
check({package = package, show = show.wshow})
end
diff --git a/xmake/modules/private/action/require/impl/package.lua b/xmake/modules/private/action/require/impl/package.lua
index 11b06d381..1e64d8b47 100644
--- a/xmake/modules/private/action/require/impl/package.lua
+++ b/xmake/modules/private/action/require/impl/package.lua
@@ -1129,7 +1129,7 @@ function _load_package(packagename, requireinfo, opt)
-- load environments from the manifest to enable the environments of on_install()
package:envs_load()
- check_api(package)
+ check_api(package, {load = true})
-- save this package package to cache
_memcache():set2("packages", packagekey, package)