diff options
| author | ruki <[email protected]> | 2026-03-17 22:43:06 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-17 22:43:06 +0800 |
| commit | 42dec9486bb56c2f08db0c30f6b2829e1b02a1a7 (patch) | |
| tree | 7fcea3a58a9b9b0495747c255a209a81dae4bc86 /xmake/modules/detect/tools/find_dotnet.lua | |
| parent | 1c5607aa0da666cd244af2cab5fc7280e30742f1 (diff) | |
| parent | 2134b93d3f87d8f4ea63e0c49b2075ba056995d9 (diff) | |
Merge pull request #7398 from xmake-io/csharp
Add csharp support
Diffstat (limited to 'xmake/modules/detect/tools/find_dotnet.lua')
| -rw-r--r-- | xmake/modules/detect/tools/find_dotnet.lua | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_dotnet.lua b/xmake/modules/detect/tools/find_dotnet.lua new file mode 100644 index 000000000..ac17979ec --- /dev/null +++ b/xmake/modules/detect/tools/find_dotnet.lua @@ -0,0 +1,53 @@ +--!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_dotnet.lua +-- + +-- imports +import("lib.detect.find_program") +import("lib.detect.find_programver") + +-- find dotnet +-- +-- @param opt the argument options, e.g. {version = true} +-- +-- @return program, version +-- +-- @code +-- +-- local dotnet = find_dotnet() +-- +-- @endcode +-- +function main(opt) + + -- 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 "dotnet", 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 |
