From 352081571a4b0ac7b28d0f3d0ac9dae0cae1c879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Fri, 29 Nov 2024 07:56:40 +0100 Subject: [PATCH] add build.rs and improved long version --- Cargo.lock | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 3 +++ build.rs | 7 +++++++ flake.lock | 6 +++--- src/cli.rs | 9 +++++++-- 5 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 build.rs diff --git a/Cargo.lock b/Cargo.lock index 402fda3..88bd74c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -512,6 +512,8 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -1537,6 +1539,19 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +[[package]] +name = "git2" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" +dependencies = [ + "bitflags 2.6.0", + "libc", + "libgit2-sys", + "log", + "url", +] + [[package]] name = "group" version = "0.13.0" @@ -2050,6 +2065,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.72" @@ -2142,6 +2166,18 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libgit2-sys" +version = "0.17.0+1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" +dependencies = [ + "cc", + "libc", + "libz-sys", + "pkg-config", +] + [[package]] name = "libm" version = "0.2.11" @@ -2159,6 +2195,18 @@ dependencies = [ "redox_syscall", ] +[[package]] +name = "libz-sys" +version = "1.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -2881,7 +2929,7 @@ dependencies = [ [[package]] name = "pimalaya-tui" version = "0.1.0" -source = "git+https://github.com/pimalaya/tui#f59e1ac129962f9f219673284a0e25874d8ec679" +source = "git+https://github.com/pimalaya/tui#3b1ea19c0e384827eba5aea2ee935cd23b02be45" dependencies = [ "async-trait", "clap", @@ -2890,6 +2938,7 @@ dependencies = [ "dirs 4.0.0", "email-lib", "email_address", + "git2", "inquire", "md5", "oauth-lib", @@ -4314,6 +4363,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" diff --git a/Cargo.toml b/Cargo.toml index a5df64b..6f7abff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,9 @@ keyring = ["dep:keyring-lib", "email-lib/keyring", "pimalaya-tui/keyring"] oauth2 = ["email-lib/oauth2", "pimalaya-tui/oauth2", "keyring"] wizard = ["email-lib/autoconfig", "pimalaya-tui/wizard"] +[build-dependencies] +pimalaya-tui = { version = "=0.1", default-features = false, features = ["build-envs"] } + [dependencies] async-ctrlc = { version = "1.2", features = ["termination"] } async-trait = "0.1" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..89f9830 --- /dev/null +++ b/build.rs @@ -0,0 +1,7 @@ +use pimalaya_tui::build::{features_env, git_envs, target_envs}; + +fn main() { + features_env(include_str!("./Cargo.toml")); + target_envs(); + git_envs(); +} diff --git a/flake.lock b/flake.lock index fc56daf..1956e9b 100644 --- a/flake.lock +++ b/flake.lock @@ -39,11 +39,11 @@ "pimalaya": { "flake": false, "locked": { - "lastModified": 1732822749, - "narHash": "sha256-mEoqH0YKEyKYLY4QFcD5wt/pRrI9AUwwrpP3fc/vlfU=", + "lastModified": 1732861699, + "narHash": "sha256-zAH0R9TnwxqevDMtQlp1+K/FUvHD7vFCvxx1IAPJPkg=", "owner": "pimalaya", "repo": "nix", - "rev": "7f5b314cdbc5373a79828e1daec81075f335788a", + "rev": "5496d03953c15ce3022b76e9514ff083517cc740", "type": "github" }, "original": { diff --git a/src/cli.rs b/src/cli.rs index 39d8bc2..ac72fa0 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -2,7 +2,10 @@ use std::path::PathBuf; use clap::{Parser, Subcommand}; use color_eyre::eyre::Result; -use pimalaya_tui::terminal::{cli::arg::path_parser, config::TomlConfig as _}; +use pimalaya_tui::{ + long_version, + terminal::{cli::arg::path_parser, config::TomlConfig as _}, +}; use crate::{ account::command::{ @@ -14,7 +17,9 @@ use crate::{ }; #[derive(Parser, Debug)] -#[command(name = "mirador", author, version, about)] +#[command(name = env!("CARGO_PKG_NAME"))] +#[command(author, version, about)] +#[command(long_version = long_version!())] #[command(propagate_version = true, infer_subcommands = true)] pub struct Cli { #[command(subcommand)]