diff options
| author | ShifftC <[email protected]> | 2025-09-29 18:32:48 +0200 |
|---|---|---|
| committer | ShifftC <[email protected]> | 2025-09-30 16:06:27 +0200 |
| commit | 8b2d1c28e69ab41cc6a1535bd4a2bce769fd7869 (patch) | |
| tree | e746a904c2fc4ca6954141751e91ac4139263a64 | |
| parent | 4e56895eb7f85db1b79a87395551a2e8625bad70 (diff) | |
add package versionfiles api checker
| -rw-r--r-- | xmake/modules/private/check/checker.lua | 1 | ||||
| -rw-r--r-- | xmake/modules/private/check/checkers/api/package/versionfiles.lua | 39 |
2 files changed, 40 insertions, 0 deletions
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 |
