Skip to content

(diagnosis) uniformize build output#7364

Closed
Arthapz wants to merge 2 commits intoxmake-io:devfrom
Arthapz:uniformize-build-output
Closed

(diagnosis) uniformize build output#7364
Arthapz wants to merge 2 commits intoxmake-io:devfrom
Arthapz:uniformize-build-output

Conversation

@Arthapz
Copy link
Member

@Arthapz Arthapz commented Mar 2, 2026

This PR is a proposition of uniformize all rules build outputs
it add a policy (enabled by default) "build.show_target" which control if target name is printed when compiling/generating/preprocessing/etc... in a rule

it also remove the namespace print from some progress.show as this information is already contained in the target:fullname() string

i don't know if the policy should be true by default, it can be a breaking change for tools that parse xmake output
and maybe add a way to configure if the namespace is showed along side the target name ?

before:

> xmake f
> xmake b -r
[  0%]: <hello> scanning.module.deps src/main.cpp
[  1%]: <mod> scanning.module.deps src/mod.cpp
[  1%]: <mod> scanning.module.deps src/mod.mpp
[ 17%]: <mod> compiling.module.release mod
[ 34%]: compiling.release src/mod.cpp
[ 43%]: compiling.release src/main.cpp
[ 51%]: archiving.release libmod.a
[ 77%]: linking.release hello
[100%]: build ok, spent 1.227s

after (policy enabled, the default in this PR):

> xmake f --policies="build.show_target:y"
> xmake b -r
[  0%]: <hello> scanning.module.deps src/main.cpp
[  1%]: <mod> scanning.module.deps src/mod.cpp
[  1%]: <mod> scanning.module.deps src/mod.mpp
[ 17%]: <mod> compiling.module.release mod
[ 34%]: <mod> compiling.release src/mod.cpp
[ 43%]: <hello> compiling.release src/main.cpp
[ 51%]: <mod> archiving.release libmod.a
[ 77%]: <hello> linking.release hello
[100%]: build ok, spent 1.244s

after (policy disabled):

> xmake f --policies="build.show_target:n"
> xmake b -r
[  0%]: scanning.module.deps src/main.cpp
[  1%]: scanning.module.deps src/mod.cpp
[  1%]: scanning.module.deps src/mod.mpp
[ 17%]: compiling.module.release mod
[ 34%]: compiling.release src/mod.cpp
[ 43%]: compiling.release src/main.cpp
[ 51%]: archiving.release libmod.a
[ 77%]: linking.release hello
[100%]: build ok, spent 1.257s

@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 standardizes the build output format by introducing a configurable policy to control the display of target names. It refactors how build progress messages are generated, ensuring that target names are consistently included when the policy is enabled, and removes duplicate namespace information for a cleaner, more uniform user experience.

Highlights

  • New Build Policy: Introduced a new build policy, "build.show_target", which controls whether the full target name is displayed in the build output. This policy is enabled by default.
  • Uniform Progress Reporting: Refactored build progress reporting across numerous rules and modules to consistently display target names using a new progress.apply_target utility function.
  • Cleaned Output: Eliminated redundant namespace information from build progress messages, as the target's full name now provides this context, leading to a cleaner and more uniform output.

