on master help sign in
Add a dumb script to repl all the executables and library
commit52f53792a892d2ef5581eefb85be935c799c0c66 authorAdithya Kumar <adithya@composewell.com> dateSat 5 Feb 2022, 01:15 (5 years ago) parent8f73864
2 files changed+114
.packcheck.ignore+1 bin/run-repl-quick.sh+113
.packcheck.ignore+1
@@ -10,6 +10,7 @@ appveyor.yml
1010benchmark/bench-report/default.nix
1111bin/ghc.sh
1212bin/run-ci.sh
13+bin/run-repl-quick.sh
1314cabal.project
1415cabal.project.coverage
1516cabal.project.doctest
bin/run-repl-quick.shnew file+113
@@ -0,0 +1,113 @@
1+#!/usr/bin/env bash
2+
3+# XXX Having a repl-ish option on packcheck can be very useful for quick type
4+# checking. Running that in a loop in a smart way will work like ghcid.
5+
6+# The idea is to have an extremely light version of run-ci.sh
7+# This can be very helpful on any refactoring change.
8+
9+# This script should be majorly improved but it solves my use case for the time
10+# being.
11+
12+set -e
13+
14+SCRIPT_DIR=$(dirname $0)
15+
16+STREAMLY_VERSION=0.8.1.1
17+BENCH_REPORT_DIR=benchmark/bench-report
18+source $SCRIPT_DIR/targets.sh
19+
20+#------------------------------------------------------------------------------
21+# Script
22+#------------------------------------------------------------------------------
23+
24+print_help () {
25+ echo "Usage: $0"
26+ echo
27+ echo "Very dumb script."
28+ echo "Currently runs everything in the repl and exits."
29+ echo "Useful for type checking and displaying warnings."
30+ echo
31+ exit
32+}
33+
34+#------------------------------------------------------------------------------
35+# Helper functions
36+#------------------------------------------------------------------------------
37+
38+run_build_repl () {
39+ local prefix=$1
40+ local targets=$2
41+ local COMPONENTS
42+ local c
43+
44+ for c in $targets
45+ do
46+ CABAL_BUILD_OPTIONS=$(dev_build "--flag dev")
47+ echo "|--------------------------------------------------------------------"
48+ echo "|" $CABAL_EXECUTABLE repl "$prefix:$c" $CABAL_BUILD_OPTIONS <<< :q
49+ echo "|--------------------------------------------------------------------"
50+ run_verbose $CABAL_EXECUTABLE repl "$prefix:$c" $CABAL_BUILD_OPTIONS <<< :q
51+ done
52+}
53+
54+#------------------------------------------------------------------------------
55+# Setup
56+#------------------------------------------------------------------------------
57+
58+source $BENCH_REPORT_DIR/bin/build-lib.sh
59+
60+USE_GIT_CABAL=0
61+set_common_vars
62+
63+#------------------------------------------------------------------------------
64+# Library
65+#------------------------------------------------------------------------------
66+
67+# XXX Ideally run for all the valid flag combinations
68+CABAL_BUILD_OPTIONS=""
69+run_verbose $CABAL_EXECUTABLE repl $CABAL_BUILD_OPTIONS <<< :q
70+
71+CABAL_BUILD_OPTIONS="--flag dev"
72+run_verbose $CABAL_EXECUTABLE repl $CABAL_BUILD_OPTIONS <<< :q
73+
74+CABAL_BUILD_OPTIONS="--flag streamk"
75+run_verbose $CABAL_EXECUTABLE repl $CABAL_BUILD_OPTIONS <<< :q
76+
77+CABAL_BUILD_OPTIONS="--flag use-c-malloc"
78+run_verbose $CABAL_EXECUTABLE repl $CABAL_BUILD_OPTIONS <<< :q
79+
80+#------------------------------------------------------------------------------
81+# Benchmarks
82+#------------------------------------------------------------------------------
83+
84+RUNNING_BENCHMARKS=y
85+RUNNING_TESTS=
86+
87+RUNNING_DEVBUILD=
88+targets
89+TARGETS="$(all_grp)"
90+run_build_repl "bench" "$TARGETS"
91+
92+
93+RUNNING_DEVBUILD=y
94+targets
95+TARGETS="$(all_grp)"
96+run_build_repl "bench" "$TARGETS"
97+
98+#------------------------------------------------------------------------------
99+# Tests
100+#------------------------------------------------------------------------------
101+
102+RUNNING_TESTS=y
103+RUNNING_BENCHMARKS=
104+
105+RUNNING_DEVBUILD=
106+targets
107+TARGETS="$(all_grp)"
108+run_build_repl "test" "$TARGETS"
109+
110+RUNNING_DEVBUILD=y
111+targets
112+TARGETS="$(all_grp)"
113+run_build_repl "test" "$TARGETS"