diff options
| author | ruki <[email protected]> | 2026-06-07 19:00:21 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-06-07 19:00:54 +0800 |
| commit | e8daedeb731439f7c26fb3bc024857e777d53ec2 (patch) | |
| tree | 1df9198882ddfd0b2714793d260ebd7ba41e5cc3 | |
| parent | 3736315a8594ca82305b51ceb9586e1e7e4768ad (diff) | |
add find xcodebuild
| -rw-r--r-- | xmake/modules/detect/tools/find_xcodebuild.lua | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_xcodebuild.lua b/xmake/modules/detect/tools/find_xcodebuild.lua new file mode 100644 index 000000000..242f057a7 --- /dev/null +++ b/xmake/modules/detect/tools/find_xcodebuild.lua @@ -0,0 +1,61 @@ +--!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 ruki +-- @file find_xcodebuild.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find xcodebuild +-- +-- @param opt the arguments, e.g. {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local xcodebuild = find_xcodebuild() +-- local xcodebuild, version = find_xcodebuild({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- only for macosx + if not is_host("macosx") then + return + end + + -- init options + opt = opt or {} + opt.check = opt.check or "-version" + opt.command = opt.command or "-version" + + -- find program + local program = find_program(opt.program or "xcodebuild", opt) + + -- find program version + local version = nil + if program and opt and opt.version then + version = find_programver(program, opt) + end + + -- ok? + return program, version +end |
