Advent of Code solutions

breaking run from compile steps

+33 -22
+33 -22
Justfile
··· 9 9 default: p1 p2 10 10 11 11 [no-cd] 12 - p1 input="input": (do "p1" input) 12 + p1 input="input": (compile "p1") && (run "p1" input) 13 + 14 + [no-cd] 15 + p2 input="input": (compile "p2") && (run "p2" input) 13 16 14 17 [no-cd] 15 - p2 input="input": (do "p2" input) 18 + compile part: 19 + #!/usr/bin/env fish 20 + if test -f {{part}}.erl 21 + erl -compile {{part}}.erl 22 + else if test -f {{part}}.swift 23 + swiftc {{part}}.swift > /dev/null 24 + else if test -f {{part}}.rs 25 + rustc {{part}}.rs > /dev/null 26 + else if test -f {{part}}.c 27 + gcc {{part}}.c -o {{part}} > /dev/null 28 + else if test -f {{part}}.cpp 29 + g++ -std=c++2c {{part}}.cpp -o {{part}} > /dev/null 30 + else if test -f {{part}}.hs 31 + ghc {{part}} -O -outputdir.{{part}} > /dev/null 32 + else if ls | rg "\.cabal\$" -q 33 + cabal build {{part}} > /dev/null 34 + else if test -f {{part}}.erl 35 + erl -compile "$fn" 36 + else if test -d {{part}} -a -f {{part}}/gleam.toml 37 + pushd {{part}} 38 + gleam build 39 + end 16 40 17 41 [no-cd] 18 - do part input: 42 + run part input="input": 19 43 #!/usr/bin/env fish 44 + if test -x {{part}} 45 + time ./{{part}} < {{input}} 46 + exit 0 47 + end 20 48 set fn (fd -d 1 -t f {{part}}) 21 49 if test -n "$fn" -a -x "$fn" 22 50 time "./$fn" < {{input}} ··· 36 64 pushd {{part}} 37 65 time gleam run "$fn" < ../{{input}} 38 66 else if test -f {{part}}.erl 39 - erl -compile "$fn" 40 - and time erl -noshell -s {{part}} main -s init stop < {{input}} 41 - else if test -f {{part}}.swift 42 - swiftc "$fn" > /dev/null 43 - and time ./{{part}} < {{input}} 44 - else if test -f {{part}}.rs 45 - rustc "$fn" > /dev/null 46 - and time ./{{part}} < {{input}} 47 - else if test -f {{part}}.c 48 - gcc "$fn" -o {{part}} > /dev/null 49 - and time ./{{part}} < {{input}} 50 - else if test -f {{part}}.cpp 51 - g++ -std=c++2c "$fn" -o {{part}} > /dev/null 52 - and time ./{{part}} < {{input}} 53 - else if test -f {{part}}.hs 54 - ghc {{part}} -O -outputdir.{{part}} > /dev/null 55 - and time ./{{part}} < {{input}} 67 + time erl -noshell -s {{part}} main -s init stop < {{input}} 56 68 else if ls | rg "\.cabal\$" -q 57 - cabal build {{part}} > /dev/null 58 - and time cabal run {{part}} < {{input}} 69 + time cabal run {{part}} < {{input}} 59 70 else 60 71 echo "Current directory does not contain known solution configuration" 61 72 exit 1