Skip to content

add manifest mode support for vcpkg package depend-info#7411

Merged
waruqi merged 3 commits intoxmake-io:devfrom
kanren3:dev
Mar 20, 2026
Merged

add manifest mode support for vcpkg package depend-info#7411
waruqi merged 3 commits intoxmake-io:devfrom
kanren3:dev

Conversation

@kanren3
Copy link
Contributor

@kanren3 kanren3 commented Mar 19, 2026

#7388
The package dependency in manifest mode still has issues.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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

  • Vcpkg Manifest Mode Detection: Introduced a new function _need_manifest to determine if Vcpkg's manifest mode should be activated based on package options like required version, features, default features, or baseline.
  • Feature Extraction Enhancement: Added a helper function _required_features to robustly extract required features from both the package name string (e.g., curl[openssl]) and the configuration options.
  • Manifest Mode Integration in Package Finding: Modified the core _find_package function to leverage the new manifest mode detection, enforce the installdir requirement for manifest mode, and adjust the lookup path for Vcpkg info directories accordingly.
  • Vcpkg Command Argument Updates: Updated the vcpkg depend-info and vcpkg list commands to include --feature-flags=versions and set the current directory (curdir) when operating in manifest mode, ensuring accurate dependency tree and installation status retrieval.
  • Utility Function Adaptations: Adjusted the is_installed and has_installed_features utility functions to accept and propagate manifest mode parameters, allowing them to correctly query Vcpkg in a manifest-aware context.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +230 to +235
-- 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 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Comment on lines +31 to +34
-- 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

跟 install_package.lua 里重复了,移到 utils 里去复用下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

--
function is_installed(vcpkg, name, triplet)

function is_installed(vcpkg, name, triplet, manifest_mode, opt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参数太多了,有些放到 opt 里面去。

另外这个 install_package.lua 里也用了,同步了么?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修复

@waruqi waruqi added this to the v3.0.8 milestone Mar 19, 2026
@waruqi waruqi closed this Mar 19, 2026
@waruqi waruqi reopened this Mar 19, 2026
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不用加 local

@waruqi
Copy link
Member

waruqi commented Mar 20, 2026

另外,rebase 下,dev 修了 ci 的问题

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


In addition, under rebase, dev fixed the ci problem.

@kanren3
Copy link
Contributor Author

kanren3 commented Mar 20, 2026

另外,rebase 下,dev 修了 ci 的问题

OK了

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


In addition, under rebase, dev fixed the ci problem

OK

@waruqi waruqi merged commit 8b1b876 into xmake-io:dev Mar 20, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants