diff options
| author | ruki <[email protected]> | 2020-07-25 21:25:55 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-07-25 21:25:55 +0800 |
| commit | 56c0819b70ee17f8f8f1f5d27d2f905ee34bb726 (patch) | |
| tree | c66b687e7cb6280066be518a927ec32be65ba366 /xmake/modules/detect/tools/find_dub.lua | |
| parent | 5d7d07a9d1a2f4728a0857ff42d9a8f09b34bee2 (diff) | |
improve dlang tests and template projects
Diffstat (limited to 'xmake/modules/detect/tools/find_dub.lua')
| -rw-r--r-- | xmake/modules/detect/tools/find_dub.lua | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_dub.lua b/xmake/modules/detect/tools/find_dub.lua new file mode 100644 index 000000000..9b66795fe --- /dev/null +++ b/xmake/modules/detect/tools/find_dub.lua @@ -0,0 +1,54 @@ +--!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-2020, TBOOX Open Source Group. +-- +-- @author ruki +-- @file find_dub.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find dub +-- +-- @param opt the argument options, e.g. {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local dub = find_dub() +-- local dub, version = find_dub({version = true}) +-- +-- @endcode +-- +function main(opt) + + -- init options + opt = opt or {} + + -- find program + local program = find_program(opt.program or "dub", 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 |
