Skip to content

feat(deps): support both embassy-executor 0.9.x and 0.10.x#80

Draft
kaspar030 wants to merge 1 commit intoprobe-rs:masterfrom
kaspar030:ee-features
Draft

feat(deps): support both embassy-executor 0.9.x and 0.10.x#80
kaspar030 wants to merge 1 commit intoprobe-rs:masterfrom
kaspar030:ee-features

Conversation

@kaspar030
Copy link
Contributor

This adds Cargo features for switching between embassy-executor 0.9.x and 0.10.x, as discussed in #71.

I tried to make this backwards compatible (the embassy feature selects embassy09).

(Includes #79)

Signed-off-by: Kaspar Schleiser <kaspar@schleiser.de>

let spawn_invoker = if cfg!(feature = "embassy09") {
quote!( spawn(#ident_invoker()).unwrap() )
} else if cfg!(feature = "embassy010") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe make this the else case.

}
);

let spawn_invoker = if cfg!(feature = "embassy09") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is basically #79 but supporting both executors.

@@ -21,7 +21,8 @@ darling = "0.21.1"

[features]
embassy = []
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here embassy means "any embassy executor".

# Enables async test and init functions using embassy-executor.
# Note: You need to enable at least one executor feature on embassy unless you are using the `external-executor` feature
embassy = ["embedded-test-macros/embassy", "dep:embassy-executor"]
embassy = ["embassy09"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here,

  • embassy just selects embassy09 for backwards compatibility.
  • embassy-any toggles code where the executor version doesn't matter

Happy to bikeshed this, maybe _embassy? It is only used internally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A semver breaking embedded-test version could also change the executor version that embassy points to. (e.g., e-t 0.9 could make embassy select embassy010, to make the then-current e-e version the default).


// Reexport the embassy stuff
#[cfg(all(feature = "embassy", not(feature = "ariel-os")))]
#[cfg(all(feature = "embassy-any", not(feature = "ariel-os")))]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now checking for embassy-any as plain embassy is used for backwards-compatibly selecting embassy-09. See below.

@kaspar030
Copy link
Contributor Author

I can reproduce the ci errors. Somehow the pub use embassy_executor:... don't pick up the crate even though it is renamed using Cargo's package field.. Changing to e.g., embassy_executor_09 works, so the dependency is actually selected. :/ Getting late, will take another look tomorrow.

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.

1 participant