Skip to content
Snippets Groups Projects
Select Git revision
  • v3.12-rc6
  • master default protected
  • objtool-32bit
  • objtool
  • v5.9
  • v5.9-rc8
  • v5.9-rc7
  • v5.9-rc6
  • v5.9-rc5
  • v5.9-rc4
  • v5.9-rc3
  • v5.9-rc2
  • v5.9-rc1
  • v5.8
  • v5.8-rc7
  • v5.8-rc6
  • v5.8-rc5
  • v5.8-rc4
  • v5.8-rc3
  • v5.8-rc2
  • v5.8-rc1
  • v5.7
  • v5.7-rc7
  • v5.7-rc6
24 results

README

Blame
  • Forked from Jonas Rabenstein / Linux
    Source project has a limited visibility.
    build.sh 1.68 KiB
    #!/usr/bin/env bash
    
    # A simple wrapper around stack
    #
    # This exists mainly to make it easier to pass arguments to test and benchmark
    # suites.
    
    if [[ $# -eq 0 ]]; then
        cat <<EOF
    Usage: $0 COMMAND [OPTS]
    
    Commands:
    ---------
    
    b[uild] [OPTS]                  build project
    
    [c]opy [OPTS]                   copy binaries to ./bin/
    
    t[est] u[nit] [OPTS]            run unit tests
    t[est] e[xamples] [OPTS]        run exampes
    t[est] d[octests] [OPTS]        run doctests
    t[est] [OPTS]                   run all testsuites
    
    bench [OPTS]                    run the benchmark suite
    
    r[un] [OPTS]                    run the main program
    
    haddock [OPTS]                  build documentation
    EOF
        exit 1
    fi
    
    doTest() {
        if [[ $# -eq 0 ]]; then
            exec stack test
        fi
    
        case "$1" in
            u|unit|s|spec)
                exec stack test :spec --test-arguments "${*:2}"
                ;;
            e|examples)
                exec stack test :examples --test-arguments "${*:2}"
                ;;
            d|doctests)
                exec stack test :doctests --test-arguments "${*:2}"
                ;;
            *)
                exec stack test "$@"
        esac
    }
    
    doBench() {
        exec stack bench :bench --benchmark-arguments "$*"
    }
    
    doCopy() {
        DIR=$(dirname "$0")/bin
        mkdir -p ${DIR}
        exec stack build --copy-bins --local-bin-path "${DIR}" "$@"
    }
    
    case "$1" in
        b|build)
            exec stack build "${@:2}"
            ;;
        c|copy)
    	doCopy "${@:2}"
    	;;
        t|test)
            doTest "${@:2}"
            ;;
        bench)
            doBench "${@:2}"
            ;;
        r|run)
            exec stack exec ma -- "${@:2}"
            ;;
        haddock)
            exec stack haddock :ma "${@:2}"
            ;;
        *)
            echo "Unknown command $1"
            exit 1
    esac