From 98b44a385162203290af5b1294781a91ce9ad6c6 Mon Sep 17 00:00:00 2001 From: FroVolod Date: Thu, 5 Sep 2024 09:46:14 +0300 Subject: [PATCH 1/2] start --- Cargo.lock | 388 ++++++++++-------- cargo-near-build/Cargo.toml | 2 +- cargo-near-build/src/cargo_native/compile.rs | 4 +- cargo-near-build/src/cargo_native/target.rs | 8 +- cargo-near-build/src/env_keys.rs | 4 +- .../src/near/abi/generate/dylib.rs | 4 +- cargo-near-build/src/near/build/export.rs | 2 +- .../src/near/docker_build/subprocess_step.rs | 4 +- cargo-near-build/src/types/cargo/metadata.rs | 8 +- .../types/near/docker_build/cloned_repo.rs | 2 +- .../types/near/docker_build/crate_in_repo.rs | 2 +- cargo-near/Cargo.toml | 7 +- cargo-near/src/main.rs | 45 +- cargo-near/src/types/mod.rs | 1 + cargo-near/src/types/my_formatter.rs | 56 +++ 15 files changed, 307 insertions(+), 230 deletions(-) create mode 100644 cargo-near/src/types/my_formatter.rs diff --git a/Cargo.lock b/Cargo.lock index ea34af08..6d679a64 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,6 +27,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aes" version = "0.8.4" @@ -136,9 +142,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "10f00e1f6e58a40e807377c75c6a7f97bf9044fab57816f2414e6f5f4499d7b8" [[package]] name = "arbitrary" @@ -157,19 +163,19 @@ checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-trait" -version = "0.1.81" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -194,7 +200,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] @@ -325,7 +331,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", "syn_derive", ] @@ -435,9 +441,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.7" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -451,12 +457,12 @@ dependencies = [ "color-eyre", "colored", "derive_more", - "env_logger", + "indenter", + "indicatif", "inquire", "interactive-clap", "interactive-clap-derive", "linked-hash-map", - "log", "names", "near-cli-rs", "reqwest", @@ -466,6 +472,9 @@ dependencies = [ "strum_macros", "tokio", "tracing", + "tracing-core", + "tracing-indicatif", + "tracing-subscriber", "tracing-test", ] @@ -483,7 +492,6 @@ dependencies = [ "hex", "home", "libloading", - "log", "near-abi", "nix", "pathdiff", @@ -494,6 +502,7 @@ dependencies = [ "sha2 0.10.8", "symbolic-debuginfo", "tempfile", + "tracing", "unix_path", "url", "zstd 0.13.2", @@ -539,11 +548,11 @@ dependencies = [ "log", "minifier", "near-workspaces", - "prettyplease 0.2.20", + "prettyplease 0.2.22", "quote", "schemars", "serde_json", - "syn 2.0.74", + "syn 2.0.77", "tempfile", "tokio", "zstd 0.13.2", @@ -560,9 +569,9 @@ dependencies = [ [[package]] name = "cargo-util" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14104698cb1694d43c2ff73492468ccf2bb0b047071a9838d999eeba9e984ffa" +checksum = "cc680c90073156fb5280c0c0127b779eef1f6292e41f7d6621acba3041e81c7d" dependencies = [ "anyhow", "core-foundation", @@ -597,9 +606,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.12" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68064e60dbf1f17005c2fde4d07c16d8baa506fd7ffed8ccab702d93617975c7" +checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" dependencies = [ "jobserver", "libc", @@ -645,9 +654,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.15" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d8838454fda655dafd3accb2b6e2bea645b9e4078abe84a22ceb947235c5cc" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", "clap_derive", @@ -655,9 +664,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstream", "anstyle", @@ -674,7 +683,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -741,18 +750,18 @@ dependencies = [ [[package]] name = "const_format" -version = "0.2.32" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a214c7af3d04997541b18d432afaff4c455e79e2029079647e72fc2bd27673" +checksum = "50c655d81ff1114fb0dcdea9225ea9f0cc712a6f8d189378e82bdf62a473a64b" dependencies = [ "const_format_proc_macros", ] [[package]] name = "const_format_proc_macros" -version = "0.2.32" +version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f6ff08fd20f4f299298a28e2dfa8a8ba1036e6cd2460ac1de7b425d76f2500" +checksum = "eff1a44b93f47b1bac19a27932f5c591e43d1ba357ee4f61526c8a25603f0eb1" dependencies = [ "proc-macro2", "quote", @@ -795,9 +804,9 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -932,7 +941,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -956,7 +965,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -967,7 +976,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -1022,7 +1031,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -1035,7 +1044,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -1206,7 +1215,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -1266,9 +1275,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "fiat-crypto" @@ -1278,9 +1287,9 @@ checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "filetime" -version = "0.2.24" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf401df4a4e3872c4fe8151134cf483738e74b67fc934d6532c882b3d24a4550" +checksum = "35c0522e981e68cbfa8c3f978441a5f34b30b96e146b33cd3359176b50fe8586" dependencies = [ "cfg-if", "libc", @@ -1299,12 +1308,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.31" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.0", ] [[package]] @@ -1433,7 +1442,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -1538,9 +1547,9 @@ dependencies = [ [[package]] name = "globset" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" dependencies = [ "aho-corasick", "bstr", @@ -1562,9 +1571,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ "atomic-waker", "bytes", @@ -1572,7 +1581,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.4.0", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -1740,9 +1749,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" dependencies = [ "futures-util", "http", @@ -1773,9 +1782,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" dependencies = [ "bytes", "futures-channel", @@ -1832,9 +1841,9 @@ dependencies = [ [[package]] name = "ignore" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +checksum = "6d89fd380afde86567dfba715db065673989d6253f42b88179abd3eae47bda4b" dependencies = [ "crossbeam-deque", "globset", @@ -1871,9 +1880,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -1954,9 +1963,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" [[package]] name = "is-docker" @@ -2082,15 +2091,15 @@ dependencies = [ [[package]] name = "keyring" -version = "3.0.5" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c163ef0b9da5ccf44ae4d7c9d24fb1a8750aa1969d484865fc1eedc44b26c09" +checksum = "030a9b84bb2a2f3673d4c8b8236091ed5d8f6b66a56d8085471d8abd5f3c6a80" dependencies = [ "byteorder", "dbus-secret-service", "openssl", "security-framework", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2144,9 +2153,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libdbus-sys" @@ -2209,9 +2218,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.19" +version = "1.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" +checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" dependencies = [ "cc", "libc", @@ -2282,9 +2291,12 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "minifier" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95bbbf96b9ac3482c2a25450b67a15ed851319bc5fabf3b40742ea9066e84282" +checksum = "9aa3f302fe0f8de065d4a2d1ed64f60204623cac58b80cd3c2a83a25d5a7d437" +dependencies = [ + "clap", +] [[package]] name = "minimal-lexical" @@ -2301,6 +2313,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" version = "0.8.11" @@ -2707,7 +2728,7 @@ checksum = "72469e7c06bf99bb7e9d5a66438c008d3b85c8c5d8f36d8c31b35968f6f599d4" dependencies = [ "quote", "serde", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -2718,7 +2739,7 @@ checksum = "bb0bd52b705619ceb5d5ea9171ecf44f00513101c903928474eca957d07f3fdb" dependencies = [ "near-rpc-error-core", "serde", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -3095,7 +3116,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -3106,9 +3127,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.3.1+3.3.1" +version = "300.3.2+3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" +checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" dependencies = [ "cc", ] @@ -3254,7 +3275,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -3320,12 +3341,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.20" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" dependencies = [ "proc-macro2", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -3354,11 +3375,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_edit 0.21.1", + "toml_edit", ] [[package]] @@ -3416,9 +3437,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -3472,9 +3493,9 @@ dependencies = [ [[package]] name = "redox_users" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", @@ -3536,9 +3557,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.5" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ "base64 0.22.1", "bytes", @@ -3575,7 +3596,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", + "windows-registry", ] [[package]] @@ -3595,9 +3616,9 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" dependencies = [ "bitvec", "bytecheck", @@ -3613,9 +3634,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" dependencies = [ "proc-macro2", "quote", @@ -3624,9 +3645,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.35.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1790d1c4c0ca81211399e0e0af16333276f375209e71a37b67698a373db5b47a" +checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" dependencies = [ "arrayvec", "borsh", @@ -3646,18 +3667,18 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.6.0", "errno", @@ -3668,9 +3689,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.12" +version = "0.23.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" dependencies = [ "log", "once_cell", @@ -3699,9 +3720,9 @@ checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" [[package]] name = "rustls-webpki" -version = "0.102.6" +version = "0.102.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" dependencies = [ "ring", "rustls-pki-types", @@ -3731,11 +3752,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3759,7 +3780,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -3791,7 +3812,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -3853,22 +3874,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.207" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5665e14a49a4ea1b91029ba7d3bca9f299e1f7cfa194388ccc20f14743e784f2" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.207" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aea2634c86b0e8ef2cfdc0c340baede54ec27b1e46febd7f80dffb2aa44a00e" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -3879,14 +3900,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.125" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -3902,7 +3923,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -3936,7 +3957,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.4.0", + "indexmap 2.5.0", "serde", "serde_derive", "serde_json", @@ -3953,7 +3974,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -3962,7 +3983,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "itoa", "ryu", "serde", @@ -4143,7 +4164,7 @@ checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -4170,7 +4191,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -4304,9 +4325,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.74" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -4322,7 +4343,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -4330,23 +4351,26 @@ name = "sync_wrapper" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", @@ -4421,7 +4445,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -4482,9 +4506,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.2" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", @@ -4506,7 +4530,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -4543,9 +4567,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.11" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", @@ -4563,7 +4587,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.20", + "toml_edit", ] [[package]] @@ -4575,28 +4599,17 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap 2.4.0", - "toml_datetime", - "winnow 0.5.40", -] - [[package]] name = "toml_edit" version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.4.0", + "indexmap 2.5.0", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.18", + "winnow", ] [[package]] @@ -4645,7 +4658,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -4727,7 +4740,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" dependencies = [ "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] @@ -4762,9 +4775,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-linebreak" @@ -4795,9 +4808,9 @@ checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "unix_path" @@ -4980,7 +4993,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", "wasm-bindgen-shared", ] @@ -5014,7 +5027,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5040,7 +5053,7 @@ dependencies = [ "ahash 0.8.11", "bitflags 2.6.0", "hashbrown 0.14.5", - "indexmap 2.4.0", + "indexmap 2.5.0", "semver", "serde", ] @@ -5057,9 +5070,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.3" +version = "0.26.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" +checksum = "0bd24728e5af82c6c4ec1b66ac4844bdf8156257fccda846ec58b42cd0cdbe6a" dependencies = [ "rustls-pki-types", ] @@ -5104,6 +5117,36 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -5252,15 +5295,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - [[package]] name = "winnow" version = "0.6.18" @@ -5270,16 +5304,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "wyz" version = "0.5.1" @@ -5302,9 +5326,9 @@ dependencies = [ [[package]] name = "xml-rs" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a77ee7c0de333dcc6da69b177380a0b81e0dacfa4f7344c465a36871ee601" +checksum = "af4e2e2f7cba5a093896c1e150fbfe177d1883e7448200efb81d40b9d339ef26" [[package]] name = "zerocopy" @@ -5324,7 +5348,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.74", + "syn 2.0.77", ] [[package]] diff --git a/cargo-near-build/Cargo.toml b/cargo-near-build/Cargo.toml index 57c07331..1f4df455 100644 --- a/cargo-near-build/Cargo.toml +++ b/cargo-near-build/Cargo.toml @@ -11,7 +11,7 @@ eyre = "0.6.12" camino = "1.1.1" colored = "2.0" dunce = "1" -log = "0.4" +tracing = "0.1.40" bs58 = "0.5" hex = "0.4.3" sha2 = "0.10" diff --git a/cargo-near-build/src/cargo_native/compile.rs b/cargo-near-build/src/cargo_native/compile.rs index 8474fc6a..66d21771 100644 --- a/cargo-near-build/src/cargo_native/compile.rs +++ b/cargo-near-build/src/cargo_native/compile.rs @@ -121,7 +121,7 @@ where if let Some(path) = working_dir { let path = crate::fs::force_canonicalize_dir(path.as_ref())?; - log::debug!("Setting cargo working dir to '{}'", path); + tracing::debug!("Setting cargo working dir to '{}'", path); cmd.current_dir(path); } @@ -134,7 +134,7 @@ where ColorPreference::Never => cmd.args(["--color", "never"]), }; - log::info!("Invoking cargo: {:?}", cmd); + tracing::info!("Invoking cargo: {:?}", cmd); let mut child = cmd // capture the stdout to return from this function as bytes diff --git a/cargo-near-build/src/cargo_native/target.rs b/cargo-near-build/src/cargo_native/target.rs index 4d990441..08fa2509 100644 --- a/cargo-near-build/src/cargo_native/target.rs +++ b/cargo-near-build/src/cargo_native/target.rs @@ -10,13 +10,13 @@ pub fn wasm32_exists() -> bool { match result { Ok(wasm32_target_libdir_path) => { if wasm32_target_libdir_path.exists() { - log::info!( + tracing::info!( "Found {COMPILATION_TARGET} in {:?}", wasm32_target_libdir_path ); true } else { - log::info!( + tracing::info!( "Failed to find {COMPILATION_TARGET} in {:?}", wasm32_target_libdir_path ); @@ -24,7 +24,7 @@ pub fn wasm32_exists() -> bool { } } Err(_) => { - log::error!("Some error in getting the target libdir, trying rustup.."); + tracing::error!("Some error in getting the target libdir, trying rustup.."); invoke_rustup(["target", "list", "--installed"]) .map(|stdout| { @@ -62,7 +62,7 @@ where let mut cmd = Command::new(rustup); cmd.args(args); - log::info!("Invoking rustup: {:?}", cmd); + tracing::info!("Invoking rustup: {:?}", cmd); let child = cmd .stdout(std::process::Stdio::piped()) diff --git a/cargo-near-build/src/env_keys.rs b/cargo-near-build/src/env_keys.rs index b6845cd5..a925758a 100644 --- a/cargo-near-build/src/env_keys.rs +++ b/cargo-near-build/src/env_keys.rs @@ -31,7 +31,7 @@ pub mod nep330 { } pub(crate) fn print_env() { - log::info!("Variables, relevant for reproducible builds:"); + tracing::info!("Variables, relevant for reproducible builds:"); for key in [ BUILD_ENVIRONMENT, BUILD_COMMAND, @@ -41,7 +41,7 @@ pub mod nep330 { let value = std::env::var(key) .map(|val| format!("'{}'", val)) .unwrap_or("unset".to_string()); - log::info!("{}={}", key, value); + tracing::info!("{}={}", key, value); } } } diff --git a/cargo-near-build/src/near/abi/generate/dylib.rs b/cargo-near-build/src/near/abi/generate/dylib.rs index 41fafebe..9b161c3e 100644 --- a/cargo-near-build/src/near/abi/generate/dylib.rs +++ b/cargo-near-build/src/near/abi/generate/dylib.rs @@ -12,7 +12,7 @@ pub fn extract_abi_entries( let dylib_path: &Utf8Path = &artifact.path; let dylib_file_contents = fs::read(dylib_path)?; let object = symbolic_debuginfo::Object::parse(&dylib_file_contents)?; - log::debug!( + tracing::debug!( "A dylib was built at {:?} with format {} for architecture {}", &dylib_path, &object.file_format(), @@ -26,7 +26,7 @@ pub fn extract_abi_entries( if near_abi_symbols.is_empty() { eyre::bail!("No NEAR ABI symbols found in the dylib"); } - log::debug!("Detected NEAR ABI symbols: {:?}", &near_abi_symbols); + tracing::debug!("Detected NEAR ABI symbols: {:?}", &near_abi_symbols); let mut entries = vec![]; unsafe { diff --git a/cargo-near-build/src/near/build/export.rs b/cargo-near-build/src/near/build/export.rs index 46991b5c..8362bcf3 100644 --- a/cargo-near-build/src/near/build/export.rs +++ b/cargo-near-build/src/near/build/export.rs @@ -1,7 +1,7 @@ use crate::{env_keys, types::near::build::input::Opts}; pub fn nep_330_build_command(args: &Opts) -> eyre::Result<()> { - log::debug!( + tracing::debug!( "compute `CARGO_NEAR_BUILD_COMMAND`, current executable: {:?}", std::env::args().collect::>() ); diff --git a/cargo-near-build/src/near/docker_build/subprocess_step.rs b/cargo-near-build/src/near/docker_build/subprocess_step.rs index b4f6336c..7ccda8df 100644 --- a/cargo-near-build/src/near/docker_build/subprocess_step.rs +++ b/cargo-near-build/src/near/docker_build/subprocess_step.rs @@ -63,7 +63,7 @@ pub fn run( &container_paths.crate_path, ]; let stdin_is_terminal = std::io::stdin().is_terminal(); - log::debug!("input device is a tty: {}", stdin_is_terminal); + tracing::debug!("input device is a tty: {}", stdin_is_terminal); if stdin_is_terminal && std::env::var(env_keys::nep330::nonspec::SERVER_DISABLE_INTERACTIVE).is_err() { @@ -75,7 +75,7 @@ pub fn run( docker_args.extend(vec![&docker_image, "/bin/bash", "-c"]); docker_args.push(&cargo_cmd); - log::debug!("docker command : {:?}", docker_args); + tracing::debug!("docker command : {:?}", docker_args); docker_args }; diff --git a/cargo-near-build/src/types/cargo/metadata.rs b/cargo-near-build/src/types/cargo/metadata.rs index ba30c09f..ea633876 100644 --- a/cargo-near-build/src/types/cargo/metadata.rs +++ b/cargo-near-build/src/types/cargo/metadata.rs @@ -44,7 +44,7 @@ impl CrateMetadata { manifest_path, raw_metadata: metadata, }; - log::trace!("crate metadata : {:#?}", crate_metadata); + tracing::trace!("crate metadata : {:#?}", crate_metadata); Ok(crate_metadata) } @@ -57,7 +57,7 @@ impl CrateMetadata { } else { self.target_directory.clone() }; - log::debug!("resolved output directory: {}", result); + tracing::debug!("resolved output directory: {}", result); Ok(result) } @@ -71,13 +71,13 @@ fn get_cargo_metadata( manifest_path: &ManifestPath, no_locked: bool, ) -> eyre::Result<(cargo_metadata::Metadata, Package)> { - log::info!("Fetching cargo metadata for {}", manifest_path.path); + tracing::info!("Fetching cargo metadata for {}", manifest_path.path); let mut cmd = MetadataCommand::new(); if !no_locked { cmd.other_options(["--locked".to_string()]); } let cmd = cmd.manifest_path(&manifest_path.path); - log::debug!("metadata command: {:#?}", cmd.cargo_command()); + tracing::debug!("metadata command: {:#?}", cmd.cargo_command()); let metadata = cmd.exec(); if let Err(cargo_metadata::Error::CargoMetadata { stderr }) = metadata.as_ref() { if stderr.contains("remove the --locked flag") { diff --git a/cargo-near-build/src/types/near/docker_build/cloned_repo.rs b/cargo-near-build/src/types/near/docker_build/cloned_repo.rs index 6706af38..a3c076ae 100644 --- a/cargo-near-build/src/types/near/docker_build/cloned_repo.rs +++ b/cargo-near-build/src/types/near/docker_build/cloned_repo.rs @@ -76,7 +76,7 @@ impl ClonedRepo { } })? }; - log::info!( + tracing::info!( "obtained tmp_crate_metadata.target_directory: {}", tmp_crate_metadata.target_directory ); diff --git a/cargo-near-build/src/types/near/docker_build/crate_in_repo.rs b/cargo-near-build/src/types/near/docker_build/crate_in_repo.rs index 167c4370..66c3711e 100644 --- a/cargo-near-build/src/types/near/docker_build/crate_in_repo.rs +++ b/cargo-near-build/src/types/near/docker_build/crate_in_repo.rs @@ -50,7 +50,7 @@ impl Crate { crate_root: initial_crate_root.clone(), head, }; - log::debug!("crate in repo: {:?}", result); + tracing::debug!("crate in repo: {:?}", result); Ok(result) } } diff --git a/cargo-near/Cargo.toml b/cargo-near/Cargo.toml index 8f6b95a6..591f1908 100644 --- a/cargo-near/Cargo.toml +++ b/cargo-near/Cargo.toml @@ -29,8 +29,6 @@ cargo-near-build = { version = "0.1.0", path = "../cargo-near-build", features = ] } clap = { version = "4.0.18", features = ["derive", "env"] } colored = "2.0" -env_logger = "0.11.5" -log = "0.4" serde = "1.0.197" color-eyre = "0.6" inquire = "0.7" @@ -44,7 +42,12 @@ interactive-clap = "0.3" interactive-clap-derive = "0.3" near-cli-rs = { version = "0.15.0", default-features = false } reqwest = "0.12.5" +indicatif = "0.17.8" +indenter = "0.3" +tracing-core = "0.1.32" tracing = "0.1.40" +tracing-indicatif = "0.3.6" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } tokio = { version = "1.0", default-features = false, features = [ "rt-multi-thread", ] } diff --git a/cargo-near/src/main.rs b/cargo-near/src/main.rs index e3cfcc47..6206538a 100644 --- a/cargo-near/src/main.rs +++ b/cargo-near/src/main.rs @@ -1,46 +1,39 @@ use std::env; -use std::io::{IsTerminal, Write}; +use std::io::IsTerminal; use cargo_near_build::env_keys; use colored::Colorize; use interactive_clap::ToCliArgs; -use log::Level; + +use tracing_subscriber::layer::SubscriberExt; +use tracing_subscriber::util::SubscriberInitExt; +use tracing_subscriber::EnvFilter; +use tracing_subscriber::{fmt::format, prelude::*}; pub use near_cli_rs::CliResult; use cargo_near::Cmd; fn main() -> CliResult { - let mut builder = env_logger::Builder::from_env(env_logger::Env::default()); - let environment = if std::env::var(env_keys::nep330::BUILD_ENVIRONMENT).is_ok() { "container".cyan() } else { "host".purple() }; + let my_formatter = cargo_near::types::my_formatter::MyFormatter::from_environment(environment); + + let format = format::debug_fn(move |writer, _field, value| write!(writer, "{:?}", value)); + + let env_filter = EnvFilter::from_default_env(); - builder - .format(move |buf, record| { - let level = format!("[{}]", record.level()); - let level = match record.level() { - Level::Error => level.red(), - Level::Warn => level.yellow(), - Level::Info => level.cyan(), - Level::Debug => level.truecolor(100, 100, 100), - Level::Trace => level.truecolor(200, 200, 200), - }; - let ts = buf.timestamp_seconds(); - writeln!( - buf, - " {}-[{}] {}:{} {} - {}", - level, - environment, - record.file().unwrap_or("unknown"), - record.line().unwrap_or(0), - ts, - record.args() - ) - }) + tracing_subscriber::registry() + .with( + tracing_subscriber::fmt::layer() + .with_line_number(true) + .fmt_fields(format) + .event_format(my_formatter) + .with_filter(env_filter), + ) .init(); match env::var("NO_COLOR") { diff --git a/cargo-near/src/types/mod.rs b/cargo-near/src/types/mod.rs index 56849354..a62e33c7 100644 --- a/cargo-near/src/types/mod.rs +++ b/cargo-near/src/types/mod.rs @@ -1,2 +1,3 @@ pub mod color_preference_cli; +pub mod my_formatter; pub mod utf8_path_buf; diff --git a/cargo-near/src/types/my_formatter.rs b/cargo-near/src/types/my_formatter.rs new file mode 100644 index 00000000..eb3fca56 --- /dev/null +++ b/cargo-near/src/types/my_formatter.rs @@ -0,0 +1,56 @@ +use colored::Colorize; +use tracing::Level; +use tracing_core::{Event, Subscriber}; +use tracing_subscriber::fmt::{ + format::{self, FormatEvent, FormatFields}, + FmtContext, +}; +use tracing_subscriber::registry::LookupSpan; + +#[derive(Debug)] +pub struct MyFormatter { + environment: colored::ColoredString, +} + +impl MyFormatter { + pub fn from_environment(environment: colored::ColoredString) -> Self { + Self { environment } + } +} + +impl FormatEvent for MyFormatter +where + S: Subscriber + for<'a> LookupSpan<'a>, + N: for<'a> FormatFields<'a> + 'static, +{ + fn format_event( + &self, + ctx: &FmtContext<'_, S, N>, + mut writer: format::Writer<'_>, + event: &Event<'_>, + ) -> std::fmt::Result { + let metadata = event.metadata(); + + let level = format!("[{}]", metadata.level()); + let level = match *metadata.level() { + Level::ERROR => level.red(), + Level::WARN => level.yellow(), + Level::INFO => level.cyan(), + Level::DEBUG => level.truecolor(100, 100, 100), + Level::TRACE => level.truecolor(200, 200, 200), + }; + + write!( + &mut writer, + "{}-[{}] {}:{} - ", + level, + self.environment, + metadata.file().unwrap_or("log"), + metadata.line().unwrap_or_default() + )?; + + ctx.field_format().format_fields(writer.by_ref(), event)?; + + writeln!(writer) + } +} From 65fc0f06419b4a331f541db257386a7cf298fbed Mon Sep 17 00:00:00 2001 From: FroVolod Date: Wed, 11 Sep 2024 11:14:41 +0300 Subject: [PATCH 2/2] refactored --- Cargo.lock | 1 + cargo-near/Cargo.toml | 1 + cargo-near/src/main.rs | 3 +-- cargo-near/src/types/my_formatter.rs | 8 +++++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d679a64..6ba33aff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -474,6 +474,7 @@ dependencies = [ "tracing", "tracing-core", "tracing-indicatif", + "tracing-log", "tracing-subscriber", "tracing-test", ] diff --git a/cargo-near/Cargo.toml b/cargo-near/Cargo.toml index 591f1908..869851f6 100644 --- a/cargo-near/Cargo.toml +++ b/cargo-near/Cargo.toml @@ -46,6 +46,7 @@ indicatif = "0.17.8" indenter = "0.3" tracing-core = "0.1.32" tracing = "0.1.40" +tracing-log = "0.2.0" tracing-indicatif = "0.3.6" tracing-subscriber = { version = "0.3", features = ["env-filter"] } tokio = { version = "1.0", default-features = false, features = [ diff --git a/cargo-near/src/main.rs b/cargo-near/src/main.rs index 6206538a..deab4953 100644 --- a/cargo-near/src/main.rs +++ b/cargo-near/src/main.rs @@ -29,9 +29,8 @@ fn main() -> CliResult { tracing_subscriber::registry() .with( tracing_subscriber::fmt::layer() - .with_line_number(true) - .fmt_fields(format) .event_format(my_formatter) + .fmt_fields(format) .with_filter(env_filter), ) .init(); diff --git a/cargo-near/src/types/my_formatter.rs b/cargo-near/src/types/my_formatter.rs index eb3fca56..611fe13d 100644 --- a/cargo-near/src/types/my_formatter.rs +++ b/cargo-near/src/types/my_formatter.rs @@ -1,6 +1,7 @@ use colored::Colorize; use tracing::Level; use tracing_core::{Event, Subscriber}; +use tracing_log::NormalizeEvent; use tracing_subscriber::fmt::{ format::{self, FormatEvent, FormatFields}, FmtContext, @@ -29,10 +30,11 @@ where mut writer: format::Writer<'_>, event: &Event<'_>, ) -> std::fmt::Result { - let metadata = event.metadata(); + let normalized_meta = event.normalized_metadata(); + let metadata = normalized_meta.as_ref().unwrap_or_else(|| event.metadata()); let level = format!("[{}]", metadata.level()); - let level = match *metadata.level() { + let fmt_level = match *metadata.level() { Level::ERROR => level.red(), Level::WARN => level.yellow(), Level::INFO => level.cyan(), @@ -43,7 +45,7 @@ where write!( &mut writer, "{}-[{}] {}:{} - ", - level, + fmt_level, self.environment, metadata.file().unwrap_or("log"), metadata.line().unwrap_or_default()