Split CLI binary from the library crate #58
Merged
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.
I am using
rsgen-avro
at work for Rust code generation based on Avro schema files. The application we are building is for an IoT system that is run on a custom Yocto linux build. We are usingrsgen-avro
as a library (we do not use the generated CLI binary). The issue with thersgen-avro>=0.12.0
is the dependency onclap@4
. Since the latter installs the most recent version, which is[email protected]
as of today, it requires at least Rust 1.70 to compile. Unfortunately, the latest supported Rust version on Yocto today is 1.68 (see [1] and [2]).With the current structure of the package, we are stuck on
[email protected]
until Yocto project supports at least Rust 1.70. We would greatly benefit from using the latest version,rsgen-avro>=0.12.2
, but this requires modifying slightly the package structure.With this change I propose to split the binary generation from the library crate using a feature flag. One can still generate the binary, if needed (and it will be done by the CI/CD pipeline), but the benefit is that the library crate does not depend on
clap@4
and therefore any other package that usesrsgen-avro
as a library skips installingclap
as dependency.[1] https://docs.yoctoproject.org/dev/migration-guides/release-notes-4.2.html
[2] https://wiki.yoctoproject.org/wiki/Releases