Add bosion crate: build-time info (#516)
This commit is contained in:
parent
14f53a6bf5
commit
f76b16c4f4
|
@ -28,6 +28,10 @@ updates:
|
|||
directory: "/crates/filterer/tagged"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "cargo"
|
||||
directory: "/crates/bosion"
|
||||
schedule:
|
||||
interval: "daily"
|
||||
- package-ecosystem: "cargo"
|
||||
directory: "/crates/ignore-files"
|
||||
schedule:
|
||||
|
|
|
@ -73,6 +73,10 @@ jobs:
|
|||
- name: Check that CLI runs
|
||||
run: cargo run ${{ env.flags }} -p watchexec-cli -- -1 echo
|
||||
|
||||
- name: Run bosion integration tests
|
||||
run: ./run-tests.sh
|
||||
working-directory: crates/bosion
|
||||
|
||||
- name: Generate manpage
|
||||
run: cargo run ${{ env.flags }} -p watchexec-cli -- --manpage > doc/watchexec.1
|
||||
- name: Check that manpage is up to date
|
||||
|
|
|
@ -28,6 +28,18 @@ dependencies = [
|
|||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"getrandom",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.20"
|
||||
|
@ -52,6 +64,12 @@ version = "1.0.69"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
|
||||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"
|
||||
|
||||
[[package]]
|
||||
name = "argfile"
|
||||
version = "0.1.5"
|
||||
|
@ -61,6 +79,12 @@ dependencies = [
|
|||
"os_str_bytes",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
|
||||
|
||||
[[package]]
|
||||
name = "async-broadcast"
|
||||
version = "0.5.1"
|
||||
|
@ -164,9 +188,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524"
|
|||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.64"
|
||||
version = "0.1.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2"
|
||||
checksum = "095183a3539c7c7649b2beb87c2d3f0591f3a7fed07761cc546d244e27e0238c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -198,9 +222,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|||
|
||||
[[package]]
|
||||
name = "axum"
|
||||
version = "0.6.9"
|
||||
version = "0.6.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6137c6234afb339e75e764c866e3594900f0211e1315d33779f269bbe2ec6967"
|
||||
checksum = "2fb79c228270dcf2426e74864cabc94babb5dbab01a4314e702d2f16540e1591"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum-core",
|
||||
|
@ -227,9 +251,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "axum-core"
|
||||
version = "0.3.2"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cae3e661676ffbacb30f1a824089a8c9150e71017f7e1e38f2aa32009188d34"
|
||||
checksum = "b2f958c80c248b34b9a877a643811be8dbca03ca5ba827f2b63baf3a81e5fc4e"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"bytes",
|
||||
|
@ -284,6 +308,14 @@ dependencies = [
|
|||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bosion"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"gix",
|
||||
"time 0.3.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
version = "1.3.0"
|
||||
|
@ -323,6 +355,12 @@ version = "1.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
|
||||
|
||||
[[package]]
|
||||
name = "bytesize"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38fcc2979eff34a4b84e1cf9a1e3da42a7d44b3b690a40cdcb23e3d556cfb2e5"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.79"
|
||||
|
@ -433,6 +471,12 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clru"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8191fa7302e03607ff0e237d4246cc043ff5b3cb9409d995172ba3bea16b807"
|
||||
|
||||
[[package]]
|
||||
name = "codespan-reporting"
|
||||
version = "0.11.1"
|
||||
|
@ -550,6 +594,20 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-channel",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-queue",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.7"
|
||||
|
@ -560,6 +618,40 @@ dependencies = [
|
|||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
"memoffset 0.8.0",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.15"
|
||||
|
@ -685,6 +777,12 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dunce"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.8.1"
|
||||
|
@ -951,6 +1049,48 @@ dependencies = [
|
|||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix"
|
||||
version = "0.38.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "297b7d406fdb5b818468946f1795c8bf5aca4b20744e7a45705b92201a0aa0b1"
|
||||
dependencies = [
|
||||
"gix-actor",
|
||||
"gix-attributes",
|
||||
"gix-config",
|
||||
"gix-credentials",
|
||||
"gix-date",
|
||||
"gix-diff",
|
||||
"gix-discover",
|
||||
"gix-features",
|
||||
"gix-glob",
|
||||
"gix-hash",
|
||||
"gix-hashtable",
|
||||
"gix-index",
|
||||
"gix-lock",
|
||||
"gix-mailmap",
|
||||
"gix-object",
|
||||
"gix-odb",
|
||||
"gix-pack",
|
||||
"gix-path",
|
||||
"gix-prompt",
|
||||
"gix-ref",
|
||||
"gix-refspec",
|
||||
"gix-revision",
|
||||
"gix-sec",
|
||||
"gix-tempfile",
|
||||
"gix-traverse",
|
||||
"gix-url",
|
||||
"gix-validate",
|
||||
"gix-worktree",
|
||||
"log",
|
||||
"once_cell",
|
||||
"signal-hook",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"unicode-normalization",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-actor"
|
||||
version = "0.18.0"
|
||||
|
@ -965,6 +1105,48 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-attributes"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "850914386c41114018a695dea0516c5bbea1144b0bf8d1683dd5290ad1b5c674"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-features",
|
||||
"gix-glob",
|
||||
"gix-path",
|
||||
"gix-quote",
|
||||
"thiserror",
|
||||
"unicode-bom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-bitmap"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "024bca0c7187517bda5ea24ab148c9ca8208dd0c3e2bea88cdb2008f91791a6d"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-chunk"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0d39583cab06464b8bf73b3f1707458270f0e7383cb24c3c9c1a16e6f792978"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-command"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2c6f75c1e0f924de39e750880a6e21307194bb1ab773efe3c7d2d787277f8ab"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-config"
|
||||
version = "0.17.0"
|
||||
|
@ -999,6 +1181,22 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-credentials"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa0bb5be75eb73793724585dc949a50804d29b4a6349561456febec2ea34afaf"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-command",
|
||||
"gix-config-value",
|
||||
"gix-path",
|
||||
"gix-prompt",
|
||||
"gix-sec",
|
||||
"gix-url",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-date"
|
||||
version = "0.4.3"
|
||||
|
@ -1011,15 +1209,52 @@ dependencies = [
|
|||
"time 0.3.20",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-diff"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce7ea311543d215dc5558217760d0f9b7da5e6640421c8fe9b8e7222571fc6da"
|
||||
dependencies = [
|
||||
"gix-hash",
|
||||
"gix-object",
|
||||
"imara-diff",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-discover"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2dc06ab79a3f9a8be0c094a2fd5b4a852fd1362b95e4800a65bf7d119b2b6563"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"dunce",
|
||||
"gix-hash",
|
||||
"gix-path",
|
||||
"gix-ref",
|
||||
"gix-sec",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-features"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e799c19245b6d19e371fc9c2981b8133e600611b59f6dc7df0293af2c7db50f"
|
||||
dependencies = [
|
||||
"bytesize",
|
||||
"crc32fast",
|
||||
"crossbeam-channel",
|
||||
"crossbeam-utils",
|
||||
"flate2",
|
||||
"gix-hash",
|
||||
"jwalk",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"prodash",
|
||||
"sha1_smol",
|
||||
"thiserror",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
|
@ -1043,6 +1278,39 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-hashtable"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9609c1b8f36f12968e6a6098f7cdb52004f7d42d570f47a2d6d7c16612f19acb"
|
||||
dependencies = [
|
||||
"gix-hash",
|
||||
"hashbrown 0.13.2",
|
||||
"parking_lot",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-index"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d949c651d7612f8f73fb82b94c3d87a17291690b19d3bfae8baa7812ecb5514c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bstr",
|
||||
"btoi",
|
||||
"filetime",
|
||||
"gix-bitmap",
|
||||
"gix-features",
|
||||
"gix-hash",
|
||||
"gix-lock",
|
||||
"gix-object",
|
||||
"gix-traverse",
|
||||
"itoa",
|
||||
"memmap2",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-lock"
|
||||
version = "4.0.0"
|
||||
|
@ -1054,6 +1322,17 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-mailmap"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5c98cfd496e7c525f8289f13040d6379f5e943e6eaf6e6bc1a9ffcf5b3edbc4"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-actor",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-object"
|
||||
version = "0.27.0"
|
||||
|
@ -1073,6 +1352,47 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-odb"
|
||||
version = "0.41.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bfbf0748ab8fb3ad34d7dd8d02ed88a966c2e3f1c13a03008c00bbe0dbf15c7c"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"gix-features",
|
||||
"gix-hash",
|
||||
"gix-object",
|
||||
"gix-pack",
|
||||
"gix-path",
|
||||
"gix-quote",
|
||||
"parking_lot",
|
||||
"tempfile",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-pack"
|
||||
version = "0.31.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d37919c003338c7211e9e0b5a49752ba536d8920f326d5d362c1e7a3b7a3d64"
|
||||
dependencies = [
|
||||
"clru",
|
||||
"gix-chunk",
|
||||
"gix-diff",
|
||||
"gix-features",
|
||||
"gix-hash",
|
||||
"gix-hashtable",
|
||||
"gix-object",
|
||||
"gix-path",
|
||||
"gix-tempfile",
|
||||
"gix-traverse",
|
||||
"memmap2",
|
||||
"parking_lot",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
"uluru",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-path"
|
||||
version = "0.7.2"
|
||||
|
@ -1083,6 +1403,30 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-prompt"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a20cebf73229debaa82574c4fd20dcaf00fa8d4bfce823a862c4e990d7a0b5b4"
|
||||
dependencies = [
|
||||
"gix-command",
|
||||
"gix-config-value",
|
||||
"nix 0.26.2",
|
||||
"parking_lot",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-quote"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a282f5a8d9ee0b09ec47390ac727350c48f2f5c76d803cd8da6b3e7ad56e0bcb"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"btoi",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-ref"
|
||||
version = "0.25.0"
|
||||
|
@ -1102,6 +1446,34 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-refspec"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0c1a5125520e07c98c5bc4574d6b3b286af0925b69392538bd57cac2022b733"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-hash",
|
||||
"gix-revision",
|
||||
"gix-validate",
|
||||
"smallvec",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-revision"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "098760be523c5b0f09e370b64dfdd0819061f5ae505c99f50a374e0670a900b3"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-date",
|
||||
"gix-hash",
|
||||
"gix-hashtable",
|
||||
"gix-object",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-sec"
|
||||
version = "0.6.2"
|
||||
|
@ -1124,9 +1496,37 @@ dependencies = [
|
|||
"libc",
|
||||
"once_cell",
|
||||
"parking_lot",
|
||||
"signal-hook",
|
||||
"signal-hook-registry",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-traverse"
|
||||
version = "0.23.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f791c926b4861ab9a512c5e8f58fc0f0c80db90ed26983b779ae3b188f40e873"
|
||||
dependencies = [
|
||||
"gix-hash",
|
||||
"gix-hashtable",
|
||||
"gix-object",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-url"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "402a16fdf106ad11781d857c7381f2b12c704538b5f321af78ab9feed0f44a5c"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-features",
|
||||
"gix-path",
|
||||
"home",
|
||||
"thiserror",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-validate"
|
||||
version = "0.7.3"
|
||||
|
@ -1137,6 +1537,24 @@ dependencies = [
|
|||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gix-worktree"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06a1b5ce22eec13124a2c1744fb1fc340badd1fd9481a6a949cdfaf8c583a2ea"
|
||||
dependencies = [
|
||||
"bstr",
|
||||
"gix-attributes",
|
||||
"gix-features",
|
||||
"gix-glob",
|
||||
"gix-hash",
|
||||
"gix-index",
|
||||
"gix-object",
|
||||
"gix-path",
|
||||
"io-close",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.10"
|
||||
|
@ -1175,9 +1593,15 @@ version = "0.12.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"ahash 0.7.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.13.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
|
||||
|
||||
[[package]]
|
||||
name = "hdrhistogram"
|
||||
version = "7.5.2"
|
||||
|
@ -1236,6 +1660,15 @@ version = "0.4.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
|
||||
|
||||
[[package]]
|
||||
name = "home"
|
||||
version = "0.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.9"
|
||||
|
@ -1276,6 +1709,12 @@ version = "1.0.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421"
|
||||
|
||||
[[package]]
|
||||
name = "human_format"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86cce260d758a9aa3d7c4b99d55c815a540f8a37514ba6046ab6be402a157cb0"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
|
@ -1383,6 +1822,16 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "imara-diff"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e98c1d0ad70fc91b8b9654b1f33db55e59579d3b3de2bffdced0fdb810570cb8"
|
||||
dependencies = [
|
||||
"ahash 0.8.3",
|
||||
"hashbrown 0.12.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.2"
|
||||
|
@ -1390,7 +1839,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
"hashbrown 0.12.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1422,6 +1871,16 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "io-close"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cadcf447f06744f8ce713d2d6239bb5bde2c357a452397a9ed90c625da390bc"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "io-lifetimes"
|
||||
version = "1.0.5"
|
||||
|
@ -1467,9 +1926,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.5"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
|
||||
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
||||
|
||||
[[package]]
|
||||
name = "jobserver"
|
||||
|
@ -1489,6 +1948,16 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jwalk"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2735847566356cd2179a2a38264839308f7079fa96e6bd5a42d740460e003c56"
|
||||
dependencies = [
|
||||
"crossbeam",
|
||||
"rayon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kqueue"
|
||||
version = "1.0.7"
|
||||
|
@ -1659,6 +2128,15 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miette"
|
||||
version = "5.5.0"
|
||||
|
@ -2114,6 +2592,16 @@ dependencies = [
|
|||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prodash"
|
||||
version = "23.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d73c6b64cb5b99eb63ca97d378685712617ec0172ff5c04cd47a489d3e2c51f8"
|
||||
dependencies = [
|
||||
"bytesize",
|
||||
"human_format",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "project-origins"
|
||||
version = "1.2.0"
|
||||
|
@ -2205,6 +2693,28 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rayon-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d"
|
||||
dependencies = [
|
||||
"crossbeam-channel",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
"num_cpus",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.16"
|
||||
|
@ -2274,9 +2784,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.36.8"
|
||||
version = "0.36.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
|
||||
checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
|
@ -2294,9 +2804,9 @@ checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70"
|
|||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.12"
|
||||
version = "1.0.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
|
||||
checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
|
@ -2315,9 +2825,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
|||
|
||||
[[package]]
|
||||
name = "scratch"
|
||||
version = "1.0.3"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2"
|
||||
checksum = "5d5e082f6ea090deaf0e6dd04b68360fd5cddb152af6ce8927c9d25db299f98c"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
|
@ -2406,6 +2916,16 @@ dependencies = [
|
|||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "732768f1176d21d09e076c23a93123d40bba92d50c4058da34d45c8de8e682b9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"signal-hook-registry",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.4.1"
|
||||
|
@ -2838,9 +3358,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "tower-http"
|
||||
version = "0.4.0"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d1d42a9b3f3ec46ba828e8d376aec14592ea199f70a06a548587ecd1c4ab658"
|
||||
checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bytes",
|
||||
|
@ -2994,6 +3514,15 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uluru"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "794a32261a1f5eb6a4462c81b59cec87b5c27d5deea7dd1ac8fc781c41d226db"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.6.0"
|
||||
|
@ -3017,9 +3546,9 @@ checksum = "63ec69f541d875b783ca40184d655f2927c95f0bffd486faa83cd3ac3529ec32"
|
|||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.6"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
|
||||
checksum = "775c11906edafc97bc378816b94585fbd9a054eabaf86fdd0ced94af449efab7"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-linebreak"
|
||||
|
@ -3027,7 +3556,7 @@ version = "0.1.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137"
|
||||
dependencies = [
|
||||
"hashbrown",
|
||||
"hashbrown 0.12.3",
|
||||
"regex",
|
||||
]
|
||||
|
||||
|
@ -3228,6 +3757,7 @@ name = "watchexec-cli"
|
|||
version = "1.21.1"
|
||||
dependencies = [
|
||||
"argfile",
|
||||
"bosion",
|
||||
"chrono",
|
||||
"clap",
|
||||
"clap_complete",
|
||||
|
@ -3494,9 +4024,9 @@ checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
|
|||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "faf09497b8f8b5ac5d3bb4d05c0a99be20f26fd3d5f2db7b0716e946d5103658"
|
||||
checksum = "c95fb4ff192527911dd18eb138ac30908e7165b8944e528b6af93aa4c842d345"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
|
|
@ -6,6 +6,7 @@ members = [
|
|||
"crates/filterer/globset",
|
||||
"crates/filterer/ignore",
|
||||
"crates/filterer/tagged",
|
||||
"crates/bosion",
|
||||
"crates/ignore-files",
|
||||
"crates/project-origins",
|
||||
]
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# Changelog
|
||||
|
||||
## Next (YYYY-MM-DD)
|
||||
|
||||
- Initial release.
|
|
@ -0,0 +1,38 @@
|
|||
[package]
|
||||
name = "bosion"
|
||||
version = "0.0.0"
|
||||
|
||||
authors = ["Félix Saparelli <felix@passcod.name>"]
|
||||
license = "Apache-2.0 OR MIT"
|
||||
description = "Gather build information for verbose versions flags"
|
||||
keywords = ["version", "git", "verbose", "long"]
|
||||
|
||||
documentation = "https://docs.rs/bosion"
|
||||
repository = "https://github.com/watchexec/watchexec"
|
||||
readme = "README.md"
|
||||
|
||||
rust-version = "1.64.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies.time]
|
||||
version = "0.3.20"
|
||||
features = ["macros", "formatting"]
|
||||
|
||||
[dependencies.gix]
|
||||
version = "0.38.0"
|
||||
optional = true
|
||||
|
||||
[features]
|
||||
default = ["git", "reproducible", "std"]
|
||||
|
||||
### Read from git repo, provide GIT_* vars
|
||||
git = ["dep:gix"]
|
||||
|
||||
### Read from SOURCE_DATE_EPOCH when available
|
||||
reproducible = []
|
||||
|
||||
### Provide a long_version_with() function to add extra info
|
||||
###
|
||||
### Specifically this is std support for the _using_ crate, not for the bosion crate itself. It's
|
||||
### assumed that the bosion crate is always std, as it runs in build.rs.
|
||||
std = []
|
|
@ -0,0 +1,147 @@
|
|||
# Bosion
|
||||
|
||||
_Gather build information for verbose versions flags._
|
||||
|
||||
- **[API documentation][docs]**.
|
||||
- Licensed under [Apache 2.0][license] or [MIT](https://passcod.mit-license.org).
|
||||
- Status: maintained.
|
||||
|
||||
[docs]: https://docs.rs/bosion
|
||||
[license]: ../../LICENSE
|
||||
|
||||
## Quick start
|
||||
|
||||
In your `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[build-dependencies]
|
||||
bosion = "0.0.0"
|
||||
```
|
||||
|
||||
In your `build.rs`:
|
||||
|
||||
```rust ,no_run
|
||||
fn main() {
|
||||
bosion::gather();
|
||||
}
|
||||
```
|
||||
|
||||
In your `src/main.rs`:
|
||||
|
||||
```rust ,ignore
|
||||
include!(env!("BOSION_PATH"));
|
||||
|
||||
fn main() {
|
||||
// default output, like rustc -Vv
|
||||
println!("{}", Bosion::long_version());
|
||||
|
||||
// with additional fields
|
||||
println!("{}", Bosion::long_version_with(&[
|
||||
("custom data", "value"),
|
||||
("LLVM version", "15.0.6"),
|
||||
]));
|
||||
|
||||
// enabled features like +feature +an-other
|
||||
println!("{}", Bosion::CRATE_FEATURE_STRING);
|
||||
|
||||
// the raw data
|
||||
println!("{}", Bosion::GIT_COMMIT_HASH);
|
||||
println!("{}", Bosion::GIT_COMMIT_SHORTHASH);
|
||||
println!("{}", Bosion::GIT_COMMIT_DATE);
|
||||
println!("{}", Bosion::GIT_COMMIT_DATETIME);
|
||||
println!("{}", Bosion::CRATE_VERSION);
|
||||
println!("{:?}", Bosion::CRATE_FEATURES);
|
||||
println!("{}", Bosion::BUILD_DATE);
|
||||
println!("{}", Bosion::BUILD_DATETIME);
|
||||
}
|
||||
```
|
||||
|
||||
## Advanced usage
|
||||
|
||||
Generating a struct with public visibility:
|
||||
|
||||
```rust ,no_run
|
||||
// build.rs
|
||||
bosion::gather_pub();
|
||||
```
|
||||
|
||||
Customising the output file and struct names:
|
||||
|
||||
```rust ,no_run
|
||||
// build.rs
|
||||
bosion::gather_to("buildinfo.rs", "Build", /* public? */ false);
|
||||
```
|
||||
|
||||
Outputting build-time environment variables instead of source:
|
||||
|
||||
```rust ,ignore
|
||||
// build.rs
|
||||
bosion::gather_to_env();
|
||||
|
||||
// src/main.rs
|
||||
fn main() {
|
||||
println!("{}", env!("BOSION_GIT_COMMIT_HASH"));
|
||||
println!("{}", env!("BOSION_GIT_COMMIT_SHORTHASH"));
|
||||
println!("{}", env!("BOSION_GIT_COMMIT_DATE"));
|
||||
println!("{}", env!("BOSION_GIT_COMMIT_DATETIME"));
|
||||
println!("{}", env!("BOSION_BUILD_DATE"));
|
||||
println!("{}", env!("BOSION_BUILD_DATETIME"));
|
||||
println!("{}", env!("BOSION_CRATE_VERSION"));
|
||||
println!("{}", env!("BOSION_CRATE_FEATURES")); // comma-separated
|
||||
}
|
||||
```
|
||||
|
||||
Custom env prefix:
|
||||
|
||||
```rust ,no_run
|
||||
// build.rs
|
||||
bosion::gather_to_env_with_prefix("MYAPP_");
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- `reproducible`: reads [`SOURCE_DATE_EPOCH`](https://reproducible-builds.org/docs/source-date-epoch/) (default).
|
||||
- `git`: enables gathering git information (default).
|
||||
- `std`: enables the `long_version_with` method (default).
|
||||
Specifically, this is about the downstream crate's std support, not Bosion's, which always requires std.
|
||||
|
||||
## Why not...?
|
||||
|
||||
- [bugreport](https://github.com/sharkdp/bugreport): runtime library, for bug information.
|
||||
- [git-testament](https://github.com/kinnison/git-testament): uses the `git` CLI instead of gitoxide.
|
||||
- [human-panic](https://github.com/rust-cli/human-panic): runtime library, for panics.
|
||||
- [shadow-rs](https://github.com/baoyachi/shadow-rs): uses libgit2 instead of gitoxide, doesn't rebuild on git changes.
|
||||
- [vergen](https://github.com/rustyhorde/vergen): uses the `git` CLI instead of gitoxide.
|
||||
|
||||
Bosion also requires no dependencies outside of build.rs, and was specifically made for crates
|
||||
installed in a variety of ways, like with `cargo install`, from pre-built binary, from source with
|
||||
git, or from source without git (like a tarball), on a variety of platforms. Its default output with
|
||||
[clap](https://clap.rs) is almost exactly like `rustc -Vv`.
|
||||
|
||||
## Examples
|
||||
|
||||
The [examples](./examples) directory contains a practical and runnable [clap-based example](./examples/clap/), as well
|
||||
as several other crates which are actually used for integration testing.
|
||||
|
||||
Here is the output for the Watchexec CLI:
|
||||
|
||||
```plain
|
||||
watchexec 1.21.1 (5026793 2023-03-05)
|
||||
commit-hash: 5026793a12ff895edf2dafb92111e7bd1767650e
|
||||
commit-date: 2023-03-05
|
||||
build-date: 2023-03-05
|
||||
release: 1.21.1
|
||||
features:
|
||||
```
|
||||
|
||||
For comparison, here's `rustc -Vv`:
|
||||
|
||||
```plain
|
||||
rustc 1.67.1 (d5a82bbd2 2023-02-07)
|
||||
binary: rustc
|
||||
commit-hash: d5a82bbd26e1ad8b7401f6a718a9c57c96905483
|
||||
commit-date: 2023-02-07
|
||||
host: x86_64-unknown-linux-gnu
|
||||
release: 1.67.1
|
||||
LLVM version: 15.0.6
|
||||
```
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,19 @@
|
|||
[package]
|
||||
name = "bosion-example-clap"
|
||||
version = "0.1.0"
|
||||
publish = false
|
||||
edition = "2021"
|
||||
|
||||
[workspace]
|
||||
|
||||
[features]
|
||||
default = ["foo"]
|
||||
foo = []
|
||||
|
||||
[build-dependencies.bosion]
|
||||
version = "*"
|
||||
path = "../.."
|
||||
|
||||
[dependencies.clap]
|
||||
version = "4.1.8"
|
||||
features = ["cargo", "derive"]
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
bosion::gather();
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
use clap::Parser;
|
||||
|
||||
include!(env!("BOSION_PATH"));
|
||||
|
||||
#[derive(Parser)]
|
||||
#[clap(version, long_version = Bosion::LONG_VERSION)]
|
||||
struct Args {
|
||||
#[clap(long)]
|
||||
extras: bool,
|
||||
|
||||
#[clap(long)]
|
||||
features: bool,
|
||||
|
||||
#[clap(long)]
|
||||
dates: bool,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let args = Args::parse();
|
||||
|
||||
if args.extras {
|
||||
println!(
|
||||
"{}",
|
||||
Bosion::long_version_with(&[("extra", "field"), ("custom", "1.2.3"),])
|
||||
);
|
||||
} else
|
||||
|
||||
if args.features {
|
||||
println!("Features: {}", Bosion::CRATE_FEATURE_STRING);
|
||||
} else
|
||||
|
||||
if args.dates {
|
||||
println!("commit date: {}", Bosion::GIT_COMMIT_DATE);
|
||||
println!("commit datetime: {}", Bosion::GIT_COMMIT_DATETIME);
|
||||
println!("build date: {}", Bosion::BUILD_DATE);
|
||||
println!("build datetime: {}", Bosion::BUILD_DATETIME);
|
||||
} else {
|
||||
println!("{}", Bosion::LONG_VERSION);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,20 @@
|
|||
[package]
|
||||
name = "bosion-test-default"
|
||||
version = "0.1.0"
|
||||
publish = false
|
||||
edition = "2021"
|
||||
|
||||
[workspace]
|
||||
|
||||
[features]
|
||||
default = ["foo"]
|
||||
foo = []
|
||||
|
||||
[build-dependencies.bosion]
|
||||
version = "*"
|
||||
path = "../.."
|
||||
|
||||
[dependencies]
|
||||
leon = { version = "0.0.1", default-features = false }
|
||||
snapbox = "0.4.8"
|
||||
time = { version = "0.3.20", features = ["formatting", "macros"] }
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
bosion::gather();
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
#[cfg(test)]
|
||||
pub(crate) fn git_commit_info(format: &str) -> String {
|
||||
let output = std::process::Command::new("git")
|
||||
.arg("show")
|
||||
.arg("--no-notes")
|
||||
.arg("--no-patch")
|
||||
.arg(format!("--pretty=format:{format}"))
|
||||
.output()
|
||||
.expect("git");
|
||||
|
||||
String::from_utf8(output.stdout)
|
||||
.expect("git")
|
||||
.trim()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! test_snapshot {
|
||||
($name:ident, $actual:expr) => {
|
||||
#[cfg(test)]
|
||||
#[test]
|
||||
fn $name() {
|
||||
use std::str::FromStr;
|
||||
let gittime = ::time::OffsetDateTime::from_unix_timestamp(
|
||||
i64::from_str(&crate::common::git_commit_info("%ct")).expect("git i64"),
|
||||
)
|
||||
.expect("git time");
|
||||
|
||||
::snapbox::Assert::new().matches(
|
||||
::leon::Template::parse(
|
||||
std::fs::read_to_string(format!("../snapshots/{}.txt", stringify!($name)))
|
||||
.expect("read file")
|
||||
.trim(),
|
||||
)
|
||||
.expect("leon parse")
|
||||
.render(&[
|
||||
(
|
||||
"today date".to_string(),
|
||||
::time::OffsetDateTime::now_utc()
|
||||
.format(::time::macros::format_description!("[year]-[month]-[day]"))
|
||||
.unwrap(),
|
||||
),
|
||||
("git hash".to_string(), crate::common::git_commit_info("%H")),
|
||||
(
|
||||
"git shorthash".to_string(),
|
||||
crate::common::git_commit_info("%h"),
|
||||
),
|
||||
(
|
||||
"git date".to_string(),
|
||||
gittime
|
||||
.format(::time::macros::format_description!("[year]-[month]-[day]"))
|
||||
.expect("git date format"),
|
||||
),
|
||||
(
|
||||
"git datetime".to_string(),
|
||||
gittime
|
||||
.format(::time::macros::format_description!(
|
||||
"[year]-[month]-[day] [hour]:[minute]:[second]"
|
||||
))
|
||||
.expect("git time format"),
|
||||
),
|
||||
])
|
||||
.expect("leon render"),
|
||||
$actual,
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
include!(env!("BOSION_PATH"));
|
||||
|
||||
mod common;
|
||||
fn main() {}
|
||||
|
||||
test_snapshot!(crate_version, Bosion::CRATE_VERSION);
|
||||
|
||||
test_snapshot!(crate_features, format!("{:#?}", Bosion::CRATE_FEATURES));
|
||||
|
||||
test_snapshot!(build_date, Bosion::BUILD_DATE);
|
||||
|
||||
test_snapshot!(build_datetime, Bosion::BUILD_DATETIME);
|
||||
|
||||
test_snapshot!(git_commit_hash, Bosion::GIT_COMMIT_HASH);
|
||||
|
||||
test_snapshot!(git_commit_shorthash, Bosion::GIT_COMMIT_SHORTHASH);
|
||||
|
||||
test_snapshot!(git_commit_date, Bosion::GIT_COMMIT_DATE);
|
||||
|
||||
test_snapshot!(git_commit_datetime, Bosion::GIT_COMMIT_DATETIME);
|
||||
|
||||
test_snapshot!(default_long_version, Bosion::LONG_VERSION);
|
||||
|
||||
test_snapshot!(
|
||||
default_long_version_with,
|
||||
Bosion::long_version_with(&[("extra", "field"), ("custom", "1.2.3")])
|
||||
);
|
|
@ -0,0 +1,352 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bosion"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bosion-test-no-git"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bosion",
|
||||
"leon",
|
||||
"snapbox",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
||||
|
||||
[[package]]
|
||||
name = "concolor"
|
||||
version = "0.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7b3e3c41e9488eeda196b6806dbf487742107d61b2e16485bcca6c25ed5755b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"concolor-query",
|
||||
"is-terminal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concolor-query"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82a90734b3d5dcf656e7624cca6bce9c3a90ee11f900e80141a7427ccfb3d317"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
|
||||
dependencies = [
|
||||
"errno-dragonfly",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno-dragonfly"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
|
||||
|
||||
[[package]]
|
||||
name = "io-lifetimes"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"io-lifetimes",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
||||
|
||||
[[package]]
|
||||
name = "leon"
|
||||
version = "0.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1afa3794684c32f91a5aa105e5109743bc6f2999a869c28fffa40aeffa30cfd0"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.139"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
|
||||
|
||||
[[package]]
|
||||
name = "normalize-line-endings"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.36.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"io-lifetimes",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.152"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
|
||||
|
||||
[[package]]
|
||||
name = "similar"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf"
|
||||
|
||||
[[package]]
|
||||
name = "snapbox"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4389a6395e9925166f19d67b64874e526ec28a4b8455f3321b686c912299c3ea"
|
||||
dependencies = [
|
||||
"concolor",
|
||||
"normalize-line-endings",
|
||||
"similar",
|
||||
"snapbox-macros",
|
||||
"yansi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snapbox-macros"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "485e65c1203eb37244465e857d15a26d3a85a5410648ccb53b18bd44cb3a7336"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"serde",
|
||||
"time-core",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-core"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36"
|
||||
dependencies = [
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "775c11906edafc97bc378816b94585fbd9a054eabaf86fdd0ced94af449efab7"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
|
||||
|
||||
[[package]]
|
||||
name = "yansi"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
|
|
@ -0,0 +1,22 @@
|
|||
[package]
|
||||
name = "bosion-test-no-git"
|
||||
version = "0.1.0"
|
||||
publish = false
|
||||
edition = "2021"
|
||||
|
||||
[workspace]
|
||||
|
||||
[features]
|
||||
default = ["foo"]
|
||||
foo = []
|
||||
|
||||
[build-dependencies.bosion]
|
||||
version = "*"
|
||||
path = "../.."
|
||||
default-features = false
|
||||
features = ["std"]
|
||||
|
||||
[dependencies]
|
||||
leon = { version = "0.0.1", default-features = false }
|
||||
snapbox = "0.4.8"
|
||||
time = { version = "0.3.20", features = ["formatting", "macros"] }
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
bosion::gather();
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
include!(env!("BOSION_PATH"));
|
||||
|
||||
#[path = "../../default/src/common.rs"]
|
||||
mod common;
|
||||
fn main() {}
|
||||
|
||||
test_snapshot!(crate_version, Bosion::CRATE_VERSION);
|
||||
|
||||
test_snapshot!(crate_features, format!("{:#?}", Bosion::CRATE_FEATURES));
|
||||
|
||||
test_snapshot!(build_date, Bosion::BUILD_DATE);
|
||||
|
||||
test_snapshot!(build_datetime, Bosion::BUILD_DATETIME);
|
||||
|
||||
test_snapshot!(no_git_long_version, Bosion::LONG_VERSION);
|
||||
|
||||
test_snapshot!(
|
||||
no_git_long_version_with,
|
||||
Bosion::long_version_with(&[("extra", "field"), ("custom", "1.2.3")])
|
||||
);
|
|
@ -0,0 +1,352 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bosion"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bosion-test-no-std"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bosion",
|
||||
"leon",
|
||||
"snapbox",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
|
||||
|
||||
[[package]]
|
||||
name = "concolor"
|
||||
version = "0.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7b3e3c41e9488eeda196b6806dbf487742107d61b2e16485bcca6c25ed5755b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"concolor-query",
|
||||
"is-terminal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concolor-query"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "82a90734b3d5dcf656e7624cca6bce9c3a90ee11f900e80141a7427ccfb3d317"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
|
||||
dependencies = [
|
||||
"errno-dragonfly",
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno-dragonfly"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
|
||||
|
||||
[[package]]
|
||||
name = "io-lifetimes"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"io-lifetimes",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6"
|
||||
|
||||
[[package]]
|
||||
name = "leon"
|
||||
version = "0.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1afa3794684c32f91a5aa105e5109743bc6f2999a869c28fffa40aeffa30cfd0"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.139"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
|
||||
|
||||
[[package]]
|
||||
name = "normalize-line-endings"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.51"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.36.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"errno",
|
||||
"io-lifetimes",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.152"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
|
||||
|
||||
[[package]]
|
||||
name = "similar"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf"
|
||||
|
||||
[[package]]
|
||||
name = "snapbox"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4389a6395e9925166f19d67b64874e526ec28a4b8455f3321b686c912299c3ea"
|
||||
dependencies = [
|
||||
"concolor",
|
||||
"normalize-line-endings",
|
||||
"similar",
|
||||
"snapbox-macros",
|
||||
"yansi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "snapbox-macros"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "485e65c1203eb37244465e857d15a26d3a85a5410648ccb53b18bd44cb3a7336"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"serde",
|
||||
"time-core",
|
||||
"time-macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time-core"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
|
||||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36"
|
||||
dependencies = [
|
||||
"time-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "775c11906edafc97bc378816b94585fbd9a054eabaf86fdd0ced94af449efab7"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.42.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
|
||||
|
||||
[[package]]
|
||||
name = "yansi"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
|
|
@ -0,0 +1,27 @@
|
|||
[package]
|
||||
name = "bosion-test-no-std"
|
||||
version = "0.1.0"
|
||||
publish = false
|
||||
edition = "2021"
|
||||
|
||||
[profile.dev]
|
||||
panic = "abort"
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
|
||||
[workspace]
|
||||
|
||||
[features]
|
||||
default = ["foo"]
|
||||
foo = []
|
||||
|
||||
[build-dependencies.bosion]
|
||||
version = "*"
|
||||
path = "../.."
|
||||
default-features = false
|
||||
|
||||
[dependencies]
|
||||
leon = { version = "0.0.1", default-features = false }
|
||||
snapbox = "0.4.8"
|
||||
time = { version = "0.3.20", features = ["formatting", "macros"] }
|
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
bosion::gather();
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
#![cfg_attr(not(test), no_main)]
|
||||
#![cfg_attr(not(test), no_std)]
|
||||
|
||||
#[cfg(not(test))]
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[cfg(not(test))]
|
||||
#[panic_handler]
|
||||
fn panic(_panic: &PanicInfo<'_>) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
include!(env!("BOSION_PATH"));
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "../../default/src/common.rs"]
|
||||
mod common;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
test_snapshot!(crate_version, Bosion::CRATE_VERSION);
|
||||
|
||||
test_snapshot!(crate_features, format!("{:#?}", Bosion::CRATE_FEATURES));
|
||||
|
||||
test_snapshot!(build_date, Bosion::BUILD_DATE);
|
||||
|
||||
test_snapshot!(build_datetime, Bosion::BUILD_DATETIME);
|
||||
|
||||
test_snapshot!(no_git_long_version, Bosion::LONG_VERSION);
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
{today date}
|
|
@ -0,0 +1 @@
|
|||
{today date} [..]
|
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
"default",
|
||||
"foo",
|
||||
]
|
|
@ -0,0 +1 @@
|
|||
0.1.0
|
|
@ -0,0 +1,6 @@
|
|||
0.1.0 ({git shorthash} {git date}) +foo
|
||||
commit-hash: {git hash}
|
||||
commit-date: {git date}
|
||||
build-date: {today date}
|
||||
release: 0.1.0
|
||||
features: default,foo
|
|
@ -0,0 +1,8 @@
|
|||
0.1.0 ({git shorthash} {git date}) +foo
|
||||
commit-hash: {git hash}
|
||||
commit-date: {git date}
|
||||
build-date: {today date}
|
||||
release: 0.1.0
|
||||
features: default,foo
|
||||
extra: field
|
||||
custom: 1.2.3
|
|
@ -0,0 +1 @@
|
|||
{git date}
|
|
@ -0,0 +1 @@
|
|||
{git datetime}
|
|
@ -0,0 +1 @@
|
|||
{git hash}
|
|
@ -0,0 +1 @@
|
|||
{git shorthash}
|
|
@ -0,0 +1,4 @@
|
|||
0.1.0 ({today date}) +foo
|
||||
build-date: {today date}
|
||||
release: 0.1.0
|
||||
features: default,foo
|
|
@ -0,0 +1,6 @@
|
|||
0.1.0 ({today date}) +foo
|
||||
build-date: {today date}
|
||||
release: 0.1.0
|
||||
features: default,foo
|
||||
extra: field
|
||||
custom: 1.2.3
|
|
@ -0,0 +1,17 @@
|
|||
pre-release-commit-message = "release: bosion v{{version}}"
|
||||
tag-prefix = "bosion-"
|
||||
tag-message = "bosion {{version}}"
|
||||
|
||||
[[pre-release-replacements]]
|
||||
file = "CHANGELOG.md"
|
||||
search = "^## Next.*$"
|
||||
replace = "## Next (YYYY-MM-DD)\n\n## v{{version}} ({{date}})"
|
||||
prerelease = true
|
||||
max = 1
|
||||
|
||||
[[pre-release-replacements]]
|
||||
file = "README.md"
|
||||
search = "^bosion = \".*\"$"
|
||||
replace = "bosion = \"{{version}}\""
|
||||
prerelease = true
|
||||
max = 1
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
for test in default no-git no-std; do
|
||||
echo "Testing $test"
|
||||
pushd examples/$test
|
||||
cargo check
|
||||
cargo test
|
||||
popd
|
||||
done
|
|
@ -0,0 +1,168 @@
|
|||
use std::{env::var, path::PathBuf};
|
||||
|
||||
use time::{format_description::FormatItem, macros::format_description, OffsetDateTime};
|
||||
|
||||
/// Gathered build-time information
|
||||
///
|
||||
/// This struct contains all the information gathered by `bosion`. It is not meant to be used
|
||||
/// directly under normal circumstances, but is public for documentation purposes and if you wish
|
||||
/// to build your own frontend for whatever reason. In that case, note that no effort has been made
|
||||
/// to make this usable outside of the build.rs environment.
|
||||
///
|
||||
/// The `git` field is only available when the `git` feature is enabled, and if there is a git
|
||||
/// repository to read from. The repository is discovered by walking up the directory tree until one
|
||||
/// is found, which means workspaces or more complex monorepos are automatically supported. If there
|
||||
/// are any errors reading the repository, the `git` field will be `None` and a rustc warning will
|
||||
/// be printed.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Info {
|
||||
/// The crate version, as read from the `CARGO_PKG_VERSION` environment variable.
|
||||
pub crate_version: String,
|
||||
|
||||
/// The crate features, as found by the presence of `CARGO_FEATURE_*` environment variables.
|
||||
///
|
||||
/// These are normalised to lowercase and have underscores replaced by hyphens.
|
||||
pub crate_features: Vec<String>,
|
||||
|
||||
/// The build date, in the format `YYYY-MM-DD`, at UTC.
|
||||
///
|
||||
/// This is either current as of build time, or from the timestamp specified by the
|
||||
/// `SOURCE_DATE_EPOCH` environment variable, for
|
||||
/// [reproducible builds](https://reproducible-builds.org/).
|
||||
pub build_date: String,
|
||||
|
||||
/// The build datetime, in the format `YYYY-MM-DD HH:MM:SS`, at UTC.
|
||||
///
|
||||
/// This is either current as of build time, or from the timestamp specified by the
|
||||
/// `SOURCE_DATE_EPOCH` environment variable, for
|
||||
/// [reproducible builds](https://reproducible-builds.org/).
|
||||
pub build_datetime: String,
|
||||
|
||||
/// Git repository information, if available.
|
||||
pub git: Option<GitInfo>,
|
||||
}
|
||||
|
||||
trait ErrString<T> {
|
||||
fn err_string(self) -> Result<T, String>;
|
||||
}
|
||||
|
||||
impl<T, E> ErrString<T> for Result<T, E>
|
||||
where
|
||||
E: std::fmt::Display,
|
||||
{
|
||||
fn err_string(self) -> Result<T, String> {
|
||||
self.map_err(|e| e.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
const DATE_FORMAT: &[FormatItem<'static>] = format_description!("[year]-[month]-[day]");
|
||||
const DATETIME_FORMAT: &[FormatItem<'static>] =
|
||||
format_description!("[year]-[month]-[day] [hour]:[minute]:[second]");
|
||||
|
||||
impl Info {
|
||||
/// Gathers build-time information
|
||||
///
|
||||
/// This is not meant to be used directly under normal circumstances, but is public if you wish
|
||||
/// to build your own frontend for whatever reason. In that case, note that no effort has been
|
||||
/// made to make this usable outside of the build.rs environment.
|
||||
pub fn gather() -> Result<Self, String> {
|
||||
let build_date = Self::build_date()?;
|
||||
|
||||
Ok(Self {
|
||||
crate_version: var("CARGO_PKG_VERSION").err_string()?,
|
||||
crate_features: Self::features(),
|
||||
build_date: build_date.format(DATE_FORMAT).err_string()?,
|
||||
build_datetime: build_date.format(DATETIME_FORMAT).err_string()?,
|
||||
|
||||
#[cfg(feature = "git")]
|
||||
git: GitInfo::gather()
|
||||
.map_err(|e| {
|
||||
println!("cargo:warning=git info gathering failed: {}", e);
|
||||
})
|
||||
.ok(),
|
||||
#[cfg(not(feature = "git"))]
|
||||
git: None,
|
||||
})
|
||||
}
|
||||
|
||||
fn build_date() -> Result<OffsetDateTime, String> {
|
||||
if cfg!(feature = "reproducible") {
|
||||
if let Ok(date) = var("SOURCE_DATE_EPOCH") {
|
||||
if let Ok(date) = date.parse::<i64>() {
|
||||
return OffsetDateTime::from_unix_timestamp(date).err_string();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(OffsetDateTime::now_utc())
|
||||
}
|
||||
|
||||
fn features() -> Vec<String> {
|
||||
let mut features = Vec::new();
|
||||
|
||||
for (key, _) in std::env::vars() {
|
||||
if let Some(stripped) = key.strip_prefix("CARGO_FEATURE_") {
|
||||
features.push(stripped.replace('_', "-").to_lowercase().to_string());
|
||||
}
|
||||
}
|
||||
|
||||
features
|
||||
}
|
||||
|
||||
pub(crate) fn set_reruns(&self) {
|
||||
if cfg!(feature = "reproducible") {
|
||||
println!("cargo:rerun-if-env-changed=SOURCE_DATE_EPOCH");
|
||||
}
|
||||
|
||||
if let Some(git) = &self.git {
|
||||
let git_head = git.git_root.join("HEAD");
|
||||
println!("cargo:rerun-if-changed={}", git_head.display());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Git repository information
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct GitInfo {
|
||||
/// The absolute path to the git repository's data folder.
|
||||
///
|
||||
/// In a normal repository, this is `.git`, _not_ the index or working directory.
|
||||
pub git_root: PathBuf,
|
||||
|
||||
/// The full hash of the current commit.
|
||||
///
|
||||
/// Note that this makes no effore to handle dirty working directories, so it may not be
|
||||
/// representative of the current state of the code.
|
||||
pub git_hash: String,
|
||||
|
||||
/// The short hash of the current commit.
|
||||
///
|
||||
/// This is read from git and not truncated manually, so it may be longer than 7 characters.
|
||||
pub git_shorthash: String,
|
||||
|
||||
/// The date of the current commit, in the format `YYYY-MM-DD`, at UTC.
|
||||
pub git_date: String,
|
||||
|
||||
/// The datetime of the current commit, in the format `YYYY-MM-DD HH:MM:SS`, at UTC.
|
||||
pub git_datetime: String,
|
||||
}
|
||||
|
||||
#[cfg(feature = "git")]
|
||||
impl GitInfo {
|
||||
fn gather() -> Result<Self, String> {
|
||||
let (path, _) = gix::discover::upwards(".").err_string()?;
|
||||
let repo = gix::discover(path).err_string()?;
|
||||
let head = repo.head_commit().err_string()?;
|
||||
let time = head.time().err_string()?;
|
||||
let timestamp =
|
||||
OffsetDateTime::from_unix_timestamp(time.seconds_since_unix_epoch as _).err_string()?;
|
||||
|
||||
Ok(Self {
|
||||
git_root: repo.path().canonicalize().err_string()?,
|
||||
git_hash: head.id().to_string(),
|
||||
git_shorthash: head.short_id().err_string()?.to_string(),
|
||||
git_date: timestamp.format(DATE_FORMAT).err_string()?,
|
||||
git_datetime: timestamp.format(DATETIME_FORMAT).err_string()?,
|
||||
})
|
||||
}
|
||||
}
|
|
@ -0,0 +1,256 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
|
||||
use std::{env::var, fs::File, io::Write, path::PathBuf};
|
||||
|
||||
pub use info::*;
|
||||
mod info;
|
||||
|
||||
/// Gather build-time information for the current crate
|
||||
///
|
||||
/// See the crate-level documentation for a guide. This function is a convenience wrapper around
|
||||
/// [`gather_to`] with the most common defaults: it writes to `bosion.rs` a pub(crate) struct named
|
||||
/// `Bosion`.
|
||||
pub fn gather() {
|
||||
gather_to("bosion.rs", "Bosion", false);
|
||||
}
|
||||
|
||||
/// Gather build-time information for the current crate (public visibility)
|
||||
///
|
||||
/// See the crate-level documentation for a guide. This function is a convenience wrapper around
|
||||
/// [`gather_to`]: it writes to `bosion.rs` a pub struct named `Bosion`.
|
||||
pub fn gather_pub() {
|
||||
gather_to("bosion.rs", "Bosion", true);
|
||||
}
|
||||
|
||||
/// Gather build-time information for the current crate (custom output)
|
||||
///
|
||||
/// Gathers a limited set of build-time information for the current crate and writes it to a file.
|
||||
/// The file is always written to the `OUT_DIR` directory, as per Cargo conventions. It contains a
|
||||
/// zero-size struct with a bunch of associated constants containing the gathered information, and a
|
||||
/// `long_version_with` function (when the `std` feature is enabled) that takes a slice of extra
|
||||
/// key-value pairs to append in the same format.
|
||||
///
|
||||
/// `public` controls whether the struct is `pub` (true) or `pub(crate)` (false).
|
||||
///
|
||||
/// The generated code is entirely documented, and will appear in your documentation (in docs.rs, it
|
||||
/// only will if visibility is public).
|
||||
///
|
||||
/// See [`Info`] for a list of gathered data.
|
||||
///
|
||||
/// The constants include all the information from [`Info`], as well as the following:
|
||||
///
|
||||
/// - `LONG_VERSION`: A clap-ready long version string, including the crate version, features, build
|
||||
/// date, and git information when available.
|
||||
/// - `CRATE_FEATURE_STRING`: A string containing the crate features, in the format `+feat1 +feat2`.
|
||||
///
|
||||
/// We also instruct rustc to rerun the build script if the environment changes, as necessary.
|
||||
pub fn gather_to(filename: &str, structname: &str, public: bool) {
|
||||
let path = PathBuf::from(var("OUT_DIR").expect("bosion")).join(filename);
|
||||
println!("cargo:rustc-env=BOSION_PATH={}", path.display());
|
||||
|
||||
let info = Info::gather().expect("bosion");
|
||||
info.set_reruns();
|
||||
let Info {
|
||||
crate_version,
|
||||
crate_features,
|
||||
build_date,
|
||||
build_datetime,
|
||||
git,
|
||||
} = info;
|
||||
|
||||
let crate_feature_string = crate_features
|
||||
.iter()
|
||||
.filter(|feat| *feat != "default")
|
||||
.map(|feat| format!("+{feat}"))
|
||||
.collect::<Vec<_>>()
|
||||
.join(" ");
|
||||
|
||||
let crate_feature_list = crate_features
|
||||
.join(",");
|
||||
|
||||
let viz = if public { "pub" } else { "pub(crate)" };
|
||||
|
||||
let (git_render, long_version) = if let Some(GitInfo {
|
||||
git_hash,
|
||||
git_shorthash,
|
||||
git_date,
|
||||
git_datetime,
|
||||
..
|
||||
}) = git
|
||||
{
|
||||
(format!(
|
||||
"
|
||||
/// The git commit hash
|
||||
///
|
||||
/// This is the full hash of the commit that was built. Note that if the repository was
|
||||
/// dirty, this will be the hash of the last commit, not including the changes.
|
||||
pub const GIT_COMMIT_HASH: &'static str = {git_hash:?};
|
||||
|
||||
/// The git commit hash, shortened
|
||||
///
|
||||
/// This is the shortened hash of the commit that was built. Same caveats as with
|
||||
/// `GIT_COMMIT_HASH` apply. The length of the hash is as short as possible while still
|
||||
/// being unambiguous, at build time. For large repositories, this may be longer than 7
|
||||
/// characters.
|
||||
pub const GIT_COMMIT_SHORTHASH: &'static str = {git_shorthash:?};
|
||||
|
||||
/// The git commit date
|
||||
///
|
||||
/// This is the date (`YYYY-MM-DD`) of the commit that was built. Same caveats as with
|
||||
/// `GIT_COMMIT_HASH` apply.
|
||||
pub const GIT_COMMIT_DATE: &'static str = {git_date:?};
|
||||
|
||||
/// The git commit date and time
|
||||
///
|
||||
/// This is the date and time (`YYYY-MM-DD HH:MM:SS`) of the commit that was built. Same
|
||||
/// caveats as with `GIT_COMMIT_HASH` apply.
|
||||
pub const GIT_COMMIT_DATETIME: &'static str = {git_datetime:?};
|
||||
"
|
||||
), format!("{crate_version} ({git_shorthash} {git_date}) {crate_feature_string}\ncommit-hash: {git_hash}\ncommit-date: {git_date}\nbuild-date: {build_date}\nrelease: {crate_version}\nfeatures: {crate_feature_list}"))
|
||||
} else {
|
||||
("".to_string(), format!("{crate_version} ({build_date}) {crate_feature_string}\nbuild-date: {build_date}\nrelease: {crate_version}\nfeatures: {crate_feature_list}"))
|
||||
};
|
||||
|
||||
#[cfg(all(feature = "std"))]
|
||||
let long_version_with_fn = r#"
|
||||
/// Returns the long version string with extra information tacked on
|
||||
///
|
||||
/// This is the same as `LONG_VERSION` but takes a slice of key-value pairs to append to the
|
||||
/// end in the same format.
|
||||
pub fn long_version_with(extra: &[(&str, &str)]) -> String {
|
||||
let mut output = Self::LONG_VERSION.to_string();
|
||||
|
||||
for (k, v) in extra {
|
||||
output.push_str(&format!("\n{}: {}", k, v));
|
||||
}
|
||||
|
||||
output
|
||||
}
|
||||
"#;
|
||||
#[cfg(not(feature = "std"))]
|
||||
let long_version_with_fn = "";
|
||||
|
||||
let bosion_version = env!("CARGO_PKG_VERSION");
|
||||
let render = format!(
|
||||
r#"
|
||||
/// Build-time information
|
||||
///
|
||||
/// This struct is generated by the [bosion](https://docs.rs/bosion) crate at build time.
|
||||
///
|
||||
/// Bosion version: {bosion_version}
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
{viz} struct {structname};
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl {structname} {{
|
||||
/// Clap-compatible long version string
|
||||
///
|
||||
/// At minimum, this will be the crate version and build date.
|
||||
///
|
||||
/// It presents as a first "summary" line like `crate_version (build_date) features`,
|
||||
/// followed by `key: value` pairs. This is the same format used by `rustc -Vv`.
|
||||
///
|
||||
/// If git info is available, it also includes the git hash, short hash and commit date,
|
||||
/// and swaps the build date for the commit date in the summary line.
|
||||
pub const LONG_VERSION: &'static str = {long_version:?};
|
||||
|
||||
/// The crate version, as reported by Cargo
|
||||
///
|
||||
/// You should probably prefer reading the `CARGO_PKG_VERSION` environment variable.
|
||||
pub const CRATE_VERSION: &'static str = {crate_version:?};
|
||||
|
||||
/// The crate features
|
||||
///
|
||||
/// This is a list of the features that were enabled when this crate was built,
|
||||
/// lowercased and with underscores replaced by hyphens.
|
||||
pub const CRATE_FEATURES: &'static [&'static str] = &{crate_features:?};
|
||||
|
||||
/// The crate features, as a string
|
||||
///
|
||||
/// This is in format `+feature +feature2 +feature3`, lowercased with underscores
|
||||
/// replaced by hyphens.
|
||||
pub const CRATE_FEATURE_STRING: &'static str = {crate_feature_string:?};
|
||||
|
||||
/// The build date
|
||||
///
|
||||
/// This is the date that the crate was built, in the format `YYYY-MM-DD`. If the
|
||||
/// environment variable `SOURCE_DATE_EPOCH` was set, it's used instead of the current
|
||||
/// time, for [reproducible builds](https://reproducible-builds.org/).
|
||||
pub const BUILD_DATE: &'static str = {build_date:?};
|
||||
|
||||
/// The build datetime
|
||||
///
|
||||
/// This is the date and time that the crate was built, in the format
|
||||
/// `YYYY-MM-DD HH:MM:SS`. If the environment variable `SOURCE_DATE_EPOCH` was set, it's
|
||||
/// used instead of the current time, for
|
||||
/// [reproducible builds](https://reproducible-builds.org/).
|
||||
pub const BUILD_DATETIME: &'static str = {build_datetime:?};
|
||||
|
||||
{git_render}
|
||||
|
||||
{long_version_with_fn}
|
||||
}}
|
||||
"#
|
||||
);
|
||||
|
||||
let mut file = File::create(path).expect("bosion");
|
||||
file.write_all(render.as_bytes()).expect("bosion");
|
||||
}
|
||||
|
||||
/// Gather build-time information and write it to the environment
|
||||
///
|
||||
/// See the crate-level documentation for a guide. This function is a convenience wrapper around
|
||||
/// [`gather_to_env_with_prefix`] with the most common default prefix of `BOSION_`.
|
||||
pub fn gather_to_env() {
|
||||
gather_to_env_with_prefix("BOSION_");
|
||||
}
|
||||
|
||||
/// Gather build-time information and write it to the environment
|
||||
///
|
||||
/// Gathers a limited set of build-time information for the current crate and makes it available to
|
||||
/// the crate as build environment variables. This is an alternative to [`include!`]ing a file which
|
||||
/// is generated at build time, like for [`gather`] and variants, which doesn't create any new code
|
||||
/// and doesn't include any information in the binary that you do not explicitly use.
|
||||
///
|
||||
/// The environment variables are prefixed with the given string, which should be generally be
|
||||
/// uppercase and end with an underscore.
|
||||
///
|
||||
/// See [`Info`] for a list of gathered data.
|
||||
///
|
||||
/// Unlike [`gather`], there is no Clap-ready `LONG_VERSION` string, but you can of course generate
|
||||
/// one yourself from the environment variables.
|
||||
///
|
||||
/// We also instruct rustc to rerun the build script if the environment changes, as necessary.
|
||||
pub fn gather_to_env_with_prefix(prefix: &str) {
|
||||
let info = Info::gather().expect("bosion");
|
||||
info.set_reruns();
|
||||
let Info {
|
||||
crate_version,
|
||||
crate_features,
|
||||
build_date,
|
||||
build_datetime,
|
||||
git,
|
||||
} = info;
|
||||
|
||||
println!("cargo:rustc-env={prefix}CRATE_VERSION={crate_version}");
|
||||
println!(
|
||||
"cargo:rustc-env={prefix}CRATE_FEATURES={}",
|
||||
crate_features.join(",")
|
||||
);
|
||||
println!("cargo:rustc-env={prefix}BUILD_DATE={build_date}");
|
||||
println!("cargo:rustc-env={prefix}BUILD_DATETIME={build_datetime}");
|
||||
|
||||
if let Some(GitInfo {
|
||||
git_hash,
|
||||
git_shorthash,
|
||||
git_date,
|
||||
git_datetime,
|
||||
..
|
||||
}) = git
|
||||
{
|
||||
println!("cargo:rustc-env={prefix}GIT_COMMIT_HASH={git_hash}");
|
||||
println!("cargo:rustc-env={prefix}GIT_COMMIT_SHORTHASH={git_shorthash}");
|
||||
println!("cargo:rustc-env={prefix}GIT_COMMIT_DATE={git_date}");
|
||||
println!("cargo:rustc-env={prefix}GIT_COMMIT_DATETIME={git_datetime}");
|
||||
}
|
||||
}
|
|
@ -89,6 +89,10 @@ shadow-rs = "0.21.0"
|
|||
[build-dependencies]
|
||||
embed-resource = "1.6.1"
|
||||
|
||||
[build-dependencies.bosion]
|
||||
version = "0.0.0"
|
||||
path = "../bosion"
|
||||
|
||||
[features]
|
||||
## For debugging only: enables the Tokio Console.
|
||||
dev-console = ["console-subscriber"]
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
fn main() {
|
||||
embed_resource::compile("watchexec-manifest.rc");
|
||||
#[cfg(target_os = "linux")]
|
||||
shadow_rs::new().unwrap();
|
||||
bosion::gather();
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ const OPTSET_FILTERING: &str = "Filtering";
|
|||
const OPTSET_COMMAND: &str = "Command";
|
||||
const OPTSET_DEBUGGING: &str = "Debugging";
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
shadow_rs::shadow!(build);
|
||||
include!(env!("BOSION_PATH"));
|
||||
|
||||
/// Execute commands when watched files change.
|
||||
///
|
||||
|
@ -45,10 +44,10 @@ shadow_rs::shadow!(build);
|
|||
bin_name = "watchexec",
|
||||
author,
|
||||
version,
|
||||
long_version = Bosion::LONG_VERSION,
|
||||
after_help = "Use @argfile as first argument to load arguments from the file 'argfile' (one argument per line) which will be inserted in place of the @argfile (further arguments on the CLI will override or add onto those in the file).",
|
||||
hide_possible_values = true
|
||||
hide_possible_values = true,
|
||||
)]
|
||||
#[cfg_attr(target_os = "linux", command(long_version = build::CLAP_LONG_VERSION,))]
|
||||
#[cfg_attr(debug_assertions, command(before_help = "⚠ DEBUG BUILD ⚠"))]
|
||||
#[cfg_attr(
|
||||
feature = "dev-console",
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue