Add a dumb script to repl all the executables and library

This commit is contained in:
Adithya Kumar 2022-02-05 01:15:08 +05:30
parent 8f73864eeb
commit 52f53792a8
2 changed files with 114 additions and 0 deletions

View File

@ -10,6 +10,7 @@ appveyor.yml
benchmark/bench-report/default.nix
bin/ghc.sh
bin/run-ci.sh
bin/run-repl-quick.sh
cabal.project
cabal.project.coverage
cabal.project.doctest

113
bin/run-repl-quick.sh Executable file
View File

@ -0,0 +1,113 @@
#!/usr/bin/env bash
# XXX Having a repl-ish option on packcheck can be very useful for quick type
# checking. Running that in a loop in a smart way will work like ghcid.
# The idea is to have an extremely light version of run-ci.sh
# This can be very helpful on any refactoring change.
# This script should be majorly improved but it solves my use case for the time
# being.
set -e
SCRIPT_DIR=$(dirname $0)
STREAMLY_VERSION=0.8.1.1
BENCH_REPORT_DIR=benchmark/bench-report
source $SCRIPT_DIR/targets.sh
#------------------------------------------------------------------------------
# Script
#------------------------------------------------------------------------------
print_help () {
echo "Usage: $0"
echo
echo "Very dumb script."
echo "Currently runs everything in the repl and exits."
echo "Useful for type checking and displaying warnings."
echo
exit
}
#------------------------------------------------------------------------------
# Helper functions
#------------------------------------------------------------------------------
run_build_repl () {
local prefix=$1
local targets=$2
local COMPONENTS
local c
for c in $targets
do
CABAL_BUILD_OPTIONS=$(dev_build "--flag dev")
echo "|--------------------------------------------------------------------"
echo "|" $CABAL_EXECUTABLE repl "$prefix:$c" $CABAL_BUILD_OPTIONS <<< :q
echo "|--------------------------------------------------------------------"
run_verbose $CABAL_EXECUTABLE repl "$prefix:$c" $CABAL_BUILD_OPTIONS <<< :q
done
}
#------------------------------------------------------------------------------
# Setup
#------------------------------------------------------------------------------
source $BENCH_REPORT_DIR/bin/build-lib.sh
USE_GIT_CABAL=0
set_common_vars
#------------------------------------------------------------------------------
# Library
#------------------------------------------------------------------------------
# XXX Ideally run for all the valid flag combinations
CABAL_BUILD_OPTIONS=""
run_verbose $CABAL_EXECUTABLE repl $CABAL_BUILD_OPTIONS <<< :q
CABAL_BUILD_OPTIONS="--flag dev"
run_verbose $CABAL_EXECUTABLE repl $CABAL_BUILD_OPTIONS <<< :q
CABAL_BUILD_OPTIONS="--flag streamk"
run_verbose $CABAL_EXECUTABLE repl $CABAL_BUILD_OPTIONS <<< :q
CABAL_BUILD_OPTIONS="--flag use-c-malloc"
run_verbose $CABAL_EXECUTABLE repl $CABAL_BUILD_OPTIONS <<< :q
#------------------------------------------------------------------------------
# Benchmarks
#------------------------------------------------------------------------------
RUNNING_BENCHMARKS=y
RUNNING_TESTS=
RUNNING_DEVBUILD=
targets
TARGETS="$(all_grp)"
run_build_repl "bench" "$TARGETS"
RUNNING_DEVBUILD=y
targets
TARGETS="$(all_grp)"
run_build_repl "bench" "$TARGETS"
#------------------------------------------------------------------------------
# Tests
#------------------------------------------------------------------------------
RUNNING_TESTS=y
RUNNING_BENCHMARKS=
RUNNING_DEVBUILD=
targets
TARGETS="$(all_grp)"
run_build_repl "test" "$TARGETS"
RUNNING_DEVBUILD=y
targets
TARGETS="$(all_grp)"
run_build_repl "test" "$TARGETS"