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

Gather more build information and improve version string #126

Merged
merged 2 commits into from
Jul 13, 2024

Conversation

martinling
Copy link
Member

This PR uses the built crate to gather additional build-time information which is reported in the --version output and the About dialog.

Fixes the failure to build without a .git directory, caused by #125.

Output of --version when built with a .git directory:

Packetry version 0.1.0 (git b2029df)

Runtime information:
  GTK version: 4.12.5

Packetry build information:
  Git commit: b2029df15600f1ddcb2e0655b6baa0abfc6355cd
  Cargo package version: 0.1.0
  Enabled features: (none)

Rust compiler:
  Version: rustc 1.79.0 (129f3b996 2024-06-10)
  Target: x86_64-unknown-linux-gnu (little-endian, 64-bit)
  Optimization level: 3
  Debug build: no

Output when built without a .git directory:

Packetry version 0.1.0

Runtime information:
  GTK version: 4.12.5

Packetry build information:
  Git commit: unknown
  Cargo package version: 0.1.0
  Enabled features: (none)

Rust compiler:
  Version: rustc 1.79.0 (129f3b996 2024-06-10)
  Target: x86_64-unknown-linux-gnu (little-endian, 64-bit)
  Optimization level: 3
  Debug build: no

The --dependencies option can now be used along with --version to print crate dependencies used. This is omitted by default as it generates a lot of output.

The same information as above, as well as the dependency listing, is displayed in the About dialog.

@mossmann
Copy link
Member

I tried it with local tags and observed that this results in git describe-style version strings like:

Packetry version 0.1.0 (git v0.0.1-8-g96882e5)

or

Packetry version 0.1.0 (git v0.1.0)

which I think is great!

@mossmann
Copy link
Member

Is it expected that I would see things like windows_aarch64_msvc 0.48.5 in my dependency list on Linux/x86_64?

@martinling
Copy link
Member Author

I tried it with local tags and observed that this results in git describe-style version strings

Yes, that was the intent and I tested it too; I should have mentioned that.

Is it expected that I would see things like windows_aarch64_msvc 0.48.5 in my dependency list on Linux/x86_64?

It's expected, but annoying. It happens because we depend on cross-platform crates that depend on the union of all their dependencies for each platform.

Originally, they had no option but to do this. Later, Cargo gained support for target-specific dependencies. But some projects haven't been updated to use that feature.

Copy link
Member

@mossmann mossmann left a comment

Choose a reason for hiding this comment

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

Love it! The additional info is excellent!

@martinling
Copy link
Member Author

Actually, looking a bit more closely that may not be the reason for the extraneous dependencies. See lukaslueg/built#55. So we may be able to do better here.

@martinling
Copy link
Member Author

Updated to catch the license file for a dependency after fixing #127; no change to the diff of the main commit.

@martinling martinling merged commit ae82994 into greatscottgadgets:main Jul 13, 2024
8 checks passed
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