diff --git a/core/src/ten_manager/Cargo.lock b/core/src/ten_manager/Cargo.lock index 7d0a6b57dc..3fee264644 100644 --- a/core/src/ten_manager/Cargo.lock +++ b/core/src/ten_manager/Cargo.lock @@ -95,14 +95,11 @@ dependencies = [ "ahash", "base64", "bitflags 2.6.0", - "brotli", "bytes", "bytestring", "derive_more", "encoding_rs", - "flate2", "futures-core", - "h2", "http 0.2.12", "httparse", "httpdate", @@ -118,7 +115,6 @@ dependencies = [ "tokio", "tokio-util", "tracing", - "zstd", ] [[package]] @@ -140,7 +136,6 @@ dependencies = [ "bytestring", "cfg-if", "http 0.2.12", - "regex", "regex-lite", "serde", "tracing", @@ -214,7 +209,6 @@ dependencies = [ "bytes", "bytestring", "cfg-if", - "cookie", "derive_more", "encoding_rs", "futures-core", @@ -226,7 +220,6 @@ dependencies = [ "mime", "once_cell", "pin-project-lite", - "regex", "regex-lite", "serde", "serde_json", @@ -325,21 +318,6 @@ dependencies = [ "as-slice", ] -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" -dependencies = [ - "alloc-no-stdlib", -] - [[package]] name = "anstream" version = "0.6.18" @@ -497,31 +475,19 @@ dependencies = [ ] [[package]] -name = "borrow-or-share" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eeab4423108c5d7c744f4d234de88d18d636100093ae04caf4825134b9c3a32" - -[[package]] -name = "brotli" -version = "6.0.0" +name = "block2" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", + "objc2", ] [[package]] -name = "brotli-decompressor" -version = "4.0.1" +name = "borrow-or-share" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] +checksum = "3eeab4423108c5d7c744f4d234de88d18d636100093ae04caf4825134b9c3a32" [[package]] name = "bstr" @@ -572,11 +538,15 @@ version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ - "jobserver", - "libc", "shlex", ] +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + [[package]] name = "cexpr" version = "0.6.0" @@ -673,11 +643,21 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +[[package]] +name = "combine" +version = "4.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "console" -version = "0.15.9" +version = "0.15.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5117385baee8c59b6b6df514c6b3423c060530b9cd4b654410d4aa0cd75468a" +checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" dependencies = [ "encode_unicode", "libc", @@ -693,16 +673,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] -name = "cookie" -version = "0.16.2" +name = "core-foundation" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" dependencies = [ - "percent-encoding", - "time", - "version_check", + "core-foundation-sys", + "libc", ] +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cpufeatures" version = "0.2.16" @@ -1148,25 +1133,6 @@ dependencies = [ "regex-syntax", ] -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "handlebars" version = "6.2.0" @@ -1188,6 +1154,15 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "http" version = "0.2.12" @@ -1545,14 +1520,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] -name = "jobserver" -version = "0.1.32" +name = "jni" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" dependencies = [ - "libc", + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", ] +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + [[package]] name = "js-sys" version = "0.3.76" @@ -1785,6 +1773,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + [[package]] name = "newline-converter" version = "0.3.0" @@ -1945,6 +1939,40 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" +dependencies = [ + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2-encode" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8" + +[[package]] +name = "objc2-foundation" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" +dependencies = [ + "bitflags 2.6.0", + "block2", + "libc", + "objc2", +] + [[package]] name = "object" version = "0.36.5" @@ -2064,12 +2092,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkg-config" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" - [[package]] name = "portable-atomic" version = "1.10.0" @@ -2827,6 +2849,7 @@ dependencies = [ "tokio", "url", "walkdir", + "webbrowser", "zip", ] @@ -3265,6 +3288,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webbrowser" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea9fe1ebb156110ff855242c1101df158b822487e4957b0556d9ffce9db0f535" +dependencies = [ + "block2", + "core-foundation", + "home", + "jni", + "log", + "ndk-context", + "objc2", + "objc2-foundation", + "url", + "web-sys", +] + [[package]] name = "webpki-roots" version = "0.26.7" @@ -3335,6 +3376,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -3362,6 +3412,21 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-targets" version = "0.48.5" @@ -3393,6 +3458,12 @@ dependencies = [ "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -3405,6 +3476,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -3417,6 +3494,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -3435,6 +3518,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -3447,6 +3536,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -3459,6 +3554,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -3471,6 +3572,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -3629,31 +3736,3 @@ dependencies = [ "once_cell", "simd-adler32", ] - -[[package]] -name = "zstd" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" -dependencies = [ - "cc", - "pkg-config", -] diff --git a/core/src/ten_manager/Cargo.toml b/core/src/ten_manager/Cargo.toml index ceb4652fc3..aea31dd827 100644 --- a/core/src/ten_manager/Cargo.toml +++ b/core/src/ten_manager/Cargo.toml @@ -8,64 +8,48 @@ version = "0.1.0" edition = "2021" [dependencies] -actix = "0.13.5" -actix-cors = "0.7" -actix-files = "0.6" -actix-rt = "2.10" -actix-web = "4.8" -actix-web-actors = "4.3.1" -anyhow = "1.0" -clap = "4.5" -clingo = "0.8" -console = "0.15" -dirs = "5.0" -futures-util = "0.3" -globset = "0.4" -handlebars = "6.2" -ignore = "0.4" -indicatif = "0.17" -inquire = "0.7.5" -mime_guess = "2.0.5" -portable-pty = "0.8.1" -regex = "1.11" -remove_dir_all = "1.0" -rust-embed = "8.5.0" -serde_json = "1.0" -sha2 = "0.10" -tempfile = "3.10" -url = "2.5" -walkdir = "2.5" -# webbrowser = "1.0.3" - -[dependencies.linked-hash-map] -version = "0.5" -features = ["serde_impl"] - -[dependencies.reqwest] -version = "0.12" -features = ["json", "blocking", "rustls-tls"] -default-features = false - -[dependencies.semver] -version = "1.0" -features = ["serde"] - -[dependencies.serde] -version = "1.0" -features = ["derive"] - -[dependencies.ten_rust] -path = "../ten_rust" -version = "0.1.0" - -[dependencies.tokio] -version = "1" -features = ["rt-multi-thread", "sync", "time"] - -[dependencies.zip] -version = "2.2" -default-features = false -features = ["deflate", "time"] +actix = { version = "0.13.5" } +actix-cors = { version = "0.7", default-features = false } +actix-files = { version = "0.6", default-features = false } +actix-rt = { version = "2.10", default-features = false, features = ["macros"] } +actix-web = { version = "4.8", default-features = false, features = ["macros"] } +actix-web-actors = { version = "4.3.1", default-features = false } +anyhow = { version = "1.0" } +clap = { version = "4.5" } +clingo = { version = "0.8" } +console = { version = "0.15" } +dirs = { version = "5.0" } +futures-util = { version = "0.3" } +globset = { version = "0.4" } +handlebars = { version = "6.2" } +ignore = { version = "0.4" } +indicatif = { version = "0.17" } +inquire = { version = "0.7.5" } +linked-hash-map = { version = "0.5", features = ["serde_impl"] } +mime_guess = { version = "2.0.5" } +portable-pty = { version = "0.8.1" } +regex = { version = "1.11" } +remove_dir_all = { version = "1.0" } +reqwest = { version = "0.12", default-features = false, features = [ + "json", + "blocking", + "rustls-tls", +] } +rust-embed = { version = "8.5.0" } +semver = { version = "1.0", features = ["serde"] } +serde = { version = "1.0", features = ["derive"] } +serde_json = { version = "1.0" } +sha2 = { version = "0.10" } +tempfile = { version = "3.10" } +ten_rust = { path = "../ten_rust", version = "0.1.0" } +tokio = { version = "1", features = ["rt-multi-thread", "sync", "time"] } +url = { version = "2.5" } +walkdir = { version = "2.5" } +webbrowser = { version = "1.0", default-features = false } +zip = { version = "2.2", default-features = false, features = [ + "deflate", + "time", +] } [target."cfg(unix)".dependencies] mimalloc = "0.1" diff --git a/core/src/ten_rust/Cargo.toml b/core/src/ten_rust/Cargo.toml index a886b28ebd..6315da1eda 100644 --- a/core/src/ten_rust/Cargo.toml +++ b/core/src/ten_rust/Cargo.toml @@ -22,17 +22,17 @@ crate-type = ["staticlib", "rlib"] test = true [dependencies] -anyhow = "1.0" +anyhow = { version = "1.0" } +json5 = { version = "0.4" } jsonschema = { version = "0.26", default-features = false } -serde_json = { version = "1.0", features = ["preserve_order"] } +libc = { version = "0.2" } linked-hash-map = { version = "0.5", features = ["serde_impl"] } -regex = "1.11" -serde = { version = "1.0", features = ["derive"] } -libc = "0.2" -json5 = "0.4" +regex = { version = "1.11" } semver = { version = "1.0", features = ["serde"] } -sha2 = "0.10" -tempfile = "3.10" +serde = { version = "1.0", features = ["derive"] } +serde_json = { version = "1.0", features = ["preserve_order"] } +sha2 = { version = "0.10" } +tempfile = { version = "3.10" } [build-dependencies] -bindgen = "0.70" +bindgen = { version = "0.70" } diff --git a/tools/rust/cargo_toml_sort.py b/tools/rust/cargo_toml_sort.py new file mode 100644 index 0000000000..2ebab6e02b --- /dev/null +++ b/tools/rust/cargo_toml_sort.py @@ -0,0 +1,84 @@ +# +# Copyright © 2024 Agora +# This file is part of TEN Framework, an open source project. +# Licensed under the Apache License, Version 2.0, with certain conditions. +# Refer to the "LICENSE" file in the root directory for more information. +# +import tomlkit +from tomlkit.items import Table, InlineTable +import argparse + + +class ArgumentInfo(argparse.Namespace): + def __init__(self): + self.cargo_toml_path: str + + +def sort_and_inline_dependencies(file_path): + # Read the original `Cargo.toml` file. + with open(file_path, "r", encoding="utf-8") as f: + content = f.read() + + # Parse the content using tomlkit. + data = tomlkit.parse(content) + + # Define the parts which need to be sorted. + sections = ["dependencies", "dev-dependencies", "build-dependencies"] + + for section in sections: + if section in data: + original_table = data[section] + if isinstance(original_table, Table): + # Extract key-value pairs and sort them by key + # (case-insensitive). + sorted_items = sorted( + original_table.items(), key=lambda x: x[0].lower() + ) + + # Create a new table to store the sorted dependencies. + new_table = tomlkit.table() + for key, value in sorted_items: + if isinstance(value, str): + # Convert dependencies in string format into inline + # tables containing only the version. + inline = tomlkit.inline_table() + inline.add("version", value) + new_table[key] = inline + elif isinstance(value, InlineTable): + # Keep dependencies that are already in inline table + # format unchanged. + new_table[key] = value + elif isinstance(value, Table): + # Handle dependencies in standard table format and + # convert them into inline tables. + inline = tomlkit.inline_table() + for sub_key, sub_value in value.items(): + inline.add(sub_key, sub_value) + new_table[key] = inline + + # Replace the original dependency table with the newly sorted + # table. + data[section] = new_table + + # Write the sorted and converted content back to the file, preserving the + # original format and comments. + with open(file_path, "w", encoding="utf-8") as f: + f.write(tomlkit.dumps(data)) + + +if __name__ == "__main__": + parser = argparse.ArgumentParser( + description="Sort and inline Cargo.toml dependencies." + ) + + parser.add_argument( + "cargo_toml_path", + type=str, + help="Path to the Cargo.toml file", + ) + + arg_info = ArgumentInfo() + args = parser.parse_args(namespace=arg_info) + + sort_and_inline_dependencies(args.cargo_toml_path) + print("Dependencies sorted and converted to inline table format!")