citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

fuzz-compile (537B)


      1 #!/usr/bin/env bash
      2 
      3 set -eou pipefail
      4 
      5 tmp=$(mktemp)
      6 trap "rm -f $tmp" EXIT
      7 
      8 cmd=""
      9 
     10 if [ -f package.json ] && [ ! -f Makefile ]
     11 then
     12 	target=$(jq -r '.scripts | keys[]' package.json | fuzzer "$@")
     13 	cmd="npm run $target"
     14 elif [ -f Cargo.toml ]
     15 then
     16 	target=$(printf "check\nbuild\ntest\n" | fuzzer "$@")
     17 	cmd="cargo $target --color=always 2>&1| sed -E '/^.*(warning|error).*:/N;s/\n//;s/-->//g'"
     18 else
     19 	target=$(fuzz-make "$@")
     20 	cmd="make -j $target"
     21 fi
     22 
     23 fullcmd="$cmd 2>&1| tee $tmp; mv $tmp .build-result"
     24 
     25 <<<"$fullcmd" tee .buildcmd