From a95b7f7ee81e8a111b321f4ef763d4d129cede65 Mon Sep 17 00:00:00 2001 From: Alex Kuzmin <6849426+alxkzmn@users.noreply.github.com> Date: Wed, 11 Dec 2024 10:02:02 +0800 Subject: [PATCH] `mopro create` improvements (#267) * Add Flutter and React Native options to `mopro create` CLI command * Refactor the error handling * Implement React Native create option * Refactor for DRY * chore: reuse target path variables for JNI libs and Uniffi in Android bindings * Cargo.lock * Refer to docs after completing the setup --- Cargo.lock | 1062 ++++++++++++++++++++++++++++++++++++++++++--- cli/Cargo.toml | 3 + cli/src/create.rs | 290 ++++++++++--- cli/src/init.rs | 8 +- cli/src/main.rs | 6 +- cli/src/print.rs | 40 ++ cli/src/style.rs | 2 +- 7 files changed, 1279 insertions(+), 132 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 927830cd..64bd2656 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" @@ -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" @@ -121,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 = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" + +[[package]] +name = "arbitrary" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" +dependencies = [ + "derive_arbitrary", +] [[package]] name = "ark-bls12-381" @@ -372,7 +392,7 @@ dependencies = [ "anyhow", "camino", "chrono", - "clap 4.5.21", + "clap 4.5.23", "colored", "curve25519-dalek", "lazy_static", @@ -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" @@ -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" @@ -673,6 +705,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" @@ -713,10 +766,12 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.2" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" +checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -734,9 +789,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -746,6 +801,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" @@ -754,7 +819,7 @@ checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "bitflags 1.3.2", "textwrap 0.11.0", - "unicode-width", + "unicode-width 0.1.14", ] [[package]] @@ -774,9 +839,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -784,13 +849,13 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", - "clap_lex 0.7.3", + "clap_lex 0.7.4", "strsim 0.11.1", ] @@ -817,9 +882,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "color-eyre" @@ -873,7 +938,7 @@ dependencies = [ "encode_unicode", "lazy_static", "libc", - "unicode-width", + "unicode-width 0.1.14", "windows-sys 0.52.0", ] @@ -899,6 +964,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" @@ -914,6 +989,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" @@ -1083,6 +1173,12 @@ dependencies = [ "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" @@ -1103,6 +1199,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" @@ -1114,6 +1219,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 = "1.0.0" @@ -1263,6 +1379,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" @@ -1437,9 +1562,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fastrlp" @@ -1499,7 +1624,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", @@ -1547,6 +1672,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" @@ -1577,13 +1717,63 @@ 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" 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", ] @@ -1666,6 +1856,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.7.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "half" version = "1.8.3" @@ -1712,7 +1921,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", @@ -1826,13 +2035,125 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "http" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" +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" 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", ] @@ -2090,6 +2411,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" @@ -2120,11 +2469,20 @@ 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" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ "once_cell", "wasm-bindgen", @@ -2176,9 +2534,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.167" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "linux-raw-sys" @@ -2192,12 +2550,28 @@ 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" 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" @@ -2234,9 +2608,9 @@ dependencies = [ [[package]] name = "minicov" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def6d99771d7c499c26ad4d40eb6645eafd3a1553b35fc26ea5a489a45e82d9a" +checksum = "f27fe9f1cc3c22e1687f9446c2083c4c5fc7f0bcf1c7a86bdbded14985895b4b" dependencies = [ "cc", "walkdir", @@ -2266,16 +2640,30 @@ 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" dependencies = [ "anyhow", - "clap 4.5.21", + "clap 4.5.23", "console", "dialoguer", "fs_extra", "include_dir", + "indicatif", + "reqwest", + "zip", ] [[package]] @@ -2328,6 +2716,23 @@ dependencies = [ "wasm-bindgen-test", ] +[[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" @@ -2372,6 +2777,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" @@ -2433,6 +2844,12 @@ dependencies = [ "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" @@ -2492,14 +2909,58 @@ 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 = "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" @@ -2552,6 +3013,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" @@ -2560,20 +3031,20 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 1.0.69", + "thiserror 2.0.3", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" +checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e" dependencies = [ "pest", "pest_generator", @@ -2581,9 +3052,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" +checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b" dependencies = [ "pest", "pest_meta", @@ -2594,9 +3065,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" +checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea" dependencies = [ "once_cell", "pest", @@ -2609,6 +3080,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" @@ -2629,6 +3106,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" @@ -2642,7 +3125,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", @@ -2656,7 +3139,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", @@ -2697,15 +3180,27 @@ 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" -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", ] +[[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" @@ -2895,6 +3390,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" @@ -2916,6 +3455,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" @@ -3032,15 +3586,54 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.41" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.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]] @@ -3107,6 +3700,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 = "scoped-tls" version = "1.0.1" @@ -3167,6 +3769,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" @@ -3229,6 +3854,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" @@ -3316,6 +3964,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" @@ -3328,6 +3982,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" @@ -3340,6 +4003,16 @@ 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" @@ -3459,6 +4132,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" @@ -3470,6 +4152,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" @@ -3518,7 +4221,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]] @@ -3580,6 +4283,25 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" +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" @@ -3624,6 +4346,54 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cec9b21b0450273377fc97bd4c33a8acffc8c996c987a7c5b319a0083707551" +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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + [[package]] name = "toml" version = "0.5.11" @@ -3661,6 +4431,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.41" @@ -3723,6 +4499,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" @@ -3765,6 +4547,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" @@ -3779,7 +4567,7 @@ checksum = "f31bff6daf87277a9014bcdefbc2842b0553392919d1096843c5aad899ca4588" dependencies = [ "anyhow", "camino", - "clap 4.5.21", + "clap 4.5.23", "uniffi_bindgen", "uniffi_build", "uniffi_core", @@ -3902,6 +4690,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.4" @@ -3946,6 +4740,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" @@ -3962,6 +4762,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" @@ -3970,9 +4779,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -3983,13 +4792,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn 2.0.90", @@ -4008,9 +4816,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.47" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", @@ -4021,9 +4829,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4031,9 +4839,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -4056,17 +4864,16 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "wasm-bindgen-test" -version = "0.3.45" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d381749acb0943d357dcbd8f0b100640679883fcdeeef04def49daf8d33a5426" +checksum = "c61d44563646eb934577f2772656c7ad5e9c90fac78aa8013d776fcdaf24625d" dependencies = [ - "console_error_panic_hook", "js-sys", "minicov", "scoped-tls", @@ -4077,9 +4884,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.45" +version = "0.3.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c97b2ef2c8d627381e51c071c2ab328eac606d3f69dd82bcbca20a9e389d95f0" +checksum = "54171416ce73aa0b9c377b51cc3cb542becee1cd678204812e8392e5b0e4a031" dependencies = [ "proc-macro2", "quote", @@ -4099,9 +4906,19 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.74" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -4156,6 +4973,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" @@ -4450,3 +5297,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", +] 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..ee497f82 100644 --- a/cli/src/create.rs +++ b/cli/src/create.rs @@ -1,18 +1,28 @@ use std::env; use std::fs; +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; 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::print::print_create_react_native_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,8 +44,10 @@ pub fn create_project(arg_platform: &Option) -> anyhow::Result<()> { let project_dir = env::current_dir()?; if platform.contains(TEMPLATES[0]) { + let 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 @@ -45,26 +57,19 @@ 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_ios_bindings(ios_bindings_dir, target_dir.clone())?; // 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_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 @@ -75,44 +80,152 @@ 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 - .join("app") - .join("src") - .join("main") - .join("jniLibs"); - let target_uniffi_path = target_dir - .join("app") - .join("src") - .join("main") - .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 = target_dir - .join("app") - .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)?; + let assets_dir = app_dir.join("src").join("main").join("assets"); + copy_keys(assets_dir)?; print_create_android_success_message(); } + + if platform.contains(TEMPLATES[2]) { + let ios_bindings_dir = check_ios_bindings(&project_dir)?; + let 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, + 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"); + 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 + 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"); + // 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]) { + let ios_bindings_dir = check_ios_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() { + 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, + 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"); + fs::rename(&react_native_dir, &target_dir)?; + + // Copy iOS bindings + let mopro_module_dir = target_dir.join("modules").join("mopro"); + copy_ios_bindings(ios_bindings_dir, mopro_module_dir.join("ios"))?; + + // Copy Android bindings + 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"); + // 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(()) +} + +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(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())?; } + 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(()) } @@ -127,6 +240,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); @@ -166,9 +284,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)?; } } } @@ -192,3 +308,77 @@ 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()?; + let spinner = ProgressBar::new_spinner(); + spinner.set_style( + ProgressStyle::default_spinner() + .template("{msg} {spinner} {bytes} downloaded") + .unwrap(), + ); + spinner.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; + let mut start_time = std::time::Instant::now(); + 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; + 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; + } + } + + spinner.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/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<()> { 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..54d32566 100644 --- a/cli/src/print.rs +++ b/cli/src/print.rs @@ -60,3 +60,43 @@ 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_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(); +} + +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_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(); +} 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); }