Advent of Code solutions

Hakari

bwc9876.dev 45cfc795 bd581c2f

verified
+115 -16
+27
.config/hakari.toml
··· 1 + # This file contains settings for `cargo hakari`. 2 + # See https://docs.rs/cargo-hakari/latest/cargo_hakari/config for a full list of options. 3 + 4 + hakari-package = "advent-hack" 5 + 6 + # Format version for hakari's output. Version 4 requires cargo-hakari 0.9.22 or above. 7 + dep-format-version = "4" 8 + 9 + # Setting workspace.resolver = "2" or higher in the root Cargo.toml is HIGHLY recommended. 10 + # Hakari works much better with the v2 resolver. (The v2 and v3 resolvers are identical from 11 + # hakari's perspective, so you're welcome to set either.) 12 + # 13 + # For more about the new feature resolver, see: 14 + # https://blog.rust-lang.org/2021/03/25/Rust-1.51.0.html#cargos-new-feature-resolver 15 + resolver = "2" 16 + 17 + # Add triples corresponding to platforms commonly used by developers here. 18 + # https://doc.rust-lang.org/rustc/platform-support.html 19 + platforms = [ 20 + "x86_64-unknown-linux-gnu", 21 + # "x86_64-apple-darwin", 22 + # "aarch64-apple-darwin", 23 + # "x86_64-pc-windows-msvc", 24 + ] 25 + 26 + # Write out exact versions rather than a semver range. (Defaults to false.) 27 + # exact-versions = true
+24 -12
Cargo.lock
··· 6 6 name = "advent" 7 7 version = "0.1.0" 8 8 dependencies = [ 9 + "advent-hack", 9 10 "advent_core", 10 11 "macros", 11 12 "y_2024", ··· 13 14 ] 14 15 15 16 [[package]] 17 + name = "advent-hack" 18 + version = "0.1.0" 19 + 20 + [[package]] 16 21 name = "advent_core" 17 22 version = "0.1.0" 18 23 dependencies = [ 24 + "advent-hack", 19 25 "indicatif", 20 26 "regex", 21 27 ] ··· 106 112 107 113 [[package]] 108 114 name = "js-sys" 109 - version = "0.3.82" 115 + version = "0.3.83" 110 116 source = "registry+https://github.com/rust-lang/crates.io-index" 111 - checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" 117 + checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" 112 118 dependencies = [ 113 119 "once_cell", 114 120 "wasm-bindgen", ··· 116 122 117 123 [[package]] 118 124 name = "libc" 119 - version = "0.2.177" 125 + version = "0.2.178" 120 126 source = "registry+https://github.com/rust-lang/crates.io-index" 121 - checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" 127 + checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" 122 128 123 129 [[package]] 124 130 name = "macros" 125 131 version = "0.1.0" 126 132 dependencies = [ 133 + "advent-hack", 127 134 "advent_core", 128 135 ] 129 136 ··· 250 257 [[package]] 251 258 name = "utils" 252 259 version = "0.1.0" 260 + dependencies = [ 261 + "advent-hack", 262 + ] 253 263 254 264 [[package]] 255 265 name = "wasm-bindgen" 256 - version = "0.2.105" 266 + version = "0.2.106" 257 267 source = "registry+https://github.com/rust-lang/crates.io-index" 258 - checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" 268 + checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" 259 269 dependencies = [ 260 270 "cfg-if", 261 271 "once_cell", ··· 266 276 267 277 [[package]] 268 278 name = "wasm-bindgen-macro" 269 - version = "0.2.105" 279 + version = "0.2.106" 270 280 source = "registry+https://github.com/rust-lang/crates.io-index" 271 - checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" 281 + checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" 272 282 dependencies = [ 273 283 "quote", 274 284 "wasm-bindgen-macro-support", ··· 276 286 277 287 [[package]] 278 288 name = "wasm-bindgen-macro-support" 279 - version = "0.2.105" 289 + version = "0.2.106" 280 290 source = "registry+https://github.com/rust-lang/crates.io-index" 281 - checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" 291 + checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" 282 292 dependencies = [ 283 293 "bumpalo", 284 294 "proc-macro2", ··· 289 299 290 300 [[package]] 291 301 name = "wasm-bindgen-shared" 292 - version = "0.2.105" 302 + version = "0.2.106" 293 303 source = "registry+https://github.com/rust-lang/crates.io-index" 294 - checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" 304 + checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" 295 305 dependencies = [ 296 306 "unicode-ident", 297 307 ] ··· 325 335 name = "y_2024" 326 336 version = "0.1.0" 327 337 dependencies = [ 338 + "advent-hack", 328 339 "advent_core", 329 340 "macros", 330 341 "rayon", ··· 336 347 name = "y_2025" 337 348 version = "0.1.0" 338 349 dependencies = [ 350 + "advent-hack", 339 351 "advent_core", 340 352 "macros", 341 353 "rayon",
+3 -2
Cargo.toml
··· 4 4 edition = "2021" 5 5 6 6 [workspace] 7 - 8 - members = ["advent_core", "macros", "utils", "years/*"] 7 + resolver = "3" 8 + members = ["advent-hack", "advent_core", "macros", "utils", "years/*"] 9 9 10 10 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 11 11 ··· 14 14 y_2024 = { path = "years/2024" } 15 15 advent_core = { path = "advent_core" } 16 16 macros = { path = "macros" } 17 + advent-hack = { version = "0.1", path = "advent-hack" } 17 18 18 19 [[bin]] 19 20 name = "advent"
+4
advent-hack/.gitattributes
··· 1 + # Avoid putting conflict markers in the generated Cargo.toml file, since their presence breaks 2 + # Cargo. 3 + # Also do not check out the file as CRLF on Windows, as that's what hakari needs. 4 + Cargo.toml merge=binary -crlf
+17
advent-hack/Cargo.toml
··· 1 + # This file is generated by `cargo hakari`. 2 + # To regenerate, run: 3 + # cargo hakari generate 4 + 5 + [package] 6 + name = "advent-hack" 7 + version = "0.1.0" 8 + edition = "2021" 9 + description = "workspace-hack package, managed by hakari" 10 + # You can choose to publish this crate: see https://docs.rs/cargo-hakari/latest/cargo_hakari/publishing. 11 + publish = false 12 + 13 + # The parts of the file between the BEGIN HAKARI SECTION and END HAKARI SECTION comments 14 + # are managed by hakari. 15 + 16 + ### BEGIN HAKARI SECTION 17 + ### END HAKARI SECTION
+2
advent-hack/build.rs
··· 1 + // A build script is required for cargo to consider build dependencies. 2 + fn main() {}
+1
advent-hack/src/lib.rs
··· 1 + // This is a stub lib.rs.
+1
advent_core/Cargo.toml
··· 8 8 [dependencies] 9 9 indicatif = "0.18.3" 10 10 regex = "1.12.2" 11 + advent-hack = { version = "0.1", path = "../advent-hack" }
+30 -2
flake.nix
··· 22 22 src = lib.fileset.toSource { 23 23 root = rawSrc; 24 24 fileset = lib.fileset.unions [ 25 + ./.config/hakari.toml 26 + ./advent-hack 25 27 ./advent_core 26 28 ./src 27 29 ./macros ··· 97 99 default = pkgs: (mkCrane pkgs).buildCrate "advent"; 98 100 }; 99 101 checks = pkgs: let 100 - inherit (mkCrane pkgs) commonArgs craneLib cargoArtifacts; 102 + inherit 103 + (mkCrane pkgs) 104 + src 105 + commonArgs 106 + craneLib 107 + cargoArtifacts 108 + ; 101 109 in 102 110 forAllCrates (name: { 103 111 name = "clippy-${name}"; ··· 120 128 cargoNextestPartitionsExtraArgs = "--no-tests=pass -p ${name}"; 121 129 } 122 130 ); 123 - }); 131 + }) 132 + // { 133 + advent-hakari = craneLib.mkCargoDerivation { 134 + inherit src; 135 + pname = "advent-hakari"; 136 + cargoArtifacts = null; 137 + doInstallCargoArtifacts = false; 138 + 139 + buildPhaseCargoCommand = '' 140 + cargo hakari generate --diff # workspace-hack Cargo.toml is up-to-date 141 + cargo hakari manage-deps --dry-run # all workspace crates depend on workspace-hack 142 + cargo hakari verify 143 + ''; 144 + 145 + nativeBuildInputs = [ 146 + pkgs.cargo-hakari 147 + ]; 148 + }; 149 + }; 124 150 devShell = pkgs: 125 151 (mkCrane pkgs).craneLib.devShell { 126 152 checks = self.checks.${pkgs.system}; 153 + 154 + packages = with pkgs; [cargo-hakari]; 127 155 }; 128 156 }; 129 157 }
+1
macros/Cargo.toml
··· 10 10 11 11 [dependencies] 12 12 advent_core = { path = "../advent_core" } 13 + advent-hack = { version = "0.1", path = "../advent-hack" }
+3
utils/Cargo.toml
··· 2 2 name = "utils" 3 3 version = "0.1.0" 4 4 edition = "2021" 5 + 6 + [dependencies] 7 + advent-hack = { version = "0.1", path = "../advent-hack" }
+1
years/2024/Cargo.toml
··· 10 10 rayon = "1.11.0" 11 11 regex = "1.12.2" 12 12 utils = { path = "../../utils" } 13 + advent-hack = { version = "0.1", path = "../../advent-hack" }
+1
years/2025/Cargo.toml
··· 9 9 macros = { path = "../../macros" } 10 10 rayon = "1.11.0" 11 11 utils = { path = "../../utils" } 12 + advent-hack = { version = "0.1", path = "../../advent-hack" }