Skip to content

Commit 41c560b

Browse files
committed
Add find_aqt to fix detection of installed aqt
1 parent a0298b7 commit 41c560b

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
--!A cross-platform build utility based on Lua
2+
--
3+
-- Licensed under the Apache License, Version 2.0 (the "License");
4+
-- you may not use this file except in compliance with the License.
5+
-- You may obtain a copy of the License at
6+
--
7+
-- http://www.apache.org/licenses/LICENSE-2.0
8+
--
9+
-- Unless required by applicable law or agreed to in writing, software
10+
-- distributed under the License is distributed on an "AS IS" BASIS,
11+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
-- See the License for the specific language governing permissions and
13+
-- limitations under the License.
14+
--
15+
-- Copyright (C) 2015-present, TBOOX Open Source Group.
16+
--
17+
-- @author ruki
18+
-- @file find_aqt.lua
19+
--
20+
21+
-- imports
22+
import("lib.detect.find_program")
23+
import("lib.detect.find_programver")
24+
25+
-- find aqt
26+
--
27+
-- @param opt the argument options, e.g. {version = true}
28+
--
29+
-- @return program, version
30+
--
31+
-- @code
32+
--
33+
-- local aqt = find_aqt()
34+
--
35+
-- @endcode
36+
--
37+
function main(opt)
38+
39+
-- init options
40+
opt = opt or {}
41+
opt.check = opt.check or "version"
42+
43+
-- find program
44+
local program = find_program(opt.program or "aqt", opt)
45+
46+
-- find program version
47+
local version = nil
48+
if program and opt and opt.version then
49+
opt.command = opt.command or function () local _, info = os.iorunv(program, {"version"}, {envs = opt.envs}); return info end
50+
opt.parse = opt.parse or "aqt%S*%s+v*(%S+)"
51+
version = find_programver(program, opt)
52+
end
53+
return program, version
54+
end

0 commit comments

Comments
 (0)