knurling-rs / defmt

Efficient, deferred formatting for logging on embedded systems
https://defmt.ferrous-systems.com/
Apache License 2.0
855 stars 79 forks source link

Release `v0.3.9` #864

Open Urhengulas opened 2 months ago

Urhengulas commented 2 months ago

This PR prepares the release of defmt v0.3.9 and related crates.

There are two breaking changes, one in defmt-decoder, one in defmt-parser. This does not affect users of the firmware defmt crate, but only of the host-side defmt-decoder crate. The breakage is minimal though. We are adding one new variant to two enums which were not non_exhaustive before and those enums are not returned from a function but are used for configuration.

This release also no longer requires the "unstable" feature from the decoder and parser (the flag remains, but is a no-op). They have been stable for years now (except one accidental breakage).

Crate Old Version New Version Breaking Change Target
defmt 0.3.8 0.3.9 - 🎙️
defmt-macros 0.3.9 0.3.10 - 🎙️
defmt-decoder 0.3.11 0.4.0 💥 🖥️
defmt-parser 0.3.4 0.4.0 💥 🎙️/🖥️
defmt-print 0.3.12 0.3.13 - 🖥️
defmt-semihosting 0.1.0 0.0.0 N/A 🎙️
firmware 0.1.0 0.0.0 N/A 🎙️
qemu-run 0.1.0 0.0.0 N/A 💻
xtask 0.1.0 0.0.0 N/A 💻
Urhengulas commented 2 months ago

Opened https://github.com/probe-rs/probe-rs/pull/2809. Once that is reviewed and considered good I will make the release.

jonathanpallant commented 1 month ago

On my list to look at this week

jonathanpallant commented 1 month ago

This PR contains a bunch of substantial changes, as well as the release version number bumps. I'd like to see the substantial changes brought out into a separate PR so they can be tested and reviewed individually.

For example https://github.com/knurling-rs/defmt/pull/864/commits/3ba66f7338d7d641af099065faadecc50a860d0b requires a change in CI to both build with --locked and without.

https://github.com/knurling-rs/defmt/pull/864/commits/b5ed24c5b99baf88333eccc26788d56b2ee71c3b also requires a change in CI to actually do the build on the MSRV (be that Rust 1.76 or Ferrocene).

It also needs a rebase after #865

jonathanpallant commented 1 month ago

I tested the radio-app exercises using this new defmt:

diff --git a/nrf52-code/radio-app/Cargo.toml b/nrf52-code/radio-app/Cargo.toml
index 44d2206..52d3e65 100644
--- a/nrf52-code/radio-app/Cargo.toml
+++ b/nrf52-code/radio-app/Cargo.toml
@@ -33,3 +33,7 @@ incremental = false
 lto = "fat"
 opt-level = 3
 overflow-checks = false
+
+[patch.crates-io]
+defmt.git = "https://github.com/knurling-rs/defmt"
+defmt.branch = "release"

followed by

cargo update -p defmt

Everything still seemed to build OK.

Urhengulas commented 1 week ago

Blocked on #883 and #884

Urhengulas commented 1 week ago

This PR contains a bunch of substantial changes, as well as the release version number bumps. I'd like to see the substantial changes brought out into a separate PR so they can be tested and reviewed individually.

All the substantial changes have been split out into separate PRs (#871, #883, #884).

Urhengulas commented 1 week ago

This is ready for review and release. As soon as you approve, @jonathanpallant, I will release the crates. Then we can update the probe-rs PR to use the crates-io version.

jonathanpallant commented 1 week ago

I think this is OK, but I want to go and manually run cargo semver-checks on each thing we're releasing so I fully understand what we're changing here.

Urhengulas commented 1 week ago

cargo semver-checks report

main branch

$ cargo semver-checks -p defmt-parser -p defmt-decoder --features unstable
     Parsing defmt-decoder v0.3.11 (current)
      Parsed [   9.142s] (current)
     Parsing defmt-decoder v0.3.11 (baseline)
      Parsed [   8.841s] (baseline)
    Checking defmt-decoder v0.3.11 -> v0.3.11 (no change)
     Checked [   0.015s] 94 checks: 93 pass, 1 fail, 0 warn, 0 skip

--- failure enum_marked_non_exhaustive: enum marked #[non_exhaustive] ---

Description:
A public enum has been marked #[non_exhaustive]. Pattern-matching on it outside of its crate must now include a wildcard pattern like `_`, or it will fail to compile.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#attr-adding-non-exhaustive
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/enum_marked_non_exhaustive.ron

Failed in:
  enum FormatterFormat in /home/urhengulas/Documents/github.com/knurling-rs/defmt/decoder/src/log/format/mod.rs:276

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  18.016s] defmt-decoder
     Parsing defmt-parser v0.3.4 (current)
      Parsed [   0.816s] (current)
     Parsing defmt-parser v0.3.4 (baseline, cached)
      Parsed [   0.184s] (baseline)
    Checking defmt-parser v0.3.4 -> v0.3.4 (no change)
     Checked [   0.010s] 94 checks: 93 pass, 1 fail, 0 warn, 0 skip

