From fc1bf95c3c39b06571e3f4d686093850890f3934 Mon Sep 17 00:00:00 2001 From: ShifftC Date: Tue, 23 Sep 2025 15:38:03 +0200 Subject: fix version file lookup with nil base --- xmake/core/package/package.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 2c42a4c94..7a1d8e24b 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -1458,7 +1458,7 @@ function _instance:_versions_list() if not path.is_absolute(versionfile) then local subpath = versionfile versionfile = path.join(self:scriptdir(), subpath) - if not os.isfile(versionfile) then + if not os.isfile(versionfile) and self:base() then versionfile = path.join(self:base():scriptdir(), subpath) end end -- cgit v1.3.1 From 4e56895eb7f85db1b79a87395551a2e8625bad70 Mon Sep 17 00:00:00 2001 From: ShifftC Date: Mon, 29 Sep 2025 18:31:48 +0200 Subject: add api checking on download failure --- xmake/modules/private/action/require/impl/actions/download.lua | 3 +++ xmake/modules/private/action/require/impl/check_api.lua | 6 ++++-- xmake/modules/private/action/require/impl/package.lua | 2 +- 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) -- cgit v1.3.1 From 8b2d1c28e69ab41cc6a1535bd4a2bce769fd7869 Mon Sep 17 00:00:00 2001 From: ShifftC Date: Mon, 29 Sep 2025 18:32:48 +0200 Subject: add package versionfiles api checker --- xmake/modules/private/check/checker.lua | 1 + .../check/checkers/api/package/versionfiles.lua | 39 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 xmake/modules/private/check/checkers/api/package/versionfiles.lua diff --git a/xmake/modules/private/check/checker.lua b/xmake/modules/private/check/checker.lua index 923c35809..6ff8b3864 100644 --- a/xmake/modules/private/check/checker.lua +++ b/xmake/modules/private/check/checker.lua @@ -28,6 +28,7 @@ function checkers() checkers = { -- package api checkers ["api.package.kind"] = {description = "Check kind configuration in package.", load = true}, + ["api.package.versionfiles"] = {description = "Check versionfiles configuration in package.", download_failure = true}, -- target api checkers ["api.target.version"] = {description = "Check version configuration in target."}, ["api.target.kind"] = {description = "Check kind configuration in target.", build = true}, diff --git a/xmake/modules/private/check/checkers/api/package/versionfiles.lua b/xmake/modules/private/check/checkers/api/package/versionfiles.lua new file mode 100644 index 000000000..d9224630b --- /dev/null +++ b/xmake/modules/private/check/checkers/api/package/versionfiles.lua @@ -0,0 +1,39 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-present, Xmake Open Source Community. +-- +-- @author Shiffted +-- @file versionfiles.lua +-- + +import(".api_checker") + +function main(opt) + opt = opt or {} + api_checker.check_packages("versionfiles", table.join(opt, {check = function(package, value) + local versionfile_path = value + if not path.is_absolute(versionfile_path) then + local subpath = versionfile_path + versionfile_path = path.join(package:scriptdir(), subpath) + if not os.isfile(versionfile_path) and package:base() then + versionfile_path = path.join(package:base():scriptdir(), subpath) + end + end + if not os.isfile(versionfile_path) then + return false, string.format("versionfile '%s' not found", value) + end + return true + end})) +end -- cgit v1.3.1