diff options
author | Nick Gerace <nickagerace@gmail.com> | 2022-08-08 15:39:50 -0400 |
---|---|---|
committer | Nick Gerace <nickagerace@gmail.com> | 2022-08-09 01:01:09 -0400 |
commit | 4256d026d06f33e6221544bba719d80bc536f815 (patch) | |
tree | 3e22cfe5e8029c4f8eba7e09dbf7430a6e09a0ab | |
parent | 012c20f47b14e0d55f3761fabb1e907d3d25987e (diff) | |
download | gfold-4256d026d06f33e6221544bba719d80bc536f815.zip |
Switch to cargo workspace
Primary:
- Switch to cargo workspace to replace xtask, make, etc.
- Add debug symbol stripping
Misc:
- Upgrade all packages
- Replace entries iterator with "next" due to the following PR:
https://github.com/rust-lang/git2-rs/pull/854
- Remove "rustfmt.toml"
Signed-off-by: Nick Gerace <nickagerace@gmail.com>
-rw-r--r-- | CHANGELOG.md | 10 | ||||
-rw-r--r-- | Cargo.lock | 106 | ||||
-rw-r--r-- | Cargo.toml | 45 | ||||
-rw-r--r-- | crates/bench-loosely/Cargo.toml (renamed from scripts/bench-loosely/Cargo.toml) | 0 | ||||
-rw-r--r-- | crates/bench-loosely/src/main.rs (renamed from scripts/bench-loosely/src/main.rs) | 2 | ||||
-rw-r--r-- | crates/gfold/Cargo.toml | 30 | ||||
-rw-r--r-- | crates/gfold/src/cli.rs (renamed from src/cli.rs) | 0 | ||||
-rw-r--r-- | crates/gfold/src/config.rs (renamed from src/config.rs) | 0 | ||||
-rw-r--r-- | crates/gfold/src/display.rs (renamed from src/display.rs) | 0 | ||||
-rw-r--r-- | crates/gfold/src/display/color.rs (renamed from src/display/color.rs) | 0 | ||||
-rw-r--r-- | crates/gfold/src/error.rs (renamed from src/error.rs) | 0 | ||||
-rw-r--r-- | crates/gfold/src/main.rs (renamed from src/main.rs) | 15 | ||||
-rw-r--r-- | crates/gfold/src/report.rs (renamed from src/report.rs) | 4 | ||||
-rw-r--r-- | crates/gfold/src/report/target.rs (renamed from src/report/target.rs) | 0 | ||||
-rw-r--r-- | crates/gfold/src/run.rs (renamed from src/run.rs) | 0 | ||||
-rw-r--r-- | crates/gfold/src/status.rs (renamed from src/status.rs) | 0 | ||||
-rw-r--r-- | crates/size/Cargo.toml (renamed from scripts/size/Cargo.toml) | 0 | ||||
-rw-r--r-- | crates/size/src/main.rs (renamed from scripts/size/src/main.rs) | 2 | ||||
-rw-r--r-- | docs/DEVELOPING.md | 8 | ||||
-rw-r--r-- | rustfmt.toml | 1 | ||||
-rw-r--r-- | scripts/.gitignore | 1 | ||||
-rw-r--r-- | scripts/README.md | 15 |
22 files changed, 130 insertions, 109 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a8c483e..810ccb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] -The latest version contains all changes. +<!-- The latest version contains all changes. --> + +### Added + +- Debug symbol stripping for `cargo install` users (result: ~79% of the size of `4.0.1`) + +### Changed + +- Switched to `cargo` workspaces ### [4.0.1] - 2022-07-05 @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "anyhow" -version = "1.0.58" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" +checksum = "c794e162a5eff65c72ef524dfe393eb923c354e350bb78b9c7383df13f3bc142" dependencies = [ "backtrace", ] @@ -74,9 +74,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a17d453482a265fd5f8479f2a3f405566e6ca627837aaddb85af8b1ab8ef61" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", @@ -88,6 +88,13 @@ dependencies = [ ] [[package]] +name = "bench-loosely" +version = "0.1.0" +dependencies = [ + "dirs", +] + +[[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -110,9 +117,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "crossbeam-channel" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ "cfg-if", "crossbeam-utils", @@ -120,9 +127,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -131,9 +138,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" +checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" dependencies = [ "autocfg", "cfg-if", @@ -145,9 +152,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83" +checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" dependencies = [ "cfg-if", "once_cell", @@ -231,15 +238,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" [[package]] name = "git2" -version = "0.14.4" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0155506aab710a86160ddb504a480d2964d7ab5b9e62419be69e0032bc5931c" +checksum = "2994bee4a3a6a51eb90c218523be382fd7ea09b16380b9312e9dbe955ff7c7d1" dependencies = [ "bitflags", "libc", @@ -285,9 +292,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" +checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" [[package]] name = "jobserver" @@ -300,15 +307,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.126" +version = "0.2.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "505e71a4706fa491e9b1b55f51b95d4037d0821ee40131190475f692b35b009b" [[package]] name = "libgit2-sys" -version = "0.13.4+1.4.2" +version = "0.14.0+1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0fa6563431ede25f5cc7f6d803c6afbc1c5d3ad3d4925d12c882bf2b526f5d1" +checksum = "47a00859c70c8a4f7218e6d1cc32875c4b55f6799445b842b0d8ed5e4c3d959b" dependencies = [ "cc", "libc", @@ -379,9 +386,9 @@ dependencies = [ [[package]] name = "object" -version = "0.28.4" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e42c982f2d955fac81dd7e1d0e1426a7d702acd9c98d19ab01083a6a0328c424" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "memchr", ] @@ -406,18 +413,18 @@ checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" [[package]] name = "proc-macro2" -version = "1.0.40" +version = "1.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804" +checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" dependencies = [ "proc-macro2", ] @@ -448,9 +455,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] @@ -474,9 +481,9 @@ checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "ryu" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695" +checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "scopeguard" @@ -486,18 +493,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.138" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1578c6245786b9d168c5447eeacfb96856573ca56c9d68fdcf394be134882a47" +checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.138" +version = "1.0.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "023e9b1467aef8a10fb88f25611870ada9800ef7e22afce356bb0d2387b6f27c" +checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391" dependencies = [ "proc-macro2", "quote", @@ -506,9 +513,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" +checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7" dependencies = [ "itoa", "ryu", @@ -516,10 +523,17 @@ dependencies = [ ] [[package]] +name = "size" +version = "0.1.0" +dependencies = [ + "dirs", +] + +[[package]] name = "syn" -version = "1.0.98" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd" +checksum = "58dbef6ec655055e20b86b15a8cc6d439cca19b667537ac6a1369572d151ab13" dependencies = [ "proc-macro2", "quote", @@ -537,18 +551,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" +checksum = "f5f6586b7f764adc0231f4c79be7b920e766bb2f3e51b3661cdb263828f19994" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" +checksum = "12bafc5b54507e0149cdf1b145a5d80ab80a90bcd9275df43d4fff68460f6c21" dependencies = [ "proc-macro2", "quote", @@ -587,9 +601,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" +checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" [[package]] name = "unicode-normalization" @@ -1,43 +1,12 @@ -[package] -authors = ["Nick Gerace <nickagerace@gmail.com>"] -categories = ["command-line-utilities", "command-line-interface"] -description = "CLI tool to help keep track of your Git repositories." -homepage = "https://nickgerace.dev" -keywords = ["git", "cli"] -license = "Apache-2.0" -name = "gfold" -readme = "README.md" -repository = "https://github.com/nickgerace/gfold/" +[workspace] +members = ["crates/*"] +default-members = ["crates/gfold"] -edition = "2021" -version = "4.0.1" - -[dependencies] -anyhow = { version = "1", features = ["backtrace"] } -argh = "0" -dirs = "4" -git2 = { version = "0", default_features = false } -log = "0" -rayon = "1" -serde = { version = "1", features = ["derive"] } -serde_json = "1" -termcolor = "1" -thiserror = "1" -toml = "0" - -# Source: https://github.com/env-logger-rs/env_logger/blob/v0.9.0/Cargo.toml#L47 -# Removed features: ["regex", "termcolor"] -env_logger = { version = "0", features = ["atty", "humantime"], default_features = false } - -[profile.release] +[profile.release.package.gfold] codegen-units = 1 - -# Instruct linker to optimize at the link stage. -lto = true - -# There is a noticeable speed difference from level 3 to 'z' or 's'. -# We need this speed for the user experience. opt-level = 3 +strip = true -# This application should not panic often and only read from the filesystem. +[profile.release] +lto = true panic = "abort" diff --git a/scripts/bench-loosely/Cargo.toml b/crates/bench-loosely/Cargo.toml index b533aa1..b533aa1 100644 --- a/scripts/bench-loosely/Cargo.toml +++ b/crates/bench-loosely/Cargo.toml diff --git a/scripts/bench-loosely/src/main.rs b/crates/bench-loosely/src/main.rs index 6613fb5..8ad46a3 100644 --- a/scripts/bench-loosely/src/main.rs +++ b/crates/bench-loosely/src/main.rs @@ -21,7 +21,7 @@ fn main() { .parent() .expect("could not get parent"); - println!("Running \"cargo build --release\"..."); + println!("running in {:?}: cargo build --release", &repo); let output = Command::new("cargo") .arg("build") .arg("--release") diff --git a/crates/gfold/Cargo.toml b/crates/gfold/Cargo.toml new file mode 100644 index 0000000..f9202af --- /dev/null +++ b/crates/gfold/Cargo.toml @@ -0,0 +1,30 @@ +[package] +authors = ["Nick Gerace <nickagerace@gmail.com>"] +categories = ["command-line-utilities", "command-line-interface"] +description = "CLI tool to help keep track of your Git repositories." +homepage = "https://nickgerace.dev" +keywords = ["git", "cli"] +license = "Apache-2.0" +name = "gfold" +readme = "README.md" +repository = "https://github.com/nickgerace/gfold/" + +edition = "2021" +version = "4.0.1" + +[dependencies] +anyhow = { version = "1", features = ["backtrace"] } +argh = "0" +dirs = "4" +git2 = { version = "0", default_features = false } +log = "0" +rayon = "1" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +termcolor = "1" +thiserror = "1" +toml = "0" + +# Source: https://github.com/env-logger-rs/env_logger/blob/v0.9.0/Cargo.toml#L47 +# Removed features: ["regex", "termcolor"] +env_logger = { version = "0", features = ["atty", "humantime"], default_features = false } diff --git a/src/cli.rs b/crates/gfold/src/cli.rs index 89518c2..89518c2 100644 --- a/src/cli.rs +++ b/crates/gfold/src/cli.rs diff --git a/src/config.rs b/crates/gfold/src/config.rs index bb4ac57..bb4ac57 100644 --- a/src/config.rs +++ b/crates/gfold/src/config.rs diff --git a/src/display.rs b/crates/gfold/src/display.rs index 98f320b..98f320b 100644 --- a/src/display.rs +++ b/crates/gfold/src/display.rs diff --git a/src/display/color.rs b/crates/gfold/src/display/color.rs index 47ae7a0..47ae7a0 100644 --- a/src/display/color.rs +++ b/crates/gfold/src/display/color.rs diff --git a/src/error.rs b/crates/gfold/src/error.rs index 6eeda29..6eeda29 100644 --- a/src/error.rs +++ b/crates/gfold/src/error.rs diff --git a/src/main.rs b/crates/gfold/src/main.rs index dd48e98..dc47f75 100644 --- a/src/main.rs +++ b/crates/gfold/src/main.rs @@ -56,7 +56,14 @@ mod tests { // └── two let manifest_directory = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let target = manifest_directory.join("target"); + let target = manifest_directory + .parent() + .expect("could not get parent") + .parent() + .expect("could not get parent") + .parent() + .expect("could not get parent") + .join("target"); create_directory(&target); // Warning: setting up test directory by removing it and its contents recursively. @@ -117,6 +124,12 @@ mod tests { // Now, let's ensure our reports are what we expect. let test_dir = Path::new(env!("CARGO_MANIFEST_DIR")) + .parent() + .expect("could not get parent") + .parent() + .expect("could not get parent") + .parent() + .expect("could not get parent") .join("target") .join("test"); let mut expected_reports: LabeledReports = BTreeMap::new(); diff --git a/src/report.rs b/crates/gfold/src/report.rs index 469ff62..8e4a483 100644 --- a/src/report.rs +++ b/crates/gfold/src/report.rs @@ -204,7 +204,7 @@ fn get_email(repository: &Repository) -> Option<String> { return None; } }; - let entries = match config.entries(None) { + let mut entries = match config.entries(None) { Ok(v) => v, Err(e) => { trace!("ignored error: {}", e); @@ -213,7 +213,7 @@ fn get_email(repository: &Repository) -> Option<String> { }; // Greedily find our "user.email" value. Return the first result found. - for entry in &entries { + while let Some(entry) = entries.next() { match entry { Ok(entry) => { if let Some(name) = entry.name() { diff --git a/src/report/target.rs b/crates/gfold/src/report/target.rs index abc836a..abc836a 100644 --- a/src/report/target.rs +++ b/crates/gfold/src/report/target.rs diff --git a/src/run.rs b/crates/gfold/src/run.rs index a67b9cf..a67b9cf 100644 --- a/src/run.rs +++ b/crates/gfold/src/run.rs diff --git a/src/status.rs b/crates/gfold/src/status.rs index 2301dc9..2301dc9 100644 --- a/src/status.rs +++ b/crates/gfold/src/status.rs diff --git a/scripts/size/Cargo.toml b/crates/size/Cargo.toml index 1a6bc06..1a6bc06 100644 --- a/scripts/size/Cargo.toml +++ b/crates/size/Cargo.toml diff --git a/scripts/size/src/main.rs b/crates/size/src/main.rs index a92309a..bd9b313 100644 --- a/scripts/size/src/main.rs +++ b/crates/size/src/main.rs @@ -12,7 +12,7 @@ fn main() { .parent() .expect("could not get parent"); - println!("Running \"cargo build --release\"..."); + println!("running in {:?}: cargo build --release", &repo); let output = Command::new("cargo") .arg("build") .arg("--release") diff --git a/docs/DEVELOPING.md b/docs/DEVELOPING.md index 929b42c..d4ed78e 100644 --- a/docs/DEVELOPING.md +++ b/docs/DEVELOPING.md @@ -30,9 +30,13 @@ cargo fix --all-targets --all-features --allow-dirty --allow-staged cargo clippy --fix --all-features --all-targets --allow-dirty --allow-staged ``` -## Running Performance Testing Scripts +## Running Performance Tests -For performance testing, navigate to the [README](../scripts/README.md) to get start. +See available packages with the following command: + +```shell +cargo run -p +``` ## Optional Checks diff --git a/rustfmt.toml b/rustfmt.toml deleted file mode 100644 index 43d4840..0000000 --- a/rustfmt.toml +++ /dev/null @@ -1 +0,0 @@ -newline_style = "Unix" diff --git a/scripts/.gitignore b/scripts/.gitignore deleted file mode 100644 index 6485775..0000000 --- a/scripts/.gitignore +++ /dev/null @@ -1 +0,0 @@ -**/Cargo.lock diff --git a/scripts/README.md b/scripts/README.md deleted file mode 100644 index eb72c92..0000000 --- a/scripts/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Performance Testing Scripts - -Run a script by executing `cargo run` in its directory. - -```shell -cd <path-to-root>/scripts/<script>/ -cargo run -q -``` - -Alternatively, you can execute `cargo run` from another directory. -Here is an example: - -```shell -cargo run -q --manifest-path <path-to-root>/scripts/<script>/Cargo.toml -```
\ No newline at end of file |