--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/enum_variant_added.ron

Failed in:
  variant DisplayHint:Octal in /home/urhengulas/Documents/github.com/knurling-rs/defmt/parser/src/display_hint.rs:16

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [   1.022s] defmt-parser
$ cargo semver-checks -p defmt-print -p defmt-macros
error: no crates with library targets selected, nothing to semver-check
note: only library targets contain an API surface that can be checked for semver
note: skipped the following crates since they have no library target: defmt-macros, defmt-print
$ cargo semver-checks -p defmt --default-features
     Parsing defmt v0.3.8 (current)
      Parsed [   1.143s] (current)
     Parsing defmt v0.3.8 (baseline, cached)
      Parsed [   0.106s] (baseline)
    Checking defmt v0.3.8 -> v0.3.8 (no change)
     Checked [   0.009s] 94 checks: 94 pass, 0 skip
     Summary no semver update required
    Finished [   1.268s] defmt

release branch

$ cargo semver-checks -p defmt-parser -p defmt-decoder --features unstable
     Parsing defmt-decoder v0.4.0 (current)
      Parsed [   9.571s] (current)
     Parsing defmt-decoder v0.3.11 (baseline, cached)
      Parsed [   0.185s] (baseline)
    Checking defmt-decoder v0.3.11 -> v0.4.0 (major change)
     Checked [   0.000s] 0 checks: 0 pass, 94 skip
     Summary no semver update required
    Finished [   9.774s] defmt-decoder
     Parsing defmt-parser v0.4.0 (current)
      Parsed [   0.900s] (current)
     Parsing defmt-parser v0.3.4 (baseline, cached)
      Parsed [   0.250s] (baseline)
    Checking defmt-parser v0.3.4 -> v0.4.0 (major change)
     Checked [   0.000s] 0 checks: 0 pass, 94 skip
     Summary no semver update required
    Finished [   1.163s] defmt-parser
$ cargo semver-checks -p defmt-print -p defmt-macros
error: no crates with library targets selected, nothing to semver-check
note: only library targets contain an API surface that can be checked for semver
note: skipped the following crates since they have no library target: defmt-macros, defmt-print
$ cargo semver-checks -p defmt --default-features
     Parsing defmt v0.3.9 (current)
      Parsed [   3.164s] (current)
     Parsing defmt v0.3.8 (baseline, cached)
      Parsed [   0.196s] (baseline)
    Checking defmt v0.3.8 -> v0.3.9 (minor change)
     Checked [   0.007s] 87 checks: 87 pass, 7 skip
     Summary no semver update required
    Finished [   3.378s] defmt
jonathanpallant commented 1 week ago

That looks good for "defmt-parser" and "defmt-decoder" on the host side. What about "defmt-print" on the host side and "defmt" on the target side? I think that's all four things you're proposing to publish here?

Urhengulas commented 1 week ago

What about "defmt-print" on the host side and "defmt" on the target side? I think that's all four things you're proposing to publish here?

There are no conflicts on the main branch already. So there are no conflicts in the release branch as well. I didn't include the output for brevity, as it is the same, but just added it for completeness.

Urhengulas commented 6 days ago

@jonathanpallant ping

jonathanpallant commented 6 days ago

OK looks good

jonathanpallant commented 5 days ago

@Urhengulas - does the change in ef2cef8659a9101cc2be2572b949033dce932724 mean we have to bump the Defmt Version from v4 to v5? It's a backwards compatible change but ... how should a decoder know whether this it has "V4 organised into log levels" or "V4 with logs in random order". I guess it could look for the __DEFMT_MARKER_TRACE_START symbol?