add manifest mode support for vcpkg package depend-info#7411
add manifest mode support for vcpkg package depend-info#7411waruqi merged 3 commits intoxmake-io:devfrom
Conversation
Summary of ChangesHello, 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 significantly enhances Xmake's integration with Vcpkg by adding comprehensive support for Vcpkg's manifest mode. The changes enable Xmake to correctly interpret and manage package dependencies that utilize manifest files for versioning, feature selection, and baseline definitions, thereby resolving existing issues with package dependency resolution in this mode. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for vcpkg's manifest mode when querying package dependency information. The changes correctly detect when to use manifest mode, execute vcpkg commands in the project's installation directory, and pass necessary flags. The implementation is solid, but I have a couple of suggestions to improve maintainability by reducing code duplication and clarifying a comment.
| -- pass feature flags to depend-info when in manifest mode, otherwise depend-info will not show the complete dependency tree with features | ||
| if manifest_mode then | ||
| table.insert(argv, 1, "--feature-flags=versions") | ||
| end | ||
|
|
||
| local _, dependinfo = try { function () return os.iorunv(vcpkg, argv, manifest_mode and {curdir = opt.installdir} or nil) end } |
There was a problem hiding this comment.
This logic for preparing and executing a vcpkg command with manifest mode support is duplicated in xmake/modules/package/manager/vcpkg/utils.lua inside the is_installed function. To improve maintainability and reduce code duplication, consider abstracting this into a helper function within the vcpkg_utils module. This would also be a good place to define "--feature-flags=versions" as a constant.
| -- pass feature flags to depend-info when in manifest mode, otherwise depend-info will not show the complete dependency tree with features | ||
| if manifest_mode then | ||
| table.insert(argv, 1, "--feature-flags=versions") | ||
| end |
There was a problem hiding this comment.
This comment is misleading as it refers to depend-info, but this function calls vcpkg list. Please update the comment to reflect the correct command and its purpose.
-- pass feature flags to the `list` command when in manifest mode to get correct information for packages with features
if manifest_mode then
table.insert(argv, 1, "--feature-flags=versions")
end
| import("package.manager.pkgconfig.find_package", {alias = "find_package_from_pkgconfig"}) | ||
|
|
||
| -- need manifest mode? | ||
| function _need_manifest(opt) |
There was a problem hiding this comment.
跟 install_package.lua 里重复了,移到 utils 里去复用下
| -- | ||
| function is_installed(vcpkg, name, triplet) | ||
|
|
||
| function is_installed(vcpkg, name, triplet, manifest_mode, opt) |
There was a problem hiding this comment.
参数太多了,有些放到 opt 里面去。
另外这个 install_package.lua 里也用了,同步了么?
| import("package.manager.pkgconfig.find_package", {alias = "find_package_from_pkgconfig"}) | ||
|
|
||
| -- extract required features from both package name and configs.features. | ||
| local function _required_features(name, configs) |
|
另外,rebase 下,dev 修了 ci 的问题 |
In addition, under rebase, dev fixed the ci problem. |
OK了 |
OK |
#7388
The package dependency in manifest mode still has issues.