diff --git a/.circleci/config.yml b/.circleci/config.yml index d27f9eaa8..5391bacf3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -167,6 +167,7 @@ commands: command: | mkdir $BIN_DIR mv target/<< parameters.target >>/release/cargo-shuttle<< parameters.suffix >> $BIN_DIR/cargo-shuttle<< parameters.suffix >> + mv target/<< parameters.target >>/release/shuttle<< parameters.suffix >> $BIN_DIR/shuttle<< parameters.suffix >> mv LICENSE $BIN_DIR/ mv README.md $BIN_DIR/ mkdir -p artifacts/<< parameters.target >> diff --git a/Cargo.lock b/Cargo.lock index af3d03cd3..2a0d1a7d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -126,6 +126,15 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "arc-swap" version = "1.7.1" @@ -839,6 +848,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block2" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f" +dependencies = [ + "objc2", +] + [[package]] name = "bollard" version = "0.15.0" @@ -1236,9 +1254,9 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "constant_time_eq" -version = "0.1.5" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "convert_case" @@ -1493,6 +1511,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "092966b41edc516079bdf31ec78a2e0588d1d0c08f78b91d8307215928642b2b" +[[package]] +name = "deflate64" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b" + [[package]] name = "der" version = "0.7.9" @@ -1539,6 +1563,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] + [[package]] name = "derive_more" version = "0.99.18" @@ -1951,9 +1986,9 @@ checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "git2" -version = "0.18.3" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70" +checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" dependencies = [ "bitflags 2.6.0", "libc", @@ -1964,9 +1999,9 @@ dependencies = [ [[package]] name = "gix" -version = "0.63.0" +version = "0.66.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984c5018adfa7a4536ade67990b3ebc6e11ab57b3d6cd9968de0947ca99b4b06" +checksum = "9048b8d1ae2104f045cb37e5c450fc49d5d8af22609386bfc739c11ba88995eb" dependencies = [ "gix-actor", "gix-attributes", @@ -1986,7 +2021,6 @@ dependencies = [ "gix-ignore", "gix-index", "gix-lock", - "gix-macros", "gix-negotiate", "gix-object", "gix-odb", @@ -2011,16 +2045,15 @@ dependencies = [ "gix-worktree", "gix-worktree-state", "once_cell", - "parking_lot", "smallvec", "thiserror", ] [[package]] name = "gix-actor" -version = "0.31.5" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0e454357e34b833cc3a00b6efbbd3dd4d18b24b9fb0c023876ec2645e8aa3f2" +checksum = "fc19e312cd45c4a66cd003f909163dc2f8e1623e30a0c0c6df3776e89b308665" dependencies = [ "bstr", "gix-date", @@ -2032,9 +2065,9 @@ dependencies = [ [[package]] name = "gix-attributes" -version = "0.22.3" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37ce99c7e81288c28b703641b6d5d119aacc45c1a6b247156e6249afa486257" +checksum = "ebccbf25aa4a973dd352564a9000af69edca90623e8a16dad9cbc03713131311" dependencies = [ "bstr", "gix-glob", @@ -2067,9 +2100,9 @@ dependencies = [ [[package]] name = "gix-command" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d76867867da891cbe32021ad454e8cae90242f6afb06762e4dd0d357afd1d7b" +checksum = "dff2e692b36bbcf09286c70803006ca3fd56551a311de450be317a0ab8ea92e7" dependencies = [ "bstr", "gix-path", @@ -2093,9 +2126,9 @@ dependencies = [ [[package]] name = "gix-config" -version = "0.37.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fafe42957e11d98e354a66b6bd70aeea00faf2f62dd11164188224a507c840" +checksum = "78e797487e6ca3552491de1131b4f72202f282fb33f198b1c34406d765b42bb0" dependencies = [ "bstr", "gix-config-value", @@ -2114,9 +2147,9 @@ dependencies = [ [[package]] name = "gix-config-value" -version = "0.14.7" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b328997d74dd15dc71b2773b162cb4af9a25c424105e4876e6d0686ab41c383e" +checksum = "03f76169faa0dec598eac60f83d7fcdd739ec16596eca8fb144c88973dbe6f8c" dependencies = [ "bitflags 2.6.0", "bstr", @@ -2127,9 +2160,9 @@ dependencies = [ [[package]] name = "gix-credentials" -version = "0.24.3" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91b446df0841c9d74b3f98f21657b892581a4af78904a22e0cbc6144da972eea" +checksum = "8ce391d305968782f1ae301c4a3d42c5701df7ff1d8bc03740300f6fd12bce78" dependencies = [ "bstr", "gix-command", @@ -2144,21 +2177,21 @@ dependencies = [ [[package]] name = "gix-date" -version = "0.8.7" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eed6931f21491ee0aeb922751bd7ec97b4b2fe8fbfedcb678e2a2dce5f3b8c0" +checksum = "35c84b7af01e68daf7a6bb8bb909c1ff5edb3ce4326f1f43063a5a96d3c3c8a5" dependencies = [ "bstr", "itoa", + "jiff", "thiserror", - "time", ] [[package]] name = "gix-diff" -version = "0.44.1" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1996d5c8a305b59709467d80617c9fde48d9d75fd1f4179ea970912630886c9d" +checksum = "92c9afd80fff00f8b38b1c1928442feb4cd6d2232a6ed806b6b193151a3d336c" dependencies = [ "bstr", "gix-hash", @@ -2168,9 +2201,9 @@ dependencies = [ [[package]] name = "gix-discover" -version = "0.32.0" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc27c699b63da66b50d50c00668bc0b7e90c3a382ef302865e891559935f3dbf" +checksum = "0577366b9567376bc26e815fd74451ebd0e6218814e242f8e5b7072c58d956d2" dependencies = [ "bstr", "dunce", @@ -2204,9 +2237,9 @@ dependencies = [ [[package]] name = "gix-filter" -version = "0.11.3" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6547738da28275f4dff4e9f3a0f28509f53f94dd6bd822733c91cb306bca61a" +checksum = "4121790ae140066e5b953becc72e7496278138d19239be2e63b5067b0843119e" dependencies = [ "bstr", "encoding_rs", @@ -2225,9 +2258,9 @@ dependencies = [ [[package]] name = "gix-fs" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6adf99c27cdf17b1c4d77680c917e0d94d8783d4e1c73d3be0d1d63107163d7a" +checksum = "f2bfe6249cfea6d0c0e0990d5226a4cb36f030444ba9e35e0639275db8f98575" dependencies = [ "fastrand 2.1.0", "gix-features", @@ -2236,9 +2269,9 @@ dependencies = [ [[package]] name = "gix-glob" -version = "0.16.4" +version = "0.16.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7df15afa265cc8abe92813cd354d522f1ac06b29ec6dfa163ad320575cb447" +checksum = "74908b4bbc0a0a40852737e5d7889f676f081e340d5451a16e5b4c50d592f111" dependencies = [ "bitflags 2.6.0", "bstr", @@ -2269,9 +2302,9 @@ dependencies = [ [[package]] name = "gix-ignore" -version = "0.11.3" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6afb8f98e314d4e1adc822449389ada863c174b5707cedd327d67b84dba527" +checksum = "e447cd96598460f5906a0f6c75e950a39f98c2705fc755ad2f2020c9e937fab7" dependencies = [ "bstr", "gix-glob", @@ -2282,9 +2315,9 @@ dependencies = [ [[package]] name = "gix-index" -version = "0.33.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a9a44eb55bd84bb48f8a44980e951968ced21e171b22d115d1cdcef82a7d73f" +checksum = "0cd4203244444017682176e65fd0180be9298e58ed90bd4a8489a357795ed22d" dependencies = [ "bitflags 2.6.0", "bstr", @@ -2319,22 +2352,11 @@ dependencies = [ "thiserror", ] -[[package]] -name = "gix-macros" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "999ce923619f88194171a67fb3e6d613653b8d4d6078b529b15a765da0edcc17" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", -] - [[package]] name = "gix-negotiate" -version = "0.13.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec879fb6307bb63519ba89be0024c6f61b4b9d61f1a91fd2ce572d89fe9c224" +checksum = "b4063bf329a191a9e24b6f948a17ccf6698c0380297f5e169cee4f1d2ab9475b" dependencies = [ "bitflags 2.6.0", "gix-commitgraph", @@ -2348,9 +2370,9 @@ dependencies = [ [[package]] name = "gix-object" -version = "0.42.3" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25da2f46b4e7c2fa7b413ce4dffb87f69eaf89c2057e386491f4c55cadbfe386" +checksum = "2f5b801834f1de7640731820c2df6ba88d95480dc4ab166a5882f8ff12b88efa" dependencies = [ "bstr", "gix-actor", @@ -2367,9 +2389,9 @@ dependencies = [ [[package]] name = "gix-odb" -version = "0.61.1" +version = "0.63.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20d384fe541d93d8a3bb7d5d5ef210780d6df4f50c4e684ccba32665a5e3bc9b" +checksum = "a3158068701c17df54f0ab2adda527f5a6aca38fd5fd80ceb7e3c0a2717ec747" dependencies = [ "arc-swap", "gix-date", @@ -2387,9 +2409,9 @@ dependencies = [ [[package]] name = "gix-pack" -version = "0.51.1" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0594491fffe55df94ba1c111a6566b7f56b3f8d2e1efc750e77d572f5f5229" +checksum = "3223aa342eee21e1e0e403cad8ae9caf9edca55ef84c347738d10681676fd954" dependencies = [ "clru", "gix-chunk", @@ -2407,9 +2429,9 @@ dependencies = [ [[package]] name = "gix-packetline" -version = "0.17.5" +version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b70486beda0903b6d5b65dfa6e40585098cdf4e6365ca2dff4f74c387354a515" +checksum = "8c43ef4d5fe2fa222c606731c8bdbf4481413ee4ef46d61340ec39e4df4c5e49" dependencies = [ "bstr", "faster-hex", @@ -2419,9 +2441,9 @@ dependencies = [ [[package]] name = "gix-packetline-blocking" -version = "0.17.4" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31d42378a3d284732e4d589979930d0d253360eccf7ec7a80332e5ccb77e14a" +checksum = "b9802304baa798dd6f5ff8008a2b6516d54b74a69ca2d3a2b9e2d6c3b5556b40" dependencies = [ "bstr", "faster-hex", @@ -2431,9 +2453,9 @@ dependencies = [ [[package]] name = "gix-path" -version = "0.10.9" +version = "0.10.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d23d5bbda31344d8abc8de7c075b3cf26e5873feba7c4a15d916bce67382bd9" +checksum = "ebfc4febd088abdcbc9f1246896e57e37b7a34f6909840045a1767c6dafac7af" dependencies = [ "bstr", "gix-trace", @@ -2444,9 +2466,9 @@ dependencies = [ [[package]] name = "gix-pathspec" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d307d1b8f84dc8386c4aa20ce0cf09242033840e15469a3ecba92f10cfb5c046" +checksum = "5d23bf239532b4414d0e63b8ab3a65481881f7237ed9647bb10c1e3cc54c5ceb" dependencies = [ "bitflags 2.6.0", "bstr", @@ -2459,9 +2481,9 @@ dependencies = [ [[package]] name = "gix-prompt" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0595d2be4b6d6a71a099e989bdd610882b882da35fb8503d91d6f81aa0936f" +checksum = "74fde865cdb46b30d8dad1293385d9bcf998d3a39cbf41bee67d0dab026fe6b1" dependencies = [ "gix-command", "gix-config-value", @@ -2472,9 +2494,9 @@ dependencies = [ [[package]] name = "gix-protocol" -version = "0.45.2" +version = "0.45.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bad8da8e89f24177bd77947092199bb13dcc318bbd73530ba8a05e6d6adaaa9d" +checksum = "cc43a1006f01b5efee22a003928c9eb83dde2f52779ded9d4c0732ad93164e3e" dependencies = [ "bstr", "gix-credentials", @@ -2501,12 +2523,11 @@ dependencies = [ [[package]] name = "gix-ref" -version = "0.44.1" +version = "0.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3394a2997e5bc6b22ebc1e1a87b41eeefbcfcff3dbfa7c4bd73cb0ac8f1f3e2e" +checksum = "ae0d8406ebf9aaa91f55a57f053c5a1ad1a39f60fdf0303142b7be7ea44311e5" dependencies = [ "gix-actor", - "gix-date", "gix-features", "gix-fs", "gix-hash", @@ -2523,9 +2544,9 @@ dependencies = [ [[package]] name = "gix-refspec" -version = "0.23.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6868f8cd2e62555d1f7c78b784bece43ace40dd2a462daf3b588d5416e603f37" +checksum = "ebb005f82341ba67615ffdd9f7742c87787544441c88090878393d0682869ca6" dependencies = [ "bstr", "gix-hash", @@ -2537,9 +2558,9 @@ dependencies = [ [[package]] name = "gix-revision" -version = "0.27.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b13e43c2118c4b0537ddac7d0821ae0dfa90b7b8dbf20c711e153fb749adce" +checksum = "ba4621b219ac0cdb9256883030c3d56a6c64a6deaa829a92da73b9a576825e1e" dependencies = [ "bstr", "gix-date", @@ -2551,9 +2572,9 @@ dependencies = [ [[package]] name = "gix-revwalk" -version = "0.13.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b030ccaab71af141f537e0225f19b9e74f25fefdba0372246b844491cab43e0" +checksum = "b41e72544b93084ee682ef3d5b31b1ba4d8fa27a017482900e5e044d5b1b3984" dependencies = [ "gix-commitgraph", "gix-date", @@ -2566,9 +2587,9 @@ dependencies = [ [[package]] name = "gix-sec" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1547d26fa5693a7f34f05b4a3b59a90890972922172653bcb891ab3f09f436df" +checksum = "0fe4d52f30a737bbece5276fab5d3a8b276dc2650df963e293d0673be34e7a5f" dependencies = [ "bitflags 2.6.0", "gix-path", @@ -2578,9 +2599,9 @@ dependencies = [ [[package]] name = "gix-submodule" -version = "0.11.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921cd49924ac14b6611b22e5fb7bbba74d8780dc7ad26153304b64d1272460ac" +checksum = "529d0af78cc2f372b3218f15eb1e3d1635a21c8937c12e2dd0b6fc80c2ca874b" dependencies = [ "bstr", "gix-config", @@ -2606,15 +2627,15 @@ dependencies = [ [[package]] name = "gix-trace" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f924267408915fddcd558e3f37295cc7d6a3e50f8bd8b606cee0808c3915157e" +checksum = "6cae0e8661c3ff92688ce1c8b8058b3efb312aba9492bbe93661a21705ab431b" [[package]] name = "gix-transport" -version = "0.42.2" +version = "0.42.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27c02b83763ffe95bcc27ce5821b2b7f843315a009c06f1cd59c9b66c508c058" +checksum = "421dcccab01b41a15d97b226ad97a8f9262295044e34fbd37b10e493b0a6481f" dependencies = [ "base64 0.22.1", "bstr", @@ -2631,9 +2652,9 @@ dependencies = [ [[package]] name = "gix-traverse" -version = "0.39.2" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e499a18c511e71cf4a20413b743b9f5bcf64b3d9e81e9c3c6cd399eae55a8840" +checksum = "030da39af94e4df35472e9318228f36530989327906f38e27807df305fccb780" dependencies = [ "bitflags 2.6.0", "gix-commitgraph", @@ -2648,9 +2669,9 @@ dependencies = [ [[package]] name = "gix-url" -version = "0.27.4" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2eb9b35bba92ea8f0b5ab406fad3cf6b87f7929aa677ff10aa042c6da621156" +checksum = "fd280c5e84fb22e128ed2a053a0daeacb6379469be6a85e3d518a0636e160c89" dependencies = [ "bstr", "gix-features", @@ -2672,9 +2693,9 @@ dependencies = [ [[package]] name = "gix-validate" -version = "0.8.5" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82c27dd34a49b1addf193c92070bcbf3beaf6e10f16a78544de6372e146a0acf" +checksum = "81f2badbb64e57b404593ee26b752c26991910fd0d81fe6f9a71c1a8309b6c86" dependencies = [ "bstr", "thiserror", @@ -2682,9 +2703,9 @@ dependencies = [ [[package]] name = "gix-worktree" -version = "0.34.1" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26f7326ebe0b9172220694ea69d344c536009a9b98fb0f9de092c440f3efe7a6" +checksum = "c312ad76a3f2ba8e865b360d5cb3aa04660971d16dec6dd0ce717938d903149a" dependencies = [ "bstr", "gix-attributes", @@ -2701,9 +2722,9 @@ dependencies = [ [[package]] name = "gix-worktree-state" -version = "0.11.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ed6205b5f51067a485b11843babcf3304c0799e265a06eb0dde7f69cd85cd8" +checksum = "7b05c4b313fa702c0bacd5068dd3e01671da73b938fade97676859fee286de43" dependencies = [ "bstr", "gix-features", @@ -3324,6 +3345,31 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jiff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a45489186a6123c128fdf6016183fcfab7113e1820eb813127e036e287233fb" +dependencies = [ + "jiff-tzdb-platform", + "windows-sys 0.52.0", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91335e575850c5c4c673b9bd467b0e025f164ca59d0564f69d0c2ee0ffad4653" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9835f0060a626fe59f160437bc725491a6af23133ea906500027d1bd2f8f4329" +dependencies = [ + "jiff-tzdb", +] + [[package]] name = "jni" version = "0.21.1" @@ -3405,9 +3451,9 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libgit2-sys" -version = "0.16.2+1.7.2" +version = "0.17.0+1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" +checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" dependencies = [ "cc", "libc", @@ -3476,6 +3522,12 @@ dependencies = [ "scopeguard", ] +[[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" @@ -3492,12 +3544,13 @@ dependencies = [ ] [[package]] -name = "malloc_buf" -version = "0.0.6" +name = "lzma-rs" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e" dependencies = [ - "libc", + "byteorder", + "crc", ] [[package]] @@ -3648,7 +3701,7 @@ dependencies = [ "hmac", "lazy_static", "md-5", - "pbkdf2", + "pbkdf2 0.11.0", "percent-encoding", "rand 0.8.5", "rustc_version_runtime", @@ -3788,27 +3841,43 @@ dependencies = [ ] [[package]] -name = "num_threads" -version = "0.1.7" +name = "number_prefix" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" + +[[package]] +name = "objc-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310" + +[[package]] +name = "objc2" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" +checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804" dependencies = [ - "libc", + "objc-sys", + "objc2-encode", ] [[package]] -name = "number_prefix" -version = "0.4.0" +name = "objc2-encode" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8" [[package]] -name = "objc" -version = "0.2.7" +name = "objc2-foundation" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8" dependencies = [ - "malloc_buf", + "bitflags 2.6.0", + "block2", + "libc", + "objc2", ] [[package]] @@ -4049,17 +4118,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core 0.6.4", - "subtle", -] - [[package]] name = "paste" version = "1.0.15" @@ -4071,11 +4129,18 @@ name = "pbkdf2" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest", +] + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest", "hmac", - "password-hash", - "sha2", ] [[package]] @@ -4545,12 +4610,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - [[package]] name = "rcgen" version = "0.11.3" @@ -5868,6 +5927,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "simple_asn1" version = "0.6.2" @@ -6452,9 +6517,7 @@ checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", - "libc", "num-conv", - "num_threads", "powerfmt", "serde", "time-core", @@ -7290,17 +7353,18 @@ dependencies = [ [[package]] name = "webbrowser" -version = "0.8.15" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db67ae75a9405634f5882791678772c94ff5f16a66535aae186e26aa0841fc8b" +checksum = "425ba64c1e13b1c6e8c5d2541c8fac10022ca584f33da781db01b5756aef1f4e" dependencies = [ + "block2", "core-foundation", "home", "jni", "log", "ndk-context", - "objc", - "raw-window-handle", + "objc2", + "objc2-foundation", "url", "web-sys", ] @@ -7726,43 +7790,79 @@ name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.72", +] [[package]] name = "zip" -version = "0.6.6" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" +checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" dependencies = [ "aes", - "byteorder", + "arbitrary", "bzip2", "constant_time_eq", "crc32fast", "crossbeam-utils", + "deflate64", + "displaydoc", "flate2", "hmac", - "pbkdf2", + "indexmap 2.2.6", + "lzma-rs", + "memchr", + "pbkdf2 0.12.2", + "rand 0.8.5", "sha1", + "thiserror", "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.11.2+zstd.1.5.2" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" dependencies = [ - "libc", "zstd-sys", ] diff --git a/cargo-shuttle/Cargo.toml b/cargo-shuttle/Cargo.toml index e6d2a9537..500c3e743 100644 --- a/cargo-shuttle/Cargo.toml +++ b/cargo-shuttle/Cargo.toml @@ -4,8 +4,9 @@ version = "0.47.0" edition.workspace = true license.workspace = true repository.workspace = true -description = "A cargo command for the Shuttle platform (https://www.shuttle.rs/)" +description = "CLI for the Shuttle platform (https://www.shuttle.rs/)" homepage = "https://www.shuttle.rs" +default-run = "cargo-shuttle" [dependencies] shuttle-api-client = { workspace = true, default-features = true } @@ -27,8 +28,8 @@ dirs = { workspace = true } dunce = { workspace = true } flate2 = { workspace = true } futures = { workspace = true } -git2 = { version = "0.18.1", default-features = false } -gix = { version = "0.63.0", default-features = false, features = [ +git2 = { version = "0.19.0", default-features = false } +gix = { version = "0.66.0", default-features = false, features = [ "blocking-http-transport-reqwest-rust-tls", "worktree-mutation", ] } @@ -49,7 +50,7 @@ serde_json = { workspace = true } strum = { workspace = true } tar = { workspace = true } tempfile = { workspace = true } -tokio = { workspace = true, features = ["macros", "signal", "rt-multi-thread"] } +tokio = { workspace = true, features = ["rt-multi-thread"] } tokio-tungstenite = { workspace = true } toml = { workspace = true } toml_edit = { workspace = true } @@ -63,8 +64,8 @@ tracing-subscriber = { workspace = true, features = [ url = { workspace = true } uuid = { workspace = true, features = ["v4"] } walkdir = "2.3.3" -webbrowser = "0.8.2" -zip = "0.6.6" +webbrowser = "1.0.1" +zip = "2.2.0" [dev-dependencies] assert_cmd = "2.0.6" diff --git a/cargo-shuttle/src/bin/cargo-shuttle.rs b/cargo-shuttle/src/bin/cargo-shuttle.rs new file mode 100644 index 000000000..3248c042e --- /dev/null +++ b/cargo-shuttle/src/bin/cargo-shuttle.rs @@ -0,0 +1,13 @@ +use anyhow::Result; +use cargo_shuttle::{parse_args, setup_tracing, Binary, Shuttle}; + +#[tokio::main] +async fn main() -> Result<()> { + let (args, provided_path_to_init) = parse_args(); + + setup_tracing(args.debug); + + Shuttle::new(Binary::CargoShuttle)? + .run(args, provided_path_to_init) + .await +} diff --git a/cargo-shuttle/src/bin/shuttle.rs b/cargo-shuttle/src/bin/shuttle.rs new file mode 100644 index 000000000..7e222c06f --- /dev/null +++ b/cargo-shuttle/src/bin/shuttle.rs @@ -0,0 +1,13 @@ +use anyhow::Result; +use cargo_shuttle::{parse_args, setup_tracing, Binary, Shuttle}; + +#[tokio::main] +async fn main() -> Result<()> { + let (args, provided_path_to_init) = parse_args(); + + setup_tracing(args.debug); + + Shuttle::new(Binary::Shuttle)? + .run(args, provided_path_to_init) + .await +} diff --git a/cargo-shuttle/src/lib.rs b/cargo-shuttle/src/lib.rs index 34de793c0..34bba5e94 100644 --- a/cargo-shuttle/src/lib.rs +++ b/cargo-shuttle/src/lib.rs @@ -35,10 +35,10 @@ use reqwest::header::HeaderMap; use shuttle_api_client::ShuttleApiClient; use shuttle_common::{ constants::{ - headers::X_CARGO_SHUTTLE_VERSION, API_URL_DEFAULT, DEFAULT_IDLE_MINUTES, EXAMPLES_REPO, - EXECUTABLE_DIRNAME, RESOURCE_SCHEMA_VERSION, RUNTIME_NAME, SHUTTLE_GH_ISSUE_URL, - SHUTTLE_IDLE_DOCS_URL, SHUTTLE_INSTALL_DOCS_URL, SHUTTLE_LOGIN_URL, STORAGE_DIRNAME, - TEMPLATES_SCHEMA_VERSION, + headers::X_CARGO_SHUTTLE_VERSION, API_URL_BETA, API_URL_DEFAULT, DEFAULT_IDLE_MINUTES, + EXAMPLES_REPO, EXECUTABLE_DIRNAME, RESOURCE_SCHEMA_VERSION, RUNTIME_NAME, + SHUTTLE_GH_ISSUE_URL, SHUTTLE_IDLE_DOCS_URL, SHUTTLE_INSTALL_DOCS_URL, SHUTTLE_LOGIN_URL, + STORAGE_DIRNAME, TEMPLATES_SCHEMA_VERSION, }, deployment::{DeploymentStateBeta, DEPLOYER_END_MESSAGES_BAD, DEPLOYER_END_MESSAGES_GOOD}, log::LogsRange, @@ -73,6 +73,7 @@ use tokio::process::Child; use tokio::time::{sleep, Duration}; use tonic::{Request, Status}; use tracing::{debug, error, info, trace, warn}; +use tracing_subscriber::{fmt, prelude::*, registry, EnvFilter}; use uuid::Uuid; use zip::write::FileOptions; @@ -88,7 +89,7 @@ use crate::provisioner_server::LocalProvisioner; const VERSION: &str = env!("CARGO_PKG_VERSION"); -// Returns the args and whether the PATH arg of the init command was explicitly given +/// Returns the args and whether the PATH arg of the init command was explicitly given pub fn parse_args() -> (ShuttleArgs, bool) { let matches = ShuttleArgs::command().get_matches(); let args = @@ -102,17 +103,42 @@ pub fn parse_args() -> (ShuttleArgs, bool) { (args, provided_path_to_init) } +pub fn setup_tracing(debug: bool) { + registry() + .with(fmt::layer()) + .with( + // let user set RUST_LOG if they want to + EnvFilter::try_from_default_env().unwrap_or_else(|_| { + if debug { + EnvFilter::new("info,cargo_shuttle=trace,shuttle=trace") + } else { + EnvFilter::default() + } + }), + ) + .init(); +} + +#[derive(PartialEq)] +pub enum Binary { + CargoShuttle, + Shuttle, +} + pub struct Shuttle { ctx: RequestContext, client: Option, version_info: Option, + /// Strings to print at the end of command execution version_warnings: Vec, - /// alter behaviour to interact with the new platform + /// Alter behaviour to interact with the new platform beta: bool, + /// Alter behaviour based on which CLI is used + bin: Binary, } impl Shuttle { - pub fn new() -> Result { + pub fn new(bin: Binary) -> Result { let ctx = RequestContext::load_global()?; Ok(Self { ctx, @@ -120,45 +146,43 @@ impl Shuttle { version_info: None, version_warnings: vec![], beta: false, + bin, }) } - pub async fn run( - mut self, - args: ShuttleArgs, - provided_path_to_init: bool, - ) -> Result { + pub async fn run(mut self, mut args: ShuttleArgs, provided_path_to_init: bool) -> Result<()> { + if self.bin == Binary::Shuttle { + // beta is always enabled in `shuttle` + args.beta = true; + } self.beta = args.beta; if self.beta { if matches!(args.cmd, Command::Project(ProjectCommand::Restart { .. })) { - eprintln!("This command is discontinued on the beta platform. Deploy to start a new deployment."); - return Ok(CommandOutcome::Ok); + bail!("This command is discontinued on the beta platform. Deploy to start a new deployment."); } if matches!(args.cmd, Command::Status) { - eprintln!("This command is discontinued on the beta platform. Use `deployment status` instead."); - return Ok(CommandOutcome::Ok); + bail!("This command is discontinued on the beta platform. Use `deployment status` instead."); } if matches!( args.cmd, Command::Stop | Command::Project(ProjectCommand::Stop { .. }) ) { - eprintln!("This command is discontinued on the beta platform. Use `deployment stop` instead."); - return Ok(CommandOutcome::Ok); + bail!("This command is discontinued on the beta platform. Use `deployment stop` instead."); } if matches!(args.cmd, Command::Clean) { - eprintln!("This command is not yet implemented on the beta platform."); - return Ok(CommandOutcome::Ok); + bail!("This command is not yet implemented on the beta platform."); + } + if self.bin == Binary::CargoShuttle { + eprintln!("INFO: Using beta platform API"); } - eprintln!("INFO: Using beta platform API"); } else if matches!( args.cmd, Command::Deployment(DeploymentCommand::Stop) | Command::Account ) { - eprintln!("This command is not supported on the legacy platform. Set --beta or SHUTTLE_BETA=true."); - return Ok(CommandOutcome::Ok); + bail!("This command is not supported on the legacy platform. Set --beta or SHUTTLE_BETA=true."); } if let Some(ref url) = args.api_url { - if url != API_URL_DEFAULT { + if (!self.beta && url != API_URL_DEFAULT) || (self.beta && url != API_URL_BETA) { eprintln!("INFO: Targeting non-standard API: {url}"); } if url.ends_with('/') { @@ -245,7 +269,7 @@ impl Shuttle { Command::Feedback => self.feedback(), Command::Run(run_args) => { if self.beta { - self.local_run_beta(run_args).await + self.local_run_beta(run_args, args.debug).await } else { self.local_run(run_args).await } @@ -379,7 +403,7 @@ impl Shuttle { mut project_args: ProjectArgs, provided_path_to_init: bool, offline: bool, - ) -> Result { + ) -> Result<()> { // Turns the template or git args (if present) to a repo+folder. let git_template = args.git_template()?; let no_git = args.no_git; @@ -691,7 +715,7 @@ impl Shuttle { } } - Ok(CommandOutcome::Ok) + Ok(()) } /// true -> success/neutral. false -> try again. @@ -750,23 +774,23 @@ impl Shuttle { } /// Provide feedback on GitHub. - fn feedback(&self) -> Result { + fn feedback(&self) -> Result<()> { let _ = webbrowser::open(SHUTTLE_GH_ISSUE_URL); println!("If your browser did not open automatically, go to {SHUTTLE_GH_ISSUE_URL}"); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn account(&self) -> Result { + async fn account(&self) -> Result<()> { let client = self.client.as_ref().unwrap(); let user = client.get_current_user_beta().await?; print!("{}", user.to_string_colored()); - Ok(CommandOutcome::Ok) + Ok(()) } /// Log in with the given API key or after prompting the user for one. - async fn login(&mut self, login_args: LoginArgs, offline: bool) -> Result { + async fn login(&mut self, login_args: LoginArgs, offline: bool) -> Result<()> { let api_key_str = match login_args.api_key { Some(api_key) => api_key, None => { @@ -805,10 +829,10 @@ impl Shuttle { } } - Ok(CommandOutcome::Ok) + Ok(()) } - async fn logout(&mut self, logout_args: LogoutArgs) -> Result { + async fn logout(&mut self, logout_args: LogoutArgs) -> Result<()> { if logout_args.reset_api_key { self.reset_api_key() .await @@ -819,7 +843,7 @@ impl Shuttle { self.ctx.clear_api_key()?; println!("Successfully logged out."); - Ok(CommandOutcome::Ok) + Ok(()) } async fn reset_api_key(&self) -> Result<()> { @@ -833,7 +857,7 @@ impl Shuttle { }) } - async fn stop_beta(&self) -> Result { + async fn stop_beta(&self) -> Result<()> { let client = self.client.as_ref().unwrap(); let p = self.ctx.project_name(); let res = client.stop_service_beta(p).await?; @@ -868,10 +892,10 @@ impl Shuttle { }) .await?; - Ok(CommandOutcome::Ok) + Ok(()) } - async fn stop(&self) -> Result { + async fn stop(&self) -> Result<()> { let client = self.client.as_ref().unwrap(); let p = self.ctx.project_name(); wait_with_spinner(500, |i, pb| async move { @@ -903,20 +927,20 @@ impl Shuttle { .await .map_err(suggestions::deployment::stop_deployment_failure)?; - Ok(CommandOutcome::Ok) + Ok(()) } - fn complete(&self, shell: Shell, output: Option) -> Result { + fn complete(&self, shell: Shell, output: Option) -> Result<()> { let name = env!("CARGO_PKG_NAME"); let mut app = Command::command(); match output { Some(path) => generate(shell, &mut app, name, &mut File::create(path)?), None => generate(shell, &mut app, name, &mut stdout()), }; - Ok(CommandOutcome::Ok) + Ok(()) } - fn generate_manpage(&self) -> Result { + fn generate_manpage(&self) -> Result<()> { let app = ShuttleArgs::command(); let output = std::io::stdout(); let mut output_handle = output.lock(); @@ -942,19 +966,19 @@ impl Shuttle { } } - Ok(CommandOutcome::Ok) + Ok(()) } - async fn status(&self) -> Result { + async fn status(&self) -> Result<()> { let client = self.client.as_ref().unwrap(); let summary = client.get_service(self.ctx.project_name()).await?; println!("{summary}"); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn clean(&self) -> Result { + async fn clean(&self) -> Result<()> { let client = self.client.as_ref().unwrap(); let message = client .clean_project(self.ctx.project_name()) @@ -969,13 +993,13 @@ impl Shuttle { })?; println!("{message}"); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn logs_beta(&self, args: LogsArgs) -> Result { + async fn logs_beta(&self, args: LogsArgs) -> Result<()> { if args.follow { eprintln!("Streamed logs are not yet supported on beta."); - return Ok(CommandOutcome::Ok); + return Ok(()); } // TODO: implement logs range let client = self.client.as_ref().unwrap(); @@ -991,7 +1015,7 @@ impl Shuttle { .deployments; let Some(most_recent) = deployments.first() else { println!("No deployments found"); - return Ok(CommandOutcome::Ok); + return Ok(()); }; eprintln!("Getting logs from: {}", most_recent.id); most_recent.id.to_string() @@ -1000,7 +1024,7 @@ impl Shuttle { } else { let Some(current) = client.get_current_deployment_beta(proj_name).await? else { println!("No deployments found"); - return Ok(CommandOutcome::Ok); + return Ok(()); }; eprintln!("Getting logs from: {}", current.id); current.id @@ -1015,10 +1039,10 @@ impl Shuttle { } } - Ok(CommandOutcome::Ok) + Ok(()) } - async fn logs(&self, args: LogsArgs) -> Result { + async fn logs(&self, args: LogsArgs) -> Result<()> { let range = match (args.head, args.tail, args.all) { (Some(num), _, _) => LogsRange::Head(num), (_, Some(num), _) => LogsRange::Tail(num), @@ -1107,19 +1131,14 @@ impl Shuttle { } } - Ok(CommandOutcome::Ok) + Ok(()) } - async fn deployments_list( - &self, - page: u32, - limit: u32, - table_args: TableArgs, - ) -> Result { + async fn deployments_list(&self, page: u32, limit: u32, table_args: TableArgs) -> Result<()> { let client = self.client.as_ref().unwrap(); if limit == 0 { println!(); - return Ok(CommandOutcome::Ok); + return Ok(()); } let limit = limit + 1; @@ -1172,10 +1191,10 @@ impl Shuttle { println!("Run `cargo shuttle logs ` to get logs for a given deployment."); } - Ok(CommandOutcome::Ok) + Ok(()) } - async fn deployment_get(&self, deployment_id: Option) -> Result { + async fn deployment_get(&self, deployment_id: Option) -> Result<()> { let client = self.client.as_ref().unwrap(); if self.beta { @@ -1191,7 +1210,7 @@ impl Shuttle { .await?; let Some(d) = d else { println!("No deployment found"); - return Ok(CommandOutcome::Ok); + return Ok(()); }; Ok(d) } @@ -1212,14 +1231,10 @@ impl Shuttle { println!("{deployment}"); } - Ok(CommandOutcome::Ok) + Ok(()) } - async fn resources_list( - &self, - table_args: TableArgs, - show_secrets: bool, - ) -> Result { + async fn resources_list(&self, table_args: TableArgs, show_secrets: bool) -> Result<()> { let client = self.client.as_ref().unwrap(); let resources = client .get_service_resources(self.ctx.project_name()) @@ -1234,14 +1249,10 @@ impl Shuttle { println!("{table}"); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn resources_list_beta( - &self, - table_args: TableArgs, - show_secrets: bool, - ) -> Result { + async fn resources_list_beta(&self, table_args: TableArgs, show_secrets: bool) -> Result<()> { let client = self.client.as_ref().unwrap(); let resources = client .get_service_resources_beta(self.ctx.project_name()) @@ -1256,14 +1267,14 @@ impl Shuttle { println!("{table}"); - Ok(CommandOutcome::Ok) + Ok(()) } async fn resource_delete( &self, resource_type: &resource::Type, no_confirm: bool, - ) -> Result { + ) -> Result<()> { let client = self.client.as_ref().unwrap(); if !no_confirm { @@ -1285,7 +1296,7 @@ impl Shuttle { .interact() .unwrap() { - return Ok(CommandOutcome::Ok); + return Ok(()); } } @@ -1311,10 +1322,10 @@ impl Shuttle { .yellow(), ); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn list_certificates(&self, table_args: TableArgs) -> Result { + async fn list_certificates(&self, table_args: TableArgs) -> Result<()> { let client = self.client.as_ref().unwrap(); let certs = client .list_certificates_beta(self.ctx.project_name()) @@ -1324,9 +1335,9 @@ impl Shuttle { let table = get_certificates_table_beta(certs.as_ref(), table_args.raw); println!("{}", table); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn add_certificate(&self, domain: String) -> Result { + async fn add_certificate(&self, domain: String) -> Result<()> { let client = self.client.as_ref().unwrap(); let cert = client .add_certificate_beta(self.ctx.project_name(), domain.clone()) @@ -1334,9 +1345,9 @@ impl Shuttle { println!("Added certificate for {}", cert.subject); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn delete_certificate(&self, domain: String, no_confirm: bool) -> Result { + async fn delete_certificate(&self, domain: String, no_confirm: bool) -> Result<()> { let client = self.client.as_ref().unwrap(); if !no_confirm { @@ -1357,7 +1368,7 @@ impl Shuttle { .interact() .unwrap() { - return Ok(CommandOutcome::Ok); + return Ok(()); } } @@ -1366,7 +1377,7 @@ impl Shuttle { .await?; println!("{msg}"); - Ok(CommandOutcome::Ok) + Ok(()) } fn get_secrets(run_args: &RunArgs, service: &BuiltService) -> Result> { @@ -1788,7 +1799,7 @@ impl Shuttle { } #[cfg(target_family = "unix")] - async fn local_run(&self, mut run_args: RunArgs) -> Result { + async fn local_run(&self, mut run_args: RunArgs) -> Result<()> { let services = self.pre_local_run(&run_args).await?; let mut sigterm_notif = @@ -1846,7 +1857,7 @@ impl Shuttle { trace!(status = ?err, "stopping the runtime errored out"); }); } - return Ok(CommandOutcome::Ok); + return Ok(()); } // If no signal was received during runtimes initialization, then we must handle each runtime until @@ -1898,10 +1909,10 @@ impl Shuttle { Run `cargo shuttle deploy` to deploy your Shuttle service." ); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn local_run_beta(&self, mut run_args: RunArgs) -> Result { + async fn local_run_beta(&self, mut run_args: RunArgs, debug: bool) -> Result<()> { let project_name = self.ctx.project_name().to_owned(); let services = self.pre_local_run(&run_args).await?; let service = services @@ -1958,6 +1969,14 @@ impl Shuttle { "SHUTTLE_API", format!("http://127.0.0.1:{}", api_port).as_str(), ), + ( + "RUST_LOG", + if debug { + "info,shuttle=trace,reqwest=debug" + } else { + "info" + }, + ), ]) .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) @@ -2076,9 +2095,7 @@ impl Shuttle { } } - println!("Run `cargo shuttle deploy` to deploy your Shuttle service."); - - Ok(CommandOutcome::Ok) + Ok(()) } #[cfg(target_family = "windows")] @@ -2122,7 +2139,7 @@ impl Shuttle { } #[cfg(target_family = "windows")] - async fn local_run(&self, mut run_args: RunArgs) -> Result { + async fn local_run(&self, mut run_args: RunArgs) -> Result<()> { let services = self.pre_local_run(&run_args).await?; // Start all the services. @@ -2160,7 +2177,7 @@ impl Shuttle { trace!(status = ?err, "stopping the runtime errored out"); }); } - return Ok(CommandOutcome::Ok); + return Ok(()); } // If no signal was received during runtimes initialization, then we must handle each runtime until @@ -2203,10 +2220,10 @@ impl Shuttle { Run `cargo shuttle deploy` to deploy your Shuttle service." ); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn deploy(&mut self, args: DeployArgs) -> Result { + async fn deploy(&mut self, args: DeployArgs) -> Result<()> { let client = self.client.as_ref().unwrap(); let working_directory = self.ctx.working_directory(); let manifest_path = working_directory.join("Cargo.toml"); @@ -2258,7 +2275,7 @@ impl Shuttle { .await?; println!("{}", deployment.to_string_colored()); - return Ok(CommandOutcome::Ok); + return Ok(()); } } @@ -2347,7 +2364,7 @@ impl Shuttle { eprintln!("Writing archive to {}", path.display()); std::fs::write(path, archive).context("writing archive")?; - return Ok(CommandOutcome::Ok); + return Ok(()); } if !self.beta && archive.len() > CREATE_SERVICE_BODY_LIMIT { @@ -2384,7 +2401,7 @@ impl Shuttle { if args.no_follow { println!("{}", deployment.to_string_colored()); - return Ok(CommandOutcome::Ok); + return Ok(()); } let id = &deployment.id; @@ -2422,7 +2439,7 @@ impl Shuttle { }) .await?; - return Ok(CommandOutcome::Ok); + return Ok(()); } deployment_req.data = archive; @@ -2540,7 +2557,7 @@ impl Shuttle { println!(); println!("cargo shuttle logs {}", &deployment.id); - return Ok(CommandOutcome::DeploymentFailure); + bail!(""); } if DEPLOYER_END_MESSAGES_GOOD .iter() @@ -2620,7 +2637,7 @@ impl Shuttle { println!(); println!("cargo shuttle logs {}", &deployment.id); - return Ok(CommandOutcome::DeploymentFailure); + bail!(""); } let service = client.get_service(self.ctx.project_name()).await?; @@ -2631,10 +2648,10 @@ impl Shuttle { println!("{resources}{service}"); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn project_start(&self, idle_minutes: u64) -> Result { + async fn project_start(&self, idle_minutes: u64) -> Result<()> { let client = self.client.as_ref().unwrap(); let config = &project::Config { idle_minutes }; @@ -2685,20 +2702,20 @@ impl Shuttle { println!("Run `cargo shuttle deploy --allow-dirty` to deploy your Shuttle service."); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn project_start_beta(&self) -> Result { + async fn project_start_beta(&self) -> Result<()> { let client = self.client.as_ref().unwrap(); let name = self.ctx.project_name(); let project = client.create_project_beta(name).await?; println!("Created project '{}' with id {}", project.name, project.id); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn project_restart(&self, idle_minutes: u64) -> Result { + async fn project_restart(&self, idle_minutes: u64) -> Result<()> { self.project_stop() .await .map_err(suggestions::project::project_restart_failure)?; @@ -2706,10 +2723,10 @@ impl Shuttle { .await .map_err(suggestions::project::project_restart_failure)?; - Ok(CommandOutcome::Ok) + Ok(()) } - async fn projects_list(&self, table_args: TableArgs) -> Result { + async fn projects_list(&self, table_args: TableArgs) -> Result<()> { let client = self.client.as_ref().unwrap(); let projects_table = if self.beta { @@ -2747,10 +2764,10 @@ impl Shuttle { } } - Ok(CommandOutcome::Ok) + Ok(()) } - async fn project_status(&self, follow: bool) -> Result { + async fn project_status(&self, follow: bool) -> Result<()> { let client = self.client.as_ref().unwrap(); if follow { let p = self.ctx.project_name(); @@ -2797,17 +2814,17 @@ impl Shuttle { ); } - Ok(CommandOutcome::Ok) + Ok(()) } - async fn project_status_beta(&self) -> Result { + async fn project_status_beta(&self) -> Result<()> { let client = self.client.as_ref().unwrap(); let project = client.get_project_beta(self.ctx.project_name()).await?; print!("{}", project.to_string_colored()); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn project_stop(&self) -> Result { + async fn project_stop(&self) -> Result<()> { let client = self.client.as_ref().unwrap(); let p = self.ctx.project_name(); @@ -2846,10 +2863,10 @@ impl Shuttle { })?; println!("Run `cargo shuttle project start` to recreate project environment on Shuttle."); - Ok(CommandOutcome::Ok) + Ok(()) } - async fn project_delete(&self, no_confirm: bool) -> Result { + async fn project_delete(&self, no_confirm: bool) -> Result<()> { let client = self.client.as_ref().unwrap(); if !no_confirm { @@ -2894,7 +2911,7 @@ impl Shuttle { .interact() .unwrap() { - return Ok(CommandOutcome::Ok); + return Ok(()); } } @@ -2916,7 +2933,7 @@ impl Shuttle { println!("Deleted project"); - Ok(CommandOutcome::Ok) + Ok(()) } fn make_archive(&self, secrets_file: Option, zip: bool) -> Result> { @@ -3021,7 +3038,7 @@ impl Shuttle { // windows things let name = name.to_str().expect("valid filename").replace('\\', "/"); - zip.start_file(name, FileOptions::default())?; + zip.start_file(name, FileOptions::<()>::default())?; let mut b = Vec::new(); File::open(path)?.read_to_end(&mut b)?; @@ -3219,12 +3236,6 @@ fn create_spinner() -> ProgressBar { pb } -#[derive(PartialEq)] -pub enum CommandOutcome { - Ok, - DeploymentFailure, -} - #[cfg(test)] mod tests { use flate2::read::GzDecoder; @@ -3250,7 +3261,7 @@ mod tests { deploy_args: DeployArgs, zip: bool, ) -> Vec { - let mut shuttle = Shuttle::new().unwrap(); + let mut shuttle = Shuttle::new(crate::Binary::CargoShuttle).unwrap(); shuttle.load_project(&project_args).unwrap(); let archive = shuttle @@ -3374,7 +3385,7 @@ mod tests { name: None, }; - let mut shuttle = Shuttle::new().unwrap(); + let mut shuttle = Shuttle::new(crate::Binary::CargoShuttle).unwrap(); shuttle.load_project(&project_args).unwrap(); assert_eq!( diff --git a/cargo-shuttle/src/main.rs b/cargo-shuttle/src/main.rs deleted file mode 100644 index eea269103..000000000 --- a/cargo-shuttle/src/main.rs +++ /dev/null @@ -1,32 +0,0 @@ -use anyhow::Result; -use cargo_shuttle::{parse_args, CommandOutcome, Shuttle}; -use tracing_subscriber::{fmt, prelude::*, registry, EnvFilter}; - -#[tokio::main(flavor = "multi_thread")] -async fn main() -> Result<()> { - let (args, provided_path_to_init) = parse_args(); - - registry() - .with(fmt::layer()) - .with( - // let user set RUST_LOG if they want to - EnvFilter::try_from_default_env().unwrap_or_else(|_| { - if args.debug { - EnvFilter::new("info,cargo_shuttle=trace,shuttle=trace") - } else { - EnvFilter::default() - } - }), - ) - .init(); - - let outcome = Shuttle::new()?.run(args, provided_path_to_init).await?; - - if outcome == CommandOutcome::DeploymentFailure { - // Deployment failure results in a shell error exit code being returned (this allows - // chaining of commands with `&&` for example to fail at the first deployment failure). - std::process::exit(1); - } - - Ok(()) -} diff --git a/cargo-shuttle/tests/integration/init.rs b/cargo-shuttle/tests/integration/init.rs index 74a1ec74b..92ec3865b 100644 --- a/cargo-shuttle/tests/integration/init.rs +++ b/cargo-shuttle/tests/integration/init.rs @@ -29,7 +29,11 @@ async fn non_interactive_basic_init() { "none", temp_dir_path.to_str().unwrap(), ]); - Shuttle::new().unwrap().run(args, true).await.unwrap(); + Shuttle::new(cargo_shuttle::Binary::CargoShuttle) + .unwrap() + .run(args, true) + .await + .unwrap(); let cargo_toml = read_to_string(temp_dir_path.join("Cargo.toml")).unwrap(); assert!(cargo_toml.contains("name = \"my-project\"")); @@ -57,7 +61,11 @@ async fn non_interactive_rocket_init() { "rocket", temp_dir_path.to_str().unwrap(), ]); - Shuttle::new().unwrap().run(args, true).await.unwrap(); + Shuttle::new(cargo_shuttle::Binary::CargoShuttle) + .unwrap() + .run(args, true) + .await + .unwrap(); assert_valid_rocket_project(temp_dir_path.as_path(), "my-project"); @@ -85,7 +93,11 @@ async fn non_interactive_init_with_from_url() { "tower/hello-world", temp_dir_path.to_str().unwrap(), ]); - Shuttle::new().unwrap().run(args, true).await.unwrap(); + Shuttle::new(cargo_shuttle::Binary::CargoShuttle) + .unwrap() + .run(args, true) + .await + .unwrap(); let cargo_toml = read_to_string(temp_dir_path.join("Cargo.toml")).unwrap(); assert!(cargo_toml.contains("name = \"my-project\"")); @@ -115,7 +127,11 @@ async fn non_interactive_init_with_from_gh() { "tower/hello-world", temp_dir_path.to_str().unwrap(), ]); - Shuttle::new().unwrap().run(args, true).await.unwrap(); + Shuttle::new(cargo_shuttle::Binary::CargoShuttle) + .unwrap() + .run(args, true) + .await + .unwrap(); let cargo_toml = read_to_string(temp_dir_path.join("Cargo.toml")).unwrap(); assert!(cargo_toml.contains("name = \"my-project\"")); @@ -145,7 +161,11 @@ async fn non_interactive_init_with_from_repo_name() { "tower/hello-world", temp_dir_path.to_str().unwrap(), ]); - Shuttle::new().unwrap().run(args, true).await.unwrap(); + Shuttle::new(cargo_shuttle::Binary::CargoShuttle) + .unwrap() + .run(args, true) + .await + .unwrap(); let cargo_toml = read_to_string(temp_dir_path.join("Cargo.toml")).unwrap(); assert!(cargo_toml.contains("name = \"my-project\"")); @@ -175,7 +195,11 @@ async fn non_interactive_init_with_from_local_path() { "tower/hello-world", temp_dir_path.to_str().unwrap(), ]); - Shuttle::new().unwrap().run(args, true).await.unwrap(); + Shuttle::new(cargo_shuttle::Binary::CargoShuttle) + .unwrap() + .run(args, true) + .await + .unwrap(); let cargo_toml = read_to_string(temp_dir_path.join("Cargo.toml")).unwrap(); assert!(cargo_toml.contains("name = \"my-project\"")); @@ -205,7 +229,11 @@ async fn non_interactive_init_from_local_path_with_workspace() { "rocket/workspace", temp_dir_path.to_str().unwrap(), ]); - Shuttle::new().unwrap().run(args, true).await.unwrap(); + Shuttle::new(cargo_shuttle::Binary::CargoShuttle) + .unwrap() + .run(args, true) + .await + .unwrap(); let cargo_toml = read_to_string(temp_dir_path.join("Cargo.toml")).unwrap(); assert!(!cargo_toml.contains("name = ")); diff --git a/cargo-shuttle/tests/integration/main.rs b/cargo-shuttle/tests/integration/main.rs index 60516f6a7..3fa1d63aa 100644 --- a/cargo-shuttle/tests/integration/main.rs +++ b/cargo-shuttle/tests/integration/main.rs @@ -1,17 +1,14 @@ mod init; mod run; -use cargo_shuttle::{Command, CommandOutcome, ProjectArgs, Shuttle, ShuttleArgs}; +use cargo_shuttle::{Command, ProjectArgs, Shuttle, ShuttleArgs}; use std::path::Path; /// creates a `cargo-shuttle` run instance with some reasonable defaults set. -async fn cargo_shuttle_command( - cmd: Command, - working_directory: &str, -) -> anyhow::Result { +async fn cargo_shuttle_command(cmd: Command, working_directory: &str) -> anyhow::Result<()> { let working_directory = Path::new(working_directory).to_path_buf(); - Shuttle::new() + Shuttle::new(cargo_shuttle::Binary::CargoShuttle) .unwrap() .run( ShuttleArgs { diff --git a/common-tests/src/cargo_shuttle.rs b/common-tests/src/cargo_shuttle.rs index 9414f6142..c496531b9 100644 --- a/common-tests/src/cargo_shuttle.rs +++ b/common-tests/src/cargo_shuttle.rs @@ -13,7 +13,7 @@ pub async fn cargo_shuttle_run(working_directory: &str, external: bool) -> Strin "Did not find directory: {} !!! because {:?}", working_directory, e ); - tokio::time::sleep(tokio::time::Duration::from_millis(500)).await; + sleep(Duration::from_millis(500)).await; canonicalize(working_directory).unwrap() } }; @@ -34,20 +34,22 @@ pub async fn cargo_shuttle_run(working_directory: &str, external: bool) -> Strin secret_args: Default::default(), }; - let runner = Shuttle::new().unwrap().run( - ShuttleArgs { - api_url: Some("http://shuttle.invalid:80".to_string()), - project_args: ProjectArgs { - working_directory: working_directory.clone(), - name: None, + let runner = Shuttle::new(cargo_shuttle::Binary::CargoShuttle) + .unwrap() + .run( + ShuttleArgs { + api_url: Some("http://shuttle.invalid:80".to_string()), + project_args: ProjectArgs { + working_directory: working_directory.clone(), + name: None, + }, + offline: false, + debug: false, + beta: false, + cmd: Command::Run(run_args), }, - offline: false, - debug: false, - beta: false, - cmd: Command::Run(run_args), - }, - false, - ); + false, + ); tokio::spawn({ let working_directory = working_directory.clone();