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

Remove smdhtool dependency by using cytryna library #50

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

Conversation

Maccraft123
Copy link

This is related to #2 and in future similar PRs will close that issue

@Maccraft123 Maccraft123 requested a review from a team as a code owner November 26, 2023 14:00
@Maccraft123 Maccraft123 marked this pull request as draft November 26, 2023 14:00
Copy link
Member

@ian-h-chamberlain ian-h-chamberlain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and simple API and really quite a small amount of code changes! I think this looks pretty good overall, but would be good to get some other @rust3ds/active opinions as well.

Cargo.lock Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whew, this adds quite a lot of dependencies to Cargo.lock huh?

I tried building with cargo install -Zunstable-options --timings just to see long it takes, and I noticed something interesting — with this change, we now have syn at both v1.0 and v2.0 which are one of the longest parts of the build. I wonder if there is some way we could massage the dependencies (either here or in cytryna) to maybe reduce the dependency tree a little?

On the whole though, I think the spirit of #2 probably means it's worth the extra build time. It might also be an incentive to prebuild binaries with something like https://github.com/axodotdev/cargo-dist or at least make sure we're compatible with https://github.com/cargo-bins/cargo-binstall, but those can be done separately at some point.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a bit better now... aside the "now we have 2 versions of syn" stuff

@@ -19,3 +19,5 @@ tee = "0.1.0"
toml = "0.5.6"
clap = { version = "4.0.15", features = ["derive", "wrap_help"] }
shlex = "1.1.0"
image = { version = "0.24.7", default-features = false, features = ["png"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relating to my other comment, we could also consider lodepng (smdhtool uses the C++ version of this I think) or png as potentially lighter-weight alternatives, although image is nice in that we could potentially support other image formats. I'm not sure that we really need to support anything other than PNG though honestly, it's a pretty universal format that most users should be able to produce.

@Meziu any preference here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image without all of its default features doesn't have many dependencies, and with png feature it uses png crate under the hood

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't realize that cytryna itself had a direct dependency on image. It should be fine though, as you said its dependency tree is not too large

/// Builds the smdh using `cytryna` library.
pub fn build_smdh(config: &CTRConfig) {
let smdh = Smdh::builder()
.with_short_desc(&config.name).unwrap()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible the user could input something that would cause these unwraps to fail? Would the error be understandable enough to easily fix if so?

If not we could augment with an expect or map_err just to make it more clear, I guess.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User could input a very long string for any of those which would error out and yeah expect for those is a good idea

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