Conversation
RubMaker
commented
Sep 30, 2025
- Before adding new features and new modules, please go to issues to submit the relevant feature description first.
- Write good commit messages and use the same coding conventions as the rest of the project.
- Please commit code to dev branch and we will merge into master branch in feature
- Ensure your edited codes with four spaces instead of TAB.
- 增加新特性和新模块之前,请先到issues提交相关特性说明,经过讨论评估确认后,再进行相应的代码提交,避免做无用工作。
- 编写友好可读的提交信息,并使用与工程代码相同的代码规范,代码请用4个空格字符代替tab缩进。
- 请提交代码到dev分支,如果通过,我们会在特定时间合并到master分支上。
- 为了规范化提交日志的格式,commit消息,不要用中文,请用英文描述。
Summary of ChangesHello @RubMaker, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new utility module to Xmake designed to streamline the process of finding Qt deployment tools across various operating systems. By automatically identifying the correct Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new detection module for Qt's deployment tools (windeployqt, macdeployqt, linuxdeployqt). The overall approach is good, but there are a few issues to address. There's a logical error in the program check function that causes it to always fail. Also, the handling of the QTDIR environment variable could lead to incorrect behavior when it's not set. I've also pointed out some minor style issues like trailing whitespace and a missing newline at the end of the file to align with the project's conventions. My suggestions aim to improve the robustness and correctness of the new module.
| opt.check = opt.check or function (program) | ||
| -- check version to verify the program is working | ||
| if is_host("windows") then | ||
| -- windeployqt --help should return successfully | ||
| os.run("%s --help", program) | ||
| elseif is_host("macosx") then | ||
| -- macdeployqt --help should return successfully | ||
| os.run("%s --help", program) | ||
| else | ||
| -- assume linux, linuxdeployqt --help should return successfully | ||
| os.run("%s --help", program) | ||
| end | ||
| end |
There was a problem hiding this comment.
The check function doesn't explicitly return a value, so it implicitly returns nil. This will cause the check to fail for any program found. You should return the result of os.run. Additionally, the if/elseif/else block is redundant because the same command is executed for all platforms. The function can be simplified significantly.
opt.check = opt.check or function (program)
-- check version to verify the program is working
-- windeployqt/macdeployqt/linuxdeployqt --help should return successfully
return os.run("%s --help", program)
end
| -- common Qt installation paths on Windows | ||
| table.insert(opt.paths, "C:\\Qt\\*\\bin") | ||
| table.insert(opt.paths, "C:\\Qt\\Tools\\*\\bin") | ||
| table.insert(opt.paths, path.join(os.getenv("QTDIR") or "", "bin")) |
There was a problem hiding this comment.
When the QTDIR environment variable is not set or is empty, path.join(os.getenv("QTDIR") or "", "bin") can resolve to an unintended absolute path (e.g., C:\bin on Windows). This could lead to finding an incorrect tool or unnecessary filesystem searches. It's safer to add this path only when QTDIR is set to a non-empty string.
local qtdir = os.getenv("QTDIR")
if qtdir and #qtdir > 0 then
table.insert(opt.paths, path.join(qtdir, "bin"))
end
| table.insert(opt.paths, "/usr/local/Qt*/*/bin") | ||
| table.insert(opt.paths, "~/Qt/*/bin") | ||
| table.insert(opt.paths, "/opt/Qt*/*/bin") | ||
| table.insert(opt.paths, path.join(os.getenv("QTDIR") or "", "bin")) |
There was a problem hiding this comment.
Similar to the Windows case, when the QTDIR environment variable is not set or is empty, an unintended path might be searched. It's better to only add the path if QTDIR is defined and not empty.
local qtdir = os.getenv("QTDIR")
if qtdir and #qtdir > 0 then
table.insert(opt.paths, path.join(qtdir, "bin"))
end
| table.insert(opt.paths, "/opt/qt*/bin") | ||
| table.insert(opt.paths, "/usr/local/qt*/bin") | ||
| table.insert(opt.paths, "~/Qt/*/bin") | ||
| table.insert(opt.paths, path.join(os.getenv("QTDIR") or "", "bin")) |
There was a problem hiding this comment.
Similar to the Windows and macOS cases, when the QTDIR environment variable is not set or is empty, an unintended path might be searched. It's better to only add the path if QTDIR is defined and not empty.
local qtdir = os.getenv("QTDIR")
if qtdir and #qtdir > 0 then
table.insert(opt.paths, path.join(qtdir, "bin"))
end
| if is_host("windows") then | ||
| program_name = "windeployqt" | ||
| elseif is_host("macosx") then | ||
| program_name = "macdeployqt" |
| elseif is_host("macosx") then | ||
| -- common Qt installation paths on macOS | ||
| table.insert(opt.paths, "/usr/local/Qt*/*/bin") | ||
| table.insert(opt.paths, "~/Qt/*/bin") |
|
|
||
| -- find program | ||
| return find_program(program_name, opt) | ||
| end No newline at end of file |
d1dabbd to
4695f3b
Compare