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

Add async examples that can't run in playground as cargo crates #567

Open
djmitche opened this issue Apr 14, 2023 · 3 comments
Open

Add async examples that can't run in playground as cargo crates #567

djmitche opened this issue Apr 14, 2023 · 3 comments
Assignees

Comments

@djmitche
Copy link
Collaborator

From #496

@djmitche djmitche self-assigned this Apr 14, 2023
@djmitche
Copy link
Collaborator Author

djmitche commented May 8, 2023

Specifically, this comment

I would suggest adding the large async examples to the repository as full Cargo projects (similar to how the Android chapter handles things).

That makes it trivial for an instructor to find known-good versions of the code, and we also get coverage from cargo build when you add those projects to the workspace for the repository.

However, I don't see this example.

⸩ git ls-files | grep Cargo.toml
Cargo.toml
mdbook-exerciser/Cargo.toml
src/bare-metal/alloc-example/Cargo.toml
src/bare-metal/aps/examples/Cargo.toml
src/bare-metal/microcontrollers/examples/Cargo.toml
src/bare-metal/useful-crates/allocator-example/Cargo.toml
src/bare-metal/useful-crates/zerocopy-example/Cargo.toml
src/exercises/Cargo.toml
src/exercises/bare-metal/compass/Cargo.toml
src/exercises/bare-metal/rtc/Cargo.toml
src/exercises/concurrency/elevator/Cargo.toml

and in fact only some of those crates are referenced in the top-level workspace.

@qwandor the Git history suggests that this relates to the work that you did around exercises? Any chance you could elaborate how that works (or is supposed to work) in the README or a linked file?

@mgeisler
Copy link
Collaborator

mgeisler commented May 9, 2023

Right now, we have src/exercises/Cargo.toml, which in turn references a few Rust files. It brings in dependencies such as reqwest, scraper, and thiserror. This gives us some coverage via cargo build and cargo test.

You could directly extend this to include the dependencies for async examples — or you could create a different project if needed (I would aim for simplicity and just extend the current file).

For the Android day, we have fully functioning Android.bp files in the repository. They reference all the examples and ensures that we can build it when needed. I would like to build it in CI, but I haven't set that up yet.

@mgeisler
Copy link
Collaborator

We should also take a look at mdbook-keeper (#175), which I believe is a testing tool which would allow us to include snippets with dependencies.

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

No branches or pull requests

2 participants