Skip to content

Make CLI optional (for library usage) #289

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LuigiPiucco
Copy link

This is made by adding a "bin" feature that's enabled by default, inspired by what was done in rust-embedded/svd2rust#619.

Additionally, support for JSON and YAML configs has also been made optional but default. This includes what should be the only behavior change: if neither were enabled at build-time, passing a config file is an error.

The motivation came from Rahix/avr-device#201, but this should be a generally beneficial change for everybody.

Since some of the features of the CLI aren't very useful when using svdtools as a library, they just vanish without the "bin" feature. This is for two reasons: one is to reduce diff size, and two is to avoid having to refactor all capabilities to have a library equivalent. There is little disadvantage to this, for instance in avr-device we only use the patching functionality (which is kept), and there's little prospect of needing more.

This is made by adding a "bin" feature that's enabled by default,
inspired by what was done in
rust-embedded/svd2rust#619.

Additionally, support for JSON and YAML configs has also been made
optional but default. This includes what should be the only behavior
change: if neither were enabled at build-time, passing a config file is
an error.

The motivation came from Rahix/avr-device#201,
but this should be a generally beneficial change for everybody.

Since some of the features of the CLI aren't very useful when using
svdtools as a library, they just vanish without the "bin" feature. This
is for two reasons: one is to reduce diff size, and two is to avoid
having to refactor all capabilities to have a library equivalent. There
is little disadvantage to this, for instance in avr-device we only use
the patching functionality (which is kept), and there's little prospect
of needing more.
@burrbull
Copy link
Member

burrbull commented May 8, 2025

I'm fine with this change. But a job should be added to CI to test different combination of features.

Builds/tests were added, some without default features and some with
just `bin` enabled. The default features builds/tests were kept.
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