🧠 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 a new policy "build.show_target" to control target name visibility in build diagnosis, defaulting to true.
  • xmake/modules/private/action/build/link_objects.lua
    • Updated linking progress messages to use progress.apply_target and display the target filename, removing previous namespace logic.
  • xmake/modules/private/action/build/object.lua
    • Updated compiling progress messages to use progress.apply_target and display the source filename, removing previous namespace logic.
  • xmake/modules/utils/progress.lua
    • Modified _get_progress_prefix to accept a target name and conditionally include it based on the build.show_target policy.
    • Updated _show_progress_with_verbose, _show_progress_with_scroll, _show_progress_with_multirow_refresh, and _show_progress_with_singlerow_refresh functions to accept a target_name argument.
    • Modified the show and text functions to extract the target name from the progress object.
    • Added a new apply_target function to enrich the progress object with the target's full name.
  • xmake/rules/asn1c/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing ASN.1 compilation progress.
  • xmake/rules/c++/modules/builder.lua
    • Applied progress.apply_target before showing module metadata generation and compilation progress, and removed explicit target full name from message format.
  • xmake/rules/c++/modules/clang/scanner.lua
    • Applied progress.apply_target before showing module dependency generation progress, and removed explicit target full name from message format.
  • xmake/rules/c++/modules/gcc/scanner.lua
    • Applied progress.apply_target before showing module dependency scanning progress, and removed explicit target full name from message format.
  • xmake/rules/c++/modules/msvc/scanner.lua
    • Applied progress.apply_target before showing module dependency generation progress, and removed explicit target full name from message format.
  • xmake/rules/c51/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing C51 binary generation progress.
  • xmake/rules/capnproto/capnp.lua
    • Imported utils.progress and applied progress.apply_target before showing Cap'n Proto compilation progress.
  • xmake/rules/cppfront/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Cppfront .h2 and .cpp2 compilation progress.
  • xmake/rules/cuda/devlink/devlink.lua
    • Applied progress.apply_target before showing CUDA device linking progress.
  • xmake/rules/go/build/target.lua
    • Applied progress.apply_target before showing Go linking progress.
  • xmake/rules/iverilog/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Icarus Verilog linking progress.
  • xmake/rules/kotlin-native/build/target.lua
    • Applied progress.apply_target before showing Kotlin/Native linking progress.
  • xmake/rules/lex_yacc/lex/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Lex compilation progress.
  • xmake/rules/lex_yacc/yacc/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Yacc compilation progress.
  • xmake/rules/lua/native-objects/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Lua native object compilation progress.
  • xmake/rules/nim/build/target.lua
    • Applied progress.apply_target before showing Nim linking progress.
  • xmake/rules/pascal/build/target.lua
    • Applied progress.apply_target before showing Pascal linking progress.
  • xmake/rules/platform/android/package.lua
    • Applied progress.apply_target before showing Android APK packing progress.
  • xmake/rules/platform/linux/bpf/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing BPF compilation progress.
  • xmake/rules/platform/linux/module/driver_modules.lua
    • Applied progress.apply_target before showing Linux kernel module linking progress.
  • xmake/rules/platform/windows/idl/idl.lua
    • Applied progress.apply_target before showing Windows IDL generation progress.
  • xmake/rules/protobuf/proto.lua
    • Applied progress.apply_target before showing Protobuf compilation progress.
  • xmake/rules/python/cython/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Cython compilation progress.
  • xmake/rules/qt/deploy/android.lua
    • Applied progress.apply_target before showing Qt Android application generation progress.
  • xmake/rules/qt/deploy/macosx.lua
    • Applied progress.apply_target before showing Qt macOS application generation progress.
  • xmake/rules/qt/moc/xmake.lua
    • Applied progress.apply_target before showing Qt MOC compilation progress.
  • xmake/rules/qt/qmltyperegistrar/xmake.lua
    • Imported utils.progress and applied progress.apply_target before generating common Qt QML metatypes.json.
  • xmake/rules/qt/qrc/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Qt QRC compilation progress.
  • xmake/rules/qt/ts/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Qt TS compilation progress.
  • xmake/rules/qt/ui/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Qt UI compilation progress.
  • xmake/rules/rust/build/cxxbridge.lua
    • Imported utils.progress and applied progress.apply_target before showing Rust CXX bridge compilation progress.
  • xmake/rules/rust/build/target.lua
    • Applied progress.apply_target before showing Rust linking progress.
  • xmake/rules/swift/xmake.lua
    • Applied progress.apply_target before showing Swift header generation progress.
  • xmake/rules/swig/build_module_file.lua
    • Applied progress.apply_target before showing Java class file compilation and SWIG compilation progress.
  • xmake/rules/utils/bin2c/utils.lua
    • Imported utils.progress with an alias and applied progress_utils.apply_target before showing bin2c header generation progress.
  • xmake/rules/utils/bin2obj/utils.lua
    • Imported utils.progress with an alias and applied progress_utils.apply_target before showing bin2obj object generation progress.
  • xmake/rules/utils/glsl2spv/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing GLSL to SPV generation progress.
  • xmake/rules/utils/hlsl2spv/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing HLSL compilation progress.
  • xmake/rules/utils/ispc/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing ISPC compilation progress.
  • xmake/rules/utils/merge_archive/xmake.lua
    • Applied progress.apply_target before showing archive merging progress.
  • xmake/rules/utils/merge_object/xmake.lua
    • Applied progress.apply_target before showing object insertion progress.
  • xmake/rules/utils/symbols/export_all/export_all.lua
    • Applied progress.apply_target before showing symbol exporting progress.
  • xmake/rules/utils/symbols/extract/xmake.lua
    • Applied progress.apply_target before showing symbol file generation progress.
  • xmake/rules/vala/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Vala and C compilation progress.
  • xmake/rules/verilator/verilator.lua
    • Applied progress.apply_target before showing Verilog and C++ compilation progress.
  • xmake/rules/wdk/inf/xmake.lua
    • Applied progress.apply_target before showing WDK INF compilation progress.
  • xmake/rules/wdk/man/xmake.lua
    • Applied progress.apply_target before showing WDK MAN compilation progress.
  • xmake/rules/wdk/mc/xmake.lua
    • Applied progress.apply_target before showing WDK MC compilation progress.
  • xmake/rules/wdk/mof/xmake.lua
    • Applied progress.apply_target before showing WDK MOF compilation progress.
  • xmake/rules/wdk/sign/xmake.lua
    • Applied progress.apply_target before showing WDK signing progress.
  • xmake/rules/wdk/tracewpp/xmake.lua
    • Applied progress.apply_target before showing WDK TraceWPP compilation progress.
  • xmake/rules/xcode/application/build.lua
    • Applied progress.apply_target before showing Xcode application generation progress.
  • xmake/rules/xcode/bundle/xmake.lua
    • Applied progress.apply_target before showing Xcode bundle generation progress.
  • xmake/rules/xcode/framework/xmake.lua
    • Applied progress.apply_target before showing Xcode framework generation progress.
  • xmake/rules/xcode/info_plist/xmake.lua
    • Applied progress.apply_target before showing Xcode Info.plist processing progress.
  • xmake/rules/xcode/metal/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Metal compilation and linking progress.
  • xmake/rules/xcode/storyboard/xmake.lua
    • Applied progress.apply_target before showing Xcode storyboard compilation progress.
  • xmake/rules/xcode/xcassets/xmake.lua
    • Applied progress.apply_target before showing Xcode asset catalog compilation progress.
  • xmake/rules/xmake_cli/xmake.lua
    • Imported utils.progress and applied progress.apply_target before showing Lua files archiving progress.
