Add check support (#4010)

* Add check support

* check each packages

* add logs

* improve logs
pull/4012/head
ruki 7 months ago committed by GitHub
parent 99e144914a
commit d0a4451f59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      packages/c/cpp-httplib/xmake.lua
  2. 8
      scripts/packages.lua
  3. 19
      scripts/test.lua

@ -19,7 +19,7 @@ package("cpp-httplib")
add_versions("0.15.1", "8d6a4a40ee8fd3f553b7e895882e60e674bd910883fc1857587dbbabee3cdb91")
add_versions("0.15.2", "4afbcf4203249d2cbcb698e46e1f6fb61b479013a84844d6bb1c044e233cab6a")
add_versions("0.15.3", "2121bbf38871bb2aafb5f7f2b9b94705366170909f434428352187cb0216124e")
add_configs("ssl", { description = "Requires OpenSSL", default = false, type = "boolean"})
add_configs("zlib", { description = "Requires Zlib", default = false, type = "boolean"})
add_configs("brotli", { description = "Requires Brotli", default = false, type = "boolean"})
@ -42,6 +42,15 @@ package("cpp-httplib")
end
end)
if on_check then
on_check("android", function (package)
import("core.tool.toolchain")
local ndk = toolchain.load("ndk", {plat = package:plat(), arch = package:arch()})
local ndk_sdkver = ndk:config("ndk_sdkver")
assert(ndk_sdkver and tonumber(ndk_sdkver) >= 24, "package(httplib): need ndk api level >= 24 for android")
end)
end
on_install(function (package)
if package:is_plat("android") then
import("core.tool.toolchain")

@ -11,10 +11,12 @@ function is_supported(instance, plat, arch, opt)
return false
end
-- get script
-- has install script?
local script = instance:get("install")
local result = select_script(script, {plat = plat, arch = arch})
return result
if not select_script(script, {plat = plat, arch = arch}) then
return false
end
return true
end
-- load package

@ -110,14 +110,17 @@ function _require_packages(argv, packages)
end
os.vexecv("xmake", config_argv)
local require_argv = {"require", "-f", "-y"}
local check_argv = {"require", "-f", "-y", "--check"}
if not argv.precompiled then
table.insert(require_argv, "--build")
end
if argv.verbose then
table.insert(require_argv, "-v")
table.insert(check_argv, "-v")
end
if argv.diagnosis then
table.insert(require_argv, "-D")
table.insert(check_argv, "-D")
end
local is_debug = false
if argv.debugdir then
@ -157,8 +160,20 @@ function _require_packages(argv, packages)
end
local extra_str = string.serialize(extra, {indent = false, strip = true})
table.insert(require_argv, "--extra=" .. extra_str)
table.join2(require_argv, packages)
os.vexecv("xmake", require_argv)
table.insert(check_argv, "--extra=" .. extra_str)
local install_packages = {}
for _, package in ipairs(packages) do
local ok = os.vexecv("xmake", table.join(check_argv, package), {try = true})
if ok == 0 then
table.insert(install_packages, package)
end
end
if #install_packages > 0 then
os.vexecv("xmake", table.join(require_argv, install_packages))
else
print("no testable packages on %s or you're using lower version xmake!", argv.plat or os.subhost())
end
end
-- the given package is supported?

Loading…
Cancel
Save