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

Merged
merged 2 commits into from
May 20, 2025

Conversation

LuigiPiucco
Copy link
Contributor

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.
@Rahix
Copy link
Contributor

Rahix commented May 20, 2025

Ping @burrbull

@burrbull burrbull added this pull request to the merge queue May 20, 2025
Merged via the queue into rust-embedded:master with commit 2d74e09 May 20, 2025
16 checks passed
@LuigiPiucco LuigiPiucco deleted the optional-cli branch May 20, 2025 12:50
@Rahix
Copy link
Contributor

Rahix commented May 25, 2025

@burrbull, can you cut a new release of svdtools with @LuigiPiucco's change? We'd like to use it in preparation for the next avr-device release.

@burrbull
Copy link
Member

Done.

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.

3 participants