Remove cargo and xtask resources The codebase has been converted to use bazel as the build system. Remove no-longer-needed cargo resources and xtasks. Fixes: #105 Signed-off-by: Chris Frantz <cfrantz@google.com>
diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 97ed374..0000000 --- a/.cargo/config.toml +++ /dev/null
@@ -1,5 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[alias] -xtask = "run --package xtask --"
diff --git a/.gitignore b/.gitignore index 645089c..913014a 100644 --- a/.gitignore +++ b/.gitignore
@@ -34,14 +34,7 @@ pw_console-*logs.txt .pw_console.user.yaml -# Rust build artifacts -/target/ -**/target/ -# Generated by Cargo -# will have compiled files and executables -debug/ -target/ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html @@ -106,14 +99,6 @@ .env.production .env.local -# Rust-specific -# Generated by rustdoc -doc/ - -# Generated by mdbook -book/ -target/book/ - # Backup files *.bak *.backup @@ -122,9 +107,6 @@ *.tmp *.temp -# Distribution -dist/ -target/dist/ # Local configuration .cargo/config
diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index e909a71..0000000 --- a/Cargo.lock +++ /dev/null
@@ -1,847 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "aead" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" -dependencies = [ - "crypto-common", - "generic-array", -] - -[[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 = "aes-gcm" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - -[[package]] -name = "bare-metal" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" -dependencies = [ - "rustc_version", -] - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "bitfield" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "cfg-if" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" - -[[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 = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "cortex-m" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" -dependencies = [ - "bare-metal", - "bitfield", - "embedded-hal 0.2.7", - "volatile-register", -] - -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - -[[package]] -name = "der" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "ecdsa" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest", - "elliptic-curve", - "rfc6979", - "signature", -] - -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest", - "ff", - "generic-array", - "group", - "rand_core 0.6.4", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "embedded-hal" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" -dependencies = [ - "nb 0.1.3", - "void", -] - -[[package]] -name = "embedded-hal" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" - -[[package]] -name = "embedded-hal-async" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" -dependencies = [ - "embedded-hal 1.0.0", -] - -[[package]] -name = "embedded-hal-nb" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" -dependencies = [ - "embedded-hal 1.0.0", - "nb 1.1.0", -] - -[[package]] -name = "ff" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" -dependencies = [ - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "generic-array" -version = "0.14.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] -name = "ghash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" -dependencies = [ - "opaque-debug", - "polyval", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "hash32" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" -dependencies = [ - "byteorder", -] - -[[package]] -name = "heapless" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af2455f757db2b292a9b1768c4b70186d443bcb3b316252d6b540aec1cd89ed" -dependencies = [ - "hash32", - "stable_deref_trait", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "inout" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" -dependencies = [ - "generic-array", -] - -[[package]] -name = "k256" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "sha2", -] - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "libc" -version = "0.2.177" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" - -[[package]] -name = "nb" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" -dependencies = [ - "nb 1.1.0", -] - -[[package]] -name = "nb" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" - -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - -[[package]] -name = "openprot" -version = "0.1.0" - -[[package]] -name = "openprot-hal-async" -version = "0.1.0" -dependencies = [ - "embedded-hal-async", -] - -[[package]] -name = "openprot-hal-blocking" -version = "0.1.0" -dependencies = [ - "embedded-hal 1.0.0", - "rand_core 0.9.3", - "subtle", - "zerocopy", - "zeroize", -] - -[[package]] -name = "openprot-hal-nb" -version = "0.1.0" -dependencies = [ - "embedded-hal 1.0.0", - "embedded-hal-nb", - "nb 1.1.0", - "openprot-hal-blocking", -] - -[[package]] -name = "openprot-platform-impl-hubris" -version = "0.1.0" -dependencies = [ - "openprot-platform-traits-hubris", -] - -[[package]] -name = "openprot-platform-linux" -version = "0.1.0" - -[[package]] -name = "openprot-platform-mock" -version = "0.1.0" -dependencies = [ - "cortex-m", - "embedded-hal 1.0.0", - "openprot-hal-blocking", -] - -[[package]] -name = "openprot-platform-tock" -version = "0.1.0" - -[[package]] -name = "openprot-platform-traits-hubris" -version = "0.1.0" -dependencies = [ - "openprot-hal-async", - "openprot-hal-blocking", - "openprot-hal-nb", -] - -[[package]] -name = "openprot-services-storage" -version = "0.1.0" - -[[package]] -name = "openprot-services-telemetry" -version = "0.1.0" - -[[package]] -name = "p256" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - -[[package]] -name = "p384" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - -[[package]] -name = "platform-rustcrypto-impl" -version = "0.1.0" -dependencies = [ - "aes", - "aes-gcm", - "cipher", - "ctr", - "heapless", - "hmac", - "k256", - "openprot-hal-blocking", - "openprot-platform-traits-hubris", - "p256", - "p384", - "rand_core 0.9.3", - "sha2", - "sha3", - "zerocopy", - "zeroize", -] - -[[package]] -name = "polyval" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "primeorder" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" -dependencies = [ - "elliptic-curve", -] - -[[package]] -name = "proc-macro2" -version = "1.0.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61789d7719defeb74ea5fe81f2fdfdbd28a803847077cecce2ff14e1472f6f1" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" - -[[package]] -name = "rand_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "subtle", - "zeroize", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "sha2" -version = "0.10.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest", - "keccak", -] - -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest", - "rand_core 0.6.4", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "2.0.105" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bc3fcb250e53458e712715cf74285c1f889686520d79294a9ef3bd7aa1fc619" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "typenum" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" - -[[package]] -name = "unicode-ident" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" - -[[package]] -name = "universal-hash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" -dependencies = [ - "crypto-common", - "subtle", -] - -[[package]] -name = "vcell" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - -[[package]] -name = "volatile-register" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" -dependencies = [ - "vcell", -] - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "xshell" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e7290c623014758632efe00737145b6867b66292c42167f2ec381eb566a373d" -dependencies = [ - "xshell-macros", -] - -[[package]] -name = "xshell-macros" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac00cd3f8ec9c1d33fb3e7958a82df6989c42d747bd326c822b1d625283547" - -[[package]] -name = "xtask" -version = "0.1.0" -dependencies = [ - "walkdir", - "xshell", -] - -[[package]] -name = "zerocopy" -version = "0.8.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zeroize" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" -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", -]
diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index bf42416..0000000 --- a/Cargo.toml +++ /dev/null
@@ -1,37 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[workspace] -members = [ - "openprot", - "xtask", - "hal/blocking", - "hal/async", - "hal/nb", - "platform/traits/hubris", - "platform/impls/baremetal/mock", - "platform/impls/linux", - "platform/impls/tock", - "platform/impls/hubris", - "platform/impls/rustcrypto", - "services/telemetry", - "services/storage", -] -exclude = [ - "third_party/crates_io" -] -resolver = "2" - -[workspace.package] -license = "Apache-2.0" -repository = "https://github.com/rusty1968/openprot" -edition = "2021" - -[workspace.dependencies] -zerocopy = { version = "0.8", features = ["derive"] } -zeroize = { version = "1.8", default-features = false, features = ["derive"] } -subtle = { version = "2", default-features = false } -# Pin to match Hubris ecosystem -rand_core = { version = "0.9", default-features = false } -embedded-hal = "1.0" -heapless = { version = "0.9", default-features = false }
diff --git a/deny.toml b/deny.toml deleted file mode 100644 index 95d6f0c..0000000 --- a/deny.toml +++ /dev/null
@@ -1,33 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -# cargo-deny configuration file -# Minimal configuration for OpenPRoT security checks - -[advisories] -version = 2 -ignore = [] - -[licenses] -version = 2 -allow = [ - "MIT", - "Apache-2.0", - "Apache-2.0 WITH LLVM-exception", - "BSD-2-Clause", - "BSD-3-Clause", - "ISC", - "Unicode-DFS-2016", - "Unicode-3.0", - "CC0-1.0", -] - -[bans] -multiple-versions = "warn" -wildcards = "allow" -deny = [] - -[sources] -unknown-registry = "warn" -unknown-git = "warn" -allow-registry = ["https://github.com/rust-lang/crates.io-index"]
diff --git a/hal/async/Cargo.toml b/hal/async/Cargo.toml deleted file mode 100644 index 2b962d8..0000000 --- a/hal/async/Cargo.toml +++ /dev/null
@@ -1,12 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot-hal-async" -version = "0.1.0" -edition = "2021" -description = "Async HAL traits for OpenPRoT" -license = "Apache-2.0" - -[dependencies] -embedded-hal-async = "1.0"
diff --git a/hal/blocking/Cargo.toml b/hal/blocking/Cargo.toml deleted file mode 100644 index 6fb3041..0000000 --- a/hal/blocking/Cargo.toml +++ /dev/null
@@ -1,16 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot-hal-blocking" -version = "0.1.0" -edition = "2021" -description = "Blocking/synchronous HAL traits for OpenPRoT" -license = "Apache-2.0" - -[dependencies] -zerocopy = { workspace = true } -zeroize = { workspace = true } -subtle = { workspace = true } -rand_core = { workspace = true } -embedded-hal = { workspace = true }
diff --git a/hal/nb/Cargo.toml b/hal/nb/Cargo.toml deleted file mode 100644 index 576929f..0000000 --- a/hal/nb/Cargo.toml +++ /dev/null
@@ -1,15 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot-hal-nb" -version = "0.1.0" -edition = "2021" -description = "Non-blocking HAL traits for OpenPRoT" -license = "Apache-2.0" - -[dependencies] -embedded-hal = "1.0" -embedded-hal-nb = "1.0" -nb = "1.0" -openprot-hal-blocking = { path = "../blocking" }
diff --git a/openprot/Cargo.toml b/openprot/Cargo.toml deleted file mode 100644 index 0950c6c..0000000 --- a/openprot/Cargo.toml +++ /dev/null
@@ -1,19 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot" -version = "0.1.0" -edition.workspace = true -license.workspace = true -repository.workspace = true - -[[bin]] -name = "openprot" -path = "src/main.rs" - -[lib] -name = "openprot" -path = "src/lib.rs" - -[dependencies]
diff --git a/platform/impls/baremetal/mock/Cargo.toml b/platform/impls/baremetal/mock/Cargo.toml deleted file mode 100644 index 964fa49..0000000 --- a/platform/impls/baremetal/mock/Cargo.toml +++ /dev/null
@@ -1,21 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot-platform-mock" -version = "0.1.0" -edition.workspace = true -license.workspace = true -repository.workspace = true -description = "Mock/stub implementation of OpenPRoT platform traits for testing" - -[features] -default = [] - -[dependencies] -# OpenPRoT HAL traits -openprot-hal-blocking = { path = "../../../../hal/blocking" } - -# Core dependencies for embedded development -cortex-m = "0.7" -embedded-hal = "1.0"
diff --git a/platform/impls/hubris/Cargo.toml b/platform/impls/hubris/Cargo.toml deleted file mode 100644 index 204c5e8..0000000 --- a/platform/impls/hubris/Cargo.toml +++ /dev/null
@@ -1,12 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot-platform-impl-hubris" -version = "0.1.0" -edition = "2021" -description = "Hubris OS platform implementation for OpenPRoT" -license = "Apache-2.0" - -[dependencies] -openprot-platform-traits-hubris = { path = "../../traits/hubris" }
diff --git a/platform/impls/linux/Cargo.toml b/platform/impls/linux/Cargo.toml deleted file mode 100644 index ed707d4..0000000 --- a/platform/impls/linux/Cargo.toml +++ /dev/null
@@ -1,11 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot-platform-linux" -version = "0.1.0" -edition = "2021" -description = "Linux platform implementation for OpenPRoT" -license = "Apache-2.0" - -[dependencies]
diff --git a/platform/impls/rustcrypto/Cargo.toml b/platform/impls/rustcrypto/Cargo.toml deleted file mode 100644 index c35f1e8..0000000 --- a/platform/impls/rustcrypto/Cargo.toml +++ /dev/null
@@ -1,37 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "platform-rustcrypto-impl" -version = "0.1.0" -license.workspace = true -repository.workspace = true -edition.workspace = true - -[dependencies] -openprot-hal-blocking = { path = "../../../hal/blocking" } -openprot-platform-traits-hubris = { path = "../../traits/hubris" } - -# RustCrypto ECDSA crates -p256 = { version = "0.13", default-features = false, features = ["ecdsa", "arithmetic"] } -p384 = { version = "0.13", default-features = false, features = ["ecdsa", "arithmetic"] } -k256 = { version = "0.13", default-features = false, features = ["ecdsa", "arithmetic"] } - -# RustCrypto digest crates -sha2 = { version = "0.10", default-features = false } -sha3 = { version = "0.10", default-features = false } - -# RustCrypto MAC crates -hmac = { version = "0.12", default-features = false } - -# RustCrypto cipher crates -aes = { version = "0.8", default-features = false } -ctr = { version = "0.9", default-features = false } -aes-gcm = { version = "0.10", default-features = false, features = ["aes"] } -cipher = { version = "0.4", default-features = false } - -# Traits and utilities -zerocopy = { workspace = true } -zeroize = { workspace = true } -rand_core = { workspace = true } -heapless = { workspace = true }
diff --git a/platform/impls/tock/Cargo.toml b/platform/impls/tock/Cargo.toml deleted file mode 100644 index 815df6e..0000000 --- a/platform/impls/tock/Cargo.toml +++ /dev/null
@@ -1,11 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot-platform-tock" -version = "0.1.0" -edition = "2021" -description = "Tock OS platform implementation for OpenPRoT" -license = "Apache-2.0" - -[dependencies]
diff --git a/platform/traits/hubris/Cargo.toml b/platform/traits/hubris/Cargo.toml deleted file mode 100644 index 67d1ed4..0000000 --- a/platform/traits/hubris/Cargo.toml +++ /dev/null
@@ -1,14 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot-platform-traits-hubris" -version = "0.1.0" -edition = "2021" -description = "Platform integration traits for OpenPRoT on Hubris" -license = "Apache-2.0" - -[dependencies] -openprot-hal-async = { path = "../../../hal/async" } -openprot-hal-blocking = { path = "../../../hal/blocking" } -openprot-hal-nb = { path = "../../../hal/nb" }
diff --git a/services/storage/Cargo.toml b/services/storage/Cargo.toml deleted file mode 100644 index 36e6a0f..0000000 --- a/services/storage/Cargo.toml +++ /dev/null
@@ -1,11 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot-services-storage" -version = "0.1.0" -edition = "2021" -description = "Persistent storage service and abstractions for OpenPRoT" -license = "Apache-2.0" - -[dependencies]
diff --git a/services/telemetry/Cargo.toml b/services/telemetry/Cargo.toml deleted file mode 100644 index 22f7d50..0000000 --- a/services/telemetry/Cargo.toml +++ /dev/null
@@ -1,11 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "openprot-services-telemetry" -version = "0.1.0" -edition = "2021" -description = "Telemetry, monitoring, and logging service for OpenPRoT" -license = "Apache-2.0" - -[dependencies]
diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml deleted file mode 100644 index 5a466c0..0000000 --- a/xtask/Cargo.toml +++ /dev/null
@@ -1,13 +0,0 @@ -# Licensed under the Apache-2.0 license -# SPDX-License-Identifier: Apache-2.0 - -[package] -name = "xtask" -version = "0.1.0" -edition.workspace = true -license.workspace = true -repository.workspace = true - -[dependencies] -xshell = "0.2" -walkdir = "2.0"
diff --git a/xtask/src/cargo_lock.rs b/xtask/src/cargo_lock.rs deleted file mode 100644 index a925fec..0000000 --- a/xtask/src/cargo_lock.rs +++ /dev/null
@@ -1,21 +0,0 @@ -// Licensed under the Apache-2.0 license -// SPDX-License-Identifier: Apache-2.0 - -use std::process::Command; - -use crate::DynError; - -pub(crate) fn cargo_lock() -> Result<(), DynError> { - println!("Checking Cargo lock"); - let status = Command::new("cargo") - .current_dir(crate::project_root()) - .args(["tree", "--locked"]) - .env("RUSTFLAGS", "-Cpanic=abort -Zpanic_abort_tests") - .stdout(std::process::Stdio::null()) - .status()?; - - if !status.success() { - return Err("cargo tree --locked failed; Please include required changes to Cargo.lock in your pull request".into()); - } - Ok(()) -}
diff --git a/xtask/src/header.rs b/xtask/src/header.rs deleted file mode 100644 index 2ffcbc0..0000000 --- a/xtask/src/header.rs +++ /dev/null
@@ -1,246 +0,0 @@ -// Licensed under the Apache-2.0 license -// SPDX-License-Identifier: Apache-2.0 - -use std::{ - fs::File, - io::{BufRead, BufReader, Error}, - path::{Path, PathBuf}, -}; -use walkdir::DirEntry; - -use crate::DynError; - -const REQUIRED_TEXT: &str = "Licensed under the Apache-2.0 license"; -const EXTENSIONS: &[&str] = &[ - "rs", "h", "c", "cpp", "cc", "toml", "sh", "py", "ld", "go", "yml", "yaml", "S", "s", -]; -const IGNORED_PATHS: &[&str] = &[ - ".github/dependabot.yml", - "target/", - "docs/book.toml", - "docs/src/", -]; -const IGNORED_DIRS: &[&str] = &[".git", "target", "out", "dist", "book"]; - -pub(crate) fn fix() -> Result<(), DynError> { - println!("Running: license header fix"); - - let project_root = crate::project_root(); - let files = find_files(&project_root, EXTENSIONS, false)?; - let mut failed = false; - - for file in files.iter() { - if check_file(file).is_err() { - println!("Fixing header in {}", remove_root(file, &project_root)); - fix_file(file)?; - } - if let Err(e) = check_file(file) { - println!("{e}"); - failed = true; - } - } - - if failed { - return Err("License header fix failed; please fix the above files manually.".into()); - } - - Ok(()) -} - -pub(crate) fn check() -> Result<(), DynError> { - println!("Running: license header check"); - - let project_root = crate::project_root(); - let files = find_files(&project_root, EXTENSIONS, false)?; - let mut failed = false; - - for file in files.iter() { - if let Err(e) = check_file(file) { - println!("{e}"); - failed = true; - } - } - - if failed { - return Err("Some files failed to have the correct license header; to fix, run \"cargo xtask header-fix\" from the repo root".into()); - } - - Ok(()) -} - -fn remove_root(path: &Path, project_root: &Path) -> String { - let root = project_root.to_str().unwrap_or_default().to_owned() + "/"; - let path = path.to_str().unwrap_or_default(); - path.strip_prefix(&root).unwrap_or(path).into() -} - -fn add_path_walkdir_error<'a>( - path: &'a Path, - project_root: &'a Path, -) -> impl Fn(walkdir::Error) -> Error + Copy + 'a { - move |e: walkdir::Error| { - let path = remove_root(path, project_root); - match e.io_error() { - Some(e) => Error::new(e.kind(), format!("{path:?}: {e}")), - None => Error::other(format!("{path:?}: {e}")), - } - } -} - -fn add_path<'a>(path: &'a Path, project_root: &'a Path) -> impl Fn(Error) -> Error + Copy + 'a { - move |e: Error| { - let path = remove_root(path, project_root); - Error::new(e.kind(), format!("{path:?}: {e}")) - } -} - -fn check_file_contents( - path: &Path, - contents: impl BufRead, - project_root: &Path, -) -> Result<(), Error> { - const N: usize = 3; - let wrap_err = add_path(path, project_root); - - for line in contents.lines().take(N) { - if line.map_err(wrap_err)?.contains(REQUIRED_TEXT) { - return Ok(()); - } - } - let path = remove_root(path, project_root); - Err(Error::other(format!( - "File {path:?} doesn't contain {REQUIRED_TEXT:?} in the first {N} lines" - ))) -} - -fn check_file(path: &Path) -> Result<(), Error> { - let project_root = crate::project_root(); - let wrap_err = add_path(path, &project_root); - check_file_contents( - path, - BufReader::new(File::open(path).map_err(wrap_err)?), - &project_root, - ) -} - -fn fix_file(path: &Path) -> Result<(), Error> { - let project_root = crate::project_root(); - let wrap_err = add_path(path, &project_root); - - let mut contents = Vec::from(match path.extension().and_then(|s| s.to_str()) { - Some("rs" | "h" | "c" | "cpp" | "cc" | "go") => format!("// {REQUIRED_TEXT}\n"), - Some("toml" | "sh" | "py" | "yaml" | "yml") => format!("# {REQUIRED_TEXT}\n"), - Some("ld" | "s" | "S") => format!("/* {REQUIRED_TEXT} */\n"), - other => { - return Err(std::io::Error::other(format!( - "Unknown extension {other:?}" - ))) - } - }); - - let mut prev_contents = std::fs::read(path).map_err(wrap_err)?; - if prev_contents.first() != Some(&b'\n') { - contents.push(b'\n'); - } - contents.append(&mut prev_contents); - std::fs::write(path, contents)?; - Ok(()) -} - -fn allow(file: &DirEntry, project_root: &Path) -> bool { - let file_path = remove_root(file.path(), project_root); - - if IGNORED_PATHS - .iter() - .any(|ignored| file_path.starts_with(ignored)) - { - return false; - } - - let file_type = file.file_type(); - if file_type.is_dir() { - if let Some(file_name) = file.file_name().to_str() { - if IGNORED_DIRS.contains(&file_name) { - return false; - } - } - } - - true -} - -pub(crate) fn find_files( - dir: &Path, - extensions: &[&str], - ignore_none: bool, -) -> Result<Vec<PathBuf>, Error> { - let mut result = vec![]; - let wrap_err = add_path_walkdir_error(dir, dir); - let walker = walkdir::WalkDir::new(dir).into_iter(); - - for file in walker.filter_entry(|f| ignore_none || allow(f, dir)) { - let file = file.map_err(wrap_err)?; - let file_path = &file.path(); - let file_type = file.file_type(); - - if let Some(Some(extension)) = file.path().extension().map(|s| s.to_str()) { - if file_type.is_file() && extensions.contains(&extension) { - result.push(file_path.into()); - } - } - } - - result.sort(); - Ok(result) -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn test_check_success() { - let project_root = PathBuf::from("/tmp"); - assert!( - check_file_contents( - Path::new("foo/bar.rs"), - "# Licensed under the Apache-2.0 license".as_bytes(), - &project_root, - ) - .is_ok(), - "Expected license check to pass for shell comment" - ); - assert!( - check_file_contents( - Path::new("foo/bar.rs"), - "/*\n * Licensed under the Apache-2.0 license\n */".as_bytes(), - &project_root, - ) - .is_ok(), - "Expected license check to pass for C-style comment" - ); - } - - #[test] - #[allow(clippy::unwrap_used)] - fn test_check_failures() { - let project_root = PathBuf::from("/tmp"); - let result = check_file_contents( - Path::new("foo/bar.rs"), - "int main()\n {\n // foobar\n".as_bytes(), - &project_root, - ); - assert!(result.is_err()); - assert_eq!( - result.unwrap_err().to_string(), - "File \"foo/bar.rs\" doesn't contain \"Licensed under the Apache-2.0 license\" in the first 3 lines" - ); - - let result = check_file_contents(Path::new("bar/foo.sh"), "".as_bytes(), &project_root); - assert!(result.is_err()); - assert_eq!( - result.unwrap_err().to_string(), - "File \"bar/foo.sh\" doesn't contain \"Licensed under the Apache-2.0 license\" in the first 3 lines" - ); - } -}
diff --git a/xtask/src/main.rs b/xtask/src/main.rs deleted file mode 100644 index 303a59a..0000000 --- a/xtask/src/main.rs +++ /dev/null
@@ -1,197 +0,0 @@ -// Licensed under the Apache-2.0 license -// SPDX-License-Identifier: Apache-2.0 - -use std::{ - env, - path::{Path, PathBuf}, -}; - -use xshell::{cmd, Shell}; - -mod cargo_lock; -mod header; -mod precheckin; - -type DynError = Box<dyn std::error::Error>; - -fn main() { - if let Err(e) = try_main() { - eprintln!("{e}"); - std::process::exit(-1); - } -} - -fn try_main() -> Result<(), DynError> { - // nosemgrep: rust.lang.security.args.args - let task = env::args().nth(1); - match task.as_deref() { - Some("build") => build()?, - Some("test") => test()?, - Some("check") => check()?, - Some("clippy") => clippy()?, - Some("fmt") => fmt()?, - Some("clean") => clean()?, - Some("dist") => dist()?, - Some("deny") => cargo_deny()?, - Some("cargo-lock") => cargo_lock::cargo_lock()?, - Some("precheckin") => precheckin::precheckin()?, - Some("header-check") => header::check()?, - Some("header-fix") => header::fix()?, - _ => print_help(), - } - Ok(()) -} - -fn print_help() { - eprintln!( - "Tasks: - -build Build the project -test Run all tests -check Run cargo check -clippy Run clippy lints -fmt Format code with rustfmt -clean Clean build artifacts -dist Build a distribution (release build) -deny Run cargo deny checks (licenses, advisories, bans) -cargo-lock Manage Cargo.lock file -precheckin Run all pre-checkin validation checks -header-check Check license headers in source files -header-fix Fix missing license headers in source files -" - ) -} - -fn build() -> Result<(), DynError> { - let sh = Shell::new()?; - sh.change_dir(project_root()); - - cmd!(sh, "cargo build").run()?; - - Ok(()) -} - -fn test() -> Result<(), DynError> { - let sh = Shell::new()?; - sh.change_dir(project_root()); - - cmd!(sh, "cargo test").run()?; - - Ok(()) -} - -fn check() -> Result<(), DynError> { - let sh = Shell::new()?; - sh.change_dir(project_root()); - - cmd!(sh, "cargo check").run()?; - - Ok(()) -} - -fn clippy() -> Result<(), DynError> { - let sh = Shell::new()?; - sh.change_dir(project_root()); - - cmd!(sh, "cargo clippy -- -D warnings").run()?; - - Ok(()) -} - -fn cargo_deny() -> Result<(), DynError> { - let sh = Shell::new()?; - sh.change_dir(project_root()); - - // Check if specific subcommand is passed - // NOTE: This is a development tool, not security-critical code - #[allow(clippy::disallowed_methods)] // Allow env::args() for CLI parsing in dev tools - // nosemgrep: rust.lang.security.args.args - let args: Vec<String> = env::args().collect(); - if args.len() > 2 { - if let Some(subcommand) = args.get(2) { - match subcommand.as_str() { - "licenses" => cmd!(sh, "cargo deny check licenses").run()?, - "advisories" => cmd!(sh, "cargo deny check advisories").run()?, - "bans" => cmd!(sh, "cargo deny check bans").run()?, - "sources" => cmd!(sh, "cargo deny check sources").run()?, - _ => { - eprintln!("Unknown deny subcommand: {subcommand}"); - eprintln!("Available: licenses, advisories, bans, sources"); - std::process::exit(1); - } - } - } - } else { - // Run all checks by default - cmd!(sh, "cargo deny check").run()?; - } - - Ok(()) -} - -fn fmt() -> Result<(), DynError> { - let sh = Shell::new()?; - sh.change_dir(project_root()); - - // Check if --check flag is passed - // NOTE: This is a development tool, not security-critical code - #[allow(clippy::disallowed_methods)] // Allow env::args() for CLI parsing in dev tools - // nosemgrep: rust.lang.security.args.args - let args: Vec<String> = env::args().collect(); - if args.len() > 2 && args.get(2).map(|s| s == "--check").unwrap_or(false) { - cmd!(sh, "cargo fmt -- --check").run()?; - } else { - cmd!(sh, "cargo fmt").run()?; - } - - Ok(()) -} - -fn clean() -> Result<(), DynError> { - let sh = Shell::new()?; - sh.change_dir(project_root()); - - cmd!(sh, "cargo clean").run()?; - - Ok(()) -} - -fn dist() -> Result<(), DynError> { - let sh = Shell::new()?; - sh.change_dir(project_root()); - - // Clean first - cmd!(sh, "cargo clean").run()?; - - // Build release - cmd!(sh, "cargo build --release").run()?; - - // Create dist directory - let dist_dir = dist_dir(); - if dist_dir.exists() { - sh.remove_path(&dist_dir)?; - } - sh.create_dir(&dist_dir)?; - - // Copy binary to dist - let binary_name = "openprot"; - let src = project_root().join("target/release").join(binary_name); - let dst = dist_dir.join(binary_name); - sh.copy_file(&src, &dst)?; - - println!("Distribution created in: {}", dist_dir.display()); - - Ok(()) -} - -fn project_root() -> PathBuf { - Path::new(&env!("CARGO_MANIFEST_DIR")) - .ancestors() - .nth(1) - .map(|p| p.to_path_buf()) - .unwrap_or_else(|| PathBuf::from(".")) -} - -fn dist_dir() -> PathBuf { - project_root().join("target/dist") -}
diff --git a/xtask/src/precheckin.rs b/xtask/src/precheckin.rs deleted file mode 100644 index 567d22d..0000000 --- a/xtask/src/precheckin.rs +++ /dev/null
@@ -1,39 +0,0 @@ -// Licensed under the Apache-2.0 license -// SPDX-License-Identifier: Apache-2.0 - -use crate::DynError; - -pub(crate) fn precheckin() -> Result<(), DynError> { - println!("Running pre-checkin validation..."); - - // Check Cargo.lock consistency - println!("Checking Cargo.lock..."); - crate::cargo_lock::cargo_lock()?; - - // Format code - println!("Checking code formatting..."); - crate::fmt()?; - - // Run clippy lints - println!("Running clippy lints..."); - crate::clippy()?; - - // Check license headers - println!("Checking license headers..."); - crate::header::check()?; - - // Run tests - println!("Running tests..."); - crate::test()?; - - // Run cargo check - println!("Running cargo check..."); - crate::check()?; - - // Build the project - println!("Building project..."); - crate::build()?; - - println!("✅ All pre-checkin checks passed!"); - Ok(()) -}