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

Move mavlink-dump from src/bin to examples/mavlink-dump #215

Merged

Conversation

antonio-sc66
Copy link
Contributor

Refactor mavlink-dump. Change from [[bin]] to [[example]].

Splitting the example has the following benefits:

  • Faster compilation for library use, as the example doesn't get compiled by default
  • Easier to retain compilation incremental files (faster re-compilation times)
  • Cleaner library src/ directory
  • std checks and imports can be removed from the mavlink-dump example -> cleaner example. no_std version didn't do anything
  • Executable name changes from mavlink -> mavlink-dump. More precise to locate and guess what it is for

Disadvantage:

  • Installation time for the example is increased (at least on my short tests), but it is something rarely done.

When running cargo run --example mavlink-dump compilation time and execution stays the same or better (easier to retain compilation incremental files)

Installation output

/rust-mavlink$ cargo install --path examples/mavlink-dump
  Installing mavlink-dump v0.1.0 (/foo/rust-mavlink/examples/mavlink-dump)
    Updating crates.io index
    Finished release [optimized] target(s) in 1.91s
   Replacing /foo/.cargo/bin/mavlink-dump
    Replaced package `mavlink-dump v0.1.0 (/foo/rust-mavlink/examples/mavlink-dump)` with `mavlink-dump v0.1.0 (/foo/examples/mavlink-dump)` (executable `mavlink-dump`)

Empty args execution

rust-mavlink$ mavlink-dump
Usage: mavlink-dump (tcpout|tcpin|udpout|udpin|udpbcast|serial|file):(ip|dev|path):(port|baud)

Splitting the example has the following benefits:
- Faster normal compilation for library use
- Easier to retain compilation incremental files (faster re-compilation times)
- Cleaner library src/ directory
- no_std/std definitions and imports can be removed from the mavlink-dump example
- Executable name changes from mavlink -> mavlink-dump. More precise to locate and guess what it is for

Disadvantage:
- Installation time for the example is increased, but it is something rarely done
@antonio-sc66 antonio-sc66 marked this pull request as ready for review January 3, 2024 23:43
@antonio-sc66
Copy link
Contributor Author

antonio-sc66 commented Jan 3, 2024

The CI for the mavlink-dump is failing as the call cargo build --verbose --bin mavlink-dump --features ardupilotmega has to be replaced by cargo build --example mavlink-dump

@patrickelectric patrickelectric merged commit d828e6e into mavlink:master Jan 4, 2024
19 of 20 checks passed
@antonio-sc66 antonio-sc66 deleted the feature-split-mavlink-dump branch January 4, 2024 18:00
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