Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add #[builder(crate = "...")] for re-export scenarios #275

Merged
merged 3 commits into from Nov 28, 2022
Merged

Conversation

TedDriggs
Copy link
Collaborator

This branch adds a new struct-level field which overrides the default crate path. This enables crates to re-export derive_builder::Builder and avoid any direct dependency on derive_builder in their downstreams.

Fixes #274

@TedDriggs
Copy link
Collaborator Author

The compiletest error here is legitimate; we seem to have lost a span on the custom error in this change, and I'm not sure where yet. That needs to be addressed before this can be merged.

This allows setting the crate root for re-export scenarios.

All hardcoded usage of `::derive_builder` in generated code has now
been replaced by a `crate_root` variable, which contains the path to use.

For backwards compatibility, this defaults to `::derive_builder`.

Fixes #274
This should cause failures for any hardcoded usage of ::derive_builder
@TedDriggs
Copy link
Collaborator Author

@ryo33 can you test this out using a git dependency and let me know how it goes?

@ryo33
Copy link
Contributor

ryo33 commented Nov 24, 2022

@TedDriggs All worked well. Thank you!

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

Successfully merging this pull request may close these issues.

Support re-export of derive_builder
2 participants