From 63cc48531b05ba310ffe113f230924129cd162f4 Mon Sep 17 00:00:00 2001 From: sksat Date: Wed, 28 Feb 2024 12:35:31 +0900 Subject: [PATCH 1/7] use notalawyer to include license notice in binary --- Cargo.lock | 34 ++++++++++++++++++++++++++++++++++ Cargo.toml | 3 +++ 2 files changed, 37 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index ebfee07..bfda96c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -782,6 +782,9 @@ dependencies = [ "async-trait", "clap", "futures", + "notalawyer", + "notalawyer-build", + "notalawyer-clap", "pin-project", "serde", "serde_with", @@ -800,6 +803,9 @@ dependencies = [ "clap", "futures", "kble-socket", + "notalawyer", + "notalawyer-build", + "notalawyer-clap", "tokio", "tokio-util", "tracing", @@ -816,6 +822,9 @@ dependencies = [ "eb90", "futures", "kble-socket", + "notalawyer", + "notalawyer-build", + "notalawyer-clap", "tokio", "tokio-util", "tracing", @@ -832,6 +841,9 @@ dependencies = [ "clap", "futures", "kble-socket", + "notalawyer", + "notalawyer-build", + "notalawyer-clap", "serde", "tokio", "tokio-serial", @@ -979,6 +991,28 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "notalawyer" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb6f7d5c326e17c81351d91ed10b175ba5afbfc276ca232d115490e876f7e4e7" + +[[package]] +name = "notalawyer-build" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e6e1b1f2c9f35e548539a8216afdfeb0ee62743e99664e6c5b3b0f815a9fdf7" + +[[package]] +name = "notalawyer-clap" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43962175b7e1f02c3fa7458b4970bdd0b78fa81272c2de2ebd1868120e2dac48" +dependencies = [ + "clap", + "notalawyer", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" diff --git a/Cargo.toml b/Cargo.toml index c9eca13..7ab01c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,3 +31,6 @@ serde = { version = "1", features = ["derive"]} tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } kble-socket = "0.2.0" +notalawyer = "0.1.0" +notalawyer-clap = "0.1.0" +notalawyer-build = "0.1.0" From 4ff46f21385fde1db314b3dcb86de21e45a8f0a3 Mon Sep 17 00:00:00 2001 From: sksat Date: Wed, 28 Feb 2024 12:37:37 +0900 Subject: [PATCH 2/7] add cargo-about config --- about.toml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 about.toml diff --git a/about.toml b/about.toml new file mode 100644 index 0000000..d196da0 --- /dev/null +++ b/about.toml @@ -0,0 +1,7 @@ +accepted = [ + "MIT", + "Apache-2.0", + "Unicode-DFS-2016", + "MPL-2.0", + "BSD-2-Clause", +] From c8537798457246e985e6f16afe89ce546afd52cd Mon Sep 17 00:00:00 2001 From: sksat Date: Wed, 28 Feb 2024 12:38:09 +0900 Subject: [PATCH 3/7] kble: integrate with notalawyer --- kble/Cargo.toml | 5 +++++ kble/build.rs | 3 +++ kble/src/main.rs | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 kble/build.rs diff --git a/kble/Cargo.toml b/kble/Cargo.toml index 984aee3..028fd1a 100644 --- a/kble/Cargo.toml +++ b/kble/Cargo.toml @@ -9,6 +9,9 @@ readme.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[build-dependencies] +notalawyer-build.workspace = true + [dependencies] anyhow.workspace = true futures.workspace = true @@ -21,3 +24,5 @@ clap.workspace = true serde.workspace = true serde_yaml = "0.9" serde_with = "3.4" +notalawyer.workspace = true +notalawyer-clap.workspace = true diff --git a/kble/build.rs b/kble/build.rs new file mode 100644 index 0000000..62844e1 --- /dev/null +++ b/kble/build.rs @@ -0,0 +1,3 @@ +fn main() { + notalawyer_build::build(); +} diff --git a/kble/src/main.rs b/kble/src/main.rs index e1c391c..1fda032 100644 --- a/kble/src/main.rs +++ b/kble/src/main.rs @@ -2,6 +2,7 @@ use std::path::PathBuf; use anyhow::{Context, Result}; use clap::Parser; +use notalawyer_clap::*; mod plug; mod spaghetti; @@ -27,7 +28,7 @@ impl Args { #[tokio::main] async fn main() -> Result<()> { - let args = Args::parse(); + let args = Args::parse_with_license_notice(include_notice!()); let config = args.load_spaghetti_config()?; config.run().await?; Ok(()) From 814e4496b1b7bb2bbca0c532080f1645333729aa Mon Sep 17 00:00:00 2001 From: sksat Date: Wed, 28 Feb 2024 12:38:25 +0900 Subject: [PATCH 4/7] kble-c2a: integrate with notalawyer --- kble-c2a/Cargo.toml | 5 +++++ kble-c2a/build.rs | 3 +++ kble-c2a/src/main.rs | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 kble-c2a/build.rs diff --git a/kble-c2a/Cargo.toml b/kble-c2a/Cargo.toml index cf6ab21..65c204c 100644 --- a/kble-c2a/Cargo.toml +++ b/kble-c2a/Cargo.toml @@ -9,6 +9,9 @@ readme.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[build-dependencies] +notalawyer-build.workspace = true + [dependencies] anyhow.workspace = true futures.workspace = true @@ -19,3 +22,5 @@ bytes.workspace = true tracing.workspace = true tracing-subscriber.workspace = true clap.workspace = true +notalawyer.workspace = true +notalawyer-clap.workspace = true diff --git a/kble-c2a/build.rs b/kble-c2a/build.rs new file mode 100644 index 0000000..62844e1 --- /dev/null +++ b/kble-c2a/build.rs @@ -0,0 +1,3 @@ +fn main() { + notalawyer_build::build(); +} diff --git a/kble-c2a/src/main.rs b/kble-c2a/src/main.rs index 71ef5eb..5bc3e97 100644 --- a/kble-c2a/src/main.rs +++ b/kble-c2a/src/main.rs @@ -3,6 +3,7 @@ use bytes::BytesMut; use clap::{Parser, Subcommand}; use futures::{SinkExt, StreamExt}; use kble_c2a::{spacepacket, tfsync}; +use notalawyer_clap::*; use tokio_util::codec::Decoder; use tracing_subscriber::{prelude::*, EnvFilter}; @@ -43,7 +44,7 @@ async fn main() -> Result<()> { .with(EnvFilter::from_default_env()) .init(); - let args = Args::parse(); + let args = Args::parse_with_license_notice(include_notice!()); match args.command { Commands::Tfsync => run_tfsync().await, Commands::Spacepacket { command } => run_spacepacket(command).await, From bf3abe186ab7f21fad40e1e69a4f553bd024582a Mon Sep 17 00:00:00 2001 From: sksat Date: Wed, 28 Feb 2024 12:38:37 +0900 Subject: [PATCH 5/7] kble-eb90: integrate with notalawyer --- kble-eb90/Cargo.toml | 5 +++++ kble-eb90/build.rs | 3 +++ kble-eb90/src/main.rs | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 kble-eb90/build.rs diff --git a/kble-eb90/Cargo.toml b/kble-eb90/Cargo.toml index fead076..f1184eb 100644 --- a/kble-eb90/Cargo.toml +++ b/kble-eb90/Cargo.toml @@ -9,6 +9,9 @@ readme.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[build-dependencies] +notalawyer-build.workspace = true + [dependencies] anyhow.workspace = true futures.workspace = true @@ -20,3 +23,5 @@ tracing.workspace = true tracing-subscriber.workspace = true clap.workspace = true eb90 = "0.1.1" +notalawyer.workspace = true +notalawyer-clap.workspace = true diff --git a/kble-eb90/build.rs b/kble-eb90/build.rs new file mode 100644 index 0000000..62844e1 --- /dev/null +++ b/kble-eb90/build.rs @@ -0,0 +1,3 @@ +fn main() { + notalawyer_build::build(); +} diff --git a/kble-eb90/src/main.rs b/kble-eb90/src/main.rs index 82a7a24..718829b 100644 --- a/kble-eb90/src/main.rs +++ b/kble-eb90/src/main.rs @@ -4,6 +4,7 @@ use anyhow::Result; use bytes::BytesMut; use clap::{Parser, Subcommand}; use futures::{SinkExt, StreamExt}; +use notalawyer_clap::*; use tokio_util::codec::{Decoder, Encoder}; use tracing::warn; use tracing_subscriber::{prelude::*, EnvFilter}; @@ -35,7 +36,7 @@ async fn main() -> Result<()> { .with(EnvFilter::from_default_env()) .init(); - let args = Args::parse(); + let args = Args::parse_with_license_notice(include_notice!()); match args.command { Commands::Encode => run_encode().await, Commands::Decode { buffer_size } => run_decode(buffer_size).await, From c632f6aa33073608e38f0de6ba9dbc164c6cc8a3 Mon Sep 17 00:00:00 2001 From: sksat Date: Wed, 28 Feb 2024 12:38:48 +0900 Subject: [PATCH 6/7] kble-serialport: integrate with notalawyer --- kble-serialport/Cargo.toml | 5 +++++ kble-serialport/build.rs | 3 +++ kble-serialport/src/main.rs | 3 ++- 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 kble-serialport/build.rs diff --git a/kble-serialport/Cargo.toml b/kble-serialport/Cargo.toml index 4041e1e..a11f607 100644 --- a/kble-serialport/Cargo.toml +++ b/kble-serialport/Cargo.toml @@ -9,6 +9,9 @@ readme.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[build-dependencies] +notalawyer-build.workspace = true + [dependencies] anyhow.workspace = true clap = { workspace = true, features = ["derive", "env"] } @@ -21,3 +24,5 @@ axum = { workspace = true, default-features = false, features = ["tokio", "tower tokio-serial = "5.4" serde.workspace = true bytes.workspace = true +notalawyer.workspace = true +notalawyer-clap.workspace = true diff --git a/kble-serialport/build.rs b/kble-serialport/build.rs new file mode 100644 index 0000000..62844e1 --- /dev/null +++ b/kble-serialport/build.rs @@ -0,0 +1,3 @@ +fn main() { + notalawyer_build::build(); +} diff --git a/kble-serialport/src/main.rs b/kble-serialport/src/main.rs index b60e241..4a03608 100644 --- a/kble-serialport/src/main.rs +++ b/kble-serialport/src/main.rs @@ -12,6 +12,7 @@ use bytes::BytesMut; use clap::Parser; use futures::{SinkExt, StreamExt}; use kble_socket::from_axum; +use notalawyer_clap::*; use serde::Deserialize; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio_serial::{DataBits, FlowControl, Parity, SerialPortBuilderExt, SerialStream, StopBits}; @@ -100,7 +101,7 @@ struct Args { #[tokio::main] async fn main() -> Result<()> { - let args = Args::parse(); + let args = Args::parse_with_license_notice(include_notice!()); tracing_subscriber::registry() .with( From 88938e6c28faea68eb585b7a200153e3e620ca4b Mon Sep 17 00:00:00 2001 From: sksat Date: Wed, 28 Feb 2024 12:41:56 +0900 Subject: [PATCH 7/7] install cargo-about in Rust CI --- .github/workflows/rust.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6ea0715..5f4f7f4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,6 +33,10 @@ jobs: - name: cache dependencies uses: Swatinem/rust-cache@v2.7.3 + - name: install cargo-about + run: | + cargo install cargo-about + - name: reviewdog / clippy uses: sksat/action-clippy@v0.5.1 with: