Skip to content

Conversation

eugineerd
Copy link
Contributor

Objective

Fix #21444

Solution

Require setting explicit target dir in BEVY_REFLECT_AUTO_REGISTER_STATIC env variable.

Right now there is no stable way to obtain this dir in a proc macro, and since we already have to set an env var for auto_register_static approach to work might as well reuse it here. BEVY_REFLECT_AUTO_REGISTER_STATIC must be an absolute path and point to the target dir for the current workspace, otherwise cargo would put type registration functions in some internal dir for each crate. This dir can be set manually or by running cargo metadata and getting target_directory field from the output json, which I've added to the example instructions.

Testing

@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide A-Dev-Tools Tools used to debug Bevy applications. S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 10, 2025
Copy link
Contributor

It looks like your PR is a breaking change, but you didn't provide a migration guide.

Please review the instructions for writing migration guides, then expand or revise the content in the migration guides directory to reflect your changes.

Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

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

This doesn't look like it's strictly breaking, but a migration guide to help users (and search engines) figure out what's going wrong feels like it would be helpful here.

Fix itself looks good, and the docs are nice and clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Dev-Tools Tools used to debug Bevy applications. C-Bug An unexpected or incorrect behavior M-Migration-Guide A breaking change to Bevy's public API that needs to be noted in a migration guide S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reflect_auto_register_static doesn't register types in crates that aren't part of the workspace

2 participants