Remove unnecesarily heavy and practically unused cargo-generate

This commit is contained in:
datdenkikniet
2023-05-01 14:42:38 +02:00
parent 17943121d9
commit 43a6abed5e
5 changed files with 21 additions and 26 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
[package]
# TODO fix `authors` and `name` if you didn't use `cargo-generate`
authors = ["{{authors}}"]
name = "{{project-name}}"
name = "test-app"
edition = "2021"
version = "0.1.0"
+3 -16
View File
@@ -25,28 +25,15 @@ $ # make sure to install v0.2.0 or later
$ cargo install probe-run
```
#### 3. [`cargo-generate`]:
``` console
$ cargo install cargo-generate
```
[`cargo-generate`]: https://crates.io/crates/cargo-generate
> *Note:* You can also just clone this repository instead of using `cargo-generate`, but this involves additional manual adjustments.
## Setup
#### 1. Initialize the project template
#### 1. Clone the project template
``` console
$ cargo generate \
--git https://github.com/rtic-rs/app-template \
--branch main \
--name my-app
$ git clone https://github.com/rtic-rs/app-template test-app
```
If you look into your new `my-app` folder, you'll find that there are a few `TODO`s in the files marking the properties you need to set.
If you look into your new `test-app` folder, you'll find that there are a few `TODO`s in the files marking the properties you need to set.
Let's walk through them together now.
-2
View File
@@ -1,2 +0,0 @@
[template]
ignore = ["README.md", "run-steps.sh"]
+16 -5
View File
@@ -4,14 +4,27 @@ set -ex
project="test-app"
cleanup() {
echo "Cleaning up"
mv Cargo.toml.tmp Cargo.toml
mv .cargo/config.toml.tmp .cargo/config.toml
}
if [ "$1" = "cleanup" ]; then
cleanup
exit 1
fi
echo "Installing necessary tools"
cargo install flip-link cargo-generate sd
cargo install flip-link sd
echo "Cleaning up old project"
rm -rf "$project"
echo "Creating new project"
cargo generate -p . --name "$project"
# cargo generate -p . --name "$project"
mkdir -p "$project"
cp -r Cargo.toml LICENSE-* src/ rust-toolchain.toml .cargo/ "$project"
echo "Storing current config so that the child project will compile."
mv Cargo.toml Cargo.toml.tmp
@@ -32,6 +45,4 @@ sd -s 'FreeInterrupt1, ...' 'SWI0_EGU0' src/bin/minimal.rs
cargo bbr minimal
cd ..
echo "Cleaning up"
mv Cargo.toml.tmp Cargo.toml
mv .cargo/config.toml.tmp .cargo/config.toml
cleanup
+1 -1
View File
@@ -2,7 +2,7 @@
#![no_std]
#![feature(type_alias_impl_trait)]
use {{crate_name}} as _; // global logger + panicking-behavior + memory layout
use test_app as _; // global logger + panicking-behavior + memory layout
#[rtic::app(
device = some_hal::pac, // TODO: Replace `some_hal::pac` with the path to the PAC