Skip to content

show target name in progress#7387

Merged
waruqi merged 3 commits intodevfrom
progress
Mar 9, 2026
Merged

show target name in progress#7387
waruqi merged 3 commits intodevfrom
progress

Conversation

@waruqi
Copy link
Member

@waruqi waruqi commented Mar 9, 2026

@waruqi waruqi added this to the v3.0.8 milestone Mar 9, 2026
@waruqi waruqi requested a review from Arthapz March 9, 2026 15:15
@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 improves the user experience during builds by adding the capability to display the name of the target currently being processed directly within the build progress output. This enhancement provides immediate feedback on which part of the project is active, making it easier to monitor and understand the build flow, especially in large multi-target projects. The change is configurable via a new policy, allowing users to tailor the verbosity of their build logs.

Highlights

  • New Policy Added: A new policy, build.progress_show_target, was introduced to allow users to enable or disable the display of target names in the build progress output. It defaults to true.
  • Coroutine-Local Progress Data: A mechanism was implemented in runjobs.lua to store and retrieve coroutine-local data within progress objects, enabling the association of a specific target name with each concurrent build job.
  • Enhanced Progress Output: The build progress display was updated across various build and scan actions to show the name of the currently processed target, providing clearer context during compilation and linking.

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

Changelog
  • xmake/core/project/policy.lua
    • Added the build.progress_show_target policy with a default value of true.
  • xmake/modules/async/runjobs.lua
    • Introduced progress_wrapper_data to store coroutine-local data.
    • Added set and get methods to the progress_wrapper for managing coroutine-specific progress data.
  • xmake/modules/private/action/build/link_objects.lua
    • Called progress.set_target to associate the target with the progress object before linking.
  • xmake/modules/private/action/build/object.lua
    • Called progress.set_target to associate the target with the progress object before building objects.
  • xmake/modules/private/action/build/target.lua
    • Added progress_utils.set_target calls for various script-related jobs (target, file, and command scripts).
    • Directly set target_name in progress for script_file and scriptcmd_file jobs.
  • xmake/modules/utils/progress.lua
    • Implemented _is_show_target_enabled to check the new policy.
    • Added _get_target_name_prefix to format the target name for display.
    • Introduced set_target function to associate a target with a progress object.
    • Modified show and text functions to prepend the target name prefix if enabled.
  • xmake/rules/c++/modules/builder.lua
    • Called progress.set_target in module build jobs (for modules, object files, and header units).
    • Adjusted progress.show calls to remove the explicit target name, relying on the new prefix mechanism.
  • xmake/rules/c++/modules/clang/scanner.lua
    • Modified progress.show call to remove the explicit target name.
  • xmake/rules/c++/modules/gcc/scanner.lua
    • Modified progress.show call to remove the explicit target name.
  • xmake/rules/c++/modules/msvc/scanner.lua
    • Modified progress.show call to remove the explicit target name.
  • xmake/rules/c++/modules/scanner.lua
    • Imported utils.progress module.
    • Called progress.set_target in module dependency scanning jobs.
  • xmake/rules/swift/xmake.lua
    • Modified progress.show call to remove the explicit target name.
Activity
  • No specific activity has been recorded for this pull request yet.
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 adds a useful feature to display the target name in the build progress output. The implementation is solid, introducing a new policy and making the progress system aware of the current build job's context via coroutines. My review includes suggestions for improving code consistency by using the new helper functions everywhere, simplifying some of the new logic, and cleaning up redundant formatting codes in progress messages now that the new system handles target name display automatically.

I am having trouble creating individual review comments. Click here to see my feedback.

xmake/modules/private/action/build/target.lua (483-485)

medium

For consistency with other changes in this file and to leverage the new helper function, please use progress_utils.set_target(opt.progress, target) here. This encapsulates the logic for setting the target name and includes necessary checks, making the code cleaner and more robust.

                        progress_utils.set_target(opt.progress, target)

xmake/modules/private/action/build/target.lua (547-549)

medium

For consistency with other changes in this file and to leverage the new helper function, please use progress_utils.set_target(opt.progress, target) here. This encapsulates the logic for setting the target name and includes necessary checks, making the code cleaner and more robust.

                        progress_utils.set_target(opt.progress, target)

xmake/modules/utils/progress.lua (354-366)

medium

This function's implementation can be simplified. The logic to determine show_target from the policy can be made more concise. You can directly assign the computed boolean to _g.show_target.

function _is_show_target_enabled()
    if _g.show_target == nil then
        _g.show_target = project.policy("build.progress_show_target") ~= false
    end
    return _g.show_target
end

xmake/modules/utils/progress.lua (388-391)

medium

This block of code to prepend the target name prefix is duplicated in the text function (lines 507-510). To improve maintainability and follow the DRY principle, consider extracting this logic into a private helper function. This function could then be called from both show and text.

xmake/rules/c++/modules/builder.lua (615)

medium

The progress.show function now automatically adds a colored target prefix, like ${color.build.target}<target>${clear} . Your format string also includes ${color.build.target}, which is now redundant. Please remove it to avoid unnecessary color codes.

        progress.show(jobopt.progress, "generating.module.metadata %s", module.name)

xmake/rules/c++/modules/builder.lua (660)

medium

Since the automatically-added target prefix in progress.show already ends with ${clear}, the ${clear} in this header variable is redundant. You can remove it to simplify the code.

    local header = dim

xmake/rules/c++/modules/clang/scanner.lua (40)

medium

The progress.show function now automatically adds a target prefix that ends with ${clear}. The ${clear} at the beginning of your format string is therefore redundant and can be removed.

            progress.show(opt.progress, "generating.module.deps %s", sourcefile)

xmake/rules/c++/modules/gcc/scanner.lua (47)

medium

The progress.show function now automatically adds a target prefix that ends with ${clear}. The ${clear} at the beginning of your format string is therefore redundant and can be removed.

            progress.show(opt.progress, "scanning.module.deps %s", sourcefile)

xmake/rules/c++/modules/msvc/scanner.lua (48)

medium

The progress.show function now automatically adds a target prefix that ends with ${clear}. The ${clear} at the beginning of your format string is therefore redundant and can be removed.

            progress.show(opt.progress, "generating.module.deps %s", sourcefile)

xmake/rules/swift/xmake.lua (133)

medium

The progress.show function now automatically adds a target prefix that ends with ${clear}. The ${clear} at the beginning of your format string is therefore redundant and can be removed.

                        progress.show(opt.progress, "generating.swift.header %s", headername)

@waruqi waruqi merged commit 5d8708f into dev Mar 9, 2026
77 checks passed
@waruqi waruqi deleted the progress branch March 9, 2026 22:43
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