diff --git a/.cargo/config.toml b/.cargo/config.toml index e821c83737..9275749986 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,5 +1,7 @@ [alias] xtask = "run --package xtask --" +metrics = "run --package xtask -- metrics" +metrics-sql = "run --package xtask --features=sql -- metrics" [target.x86_64-unknown-linux-gnu] rustflags = ["-C", "link-arg=-fuse-ld=lld"] diff --git a/.github/workflows/metrics.yml b/.github/workflows/metrics.yml index 3bfe11537f..f32c73ed65 100644 --- a/.github/workflows/metrics.yml +++ b/.github/workflows/metrics.yml @@ -2,8 +2,9 @@ name: Metrics on: push: - branches: - - master + branches: [ master ] + pull_request: + branches: [ master ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -16,17 +17,20 @@ jobs: metrics: name: Metrics runs-on: ubuntu-latest + container: ghcr.io/plc-lang/rust-llvm:latest steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - ref: master + - uses: actions/checkout@v3 - - name: Collect metrics + - name: Collect metrics (Git) + shell: bash + if: github.ref_name == 'master' run: | - IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$IMAGE_VERSION - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - docker pull $IMAGE_ID - ./scripts/build.sh --metrics --container --container-name=$IMAGE_ID --ci + cargo metrics --reporter=git + + - name: Collect metrics (Local) + shell: bash + if: github.ref_name != 'master' + run: | + git config --global --add safe.directory /__w/rusty/rusty && + cargo metrics diff --git a/.gitignore b/.gitignore index d11b59f723..a9fe45999f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ *.o *.bc *.a -*.elf \ No newline at end of file +*.elf diff --git a/Cargo.lock b/Cargo.lock index bc4df9b3cf..f9c5006baf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,18 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "1.0.2" @@ -11,6 +23,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56fc6cf8dc8c4158eed8649f9b8b0ea1518eb62b544fe9490d66fa0b349eafe9" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -26,12 +44,177 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" + +[[package]] +name = "anstyle-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] +name = "anstyle-wincon" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +dependencies = [ + "anstyle", + "windows-sys 0.48.0", +] + [[package]] name = "anyhow" version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +[[package]] +name = "async-channel" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb" +dependencies = [ + "async-lock", + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "slab", +] + +[[package]] +name = "async-global-executor" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +dependencies = [ + "async-channel", + "async-executor", + "async-io", + "async-lock", + "blocking", + "futures-lite", + "once_cell", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock", + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-lite", + "log", + "parking", + "polling", + "rustix 0.37.22", + "slab", + "socket2", + "waker-fn", +] + +[[package]] +name = "async-lock" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-std" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d" +dependencies = [ + "async-channel", + "async-global-executor", + "async-io", + "async-lock", + "crossbeam-utils", + "futures-channel", + "futures-core", + "futures-io", + "futures-lite", + "gloo-timers", + "kv-log-macro", + "log", + "memchr", + "once_cell", + "pin-project-lite", + "pin-utils", + "slab", + "wasm-bindgen-futures", +] + +[[package]] +name = "async-task" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae" + +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[package]] +name = "atomic-waker" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3" + [[package]] name = "atty" version = "0.2.14" @@ -49,6 +232,18 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "base64" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "beef" version = "0.5.2" @@ -61,12 +256,57 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +dependencies = [ + "serde", +] + +[[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 = "blocking" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "atomic-waker", + "fastrand", + "futures-lite", + "log", +] + [[package]] name = "bumpalo" version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + [[package]] name = "cc" version = "1.0.79" @@ -101,16 +341,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", - "bitflags", - "clap_derive", - "clap_lex", - "indexmap", + "bitflags 1.3.2", + "clap_derive 3.2.25", + "clap_lex 0.2.4", + "indexmap 1.9.3", "once_cell", "strsim", "termcolor", "textwrap", ] +[[package]] +name = "clap" +version = "4.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384e169cc618c613d5e3ca6404dda77a8685a63e08660dcc64abaf7da7cb0c7a" +dependencies = [ + "clap_builder", + "clap_derive 4.3.2", + "once_cell", +] + +[[package]] +name = "clap_builder" +version = "4.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef137bbe35aab78bdb468ccfba75a5f4d8321ae011d34063770780545176af2d" +dependencies = [ + "anstream", + "anstyle", + "clap_lex 0.5.0", + "strsim", +] + [[package]] name = "clap_derive" version = "3.2.25" @@ -119,11 +382,23 @@ checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" dependencies = [ "heck", "proc-macro-error", - "proc-macro2 1.0.60", - "quote 1.0.28", + "proc-macro2 1.0.63", + "quote 1.0.29", "syn 1.0.109", ] +[[package]] +name = "clap_derive" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +dependencies = [ + "heck", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", +] + [[package]] name = "clap_lex" version = "0.2.4" @@ -133,6 +408,12 @@ dependencies = [ "os_str_bytes", ] +[[package]] +name = "clap_lex" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" + [[package]] name = "codespan-reporting" version = "0.11.1" @@ -143,6 +424,21 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + +[[package]] +name = "concurrent-queue" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "console" version = "0.15.7" @@ -155,12 +451,52 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "const-oid" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6340df57935414636969091153f35f68d9f00bbc8fb4a9c6054706c213e6c6bc" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +[[package]] +name = "cpufeatures" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" + [[package]] name = "crossbeam-channel" version = "0.5.8" @@ -195,6 +531,16 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.16" @@ -204,13 +550,23 @@ dependencies = [ "cfg-if", ] +[[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 = "ctor" version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ - "quote 1.0.28", + "quote 1.0.29", "syn 1.0.109", ] @@ -221,23 +577,55 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" dependencies = [ "cfg-if", - "hashbrown", + "hashbrown 0.12.3", "lock_api", "once_cell", "parking_lot_core", ] +[[package]] +name = "der" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + [[package]] name = "diff" version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" +[[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 = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + [[package]] name = "either" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +dependencies = [ + "serde", +] [[package]] name = "encode_unicode" @@ -276,6 +664,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" + [[package]] name = "errno" version = "0.3.1" @@ -297,6 +691,23 @@ dependencies = [ "libc", ] +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "fastrand" version = "1.9.0" @@ -306,12 +717,48 @@ dependencies = [ "instant", ] +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "futures-core", + "futures-sink", + "pin-project", + "spin 0.9.8", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + [[package]] name = "futures" version = "0.3.28" @@ -354,11 +801,37 @@ dependencies = [ "futures-util", ] +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] + [[package]] name = "futures-io" version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] [[package]] name = "futures-sink" @@ -398,23 +871,78 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + [[package]] name = "glob" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "gloo-timers" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" +dependencies = [ + "futures-channel", + "futures-core", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "ahash", + "allocator-api2", +] + +[[package]] +name = "hashlink" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" +dependencies = [ + "hashbrown 0.14.0", +] + [[package]] name = "heck" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "hermit-abi" @@ -427,18 +955,42 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" dependencies = [ - "libc", + "hmac", ] [[package]] -name = "hermit-abi" -version = "0.3.1" +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "home" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", +] [[package]] name = "humantime" @@ -469,6 +1021,16 @@ dependencies = [ "cc", ] +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "iec61131std" version = "0.1.0" @@ -490,7 +1052,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", ] [[package]] @@ -511,9 +1083,9 @@ name = "inkwell_internals" version = "0.8.0" source = "git+https://github.com/TheDan64/inkwell?branch=master#ec963b95da169d0927112126a204a2e9d0bcaee0" dependencies = [ - "proc-macro2 1.0.60", - "quote 1.0.28", - "syn 2.0.18", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] @@ -544,20 +1116,19 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "libc", "windows-sys 0.48.0", ] [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", + "hermit-abi 0.3.2", + "rustix 0.38.2", "windows-sys 0.48.0", ] @@ -572,9 +1143,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" [[package]] name = "js-sys" @@ -585,17 +1156,46 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kv-log-macro" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" +dependencies = [ + "log", +] + [[package]] name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin 0.5.2", +] [[package]] name = "libc" -version = "0.2.146" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "libm" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" + +[[package]] +name = "libsqlite3-sys" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "afc22eff61b133b115c6e8c74e818c628d6d5e7a502afea6f64dee076dd94326" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] [[package]] name = "linked-hash-map" @@ -609,6 +1209,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "linux-raw-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" + [[package]] name = "lld_rs" version = "140.0.0" @@ -650,6 +1256,9 @@ name = "log" version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +dependencies = [ + "value-bag", +] [[package]] name = "logos" @@ -668,12 +1277,21 @@ checksum = "a1d849148dbaf9661a6151d1ca82b13bb4c4c128146a88d05253b38d4e2f496c" dependencies = [ "beef", "fnv", - "proc-macro2 1.0.60", - "quote 1.0.28", + "proc-macro2 1.0.63", + "quote 1.0.29", "regex-syntax 0.6.29", "syn 1.0.109", ] +[[package]] +name = "md-5" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +dependencies = [ + "digest", +] + [[package]] name = "memchr" version = "2.5.0" @@ -689,6 +1307,40 @@ dependencies = [ "autocfg", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "ntapi" version = "0.4.1" @@ -723,6 +1375,23 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + [[package]] name = "num-complex" version = "0.4.3" @@ -772,15 +1441,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", + "libm", ] [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.2", "libc", ] @@ -790,6 +1460,50 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "openssl" +version = "0.10.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" +dependencies = [ + "bitflags 1.3.2", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "os_str_bytes" version = "6.5.1" @@ -805,6 +1519,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "parking" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" + [[package]] name = "parking_lot" version = "0.12.1" @@ -825,20 +1545,55 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] name = "paste" -version = "1.0.12" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35" + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pin-project" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +dependencies = [ + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", +] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pin-utils" @@ -846,6 +1601,33 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + [[package]] name = "plc_ast" version = "0.1.0" @@ -864,11 +1646,11 @@ dependencies = [ name = "plc_driver" version = "0.1.0" dependencies = [ - "clap", + "clap 3.2.25", "encoding_rs", "encoding_rs_io", "env_logger", - "indexmap", + "indexmap 1.9.3", "insta", "log", "plc_ast", @@ -906,6 +1688,28 @@ dependencies = [ "encoding_rs_io", ] +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "pretty_assertions" version = "1.3.0" @@ -925,8 +1729,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.60", - "quote 1.0.28", + "proc-macro2 1.0.63", + "quote 1.0.29", "syn 1.0.109", "version_check", ] @@ -937,8 +1741,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.60", - "quote 1.0.28", + "proc-macro2 1.0.63", + "quote 1.0.29", "version_check", ] @@ -953,9 +1757,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] @@ -971,11 +1775,41 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.28" +version = "1.0.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +dependencies = [ + "proc-macro2 1.0.63", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "proc-macro2 1.0.60", + "getrandom", ] [[package]] @@ -1006,7 +1840,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1032,17 +1866,52 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +[[package]] +name = "rsa" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ab43bb47d23c1a631b4b680199a45255dce26fa9ab2fa902581f624ff13e6a8" +dependencies = [ + "byteorder", + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-iter", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + [[package]] name = "rustix" -version = "0.37.20" +version = "0.37.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" +checksum = "8818fa822adcc98b18fedbb3632a6a33213c070556b5aa7c4c8cc21cff565c4c" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabcb0461ebd01d6b79945797c27f8529082226cb630a9865a71870ff63532a4" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys 0.4.3", "windows-sys 0.48.0", ] @@ -1051,12 +1920,12 @@ name = "rusty" version = "0.2.0" dependencies = [ "chrono", - "clap", + "clap 3.2.25", "codespan-reporting", "encoding_rs", "encoding_rs_io", "generational-arena", - "indexmap", + "indexmap 1.9.3", "inkwell", "insta", "itertools", @@ -1091,9 +1960,18 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" + +[[package]] +name = "schannel" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys 0.48.0", +] [[package]] name = "scopeguard" @@ -1101,6 +1979,29 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "security-framework" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "1.0.17" @@ -1109,29 +2010,29 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.164" +version = "1.0.166" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "d01b7404f9d441d3ad40e6a636a7782c377d2abdbe4fa2440e2edcc2f4f10db8" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.166" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "5dd83d6dde2b6b2d466e14d9d1acce8816dedee94f735eac6395808b3483c6d6" dependencies = [ - "proc-macro2 1.0.60", - "quote 1.0.28", - "syn 2.0.18", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] name = "serde_json" -version = "1.0.97" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" +checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" dependencies = [ "itoa", "ryu", @@ -1158,9 +2059,31 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ - "proc-macro2 1.0.60", - "quote 1.0.28", - "syn 2.0.18", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", +] + +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", ] [[package]] @@ -1169,6 +2092,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "similar" version = "2.2.1" @@ -1190,12 +2123,269 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "sqlformat" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e" +dependencies = [ + "itertools", + "nom", + "unicode_categories", +] + +[[package]] +name = "sqlx" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ef53c86d2066e04f0ac6b1364f16d13d82388e2d07f11a5c71782345555761" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a22fd81e9c1ad53c562edb869ff042b215d4eadefefc4784bacfbfd19835945" +dependencies = [ + "ahash", + "async-io", + "async-std", + "atoi", + "byteorder", + "bytes", + "crc", + "crossbeam-queue", + "dotenvy", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap 2.0.0", + "log", + "memchr", + "native-tls", + "once_cell", + "paste", + "percent-encoding", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlformat", + "thiserror", + "tracing", + "url", +] + +[[package]] +name = "sqlx-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00bb7c096a202b8164c175614cbfb79fe0e1e0a3d50e0374526183ef2974e4a2" +dependencies = [ + "proc-macro2 1.0.63", + "quote 1.0.29", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d644623ab9699014e5b3cb61a040d16caa50fd477008f63f1399ae35498a58" +dependencies = [ + "async-std", + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2 1.0.63", + "quote 1.0.29", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8264c59b28b6858796acfcedc660aa4c9075cc6e4ec8eb03cdca2a3e725726db" +dependencies = [ + "atoi", + "base64", + "bitflags 2.3.3", + "byteorder", + "bytes", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cab6147b81ca9213a7578f1b4c9d24c449a53953cd2222a7b5d7cd29a5c3139" +dependencies = [ + "atoi", + "base64", + "bitflags 2.3.3", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "rand", + "serde", + "serde_json", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59fba60afa64718104b71eec6984f8779d4caffff3b30cde91a75843c7efc126" +dependencies = [ + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "tracing", + "url", +] + +[[package]] +name = "stringprep" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "strsim" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "0.15.44" @@ -1213,19 +2403,19 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.60", - "quote 1.0.28", + "proc-macro2 1.0.63", + "quote 1.0.29", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.18" +version = "2.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" dependencies = [ - "proc-macro2 1.0.60", - "quote 1.0.28", + "proc-macro2 1.0.63", + "quote 1.0.29", "unicode-ident", ] @@ -1254,7 +2444,7 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall", - "rustix", + "rustix 0.37.22", "windows-sys 0.48.0", ] @@ -1275,22 +2465,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "c16a64ba9387ef3fdae4f9c1a7f07a0997fce91985c0336f1ddc1822b3b37802" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "d14928354b01c4d6a4f0e549069adef399a284e7995c7ccca94e8a07a5346c59" dependencies = [ - "proc-macro2 1.0.60", - "quote 1.0.28", - "syn 2.0.18", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] @@ -1300,10 +2490,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" dependencies = [ "libc", - "wasi", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi", ] +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "toml" version = "0.5.11" @@ -1313,11 +2518,71 @@ dependencies = [ "serde", ] +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +dependencies = [ + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" @@ -1331,18 +2596,65 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "url" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "value-bag" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d92ccd67fb88503048c01b59152a04effd0782d035a83a6d256ce6085f08f4a3" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + [[package]] name = "wasm-bindgen" version = "0.2.87" @@ -1362,19 +2674,31 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.60", - "quote 1.0.28", - "syn 2.0.18", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ - "quote 1.0.28", + "quote 1.0.29", "wasm-bindgen-macro-support", ] @@ -1384,9 +2708,9 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ - "proc-macro2 1.0.60", - "quote 1.0.28", - "syn 2.0.18", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1397,6 +2721,16 @@ version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "which" version = "4.4.0" @@ -1408,6 +2742,12 @@ dependencies = [ "once_cell", ] +[[package]] +name = "whoami" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" + [[package]] name = "winapi" version = "0.3.9" @@ -1445,7 +2785,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -1463,7 +2803,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -1483,9 +2823,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -1600,9 +2940,13 @@ name = "xtask" version = "0.1.0" dependencies = [ "anyhow", + "async-std", + "clap 4.3.10", "serde", "serde_json", + "sqlx", "sysinfo", + "tempfile", "xshell", ] @@ -1620,3 +2964,9 @@ name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zeroize" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" diff --git a/scripts/build.sh b/scripts/build.sh index d912b5ef5a..536c838940 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,7 +5,6 @@ vendor=0 offline=0 check=0 check_style=0 -metrics=0 build=0 doc=0 test=0 @@ -15,7 +14,6 @@ debug=0 container=0 assume_linux=0 junit=0 -ci=0 package=0 target="" @@ -122,11 +120,6 @@ function run_check() { cargo check $CARGO_OPTIONS --workspace } -function run_metrics() { - log "Running cargo xtask metrics" - cargo xtask metrics -} - function run_doc() { CARGO_OPTIONS=$(set_cargo_options) log "Running cargo doc --workspace $CARGO_OPTIONS" @@ -294,9 +287,6 @@ function run_in_container() { if [[ $check_style -ne 0 ]]; then params="$params --check-style" fi - if [[ $metrics -ne 0 ]]; then - params="$params --metrics" - fi if [[ $build -ne 0 ]]; then params="$params --build" fi @@ -321,9 +311,6 @@ function run_in_container() { if [[ ! -z $target ]]; then params="$params --target $target" fi - if [[ $ci -ne 0 ]]; then - options="$options --env=CI_RUN=true" - fi volume_target="/build" unameOut="$(uname -s)" @@ -351,7 +338,7 @@ function run_in_container() { set -o errexit -o pipefail -o noclobber -o nounset OPTIONS=sorbvc -LONGOPTS=sources,offline,release,check,check-style,metrics,ci,build,doc,test,junit,verbose,container,linux,container-name:,coverage,package,target: +LONGOPTS=sources,offline,release,check,check-style,build,doc,test,junit,verbose,container,linux,container-name:,coverage,package,target: check_env # -activate quoting/enhanced mode (e.g. by writing out “--options”) @@ -397,12 +384,6 @@ while true; do --check) check=1 ;; - --metrics) - metrics=1 - ;; - --ci) - ci=1 - ;; -b|--build) build=1 ;; @@ -438,11 +419,6 @@ project_location=$(find_project_root) log "Moving to project level directory $project_location" cd "$project_location" - -if [[ $ci -ne 0 ]]; then - export CI_RUN=true -fi - if [[ $container -ne 0 ]]; then log "Container Build" run_in_container @@ -475,10 +451,6 @@ if [[ $check_style -ne 0 ]]; then run_check_style fi -if [[ $metrics -ne 0 ]]; then - run_metrics -fi - if [[ $build -ne 0 ]]; then run_build #Build the standard functions diff --git a/src/codegen.rs b/src/codegen.rs index 97ee632e2b..2accf8c16e 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -271,10 +271,12 @@ impl<'ink> GeneratedModule<'ink> { std::fs::create_dir_all(parent)?; } match format { - FormatOption::Object | FormatOption::Static | FormatOption::Relocatable => { + FormatOption::Object | FormatOption::Relocatable => { self.persist_as_static_obj(output, target, optimization_level) } - FormatOption::PIC => self.persist_to_shared_pic_object(output, target, optimization_level), + FormatOption::PIC | FormatOption::Static => { + self.persist_to_shared_pic_object(output, target, optimization_level) + } FormatOption::Shared => self.persist_to_shared_object(output, target, optimization_level), FormatOption::Bitcode => self.persist_to_bitcode(output), FormatOption::IR => self.persist_to_ir(output), diff --git a/xtask/.gitignore b/xtask/.gitignore index 9f970225ad..5f32e705c4 100644 --- a/xtask/.gitignore +++ b/xtask/.gitignore @@ -1 +1,2 @@ -target/ \ No newline at end of file +target/ +.env \ No newline at end of file diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 374b1e3c09..3a77e6467d 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -3,11 +3,18 @@ name = "xtask" version = "0.1.0" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +default = [] +sql = ["dep:sqlx"] [dependencies] xshell = "0.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" sysinfo = "0.28" -anyhow = "1.0" \ No newline at end of file +anyhow = "1.0" +sqlx = { version = "0.7", features = [ "runtime-async-std", "tls-native-tls", "mysql" ], optional = true} + +async-std = "1.12.0" +tempfile = "3" +clap = { version = "4.3.10", features = ["derive"] } diff --git a/xtask/migrations/20230620132156_benchmarks.sql b/xtask/migrations/20230620132156_benchmarks.sql new file mode 100644 index 0000000000..132f8b75cb --- /dev/null +++ b/xtask/migrations/20230620132156_benchmarks.sql @@ -0,0 +1,25 @@ +CREATE TABLE Host( + id SERIAL, + os TEXT NOT NULL, + cpu TEXT NOT NULL, + memory BIGINT UNSIGNED NOT NULL, + CONSTRAINT Host_pk PRIMARY KEY (id) +); + +CREATE TABLE Report( + id SERIAL, + `timestamp` BIGINT UNSIGNED NOT NULL, + `commit` TEXT NOT NULL, + host_id BIGINT UNSIGNED NOT NULL, + CONSTRAINT Report_pk PRIMARY KEY (id), + CONSTRAINT Report_FK FOREIGN KEY (host_id) REFERENCES Host(id) ON DELETE RESTRICT +); + +CREATE TABLE Metric ( + id SERIAL, + name TEXT NOT NULL, + `time` BIGINT UNSIGNED NOT NULL, + report_id BIGINT UNSIGNED NOT NULL, + CONSTRAINT Metric_pk PRIMARY KEY (id), + CONSTRAINT Metric_FK FOREIGN KEY (report_id) REFERENCES Report(id) ON DELETE CASCADE ON UPDATE CASCADE +); \ No newline at end of file diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 66135b2651..80ba67455f 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,34 +1,121 @@ -use std::str::FromStr; +use crate::task::Task; +use anyhow::Result; +use clap::{Parser, Subcommand}; +use reporter::{BenchmarkReport, ReporterType}; +use std::path::PathBuf; +use task::{compile::Compile, run::Run}; +use tempfile::{tempdir, TempDir}; +use xshell::{cmd, Shell}; -use anyhow::anyhow; -use metrics::Metrics; -use xshell::Shell; +mod reporter; +mod task; -mod metrics; -mod traits; +#[derive(Parser)] +#[command(author, version, about, long_about = None)] +struct Parameters { + #[command(subcommand)] + command: Command, +} + +#[derive(Subcommand, Clone)] +enum Command { + Metrics { + #[command(subcommand)] + action: Option, + #[arg(value_enum, long, global = true, default_value_t = ReporterType::Sysout)] + reporter: ReporterType, + }, +} -enum Task { - Metrics, +#[derive(Subcommand, Clone)] +enum Action { + Run { + #[arg()] + directory: String, + }, + Compile { + directory: String, + }, } -impl FromStr for Task { - type Err = anyhow::Error; +fn main() -> anyhow::Result<()> { + let params = Parameters::parse(); + let Command::Metrics { action, reporter } = params.command; + run_metrics(action, reporter)?; + + Ok(()) +} - fn from_str(s: &str) -> Result { - match s { - "metrics" => Ok(Task::Metrics), - _ => Err(anyhow!("Unrecognized task '{s}'")), +fn run_metrics(action: Option, reporter: ReporterType) -> Result<()> { + let (work_dir, compiler) = prepare()?; + //Create tasks + let mut tasks: Vec> = vec![]; + match &action { + Some(Action::Compile { directory }) => { + for opt in ["none", "less", "default", "aggressive"] { + let task = Compile { + name: directory.clone(), + directory: directory.into(), + optimization: opt.to_string(), + compiler: compiler.clone(), + }; + tasks.push(Box::new(task)); + } + } + Some(Action::Run { directory }) => { + for opt in ["none", "less", "default", "aggressive"] { + let task = Run { + name: directory.into(), + optimization: opt.to_string(), + compiler: compiler.clone(), + location: directory.into(), + parameters: Some("--linker=cc".into()), + work_dir: work_dir.path().into(), + }; + tasks.push(Box::new(task)); + } } + None => { + let path = work_dir.path(); + tasks.extend(task::get_default_tasks(path, &compiler)?) + } + }; + //Run benchmarks + let mut data = vec![]; + for mut task in tasks { + println!("Running benchmark for {}", task.get_name()); + let res = task.benchmark(3)?; + //Report + data.push((task.get_name(), res)); } + //Reprort data + let report = BenchmarkReport::new(data)?; + let reporter = reporter::from_type(reporter); + reporter.persist(report)?; + Ok(()) } -fn main() -> anyhow::Result<()> { +fn prepare() -> Result<(TempDir, PathBuf)> { + let temp = tempdir()?; let sh = Shell::new()?; - let Some(arg) = std::env::args().nth(1) else { anyhow::bail!("No argument specified, try `xtask `") }; - - match Task::from_str(&arg)? { - Task::Metrics => Metrics::new(&sh)?.execute(&sh)?, + cmd!(&sh, "cargo build --release --workspace").run()?; + //Todo convert to xtask + // Build the standard libs and copy them to the output directory + cmd!(&sh, "./scripts/build.sh --release --package").run()?; + // Copy the standard lib to the release target + cmd!(&sh, "rm -rf target/release/stdlib").run()?; + cmd!(&sh, "mv output target/release/stdlib").run()?; + //Get rusty path + let compile_dir = std::env::current_dir()?.join("target").join("release"); + let plc = std::env::current_dir()?.join("target").join("release").join("plc"); + if !plc.exists() { + anyhow::bail!("Could not find compiler, did you run cargo build --release?") } - - Ok(()) + //Export the standard lib location + let lib_loc = compile_dir.join("stdlib"); + if !(lib_loc.exists()) { + anyhow::bail!("Could not find stdlib, did you run the standard function compile script?") + } + std::env::set_var("STDLIBLOC", &lib_loc); + Ok((temp, plc)) } diff --git a/xtask/src/metrics/mod.rs b/xtask/src/metrics/mod.rs deleted file mode 100644 index a7a6947fd2..0000000000 --- a/xtask/src/metrics/mod.rs +++ /dev/null @@ -1,113 +0,0 @@ -use crate::metrics::{oscat::Oscat, sieve::Sieve}; -use crate::traits::Task; -use serde::Serialize; -use std::{ - collections::BTreeMap, - fs, - io::Write, - time::{SystemTime, UNIX_EPOCH}, -}; -use sysinfo::{CpuExt, System, SystemExt}; -use xshell::{cmd, Shell}; - -mod oscat; -mod sieve; - -#[derive(Serialize)] -pub struct Metrics { - /// Host information, see [`Host`]. - host: Host, - - /// Unix timestamp of when this xtask was called. - timestamp: u64, - - /// Commit hash on which the benchmark ran. - commit: String, - - /// Collected benchmarks, where the first tuple element describes the benchmark and the second - /// element is its raw wall-time value in milliseconds. - /// For example one such element might be `("oscat/aggressive", 8000)`, indicating an oscat build - /// with the `aggressive` optimization flag took 8000ms. - pub(crate) metrics: BTreeMap, -} - -#[derive(Serialize)] -struct Host { - os: String, - cpu: String, - mem: u64, -} - -impl Host { - fn new() -> Self { - let sys = System::new_all(); - - let os = sys.long_os_version().unwrap_or("n/a".to_string()); - let cpu = sys.global_cpu_info().brand().to_owned(); - let mem = sys.total_memory() / 1024; - - Self { os, cpu, mem } - } -} - -impl Metrics { - pub fn new(sh: &Shell) -> anyhow::Result { - // Needed because of "fatal: detected deubious ownership in repository at '/build'" error - cmd!(sh, "git config --global --add safe.directory /build").run()?; - - let host = Host::new(); - let commit = cmd!(sh, "git rev-parse HEAD").read()?; - let timestamp = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(); - let metrics = BTreeMap::new(); - - Ok(Self { host, timestamp, commit, metrics }) - } - - /// Starts the execution of various [`Task`]s, collecting bechmark data. - /// Additionally the data is pushed onto the `metrics` branch on rusty if the task - /// is executed within a CI enviroment, i.e. specified by the `CI_RUN` environment flag. - pub fn execute(&mut self, sh: &Shell) -> anyhow::Result<()> { - // Remove and re-create the folder in case of previous dry runs - sh.remove_path("./benchmark")?; - sh.create_dir("./benchmark")?; - - let tasks: Vec> = vec![Box::new(Oscat), Box::new(Sieve)]; - for task in tasks { - task.prepare(sh)?; - task.execute(sh, self)?; - } - - // Only commit and push IF we executed the task within a CI job - if std::env::var("CI_RUN").is_ok() { - self.finalize(sh)?; - } - - println!("{}", serde_json::to_string_pretty(self)?); - Ok(()) - } - - /// Appends the collected data to a JSON file, commiting and pushing it onto - /// the `metrics` branch hosted on RuSTy. Whoever the author of the last commit - /// on the RuSTy master branch is thereby also the author of this commit. - pub fn finalize(&self, sh: &Shell) -> anyhow::Result<()> { - let branch = "metrics-data"; - let filename = "metrics.json"; - let message = format!("Update {}", self.commit); - let user_name = cmd!(sh, "git log -1 --pretty=format:'%an'").read()?; - let user_mail = cmd!(sh, "git log -1 --pretty=format:'%ae'").read()?; - - cmd!(sh, "git pull").run()?; - cmd!(sh, "git config user.name \"{user_name}\"").run()?; - cmd!(sh, "git config user.email \"{user_mail}\"").run()?; - cmd!(sh, "git checkout {branch}").run()?; - - let mut file = fs::File::options().create(true).append(true).open(filename)?; - writeln!(file, "{}", serde_json::to_string(self)?)?; - - cmd!(sh, "git add {filename}").run()?; - cmd!(sh, "git commit -m {message}").run()?; - cmd!(sh, "git push origin {branch}").run()?; - - Ok(()) - } -} diff --git a/xtask/src/metrics/oscat.rs b/xtask/src/metrics/oscat.rs deleted file mode 100644 index 4ecd5110ac..0000000000 --- a/xtask/src/metrics/oscat.rs +++ /dev/null @@ -1,36 +0,0 @@ -use crate::traits::{Benchmark, Task}; -use xshell::{cmd, Shell}; - -pub struct Oscat; -impl Task for Oscat { - fn prepare(&self, sh: &Shell) -> anyhow::Result<()> { - cmd!(sh, "git clone https://github.com/plc-lang/oscat ./benchmark/oscat").run()?; - sh.create_dir("./benchmark/oscat/lib")?; - sh.create_dir("./benchmark/oscat/include")?; - - cmd!(sh, "cargo b --release --workspace").run()?; - sh.copy_file("./target/release/plc", "./benchmark/oscat")?; - sh.copy_file("./target/release/libiec61131std.so", "./benchmark/oscat/lib")?; - - for file in sh.read_dir("libs/stdlib/iec61131-st")? { - sh.copy_file(file, "./benchmark/oscat/include")?; - } - - Ok(()) - } - - fn execute(&self, sh: &Shell, metrics: &mut super::Metrics) -> anyhow::Result<()> { - let _oscat = sh.push_dir("./benchmark/oscat"); - - for flag in ["none", "less", "default", "aggressive"] { - cmd!(sh, "./plc -O{flag} build").ignore_stderr().benchmark(metrics, "oscat", flag)?; - } - - cmd!(sh, "./plc check oscat.st") - .ignore_status() - .ignore_stderr() - .benchmark(metrics, "check", "oscat")?; - - Ok(()) - } -} diff --git a/xtask/src/metrics/sieve.rs b/xtask/src/metrics/sieve.rs deleted file mode 100644 index 9e8bfe18c8..0000000000 --- a/xtask/src/metrics/sieve.rs +++ /dev/null @@ -1,30 +0,0 @@ -use crate::traits::{Benchmark, Task}; -use xshell::cmd; - -pub struct Sieve; -impl Task for Sieve { - fn prepare(&self, sh: &xshell::Shell) -> anyhow::Result<()> { - cmd!(sh, "cargo b --release").run()?; - sh.copy_file("./target/release/plc", "./benchmark")?; - sh.copy_file("./xtask/res/sieve.st", "./benchmark")?; - sh.copy_file("./xtask/res/sieve.c", "./benchmark")?; - - Ok(()) - } - - fn execute(&self, sh: &xshell::Shell, metrics: &mut super::Metrics) -> anyhow::Result<()> { - let _path = sh.push_dir("./benchmark"); - - for flag in ["none", "less", "default", "aggressive"] { - cmd!(sh, "./plc --linker=clang -O{flag} sieve.st").run()?; - cmd!(sh, "./sieve").ignore_status().benchmark(metrics, "sieve-st", flag)?; - } - - for flag in ["0", "1", "2", "3"] { - cmd!(sh, "gcc -O{flag} sieve.c").run()?; - cmd!(sh, "./a.out").ignore_status().benchmark(metrics, "sieve-c", flag)?; - } - - Ok(()) - } -} diff --git a/xtask/src/reporter.rs b/xtask/src/reporter.rs new file mode 100644 index 0000000000..aa61274cde --- /dev/null +++ b/xtask/src/reporter.rs @@ -0,0 +1,102 @@ +use clap::ValueEnum; +use std::{ + collections::BTreeMap, + time::{Duration, SystemTime, UNIX_EPOCH}, +}; +use sysinfo::{CpuExt, System, SystemExt}; + +use anyhow::Result; +use serde::Serialize; +use xshell::{cmd, Shell}; + +pub(crate) mod git; +#[cfg(feature = "sql")] +pub mod sql; +pub(crate) mod sysout; + +#[cfg(feature = "sql")] +use sql::SqlReporter; + +use self::{git::GitReporter, sysout::SysoutReporter}; + +pub trait Reporter { + /// Persists the benchmark data into a database + fn persist(&self, report: BenchmarkReport) -> Result<()>; +} + +#[derive(Default, ValueEnum, Clone, Copy)] +pub enum ReporterType { + #[cfg(feature = "sql")] + Sql, + Git, + #[default] + Sysout, +} + +#[derive(Serialize)] +pub struct BenchmarkReport { + #[serde(skip_serializing)] + pub id: u64, + /// Host information, see [`Host`]. + pub host: Host, + + /// Unix timestamp of when this xtask was called. + pub timestamp: u64, + + /// Commit hash on which the benchmark ran. + pub commit: String, + + /// Collected benchmarks, where the first tuple element describes the benchmark and the second + /// element is its raw wall-time value in milliseconds. + /// For example one such element might be `("oscat/aggressive", 8000)`, indicating an oscat build + /// with the `aggressive` optimization flag took 8000ms. + pub(crate) metrics: BTreeMap, +} + +#[derive(Serialize, Debug)] +pub struct Host { + #[serde(skip_serializing)] + pub id: u64, + pub os: String, + pub cpu: String, + pub mem: u64, +} + +impl Host { + fn new() -> Self { + let sys = System::new_all(); + + let os = sys.long_os_version().unwrap_or("n/a".to_string()); + let cpu = sys.global_cpu_info().brand().to_owned(); + let mem = sys.total_memory() / 1024; + + Self { id: 0, os, cpu, mem } + } +} + +impl BenchmarkReport { + pub fn new(data: Vec<(String, Duration)>) -> Result { + let mut metrics = BTreeMap::new(); + for (name, duration) in data { + metrics.insert(name, duration.as_millis() as u64); + } + let sh = Shell::new()?; + let commit = cmd!(sh, "git rev-parse HEAD").read()?; + Ok(BenchmarkReport { + id: 0, + host: Host::new(), + timestamp: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(), + commit, + metrics, + }) + } +} + +pub fn from_type(r_type: ReporterType) -> Box { + match r_type { + ReporterType::Sysout => Box::new(SysoutReporter), + #[cfg(feature = "sql")] + ReporterType::Sql => Box::new(SqlReporter), + ReporterType::Git => Box::new(GitReporter), + } +} diff --git a/xtask/src/reporter/git.rs b/xtask/src/reporter/git.rs new file mode 100644 index 0000000000..0e151d41a6 --- /dev/null +++ b/xtask/src/reporter/git.rs @@ -0,0 +1,33 @@ +use serde::Serialize; +use std::{fs, io::Write}; +use xshell::{cmd, Shell}; + +use super::Reporter; + +#[derive(Serialize)] +pub struct GitReporter; + +impl Reporter for GitReporter { + fn persist(&self, report: super::BenchmarkReport) -> anyhow::Result<()> { + let sh = Shell::new()?; + let branch = "metrics-data"; + let filename = "metrics.json"; + let message = format!("Update {}", report.commit); + let user_name = cmd!(sh, "git log -1 --pretty=format:'%an'").read()?; + let user_mail = cmd!(sh, "git log -1 --pretty=format:'%ae'").read()?; + + cmd!(sh, "git pull").run()?; + cmd!(sh, "git config user.name \"{user_name}\"").run()?; + cmd!(sh, "git config user.email \"{user_mail}\"").run()?; + cmd!(sh, "git checkout {branch}").run()?; + + let mut file = fs::File::options().create(true).append(true).open(filename)?; + writeln!(file, "{}", serde_json::to_string(&report)?)?; + + cmd!(sh, "git add {filename}").run()?; + cmd!(sh, "git commit -m {message}").run()?; + cmd!(sh, "git push origin {branch}").run()?; + + Ok(()) + } +} diff --git a/xtask/src/reporter/sql.rs b/xtask/src/reporter/sql.rs new file mode 100644 index 0000000000..609041acc1 --- /dev/null +++ b/xtask/src/reporter/sql.rs @@ -0,0 +1,74 @@ +use async_std::task::block_on; +use sqlx::mysql::MySqlPoolOptions; + +use super::Host; + +pub struct SqlReporter; + +impl super::Reporter for SqlReporter { + fn persist(&self, report: super::BenchmarkReport) -> anyhow::Result<()> { + block_on(self.persist_to_db(report)) + } +} + +impl SqlReporter { + async fn persist_to_db(&self, report: super::BenchmarkReport) -> anyhow::Result<()> { + //Connect to db + let db_url = std::env::var("DATABASE_URL")?; + let db = MySqlPoolOptions::new().connect(&db_url).await?; + + // get host id + let host = sqlx::query_as!( + Host, + "SELECT id, cpu, os, memory as mem from Host WHERE cpu = ? AND os = ? AND memory = ?", + &report.host.cpu, + &report.host.os, + &report.host.mem, + ) + .fetch_optional(&db) + .await?; + + //Start transaction + let trans = db.begin().await?; + + let id = match host { + Some(Host { id, .. }) => id, + _ => { + //Commit new host and get its id + sqlx::query!( + "INSERT INTO Host (cpu, os, memory) VALUES (?, ?, ?)", + &report.host.cpu, + &report.host.os, + &report.host.mem + ) + .execute(&db) + .await?; + sqlx::query!("SELECT id from Host ORDER BY id DESC LIMIT 1").fetch_one(&db).await?.id + } + }; + + //Commit the benchmark + + sqlx::query!( + "INSERT INTO Report (host_id, timestamp, commit) VALUES (?, ?, ?)", + id, + &report.timestamp, + &report.commit + ) + .execute(&db) + .await?; + let id = sqlx::query!("SELECT id from Report ORDER BY id DESC LIMIT 1").fetch_one(&db).await?.id; + + for (name, time) in report.metrics { + sqlx::query!("INSERT INTO Metric (report_id, name, time) VALUES (?, ?, ?)", id, &name, &time) + .execute(&db) + .await?; + } + + trans.commit().await?; + db.close().await; + + //Push data + Ok(()) + } +} diff --git a/xtask/src/reporter/sysout.rs b/xtask/src/reporter/sysout.rs new file mode 100644 index 0000000000..78dd526965 --- /dev/null +++ b/xtask/src/reporter/sysout.rs @@ -0,0 +1,21 @@ +use super::{BenchmarkReport, Reporter}; +use anyhow::Result; + +pub struct SysoutReporter; + +impl Reporter for SysoutReporter { + fn persist(&self, report: BenchmarkReport) -> Result<()> { + println!("Benchmark results for commit: {}", &report.commit); + println!("Host information:"); + println!("-----------------"); + println!(" CPU: {}", &report.host.cpu); + println!(" Memory: {}", &report.host.mem); + println!(" OS: {}", &report.host.os); + println!("-----------------"); + for (name, time) in report.metrics { + println!("Run {name} took {time} ms"); + } + println!("-----------------"); + Ok(()) + } +} diff --git a/xtask/src/task.rs b/xtask/src/task.rs new file mode 100644 index 0000000000..5454bb3ada --- /dev/null +++ b/xtask/src/task.rs @@ -0,0 +1,79 @@ +use anyhow::Result; +use std::{path::Path, time::Duration}; +use xshell::{cmd, Shell}; + +use self::{compile::Compile, run::Run}; + +pub(crate) mod compile; +pub(crate) mod run; + +pub(crate) trait Task { + /// Returns the name of the task being benchmarked + fn get_name(&self) -> String; + /// Executes any actions required before time measurement starts + /// By default we make sure we have a release build ready + fn prepare(&mut self) -> Result<()> { + Ok(()) + } + /// Executes the task to be measured and returns the time it took + fn execute(&self) -> Result; + + /// Benchmarks the current task and returns the avarage execution time + fn benchmark(&mut self, executions: u32) -> Result { + self.prepare()?; + //Cold run + self.execute()?; + let mut duration = Duration::from_millis(0); + for _ in 0..executions { + duration += self.execute()?; + } + + Ok(duration / executions) + } +} + +pub(crate) fn get_default_tasks(work_dir: &Path, compiler: &Path) -> Result>> { + //Clone the extra required code + println!("Clone Oscat into the benchmarks"); + let sh = Shell::new()?; + cmd!(&sh, "git clone https://github.com/plc-lang/oscat --depth 1 {work_dir}/oscat").run()?; + let mut tasks: Vec> = vec![]; + //Create a default benchmark run + //This includes oscat in 4 different opt + for opt in &["none", "less", "default", "aggressive"] { + let task = Compile { + name: "oscat".into(), + compiler: compiler.into(), + directory: work_dir.join("oscat"), + optimization: opt.to_string(), + }; + tasks.push(Box::new(task)); + } + + // This includes the sieve of eratosthenes in + // C + for opt in ["0", "1", "2", "3"] { + let task = Run { + name: "sieve-c".into(), + optimization: opt.to_string(), + compiler: "cc".into(), + location: "xtask/res/sieve.c".into(), + parameters: None, + work_dir: work_dir.into(), + }; + tasks.push(Box::new(task)); + } + // and ST + for opt in ["none", "less", "default", "aggressive"] { + let task = Run { + name: "sieve-st".into(), + optimization: opt.to_string(), + compiler: compiler.into(), + location: "xtask/res/sieve.st".into(), + parameters: Some("--linker=cc".into()), + work_dir: work_dir.into(), + }; + tasks.push(Box::new(task)); + } + Ok(tasks) +} diff --git a/xtask/src/task/compile.rs b/xtask/src/task/compile.rs new file mode 100644 index 0000000000..08f1958acc --- /dev/null +++ b/xtask/src/task/compile.rs @@ -0,0 +1,30 @@ +use anyhow::Result; +use std::time::Instant; +use std::{path::PathBuf, time::Duration}; +use xshell::Shell; + +use crate::task::Task; + +pub(crate) struct Compile { + pub name: String, + pub compiler: PathBuf, + pub directory: PathBuf, + pub optimization: String, +} + +impl Task for Compile { + fn get_name(&self) -> String { + format!("{}/{}", &self.name, &self.optimization) + } + + fn execute(&self) -> Result { + let sh = Shell::new()?; + //Navigate to directory + sh.change_dir(&self.directory); + + // Run compile + let start = Instant::now(); + sh.cmd(&self.compiler).args(&["build", "-O", &self.optimization]).run()?; + Ok(start.elapsed()) + } +} diff --git a/xtask/src/task/run.rs b/xtask/src/task/run.rs new file mode 100644 index 0000000000..70161ac08e --- /dev/null +++ b/xtask/src/task/run.rs @@ -0,0 +1,51 @@ +use std::time::Instant; + +use std::path::PathBuf; +use xshell::Shell; + +use crate::task::Task; +use xshell::cmd; + +pub(crate) struct Run { + pub name: String, + pub optimization: String, + // Call the appropriate compiler with the file name. Output and optimization are not specifed here + pub compiler: PathBuf, + pub location: PathBuf, + pub parameters: Option, + pub work_dir: PathBuf, +} + +impl Task for Run { + fn execute(&self) -> anyhow::Result { + //Run the application + let shell = Shell::new()?; + let task = self.work_dir.join(&self.name).with_extension("out"); + let start = Instant::now(); + cmd!(&shell, "{task}").run()?; + + Ok(start.elapsed()) + } + + fn get_name(&self) -> String { + format!("{}/{}", self.name, self.optimization) + } + + fn prepare(&mut self) -> anyhow::Result<()> { + let shell = Shell::new()?; + //Compile the application with the correct optimization flag + let command = &self.compiler; + let opt = &self.optimization; + let output = self.work_dir.join(&self.name).with_extension("out"); + let file = &self.location; + let cmd = cmd!(&shell, "{command} {file} -O{opt} -o {output}"); + let cmd = if let Some(parameters) = &self.parameters { cmd.arg(parameters) } else { cmd }; + + cmd.run()?; + + if !output.exists() { + anyhow::bail!("Output does not exist"); + } + Ok(()) + } +} diff --git a/xtask/src/traits.rs b/xtask/src/traits.rs deleted file mode 100644 index 748138ab4c..0000000000 --- a/xtask/src/traits.rs +++ /dev/null @@ -1,40 +0,0 @@ -use std::time::Instant; - -use xshell::{Cmd, Shell}; - -use super::Metrics; - -pub trait Task { - /// Prepares its environment to execute command(s). - fn prepare(&self, sh: &Shell) -> anyhow::Result<()>; - - /// Executes command(s), typically benchmarking it along the way. - fn execute(&self, sh: &Shell, metrics: &mut Metrics) -> anyhow::Result<()>; -} - -/// Trait Extension for the [`xshell::Cmd`] struct. -pub trait Benchmark { - const ITERATIONS_PER_BENCHMARK: u64 = 3; - - /// Benchmarks a command specified by the [`self`] argument measuring its wall-time, - /// collecting and inserting the data into the [`Metrics`] struct. The `name` thereby - /// specifies the to be benchmarked task (e.g. `plc`) whereas the `desc` argument - /// describes how the task ran (e.g. with the `-Oaggressive` flag). - fn benchmark(&self, metrics: &mut Metrics, name: &str, desc: &str) -> anyhow::Result<()>; -} - -impl<'sh> Benchmark for Cmd<'sh> { - fn benchmark(&self, metrics: &mut Metrics, name: &str, desc: &str) -> anyhow::Result<()> { - let mut elapsed_sum = 0; - for _ in 0..Self::ITERATIONS_PER_BENCHMARK { - let now = Instant::now(); - self.run()?; - let elapsed = now.elapsed(); - - elapsed_sum += elapsed.as_millis() as u64; - } - - metrics.metrics.insert(format!("{name}/{desc}"), elapsed_sum / Self::ITERATIONS_PER_BENCHMARK); - Ok(()) - } -}