Make BEVY_REFLECT_AUTO_REGISTER_STATIC require a target dir #21494
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Fix #21444
Solution
Require setting explicit
target
dir inBEVY_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 thetarget
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 runningcargo metadata
and gettingtarget_directory
field from the output json, which I've added to the example instructions.Testing