Skip to content

fix project default config in vsxmake #7014#7016

Merged
waruqi merged 1 commit intodevfrom
vsxmake
Nov 12, 2025
Merged

fix project default config in vsxmake #7014#7016
waruqi merged 1 commit intodevfrom
vsxmake

Conversation

@waruqi
Copy link
Member

@waruqi waruqi commented Nov 12, 2025

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @waruqi, 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 addresses an issue related to project default configurations within the vsxmake plugin by significantly refactoring the way project settings and caches are reset. The core change involves centralizing this complex logic into a new utility function, vsutils.reset_config_and_caches. This not only improves code maintainability by reducing duplication but also enhances the reliability of configuration management, particularly when switching between different build modes or architectures in Visual Studio projects generated by xmake.

Highlights

  • Refactored Configuration Reset Logic: The scattered logic for resetting project configurations and clearing various caches has been consolidated into a single, reusable utility function.
  • Centralized vsutils.reset_config_and_caches: A new function, reset_config_and_caches, was introduced in vsutils.lua to encapsulate the entire process of modifying configurations, clearing options, and invalidating caches.
  • Improved Default Configuration Handling: The newly centralized reset function now includes logic to merge project options after default options, ensuring a more robust and complete configuration management process.
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.

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

  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 refactors the logic for resetting project configurations and caches into a new utility function vsutils.reset_config_and_caches, which is a good improvement to reduce code duplication. However, there is a critical issue in the implementation: the new function uses mode and arch variables that are not in its scope, which will lead to incorrect behavior. These variables need to be passed as arguments to the function. I've provided specific comments and suggestions to fix this.

return (filepath:gsub("::", "#"))
end

function reset_config_and_caches()
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The variables mode and arch used on lines 71 and 72 are not defined within the scope of this function. They will be nil, which is not the intended behavior as it would incorrectly reset the mode and architecture. To fix this, you should pass mode and arch as arguments to this function.

function reset_config_and_caches(mode, arch)

localcache.clear("toolchain")
localcache.clear("cxxmodules")
-- reset project configs and caches
vsutils.reset_config_and_caches()
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

You need to pass the mode and arch variables to the reset_config_and_caches function. The mode and arch variables are local to the loops in the make function and are not accessible inside reset_config_and_caches otherwise.

                vsutils.reset_config_and_caches(mode, arch)

localcache.clear("toolchain")
localcache.clear("cxxmodules")
-- reset project configs and caches
vsutils.reset_config_and_caches()
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

You need to pass the mode and arch variables to the reset_config_and_caches function. The mode and arch variables are local to the loops in the main function and are not accessible inside reset_config_and_caches otherwise.

            vsutils.reset_config_and_caches(mode, arch)

@waruqi waruqi added this to the v3.0.5 milestone Nov 12, 2025
@waruqi waruqi merged commit 1449373 into dev Nov 12, 2025
43 of 44 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.

1 participant