blob: 7c2e15cfe1ea33d6e499c7385bc10363e6d18614 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/usr/bin/env bash
#
# a simple complement to bild which only deals with launching repls
#
# > repl <target..>
#
# Starts a repl/shell for one or more targets. (Currently, all targets must have
# the same extension for this to work.)
##
set -e
targets=${@:?}
json=$(bild --json ${targets[@]})
langdeps=$(jq --raw-output '.langdeps | join(" ")' <<< $json)
exts=$(jq --raw-output '.namespace.ext' <<< $json | sort | uniq)
case $exts in
Hs)
nix-shell \
--packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.ghcWith (h: with h; [$langdeps])" \
--command "ghci -i$BIZ_ROOT -ghci-script $BIZ_ROOT/.ghci ${targets[@]}"
;;
Scm)
echo "scheme repl not supported yet: $target"
exit 1
;;
Lisp)
nix-shell \
--packages "(import $BIZ_ROOT/Biz/Bild.nix {}).private.sbclWith (p: with p; [asdf swank $langdeps])" \
--run "sbcl --eval '(require :asdf)' --eval '(require :swank)' --eval '(swank:create-server)' --load $targets"
;;
*)
echo "unsupported targets: ${targets[@]}"
exit 1
;;
esac
##
|