From 55574c808e055e67ccc3c565c92c9b514edfd2fc Mon Sep 17 00:00:00 2001 From: Alex Kuzmin Date: Tue, 3 Dec 2024 17:03:45 +0800 Subject: [PATCH 1/7] Add Flutter and React Native options to `mopro create` CLI command --- Cargo.lock | 1054 +++++++++++++++++++++++++++++++++++++++++++-- cli/Cargo.toml | 3 + cli/src/create.rs | 202 ++++++++- cli/src/main.rs | 6 +- cli/src/print.rs | 19 + cli/src/style.rs | 2 +- 6 files changed, 1222 insertions(+), 64 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bf758848..db4739e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,6 +23,17 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.7.8" @@ -125,6 +136,15 @@ version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" +[[package]] +name = "arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "ark-bls12-381" version = "0.4.0" @@ -173,7 +193,7 @@ dependencies = [ "num", "num-bigint", "num-traits", - "thiserror", + "thiserror 1.0.39", "url", ] @@ -408,7 +428,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.82", + "syn 2.0.90", ] [[package]] @@ -426,6 +446,12 @@ dependencies = [ "nom", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atty" version = "0.2.14" @@ -445,7 +471,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", ] [[package]] @@ -481,6 +507,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + [[package]] name = "base64ct" version = "1.6.0" @@ -615,7 +647,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", "syn_derive", ] @@ -674,6 +706,27 @@ dependencies = [ "serde", ] +[[package]] +name = "bzip2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "camino" version = "1.1.9" @@ -703,7 +756,7 @@ dependencies = [ "semver", "serde", "serde_json", - "thiserror", + "thiserror 1.0.39", ] [[package]] @@ -718,6 +771,8 @@ version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -747,6 +802,16 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "clap" version = "2.34.0" @@ -755,7 +820,7 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "bitflags 1.3.2", "textwrap 0.11.0", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -804,7 +869,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", ] [[package]] @@ -874,7 +939,7 @@ dependencies = [ "encode_unicode", "lazy_static", "libc", - "unicode-width", + "unicode-width 0.1.14", "windows-sys 0.52.0", ] @@ -890,6 +955,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -905,6 +980,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "3.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + [[package]] name = "crc32fast" version = "1.4.2" @@ -1062,9 +1152,15 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", ] +[[package]] +name = "deflate64" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b" + [[package]] name = "der" version = "0.6.1" @@ -1085,6 +1181,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "derivative" version = "2.2.0" @@ -1096,6 +1201,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "derive_more" version = "0.99.18" @@ -1104,7 +1220,7 @@ checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", ] [[package]] @@ -1149,6 +1265,17 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "ecdsa" version = "0.14.8" @@ -1225,6 +1352,15 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -1254,7 +1390,7 @@ dependencies = [ "serde", "serde_json", "sha3 0.10.8", - "thiserror", + "thiserror 1.0.39", "uint", ] @@ -1271,7 +1407,7 @@ dependencies = [ "serde", "serde_json", "sha3 0.10.8", - "thiserror", + "thiserror 1.0.39", "uint", ] @@ -1355,7 +1491,7 @@ dependencies = [ "serde", "serde_json", "strum", - "thiserror", + "thiserror 1.0.39", "tiny-keccak", "unicode-xid", ] @@ -1382,7 +1518,7 @@ dependencies = [ "serde_json", "strum", "tempfile", - "thiserror", + "thiserror 1.0.39", "tiny-keccak", "unicode-xid", ] @@ -1467,7 +1603,7 @@ dependencies = [ "plonkish_backend", "rand", "serde", - "thiserror", + "thiserror 1.0.39", ] [[package]] @@ -1510,6 +1646,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1540,6 +1691,56 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "gemini-fibonacci" version = "0.1.0" @@ -1628,6 +1829,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "h2" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap 2.6.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "1.8.3" @@ -1652,7 +1872,7 @@ dependencies = [ "rayon", "serde", "sha3 0.10.8", - "thiserror", + "thiserror 1.0.39", ] [[package]] @@ -1788,6 +2008,118 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" + +[[package]] +name = "hyper" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + [[package]] name = "hyperplonk-fibonacci" version = "0.1.0" @@ -1924,6 +2256,34 @@ dependencies = [ "hashbrown 0.15.0", ] +[[package]] +name = "indicatif" +version = "0.17.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf675b85ed934d3c67b5c5469701eec7db22689d0a2139d856e0925fa28b281" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width 0.2.0", + "web-time", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -1954,6 +2314,15 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.72" @@ -2019,12 +2388,28 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "lockfree-object-pool" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" + [[package]] name = "log" version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "lzma-rs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e" +dependencies = [ + "byteorder", + "crc", +] + [[package]] name = "memchr" version = "2.7.4" @@ -2083,6 +2468,17 @@ dependencies = [ "adler2", ] +[[package]] +name = "mio" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.52.0", +] + [[package]] name = "mopro-cli" version = "0.1.0" @@ -2093,6 +2489,9 @@ dependencies = [ "dialoguer", "fs_extra", "include_dir", + "indicatif", + "reqwest", + "zip", ] [[package]] @@ -2122,11 +2521,28 @@ dependencies = [ "rust-witness", "serde", "serde_derive", - "thiserror", + "thiserror 1.0.39", "uniffi", "uuid", ] +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "nom" version = "7.1.3" @@ -2171,6 +2587,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.46" @@ -2229,9 +2651,15 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", ] +[[package]] +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + [[package]] name = "object" version = "0.32.2" @@ -2291,16 +2719,60 @@ dependencies = [ ] [[package]] -name = "os_str_bytes" -version = "6.6.1" +name = "openssl" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] [[package]] -name = "owo-colors" -version = "3.5.0" +name = "openssl-macros" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "os_str_bytes" +version = "6.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" + +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" [[package]] name = "parity-scale-codec" @@ -2351,6 +2823,16 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +dependencies = [ + "digest 0.10.7", + "hmac", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -2364,7 +2846,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", - "thiserror", + "thiserror 1.0.39", "ucd-trie", ] @@ -2388,7 +2870,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", ] [[package]] @@ -2408,6 +2890,12 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkcs8" version = "0.9.0" @@ -2428,6 +2916,12 @@ dependencies = [ "spki 0.7.3", ] +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + [[package]] name = "plain" version = "0.2.3" @@ -2497,6 +2991,12 @@ dependencies = [ "plotters-backend", ] +[[package]] +name = "portable-atomic" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" + [[package]] name = "poseidon" version = "0.2.0" @@ -2506,6 +3006,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.20" @@ -2586,9 +3092,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.88" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2716,6 +3222,50 @@ dependencies = [ "bytecheck", ] +[[package]] +name = "reqwest" +version = "0.12.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows-registry", +] + [[package]] name = "rfc6979" version = "0.3.1" @@ -2737,6 +3287,21 @@ dependencies = [ "subtle", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "ring-math" version = "0.4.0" @@ -2864,6 +3429,45 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.23.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.18" @@ -2928,6 +3532,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "scroll" version = "0.12.0" @@ -2945,7 +3558,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", ] [[package]] @@ -2982,6 +3595,29 @@ dependencies = [ "zeroize", ] +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa39c7303dc58b5543c94d22c1766b0d31f2ee58306363ea622b10bbc075eaa2" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.23" @@ -3018,7 +3654,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", ] [[package]] @@ -3033,6 +3669,29 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + [[package]] name = "sha2" version = "0.10.8" @@ -3120,6 +3779,12 @@ dependencies = [ "rand_core", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "simdutf8" version = "0.1.5" @@ -3132,12 +3797,37 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + [[package]] name = "smawk" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" +[[package]] +name = "socket2" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "spartan" version = "0.8.0" @@ -3242,9 +3932,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.82" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -3260,7 +3950,37 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", ] [[package]] @@ -3311,7 +4031,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -3329,7 +4049,16 @@ version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.39", +] + +[[package]] +name = "thiserror" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa" +dependencies = [ + "thiserror-impl 2.0.3", ] [[package]] @@ -3343,6 +4072,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "thiserror-impl" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "thread_local" version = "1.1.8" @@ -3353,6 +4093,25 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -3387,6 +4146,55 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.41.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.5.11" @@ -3424,6 +4232,12 @@ dependencies = [ "winnow 0.6.20", ] +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + [[package]] name = "tracing" version = "0.1.40" @@ -3443,7 +4257,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", ] [[package]] @@ -3486,6 +4300,12 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "typenum" version = "1.17.0" @@ -3543,6 +4363,12 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "unicode-xid" version = "0.2.6" @@ -3606,7 +4432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2c801f0f05b06df456a2da4c41b9c2c4fdccc6b9916643c6c67275c4c9e4d07" dependencies = [ "quote", - "syn 2.0.82", + "syn 2.0.90", ] [[package]] @@ -3637,7 +4463,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.82", + "syn 2.0.90", "toml", "uniffi_meta", ] @@ -3680,6 +4506,12 @@ dependencies = [ "weedle2", ] +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.2" @@ -3712,6 +4544,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.5" @@ -3728,6 +4566,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3756,10 +4603,22 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.95" @@ -3778,7 +4637,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3799,6 +4658,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "weedle2" version = "5.0.0" @@ -3848,6 +4717,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" @@ -4041,7 +4940,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", ] [[package]] @@ -4061,5 +4960,76 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.90", +] + +[[package]] +name = "zip" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d52293fc86ea7cf13971b3bb81eb21683636e7ae24c729cdaf1b7c4157a352" +dependencies = [ + "aes", + "arbitrary", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "deflate64", + "displaydoc", + "flate2", + "hmac", + "indexmap 2.6.0", + "lzma-rs", + "memchr", + "pbkdf2", + "rand", + "sha1", + "thiserror 2.0.3", + "time", + "zeroize", + "zopfli", + "zstd", +] + +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "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/cli/Cargo.toml b/cli/Cargo.toml index 373afc18..f70811aa 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -14,3 +14,6 @@ include_dir = "0.7" dialoguer = "0.10" console = "0.15.8" anyhow = "1.0.86" +zip = "2.2.1" +reqwest = { version= "0.12.9", features = ["blocking"] } +indicatif = "0.17.9" diff --git a/cli/src/create.rs b/cli/src/create.rs index 5b069e67..868d9e34 100644 --- a/cli/src/create.rs +++ b/cli/src/create.rs @@ -1,18 +1,25 @@ use std::env; use std::fs; +use std::fs::File; +use std::io::Read; +use std::io::Write; use std::path::Path; use dialoguer::theme::ColorfulTheme; use dialoguer::Select; use include_dir::include_dir; use include_dir::Dir; +use indicatif::ProgressBar; +use indicatif::ProgressStyle; +use reqwest::blocking::Client; +use zip::ZipArchive; use crate::print::print_create_android_success_message; +use crate::print::print_create_flutter_success_message; use crate::print::print_create_ios_success_message; use crate::style; -// TODO: add "react-native", "flutter" -const TEMPLATES: [&str; 2] = ["ios", "android"]; +const TEMPLATES: [&str; 4] = ["ios", "android", "flutter", "react-native"]; pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { let platform: String = match arg_platform.as_deref() { @@ -34,6 +41,17 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { let project_dir = env::current_dir()?; if platform.contains(TEMPLATES[0]) { + let ios_bindings = "MoproiOSBindings"; + let ios_bindings_dir = project_dir.join(&ios_bindings); + + // Check if the dir exists and is not empty + if !ios_bindings_dir.exists() || fs::read_dir(&ios_bindings_dir)?.count() == 0 { + style::print_red_bold( + "iOS bindings are required to create the iOS template. Please run 'mopro build' to create them.".to_string(), + ); + return Ok(()); + } + let platform_name = "ios"; let target_dir = project_dir.join(&platform_name); fs::create_dir(&target_dir)?; @@ -45,24 +63,28 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { // Copy ios bindings env::set_current_dir(&project_dir)?; - let ios_bindings = "MoproiOSBindings"; - let ios_bindings_dir = project_dir.join(&ios_bindings); + let target_ios_bindings_dir = target_dir.join(&ios_bindings); fs::create_dir(target_ios_bindings_dir.clone())?; copy_dir(&ios_bindings_dir, &target_ios_bindings_dir)?; // Copy keys - const CIRCOM_KEYS_DIR: Dir = - include_dir!("$CARGO_MANIFEST_DIR/src/template/init/test-vectors/circom"); - const HALO2_KEYS_DIR: Dir = - include_dir!("$CARGO_MANIFEST_DIR/src/template/init/test-vectors/halo2"); - copy_embedded_file(&CIRCOM_KEYS_DIR, &target_dir)?; - copy_embedded_file(&HALO2_KEYS_DIR, &target_dir)?; + copy_keys(target_dir)?; print_create_ios_success_message(); } if platform.contains(TEMPLATES[1]) { + let android_bindings = "MoproAndroidBindings"; + let android_bindings_dir = project_dir.join(&android_bindings); + // Check if the dir exists and is not empty + if !android_bindings_dir.exists() || fs::read_dir(&android_bindings_dir)?.count() == 0 { + style::print_red_bold( + "Android bindings are required to create Android template. Please run 'mopro build' to create them.".to_string(), + ); + return Ok(()); + } + let platform_name = "android"; let target_dir = project_dir.join(&platform_name); fs::create_dir(&target_dir)?; @@ -75,10 +97,8 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { // Copy Android bindings env::set_current_dir(&project_dir)?; - let android_bindings = "MoproAndroidBindings"; let jni_libs_name = "jniLibs"; let uniffi_name = "uniffi"; - let android_bindings_dir = project_dir.join(&android_bindings); let jni_libs_path = android_bindings_dir.join(&jni_libs_name); let uniffi_path = android_bindings_dir.join(&uniffi_name); let target_jni_libs_path = target_dir @@ -103,19 +123,125 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { .join("src") .join("main") .join("assets"); - const CIRCOM_KEYS_DIR: Dir = - include_dir!("$CARGO_MANIFEST_DIR/src/template/init/test-vectors/circom"); - const HALO2_KEYS_DIR: Dir = - include_dir!("$CARGO_MANIFEST_DIR/src/template/init/test-vectors/halo2"); - copy_embedded_file(&CIRCOM_KEYS_DIR, &assets_dir)?; - copy_embedded_file(&HALO2_KEYS_DIR, &assets_dir)?; + copy_keys(assets_dir)?; print_create_android_success_message(); } + + if platform.contains(TEMPLATES[2]) { + let ios_bindings = "MoproiOSBindings"; + let ios_bindings_dir = project_dir.join(&ios_bindings); + // Check if the dir exists and is not empty + let mut ios_missing = false; + if !ios_bindings_dir.exists() || fs::read_dir(&ios_bindings_dir)?.count() == 0 { + ios_missing = true; + } + let android_bindings = "MoproAndroidBindings"; + let android_bindings_dir = project_dir.join(&android_bindings); + // Check if the dir exists and is not empty + let mut android_missing = false; + if !android_bindings_dir.exists() || fs::read_dir(&android_bindings_dir)?.count() == 0 { + android_missing = true; + } + + if ios_missing || android_missing { + style::print_red_bold( + "Both iOS and Android bindings are required to create a Flutter template. Please run 'mopro build' to create the missing bindings.".to_string(), + ); + return Ok(()); + } + + download_and_extract_template( + "https://github.com/zkmopro/flutter-app/archive/refs/heads/main.zip", + &project_dir, + TEMPLATES[2], + )?; + + // The resulting directory will have -main attached to its name, we need to remove it + let flutter_dir = project_dir.join("flutter-app-main"); + let target_dir = project_dir.join("flutter-app"); + fs::rename(&flutter_dir, &target_dir)?; + + // Copy iOS bindings + let xcframeworks_dir = ios_bindings_dir.join("MoproBindings.xcframework"); + let mopro_swift_file = ios_bindings_dir.join("mopro.swift"); + + let mopro_flutter_plugin_dir = target_dir.join("mopro_flutter_plugin"); + let ios_dir = mopro_flutter_plugin_dir.join("ios"); + let mopro_bindings_dir = ios_dir.join("MoproBindings.xcframework"); + let classes_dir = ios_dir.join("Classes"); + + // Replace the existing MoproBindings.xcframework dir with the one from the MoproiOSBindings + fs::remove_dir_all(&mopro_bindings_dir)?; + fs::create_dir(&mopro_bindings_dir)?; + copy_dir(&xcframeworks_dir, &mopro_bindings_dir)?; + + // Replace the mopro.swift file + fs::remove_file(&classes_dir.join("mopro.swift"))?; + fs::copy(&mopro_swift_file, &classes_dir.join("mopro.swift"))?; + + // Copy Android bindings + + let jni_libs_name = "jniLibs"; + let uniffi_name = "uniffi"; + let jni_libs_path = android_bindings_dir.join(&jni_libs_name); + let uniffi_path = android_bindings_dir.join(&uniffi_name); + let target_jni_libs_path = target_dir + .join("mopro_flutter_plugin") + .join("android") + .join("src") + .join("main") + .join("jniLibs"); + let target_uniffi_path = target_dir + .join("mopro_flutter_plugin") + .join("android") + .join("src") + .join("main") + .join("kotlin") + .join("uniffi"); + fs::remove_dir_all(target_jni_libs_path.clone())?; + fs::create_dir(target_jni_libs_path.clone())?; + copy_dir(&jni_libs_path, &target_jni_libs_path)?; + fs::remove_dir_all(target_uniffi_path.clone())?; + fs::create_dir(target_uniffi_path.clone())?; + copy_dir(&uniffi_path, &target_uniffi_path)?; + + // Copy the keys to the flutter assets dir + let assets_dir = target_dir.join("assets"); + // Clear the assets dir before copying + fs::remove_dir_all(&assets_dir)?; + fs::create_dir(&assets_dir)?; + + copy_keys(assets_dir)?; + + print_create_flutter_success_message(); + } + + if platform.contains(TEMPLATES[3]) { + download_and_extract_template( + "https://codeload.github.com/zkmopro/react-native-app/zip/refs/heads/main", + &project_dir, + TEMPLATES[3], + )?; + // The resulting directory will have -main attached to its name, remove it + let react_native_dir = project_dir.join("react-native-app-main"); + let target_dir = project_dir.join("react-native-app"); + fs::rename(&react_native_dir, &target_dir)?; + } } Ok(()) } +fn copy_keys(target_dir: std::path::PathBuf) -> Result<(), anyhow::Error> { + const CIRCOM_KEYS_DIR: Dir = + include_dir!("$CARGO_MANIFEST_DIR/src/template/init/test-vectors/circom"); + const HALO2_KEYS_DIR: Dir = + include_dir!("$CARGO_MANIFEST_DIR/src/template/init/test-vectors/halo2"); + copy_embedded_file(&CIRCOM_KEYS_DIR, &target_dir)?; + copy_embedded_file(&HALO2_KEYS_DIR, &target_dir)?; + Ok(()) +} + fn select_template() -> anyhow::Result { let idx = Select::with_theme(&ColorfulTheme::default()) .with_prompt("Create template") @@ -192,3 +318,43 @@ fn copy_dir(input_dir: &Path, output_dir: &Path) -> anyhow::Result<()> { } Ok(()) } + +fn download_and_extract_template(url: &str, dest: &Path, platform: &str) -> anyhow::Result<()> { + let client = Client::new(); + let mut response = client.get(url).send()?; + let pb = ProgressBar::new_spinner(); + pb.set_style( + ProgressStyle::default_spinner() + .template("{msg} {spinner} {bytes} downloaded") + .unwrap(), + ); + pb.set_message(format!("Downloading {} template...", platform)); + + // Save to a temporary file + let temp_zip_path = dest.join("template.zip"); + let mut dest_file = File::create(&temp_zip_path)?; + + // Create a buffer and copy while updating the progress bar + let mut buffer = [0u8; 8192]; + let mut downloaded: u64 = 0; + loop { + let bytes_read = response.read(&mut buffer)?; + if bytes_read == 0 { + break; + } + dest_file.write_all(&buffer[..bytes_read])?; + downloaded += bytes_read as u64; + pb.set_position(downloaded); + } + + pb.finish_with_message("Download complete!"); + + let zip_file = File::open(&temp_zip_path)?; + let mut archive = ZipArchive::new(zip_file)?; + archive.extract(dest)?; + + // Clean up + std::fs::remove_file(&temp_zip_path)?; + + Ok(()) +} diff --git a/cli/src/main.rs b/cli/src/main.rs index 97475400..6f79cddc 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -50,15 +50,15 @@ fn main() { project_name, } => match init::init_project(adapter, project_name) { Ok(_) => {} - Err(e) => style::print_read_bold(format!("Failed to initialize project {:?}", e)), + Err(e) => style::print_red_bold(format!("Failed to initialize project: {:?}", e)), }, Commands::Build { mode, platforms } => match build::build_project(mode, platforms) { Ok(_) => {} - Err(e) => style::print_read_bold(format!("Failed to build project {:?}", e)), + Err(e) => style::print_red_bold(format!("Failed to build project: {:?}", e)), }, Commands::Create { template } => match create::create_project(template) { Ok(_) => {} - Err(e) => style::print_read_bold(format!("Failed to create template {:?}", e)), + Err(e) => style::print_red_bold(format!("Failed to create template: {:?}", e)), }, } } diff --git a/cli/src/print.rs b/cli/src/print.rs index 6e3bb9bf..3cc52632 100644 --- a/cli/src/print.rs +++ b/cli/src/print.rs @@ -60,3 +60,22 @@ pub(crate) fn print_create_android_success_message() { print_green_bold("This will open the Android project in Android Studio.".to_string()); print_footer_message(); } + +pub(crate) fn print_create_flutter_success_message() { + print_green_bold("Flutter template created successfully!".to_string()); + println!(); + print_green_bold("Next steps:".to_string()); + println!(); + print_green_bold( + " You can now use the following command to open the app in Android Studio:".to_string(), + ); + println!(); + print_bold(r" open flutter-app -a Android\ Studio ".to_string()); + println!(); + print_green_bold(" or VS Code::".to_string()); + println!(); + print_bold(r" code flutter-app".to_string()); + println!(); + + print_footer_message(); +} diff --git a/cli/src/style.rs b/cli/src/style.rs index ac394a07..7523873d 100644 --- a/cli/src/style.rs +++ b/cli/src/style.rs @@ -10,7 +10,7 @@ pub fn print_bold(text: String) { print_text(text, style); } -pub fn print_read_bold(text: String) { +pub fn print_red_bold(text: String) { let style = Style::new().red().bold(); print_text(text, style); } From 328f1fcc89a9d46947b928811c0360e86425a857 Mon Sep 17 00:00:00 2001 From: Alex Kuzmin Date: Tue, 3 Dec 2024 17:29:12 +0800 Subject: [PATCH 2/7] Refactor the error handling --- cli/src/create.rs | 129 +++++++++++++++++----------------------------- 1 file changed, 48 insertions(+), 81 deletions(-) diff --git a/cli/src/create.rs b/cli/src/create.rs index 868d9e34..5fa7c516 100644 --- a/cli/src/create.rs +++ b/cli/src/create.rs @@ -4,7 +4,9 @@ use std::fs::File; use std::io::Read; use std::io::Write; use std::path::Path; +use std::path::PathBuf; +use anyhow::Error; use dialoguer::theme::ColorfulTheme; use dialoguer::Select; use include_dir::include_dir; @@ -41,16 +43,7 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { let project_dir = env::current_dir()?; if platform.contains(TEMPLATES[0]) { - let ios_bindings = "MoproiOSBindings"; - let ios_bindings_dir = project_dir.join(&ios_bindings); - - // Check if the dir exists and is not empty - if !ios_bindings_dir.exists() || fs::read_dir(&ios_bindings_dir)?.count() == 0 { - style::print_red_bold( - "iOS bindings are required to create the iOS template. Please run 'mopro build' to create them.".to_string(), - ); - return Ok(()); - } + let target_ios_bindings_dir = check_ios_bindings(&project_dir)?; let platform_name = "ios"; let target_dir = project_dir.join(&platform_name); @@ -64,9 +57,11 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { // Copy ios bindings env::set_current_dir(&project_dir)?; - let target_ios_bindings_dir = target_dir.join(&ios_bindings); fs::create_dir(target_ios_bindings_dir.clone())?; - copy_dir(&ios_bindings_dir, &target_ios_bindings_dir)?; + copy_dir( + &project_dir.join("MoproiOSBindings"), + &target_ios_bindings_dir, + )?; // Copy keys copy_keys(target_dir)?; @@ -75,15 +70,7 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { } if platform.contains(TEMPLATES[1]) { - let android_bindings = "MoproAndroidBindings"; - let android_bindings_dir = project_dir.join(&android_bindings); - // Check if the dir exists and is not empty - if !android_bindings_dir.exists() || fs::read_dir(&android_bindings_dir)?.count() == 0 { - style::print_red_bold( - "Android bindings are required to create Android template. Please run 'mopro build' to create them.".to_string(), - ); - return Ok(()); - } + let android_bindings_dir = check_android_bindings(&project_dir)?; let platform_name = "android"; let target_dir = project_dir.join(&platform_name); @@ -101,55 +88,24 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { let uniffi_name = "uniffi"; let jni_libs_path = android_bindings_dir.join(&jni_libs_name); let uniffi_path = android_bindings_dir.join(&uniffi_name); - let target_jni_libs_path = target_dir - .join("app") - .join("src") - .join("main") - .join("jniLibs"); - let target_uniffi_path = target_dir - .join("app") - .join("src") - .join("main") - .join("java") - .join("uniffi"); + let main_dir = target_dir.join("app").join("src").join("main"); + let target_jni_libs_path = main_dir.join("jniLibs"); + let target_uniffi_path = main_dir.join("java").join("uniffi"); fs::create_dir(target_jni_libs_path.clone())?; copy_dir(&jni_libs_path, &target_jni_libs_path)?; fs::create_dir(target_uniffi_path.clone())?; copy_dir(&uniffi_path, &target_uniffi_path)?; // Copy keys - let assets_dir = target_dir - .join("app") - .join("src") - .join("main") - .join("assets"); + let assets_dir = main_dir.join("assets"); copy_keys(assets_dir)?; print_create_android_success_message(); } if platform.contains(TEMPLATES[2]) { - let ios_bindings = "MoproiOSBindings"; - let ios_bindings_dir = project_dir.join(&ios_bindings); - // Check if the dir exists and is not empty - let mut ios_missing = false; - if !ios_bindings_dir.exists() || fs::read_dir(&ios_bindings_dir)?.count() == 0 { - ios_missing = true; - } - let android_bindings = "MoproAndroidBindings"; - let android_bindings_dir = project_dir.join(&android_bindings); - // Check if the dir exists and is not empty - let mut android_missing = false; - if !android_bindings_dir.exists() || fs::read_dir(&android_bindings_dir)?.count() == 0 { - android_missing = true; - } - - if ios_missing || android_missing { - style::print_red_bold( - "Both iOS and Android bindings are required to create a Flutter template. Please run 'mopro build' to create the missing bindings.".to_string(), - ); - return Ok(()); - } + let ios_bindings_dir = check_ios_bindings(&project_dir)?; + let mopro_android_bindings_dir = check_android_bindings(&project_dir)?; download_and_extract_template( "https://github.com/zkmopro/flutter-app/archive/refs/heads/main.zip", @@ -181,24 +137,17 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { fs::copy(&mopro_swift_file, &classes_dir.join("mopro.swift"))?; // Copy Android bindings - let jni_libs_name = "jniLibs"; let uniffi_name = "uniffi"; - let jni_libs_path = android_bindings_dir.join(&jni_libs_name); - let uniffi_path = android_bindings_dir.join(&uniffi_name); - let target_jni_libs_path = target_dir - .join("mopro_flutter_plugin") - .join("android") - .join("src") - .join("main") - .join("jniLibs"); - let target_uniffi_path = target_dir + let jni_libs_path = mopro_android_bindings_dir.join(&jni_libs_name); + let uniffi_path = mopro_android_bindings_dir.join(&uniffi_name); + let main_dir = target_dir .join("mopro_flutter_plugin") .join("android") .join("src") - .join("main") - .join("kotlin") - .join("uniffi"); + .join("main"); + let target_jni_libs_path = main_dir.join("jniLibs"); + let target_uniffi_path = main_dir.join("kotlin").join("uniffi"); fs::remove_dir_all(target_jni_libs_path.clone())?; fs::create_dir(target_jni_libs_path.clone())?; copy_dir(&jni_libs_path, &target_jni_libs_path)?; @@ -232,16 +181,6 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { Ok(()) } -fn copy_keys(target_dir: std::path::PathBuf) -> Result<(), anyhow::Error> { - const CIRCOM_KEYS_DIR: Dir = - include_dir!("$CARGO_MANIFEST_DIR/src/template/init/test-vectors/circom"); - const HALO2_KEYS_DIR: Dir = - include_dir!("$CARGO_MANIFEST_DIR/src/template/init/test-vectors/halo2"); - copy_embedded_file(&CIRCOM_KEYS_DIR, &target_dir)?; - copy_embedded_file(&HALO2_KEYS_DIR, &target_dir)?; - Ok(()) -} - fn select_template() -> anyhow::Result { let idx = Select::with_theme(&ColorfulTheme::default()) .with_prompt("Create template") @@ -319,6 +258,34 @@ fn copy_dir(input_dir: &Path, output_dir: &Path) -> anyhow::Result<()> { Ok(()) } +fn copy_keys(target_dir: std::path::PathBuf) -> Result<(), anyhow::Error> { + const CIRCOM_KEYS_DIR: Dir = + include_dir!("$CARGO_MANIFEST_DIR/src/template/init/test-vectors/circom"); + const HALO2_KEYS_DIR: Dir = + include_dir!("$CARGO_MANIFEST_DIR/src/template/init/test-vectors/halo2"); + copy_embedded_file(&CIRCOM_KEYS_DIR, &target_dir)?; + copy_embedded_file(&HALO2_KEYS_DIR, &target_dir)?; + Ok(()) +} + +fn check_ios_bindings(project_dir: &Path) -> anyhow::Result { + let ios_bindings_dir = project_dir.join("MoproiOSBindings"); + if ios_bindings_dir.exists() && fs::read_dir(&ios_bindings_dir)?.count() > 0 { + Ok(ios_bindings_dir) + } else { + Err(Error::msg("iOS bindings are required to create the template. Please run 'mopro build' to generate them.")) + } +} + +fn check_android_bindings(project_dir: &Path) -> anyhow::Result { + let android_bindings_dir = project_dir.join("MoproAndroidBindings"); + if android_bindings_dir.exists() && fs::read_dir(&android_bindings_dir)?.count() > 0 { + Ok(android_bindings_dir) + } else { + Err(Error::msg("Android bindings are required to create the template. Please run 'mopro build' to generate them.")) + } +} + fn download_and_extract_template(url: &str, dest: &Path, platform: &str) -> anyhow::Result<()> { let client = Client::new(); let mut response = client.get(url).send()?; From 29f6e769f65c3d4118f282567718ef369f3c7282 Mon Sep 17 00:00:00 2001 From: Alex Kuzmin Date: Wed, 4 Dec 2024 22:30:58 +0800 Subject: [PATCH 3/7] Implement React Native create option --- cli/src/create.rs | 79 +++++++++++++++++++++++++++++++++++++++-------- cli/src/print.rs | 15 +++++++++ 2 files changed, 81 insertions(+), 13 deletions(-) diff --git a/cli/src/create.rs b/cli/src/create.rs index 5fa7c516..84022ee1 100644 --- a/cli/src/create.rs +++ b/cli/src/create.rs @@ -19,6 +19,7 @@ use zip::ZipArchive; use crate::print::print_create_android_success_message; use crate::print::print_create_flutter_success_message; use crate::print::print_create_ios_success_message; +use crate::print::print_create_react_native_success_message; use crate::style; const TEMPLATES: [&str; 4] = ["ios", "android", "flutter", "react-native"]; @@ -46,7 +47,7 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { let target_ios_bindings_dir = check_ios_bindings(&project_dir)?; let platform_name = "ios"; - let target_dir = project_dir.join(&platform_name); + let target_dir = project_dir.join(platform_name); fs::create_dir(&target_dir)?; // Change directory to the project directory @@ -73,7 +74,7 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { let android_bindings_dir = check_android_bindings(&project_dir)?; let platform_name = "android"; - let target_dir = project_dir.join(&platform_name); + let target_dir = project_dir.join(platform_name); fs::create_dir(&target_dir)?; // Change directory to the project directory @@ -86,8 +87,8 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { env::set_current_dir(&project_dir)?; let jni_libs_name = "jniLibs"; let uniffi_name = "uniffi"; - let jni_libs_path = android_bindings_dir.join(&jni_libs_name); - let uniffi_path = android_bindings_dir.join(&uniffi_name); + let jni_libs_path = android_bindings_dir.join(jni_libs_name); + let uniffi_path = android_bindings_dir.join(uniffi_name); let main_dir = target_dir.join("app").join("src").join("main"); let target_jni_libs_path = main_dir.join("jniLibs"); let target_uniffi_path = main_dir.join("java").join("uniffi"); @@ -107,6 +108,13 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { let ios_bindings_dir = check_ios_bindings(&project_dir)?; let mopro_android_bindings_dir = check_android_bindings(&project_dir)?; + let target_dir = project_dir.join("flutter-app"); + if target_dir.exists() { + return Err(Error::msg(format!( + "The directory {} already exists. Please remove it and try again.", + target_dir.display() + ))); + } download_and_extract_template( "https://github.com/zkmopro/flutter-app/archive/refs/heads/main.zip", &project_dir, @@ -115,7 +123,6 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { // The resulting directory will have -main attached to its name, we need to remove it let flutter_dir = project_dir.join("flutter-app-main"); - let target_dir = project_dir.join("flutter-app"); fs::rename(&flutter_dir, &target_dir)?; // Copy iOS bindings @@ -133,14 +140,14 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { copy_dir(&xcframeworks_dir, &mopro_bindings_dir)?; // Replace the mopro.swift file - fs::remove_file(&classes_dir.join("mopro.swift"))?; - fs::copy(&mopro_swift_file, &classes_dir.join("mopro.swift"))?; + fs::remove_file(classes_dir.join("mopro.swift"))?; + fs::copy(&mopro_swift_file, classes_dir.join("mopro.swift"))?; // Copy Android bindings let jni_libs_name = "jniLibs"; let uniffi_name = "uniffi"; - let jni_libs_path = mopro_android_bindings_dir.join(&jni_libs_name); - let uniffi_path = mopro_android_bindings_dir.join(&uniffi_name); + let jni_libs_path = mopro_android_bindings_dir.join(jni_libs_name); + let uniffi_path = mopro_android_bindings_dir.join(uniffi_name); let main_dir = target_dir .join("mopro_flutter_plugin") .join("android") @@ -167,6 +174,16 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { } if platform.contains(TEMPLATES[3]) { + let ios_bindings_dir = check_ios_bindings(&project_dir)?; + let mopro_android_bindings_dir = check_android_bindings(&project_dir)?; + + let target_dir = project_dir.join("react-native-app"); + if target_dir.exists() { + return Err(Error::msg(format!( + "The directory {} already exists. Please remove it and try again.", + target_dir.display() + ))); + } download_and_extract_template( "https://codeload.github.com/zkmopro/react-native-app/zip/refs/heads/main", &project_dir, @@ -174,8 +191,41 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { )?; // The resulting directory will have -main attached to its name, remove it let react_native_dir = project_dir.join("react-native-app-main"); - let target_dir = project_dir.join("react-native-app"); fs::rename(&react_native_dir, &target_dir)?; + + // Copy iOS bindings + let mopro_module_dir = target_dir.join("modules").join("mopro"); + let ios_bindings_target_dir = mopro_module_dir.join("ios").join("MoproiOSBindings"); + + // Replace the existing MoproBindings.xcframework dir with the one from the MoproiOSBindings + fs::remove_dir_all(&ios_bindings_target_dir)?; + fs::create_dir(&ios_bindings_target_dir)?; + copy_dir(&ios_bindings_dir, &ios_bindings_target_dir)?; + + // Copy Android bindings + let jni_libs_name = "jniLibs"; + let uniffi_name = "uniffi"; + let jni_libs_path = mopro_android_bindings_dir.join(jni_libs_name); + let uniffi_path = mopro_android_bindings_dir.join(uniffi_name); + let main_dir = mopro_module_dir.join("android").join("src").join("main"); + let target_jni_libs_path = main_dir.join("jniLibs"); + let target_uniffi_path = main_dir.join("java").join("uniffi"); + fs::remove_dir_all(target_jni_libs_path.clone())?; + fs::create_dir(target_jni_libs_path.clone())?; + copy_dir(&jni_libs_path, &target_jni_libs_path)?; + fs::remove_dir_all(target_uniffi_path.clone())?; + fs::create_dir(target_uniffi_path.clone())?; + copy_dir(&uniffi_path, &target_uniffi_path)?; + + // Copy the keys to the flutter assets dir + let assets_dir = target_dir.join("assets").join("keys"); + // Clear the assets dir before copying + fs::remove_dir_all(&assets_dir)?; + fs::create_dir(&assets_dir)?; + + copy_keys(assets_dir)?; + + print_create_react_native_success_message(); } } Ok(()) @@ -192,6 +242,11 @@ fn select_template() -> anyhow::Result { fn copy_embedded_file(dir: &Dir, output_dir: &Path) -> anyhow::Result<()> { for file in dir.entries() { + // Skip .wasm files + if file.path().extension().map_or(false, |ext| ext == "wasm") { + continue; + } + let relative_path = file.path(); let output_path = output_dir.join(relative_path); @@ -231,9 +286,7 @@ fn copy_embedded_dir(dir: &Dir, output_dir: &Path) -> anyhow::Result<()> { } } None => { - if let Err(e) = copy_embedded_dir(file.as_dir().unwrap(), &output_dir) { - return Err(e); - }; + copy_embedded_dir(file.as_dir().unwrap(), &output_dir)?; } } } diff --git a/cli/src/print.rs b/cli/src/print.rs index 3cc52632..939a670e 100644 --- a/cli/src/print.rs +++ b/cli/src/print.rs @@ -79,3 +79,18 @@ pub(crate) fn print_create_flutter_success_message() { print_footer_message(); } + +pub(crate) fn print_create_react_native_success_message() { + print_green_bold("React Native template created successfully!".to_string()); + println!(); + print_green_bold("Next steps:".to_string()); + println!(); + print_green_bold( + " You can now use the following command to open the app in VS Code:".to_string(), + ); + println!(); + print_bold(r" code react-native-app".to_string()); + println!(); + + print_footer_message(); +} From 599de35c4ccf107ef75da139e96214ae05252dfd Mon Sep 17 00:00:00 2001 From: Alex Kuzmin Date: Thu, 5 Dec 2024 16:13:58 +0800 Subject: [PATCH 4/7] Refactor for DRY --- cli/src/create.rs | 130 ++++++++++++++++++++++++---------------------- cli/src/init.rs | 8 +-- 2 files changed, 69 insertions(+), 69 deletions(-) diff --git a/cli/src/create.rs b/cli/src/create.rs index 84022ee1..fb3b3fd3 100644 --- a/cli/src/create.rs +++ b/cli/src/create.rs @@ -44,7 +44,7 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { let project_dir = env::current_dir()?; if platform.contains(TEMPLATES[0]) { - let target_ios_bindings_dir = check_ios_bindings(&project_dir)?; + let ios_bindings_dir = check_ios_bindings(&project_dir)?; let platform_name = "ios"; let target_dir = project_dir.join(platform_name); @@ -57,12 +57,7 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { // Copy ios bindings env::set_current_dir(&project_dir)?; - - fs::create_dir(target_ios_bindings_dir.clone())?; - copy_dir( - &project_dir.join("MoproiOSBindings"), - &target_ios_bindings_dir, - )?; + copy_ios_bindings(ios_bindings_dir, target_dir.clone())?; // Copy keys copy_keys(target_dir)?; @@ -85,20 +80,11 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { // Copy Android bindings env::set_current_dir(&project_dir)?; - let jni_libs_name = "jniLibs"; - let uniffi_name = "uniffi"; - let jni_libs_path = android_bindings_dir.join(jni_libs_name); - let uniffi_path = android_bindings_dir.join(uniffi_name); - let main_dir = target_dir.join("app").join("src").join("main"); - let target_jni_libs_path = main_dir.join("jniLibs"); - let target_uniffi_path = main_dir.join("java").join("uniffi"); - fs::create_dir(target_jni_libs_path.clone())?; - copy_dir(&jni_libs_path, &target_jni_libs_path)?; - fs::create_dir(target_uniffi_path.clone())?; - copy_dir(&uniffi_path, &target_uniffi_path)?; + let app_dir = target_dir.join("app"); + copy_android_bindings(&android_bindings_dir, &app_dir, "java")?; // Copy keys - let assets_dir = main_dir.join("assets"); + let assets_dir = app_dir.join("src").join("main").join("assets"); copy_keys(assets_dir)?; print_create_android_success_message(); @@ -106,7 +92,7 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { if platform.contains(TEMPLATES[2]) { let ios_bindings_dir = check_ios_bindings(&project_dir)?; - let mopro_android_bindings_dir = check_android_bindings(&project_dir)?; + let android_bindings_dir = check_android_bindings(&project_dir)?; let target_dir = project_dir.join("flutter-app"); if target_dir.exists() { @@ -144,23 +130,11 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { fs::copy(&mopro_swift_file, classes_dir.join("mopro.swift"))?; // Copy Android bindings - let jni_libs_name = "jniLibs"; - let uniffi_name = "uniffi"; - let jni_libs_path = mopro_android_bindings_dir.join(jni_libs_name); - let uniffi_path = mopro_android_bindings_dir.join(uniffi_name); - let main_dir = target_dir - .join("mopro_flutter_plugin") - .join("android") - .join("src") - .join("main"); - let target_jni_libs_path = main_dir.join("jniLibs"); - let target_uniffi_path = main_dir.join("kotlin").join("uniffi"); - fs::remove_dir_all(target_jni_libs_path.clone())?; - fs::create_dir(target_jni_libs_path.clone())?; - copy_dir(&jni_libs_path, &target_jni_libs_path)?; - fs::remove_dir_all(target_uniffi_path.clone())?; - fs::create_dir(target_uniffi_path.clone())?; - copy_dir(&uniffi_path, &target_uniffi_path)?; + copy_android_bindings( + &android_bindings_dir, + &target_dir.join("mopro_flutter_plugin").join("android"), + "kotlin", + )?; // Copy the keys to the flutter assets dir let assets_dir = target_dir.join("assets"); @@ -175,7 +149,7 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { if platform.contains(TEMPLATES[3]) { let ios_bindings_dir = check_ios_bindings(&project_dir)?; - let mopro_android_bindings_dir = check_android_bindings(&project_dir)?; + let android_bindings_dir = check_android_bindings(&project_dir)?; let target_dir = project_dir.join("react-native-app"); if target_dir.exists() { @@ -195,27 +169,14 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { // Copy iOS bindings let mopro_module_dir = target_dir.join("modules").join("mopro"); - let ios_bindings_target_dir = mopro_module_dir.join("ios").join("MoproiOSBindings"); - - // Replace the existing MoproBindings.xcframework dir with the one from the MoproiOSBindings - fs::remove_dir_all(&ios_bindings_target_dir)?; - fs::create_dir(&ios_bindings_target_dir)?; - copy_dir(&ios_bindings_dir, &ios_bindings_target_dir)?; + copy_ios_bindings(ios_bindings_dir, mopro_module_dir.join("ios"))?; // Copy Android bindings - let jni_libs_name = "jniLibs"; - let uniffi_name = "uniffi"; - let jni_libs_path = mopro_android_bindings_dir.join(jni_libs_name); - let uniffi_path = mopro_android_bindings_dir.join(uniffi_name); - let main_dir = mopro_module_dir.join("android").join("src").join("main"); - let target_jni_libs_path = main_dir.join("jniLibs"); - let target_uniffi_path = main_dir.join("java").join("uniffi"); - fs::remove_dir_all(target_jni_libs_path.clone())?; - fs::create_dir(target_jni_libs_path.clone())?; - copy_dir(&jni_libs_path, &target_jni_libs_path)?; - fs::remove_dir_all(target_uniffi_path.clone())?; - fs::create_dir(target_uniffi_path.clone())?; - copy_dir(&uniffi_path, &target_uniffi_path)?; + copy_android_bindings( + &android_bindings_dir, + &mopro_module_dir.join("android"), + "java", + )?; // Copy the keys to the flutter assets dir let assets_dir = target_dir.join("assets").join("keys"); @@ -231,6 +192,43 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { Ok(()) } +fn copy_android_bindings( + android_bindings_dir: &Path, + target_dir: &Path, + language: &str, +) -> anyhow::Result<()> { + let jni_libs_name = "jniLibs"; + let uniffi_name = "uniffi"; + let jni_libs_path = android_bindings_dir.join(jni_libs_name); + let uniffi_path = android_bindings_dir.join(uniffi_name); + let main_dir = target_dir.join("src").join("main"); + let target_jni_libs_path = main_dir.join("jniLibs"); + let target_uniffi_path = main_dir.join(language).join("uniffi"); + + if target_jni_libs_path.exists() { + fs::remove_dir_all(target_jni_libs_path.clone())?; + } + fs::create_dir(&target_jni_libs_path)?; + copy_dir(&jni_libs_path, &target_jni_libs_path)?; + if target_uniffi_path.exists() { + fs::remove_dir_all(target_uniffi_path.clone())?; + } + fs::create_dir(&target_uniffi_path)?; + copy_dir(&uniffi_path, &target_uniffi_path)?; + + Ok(()) +} + +fn copy_ios_bindings(input_dir: PathBuf, output_dir: PathBuf) -> Result<(), Error> { + let ios_bindings_target_dir = output_dir.join("MoproiOSBindings"); + if ios_bindings_target_dir.exists() { + fs::remove_dir_all(&ios_bindings_target_dir)?; + } + fs::create_dir(&ios_bindings_target_dir)?; + copy_dir(&input_dir, &ios_bindings_target_dir)?; + Ok(()) +} + fn select_template() -> anyhow::Result { let idx = Select::with_theme(&ColorfulTheme::default()) .with_prompt("Create template") @@ -286,7 +284,7 @@ fn copy_embedded_dir(dir: &Dir, output_dir: &Path) -> anyhow::Result<()> { } } None => { - copy_embedded_dir(file.as_dir().unwrap(), &output_dir)?; + copy_embedded_dir(file.as_dir().unwrap(), output_dir)?; } } } @@ -342,13 +340,13 @@ fn check_android_bindings(project_dir: &Path) -> anyhow::Result { fn download_and_extract_template(url: &str, dest: &Path, platform: &str) -> anyhow::Result<()> { let client = Client::new(); let mut response = client.get(url).send()?; - let pb = ProgressBar::new_spinner(); - pb.set_style( + let spinner = ProgressBar::new_spinner(); + spinner.set_style( ProgressStyle::default_spinner() .template("{msg} {spinner} {bytes} downloaded") .unwrap(), ); - pb.set_message(format!("Downloading {} template...", platform)); + spinner.set_message(format!("Downloading {} template...", platform)); // Save to a temporary file let temp_zip_path = dest.join("template.zip"); @@ -357,6 +355,7 @@ fn download_and_extract_template(url: &str, dest: &Path, platform: &str) -> anyh // Create a buffer and copy while updating the progress bar let mut buffer = [0u8; 8192]; let mut downloaded: u64 = 0; + let mut start_time = std::time::Instant::now(); loop { let bytes_read = response.read(&mut buffer)?; if bytes_read == 0 { @@ -364,10 +363,15 @@ fn download_and_extract_template(url: &str, dest: &Path, platform: &str) -> anyh } dest_file.write_all(&buffer[..bytes_read])?; downloaded += bytes_read as u64; - pb.set_position(downloaded); + let current_time = std::time::Instant::now(); + // Tick every 50 ms + if (current_time - start_time).as_millis() > 50 { + spinner.set_position(downloaded); + start_time = current_time; + } } - pb.finish_with_message("Download complete!"); + spinner.finish_with_message("Download complete!"); let zip_file = File::open(&temp_zip_path)?; let mut archive = ZipArchive::new(zip_file)?; diff --git a/cli/src/init.rs b/cli/src/init.rs index 839a731b..127a91ff 100644 --- a/cli/src/init.rs +++ b/cli/src/init.rs @@ -133,11 +133,7 @@ fn copy_embedded_dir(dir: &Dir, output_dir: &Path, selection: Vec) -> any } } None => { - if let Err(e) = - copy_embedded_dir(file.as_dir().unwrap(), &output_dir, selection.clone()) - { - return Err(e); - }; + copy_embedded_dir(file.as_dir().unwrap(), output_dir, selection.clone())?; } } } @@ -146,7 +142,7 @@ fn copy_embedded_dir(dir: &Dir, output_dir: &Path, selection: Vec) -> any fn replace_project_name(file_path: &str, project_name: &str) -> anyhow::Result<()> { let target = ""; - replace_string_in_file(file_path, target, &project_name) + replace_string_in_file(file_path, target, project_name) } fn replace_features(file_path: &str, adapters: Vec<&str>) -> anyhow::Result<()> { From dc921746d1c713151a9cf8e4d73fc0768267e96f Mon Sep 17 00:00:00 2001 From: Alex Kuzmin Date: Thu, 5 Dec 2024 16:16:08 +0800 Subject: [PATCH 5/7] chore: reuse target path variables for JNI libs and Uniffi in Android bindings --- cli/src/create.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/src/create.rs b/cli/src/create.rs index fb3b3fd3..ee497f82 100644 --- a/cli/src/create.rs +++ b/cli/src/create.rs @@ -202,8 +202,8 @@ fn copy_android_bindings( let jni_libs_path = android_bindings_dir.join(jni_libs_name); let uniffi_path = android_bindings_dir.join(uniffi_name); let main_dir = target_dir.join("src").join("main"); - let target_jni_libs_path = main_dir.join("jniLibs"); - let target_uniffi_path = main_dir.join(language).join("uniffi"); + let target_jni_libs_path = main_dir.join(jni_libs_name); + let target_uniffi_path = main_dir.join(language).join(uniffi_name); if target_jni_libs_path.exists() { fs::remove_dir_all(target_jni_libs_path.clone())?; From 8082438b739d141ddefae932153a88ed4967d2fc Mon Sep 17 00:00:00 2001 From: Alex Kuzmin Date: Thu, 5 Dec 2024 16:23:31 +0800 Subject: [PATCH 6/7] Cargo.lock --- Cargo.lock | 252 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 223 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index efc5c5c7..9196aba2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 4 +version = 3 [[package]] name = "addr2line" @@ -132,9 +132,18 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" + +[[package]] +name = "arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" +dependencies = [ + "derive_arbitrary", +] [[package]] name = "ark-bls12-381" @@ -383,7 +392,7 @@ dependencies = [ "anyhow", "camino", "chrono", - "clap 4.5.21", + "clap 4.5.22", "colored", "curve25519-dalek", "lazy_static", @@ -830,9 +839,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.21" +version = "4.5.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "69371e34337c4c984bbe322360c2547210bf632eb2814bbe78a6e87a2935bd2b" dependencies = [ "clap_builder", "clap_derive", @@ -840,9 +849,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "6e24c1b4099818523236a8ca881d2b45db98dadfb4625cf6608c12069fcbbde1" dependencies = [ "anstream", "anstyle", @@ -1596,7 +1605,7 @@ version = "0.1.0" source = "git+https://github.com/sifnoc/plonkish-fibonacci-sample.git#3917ee5e91f2237d97210821649b73806ada7e2f" dependencies = [ "bincode", - "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature%2Ffor-benchmark)", + "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature/for-benchmark)", "itertools 0.13.0", "plonkish_backend", "rand", @@ -1745,7 +1754,7 @@ version = "0.1.0" source = "git+https://github.com/sifnoc/plonkish-fibonacci-sample.git#3917ee5e91f2237d97210821649b73806ada7e2f" dependencies = [ "fibonacci-circuit", - "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature%2Ffor-benchmark)", + "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature/for-benchmark)", "plonkish_backend", ] @@ -1838,7 +1847,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.6.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -1891,7 +1900,7 @@ dependencies = [ [[package]] name = "halo2_proofs" version = "0.2.0" -source = "git+https://github.com/han0110/halo2.git?branch=feature%2Ffor-benchmark#4981b8d5bdaab04af9b56a5d2c482b6eec9f7fa4" +source = "git+https://github.com/han0110/halo2.git?branch=feature/for-benchmark#4981b8d5bdaab04af9b56a5d2c482b6eec9f7fa4" dependencies = [ "ark-std", "blake2b_simd", @@ -2007,9 +2016,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" dependencies = [ "bytes", "fnv", @@ -2123,7 +2132,7 @@ version = "0.1.0" source = "git+https://github.com/sifnoc/plonkish-fibonacci-sample.git#3917ee5e91f2237d97210821649b73806ada7e2f" dependencies = [ "fibonacci-circuit", - "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature%2Ffor-benchmark)", + "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature/for-benchmark)", "plonkish_backend", ] @@ -2381,6 +2390,34 @@ dependencies = [ "hashbrown 0.15.2", ] +[[package]] +name = "indicatif" +version = "0.17.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf675b85ed934d3c67b5c5469701eec7db22689d0a2139d856e0925fa28b281" +dependencies = [ + "console", + "number_prefix", + "portable-atomic", + "unicode-width 0.2.0", + "web-time", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.7", +] + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -2411,6 +2448,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.74" @@ -2483,6 +2529,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" +[[package]] +name = "lockfree-object-pool" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" + [[package]] name = "log" version = "0.4.22" @@ -2573,7 +2625,7 @@ name = "mopro-cli" version = "0.1.0" dependencies = [ "anyhow", - "clap 4.5.21", + "clap 4.5.22", "console", "dialoguer", "fs_extra", @@ -2979,6 +3031,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkcs8" version = "0.9.0" @@ -3018,7 +3076,7 @@ source = "git+https://github.com/sifnoc/plonkish-fibonacci-sample.git#3917ee5e91 dependencies = [ "bincode", "fibonacci-circuit", - "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature%2Ffor-benchmark)", + "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature/for-benchmark)", "plonkish_backend", "rand", "serde", @@ -3032,7 +3090,7 @@ dependencies = [ "bincode", "bitvec", "generic-array 0.14.7", - "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature%2Ffor-benchmark)", + "halo2_proofs 0.2.0 (git+https://github.com/han0110/halo2.git?branch=feature/for-benchmark)", "halo2curves 0.3.3", "itertools 0.10.5", "num-bigint", @@ -3082,7 +3140,7 @@ checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" [[package]] name = "poseidon" version = "0.2.0" -source = "git+https://github.com/han0110/poseidon?branch=feature%2Fwith-spec#fa4c2544ed38666f1f72d1c4fd0956756a7112b3" +source = "git+https://github.com/han0110/poseidon?branch=feature/with-spec#fa4c2544ed38666f1f72d1c4fd0956756a7112b3" dependencies = [ "halo2curves 0.3.2", "subtle", @@ -3591,6 +3649,15 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "scroll" version = "0.12.0" @@ -3847,6 +3914,15 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" version = "1.13.2" @@ -3988,6 +4064,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + [[package]] name = "synstructure" version = "0.13.1" @@ -3999,6 +4084,27 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tap" version = "1.0.1" @@ -4111,9 +4217,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "num-conv", @@ -4174,9 +4280,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.1" +version = "1.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" dependencies = [ "backtrace", "bytes", @@ -4210,9 +4316,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -4370,10 +4476,16 @@ checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-width" -version = "0.2.0" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "unicode-xid" version = "0.2.6" @@ -4388,7 +4500,7 @@ checksum = "f31bff6daf87277a9014bcdefbc2842b0553392919d1096843c5aad899ca4588" dependencies = [ "anyhow", "camino", - "clap 4.5.21", + "clap 4.5.22", "uniffi_bindgen", "uniffi_build", "uniffi_core", @@ -4626,12 +4738,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] @@ -4675,6 +4788,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "weedle2" version = "5.0.0" @@ -5048,3 +5171,74 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zip" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d52293fc86ea7cf13971b3bb81eb21683636e7ae24c729cdaf1b7c4157a352" +dependencies = [ + "aes", + "arbitrary", + "bzip2", + "constant_time_eq", + "crc32fast", + "crossbeam-utils", + "deflate64", + "displaydoc", + "flate2", + "hmac", + "indexmap 2.7.0", + "lzma-rs", + "memchr", + "pbkdf2", + "rand", + "sha1", + "thiserror 2.0.3", + "time", + "zeroize", + "zopfli", + "zstd", +] + +[[package]] +name = "zopfli" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" +dependencies = [ + "bumpalo", + "crc32fast", + "lockfree-object-pool", + "log", + "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", +] From f6cc71267aa5422780aa77f0225a7c55a0d49589 Mon Sep 17 00:00:00 2001 From: Alex Kuzmin Date: Tue, 10 Dec 2024 22:43:22 +0800 Subject: [PATCH 7/7] Refer to docs after completing the setup --- cli/src/print.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cli/src/print.rs b/cli/src/print.rs index 939a670e..54d32566 100644 --- a/cli/src/print.rs +++ b/cli/src/print.rs @@ -76,6 +76,9 @@ pub(crate) fn print_create_flutter_success_message() { println!(); print_bold(r" code flutter-app".to_string()); println!(); + print_green_bold( + "To learn more about setting up the Flutter app with mopro, visit https://zkmopro.org/docs/setup/flutter-setup/".to_string(), + ); print_footer_message(); } @@ -91,6 +94,9 @@ pub(crate) fn print_create_react_native_success_message() { println!(); print_bold(r" code react-native-app".to_string()); println!(); + print_green_bold( + "To learn more about setting up the React Native app with mopro, visit https://zkmopro.org/docs/setup/react-native-setup/".to_string(), + ); print_footer_message(); }