Activity
  • No specific review comments or activity were provided in the context.
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.

@Arthapz Arthapz force-pushed the uniformize-build-output branch from f803ae1 to 5cf3f01 Compare March 2, 2026 16:50
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 introduces a significant and valuable refactoring to unify the build output, making it more consistent across different rules. A new policy build.show_target is added to control the display of target names, which is a great feature for improving build log clarity. The changes are extensive, touching many rule files to adopt the new centralized progress reporting mechanism. While the overall implementation is solid, I've identified a critical bug in the new apply_target helper function that could lead to a runtime error, and a minor formatting issue in the swift rule that results in duplicated output. Addressing these will make this PR ready for merging.

@Arthapz Arthapz force-pushed the uniformize-build-output branch from 5cf3f01 to 8779eaf Compare March 2, 2026 16:55
@Arthapz Arthapz changed the title (diagnosis) Uniformize build output (diagnosis) uniformize build output Mar 2, 2026
@Arthapz Arthapz marked this pull request as ready for review March 3, 2026 15:40
@waruqi
Copy link
Member

waruqi commented Mar 9, 2026

This patch has made too many changes, and I can't review it quickly right now. If it's just about adding targets to the progress bar, some refactoring is needed, and the current patch isn't sufficient. I'll take a look at it when I have time.

@waruqi
Copy link
Member

waruqi commented Mar 9, 2026

try this patch, #7364

we need not to modify so many files

@waruqi
Copy link
Member

waruqi commented Mar 9, 2026

done

@waruqi waruqi closed this Mar 9, 2026
@Arthapz
Copy link
Member Author

Arthapz commented Mar 10, 2026

try this patch, #7364

we need not to modify so many files

it's perfect

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.

2 participants