diff options
| author | ruki <[email protected]> | 2023-01-09 23:46:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-01-09 23:46:59 +0800 |
| commit | 66fcf40bc0042c401e06b8579b40f6203b21b256 (patch) | |
| tree | bc40c7229416c72c01d4727fd8dcd614362c4870 /xmake/modules | |
| parent | d3fc1bb511e858e7f18c8cb9fd72685751513720 (diff) | |
add find_xrepo
Diffstat (limited to 'xmake/modules')
| -rw-r--r-- | xmake/modules/detect/tools/find_xrepo.lua | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_xrepo.lua b/xmake/modules/detect/tools/find_xrepo.lua new file mode 100644 index 000000000..b4a90c661 --- /dev/null +++ b/xmake/modules/detect/tools/find_xrepo.lua @@ -0,0 +1,52 @@ +--!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, TBOOX Open Source Group. +-- +-- @author ruki +-- @file find_xrepo.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find xz +-- +-- @param opt the argument options, e.g. {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local xz = find_xrepo() +-- local xz, version = find_xrepo({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + + -- find program + local program = find_program(opt.program or (is_host("windows") and "xrepo.bat" or "xrepo"), opt) + + -- find program version + local version = nil + if program and opt and opt.version then + version = find_programver(program, opt) + end + return program, version +end |
