1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-22 02:10:25 +02:00

6 Commits

Author SHA1 Message Date
Eric Githinji
738d5ad820
Simplify project commands using cargo xtask (#2753)
We are already using `cargo xtask install-tools` to install the
project's tools, and `cargo xtask web-tests` to run the js tests. In
this PR we provide support for the various `mdbook` commands
(`test`,`serve`, and `build`) with `cargo xtask` commands. This provides
a uniform interface for running tasks in the project. Additionally it
allows these commands to work from within any dirrectory (previously
you'd need to navigate to the workspace root in order to run say `mdbook
build`).

Additionally we're improving the xtask code by making use of `Clap`
enums to handle validation of the possible tasks to run via xtask (this
closes #2741 ).

---------

Co-authored-by: Eric Githinji <egithinji@google.com>
2025-05-21 09:58:52 +03:00
Eric Githinji
6da4ade59e
Add xtask command for running web-tests. (#2743)
Currently, to run the tests that are located in the `tests` directory
(the js tests), one has to navigate to the directory and run `npm test`
or `npm start`. We now have a way of automating such task execution
using the binary in the `xtask` directory. This pr makes use of this by
introducing a new command `cargo xtask web-tests` that can be run from
anywhere in the repo to run the tests in the `tests` directory.

---------

Co-authored-by: Eric Githinji <egithinji@google.com>
2025-05-07 12:31:08 +03:00
Eric Githinji
291c2b08e3
Make install-tools command work from any directory in the workspace. (#2725)
This fixes #2708 by creating a CARGO_WORKSPACE_DIR env variable to act
as an anchor path, allowing the installation of mdbook-exerciser and
mdbook-course to succeed from any directory within the repository. Based
on the approach mentioned here:
https://github.com/rust-lang/cargo/issues/3946#issuecomment-973132993

---------

Co-authored-by: Eric Githinji <egithinji@google.com>
2025-05-06 09:55:55 +03:00
dependabot[bot]
53afa8416b
cargo: bump the patch group with 6 updates (#2731)
Bumps the patch group with 6 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.97` | `1.0.98` |
| [clap](https://github.com/clap-rs/clap) | `4.5.35` | `4.5.37` |
| [zerocopy](https://github.com/google/zerocopy) | `0.8.24` | `0.8.25` |
| [tokio-websockets](https://github.com/Gelbpunkt/tokio-websockets) |
`0.11.3` | `0.11.4` |
| [cxx](https://github.com/dtolnay/cxx) | `1.0.153` | `1.0.158` |
| [cxx-build](https://github.com/dtolnay/cxx) | `1.0.153` | `1.0.158` |

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-01 11:45:05 +01:00
Eric Githinji
0085748d17
Xtask improvements (#2707)
Some minor improvements to an already-merged PR (#2688) on the task
automation via xtask. Main ones being:

- Adding more explanatory comments about what the xtask package is and
what it does
- Using Clap for CLI arg parsing
- Using Anyhow for error handling

---------

Co-authored-by: Eric Githinji <egithinji@google.com>
2025-04-07 12:18:49 +02:00
Eric Githinji
91f6de64df
Xtask (#2688)
### Background
Comprehensive Rust requires a number of tools to be installed (e.g.
mdbook and mdbook-course). As mentioned in #2509 (and discussed in
#2469) it would be nice to have a cross platform command for installing
these dependencies. Currently these are installed using a shell script
(`install-mdbook.sh`) but this isn't truly cross platform e.g. for
Windows users.

### Xtask

[xtask](https://github.com/matklad/cargo-xtask) outlines an approach for
automating tasks in a Rust project. It involves using cargo's aliasing
feature to allow us to run commands like `cargo xtask <some task>` to
perform adhoc tasks via a Rust binary that we might otherwise need a
shell script for.

In this PR we add support for a `cargo xtask install-tools` command that
will replace the `install-mdbook.sh` script and install the dependent
tools. We can potentially extend it to support for other tasks e.g.
`cargo xtask fmt`.

---------

Co-authored-by: Eric Githinji <egithinji@google.com>
2025-03-14 12:24:08 +01:00