Skip to content

Commit

Permalink
Merge pull request #5 from haskell-works/update-development-build-files
Browse files Browse the repository at this point in the history
Fix development build files
  • Loading branch information
newhoggy authored Jan 11, 2020
2 parents f0a5c7f + 9978ff7 commit 6d1eee8
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 30 deletions.
57 changes: 57 additions & 0 deletions .ghc.environment.x86_64-darwin-8.6.5
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
-- This is a GHC environment file written by cabal. This means you can
-- run ghc or ghci and get the environment of the project as a whole.
-- But you still need to use cabal repl $target to get the environment
-- of specific components (libs, exes, tests etc) because each one can
-- have its own source dirs, cpp flags etc.
--
clear-package-db
global-package-db
package-db /Users/jky/.cabal/store/ghc-8.6.5/package.db
package-db dist-newstyle/packagedb/ghc-8.6.5
package-id hw-diagnostics-0.0.0.7-inplace
package-id base-4.12.0.0
package-id ghc-prim-0.5.3
package-id rts
package-id integer-gmp-1.0.2.0
package-id dctst-0.16.2-e597ef1d
package-id bs-cmpt-0.11.0-716cc803
package-id unix-2.7.2.2
package-id bytestring-0.10.8.2
package-id deepseq-1.4.4.0
package-id array-0.5.3.0
package-id time-1.8.0.2
package-id cd-pg-0.2-6c5495c6
package-id directory-1.3.3.0
package-id filepath-1.4.2.1
package-id ghc-8.6.5
package-id binary-0.8.6.0
package-id containers-0.6.0.1
package-id ghc-boot-8.6.5
package-id ghc-boot-th-8.6.5
package-id ghc-heap-8.6.5
package-id ghci-8.6.5
package-id template-haskell-2.14.0.0
package-id pretty-1.1.3.6
package-id transformers-0.5.6.2
package-id hpc-0.6.0.3
package-id process-1.6.5.0
package-id terminfo-0.4.1.2
package-id ghc-pths-0.1.0.12-5d9fa1db
package-id syb-0.7.1-6bcdab30
package-id dctst-dscvr-0.2.0.0-c72e657f
package-id sn-1.4.6.0-a791f21f
package-id ttprsc-0.13.2.3-8d341a99
package-id scntfc-0.3.6.2-b19eabdf
package-id hshbl-1.3.0.0-c69577bd
package-id text-1.2.3.1
package-id ntgr-lgrthms-1.0.3-9cf93210
package-id prmtv-0.7.0.0-85a44d7d
package-id dlst-0.8.0.7-c7a10ad9
package-id tggd-0.8.6-89a18c75
package-id th-bstrctn-0.3.1.0-61121570
package-id tm-cmpt-1.9.2.2-f201bc66
package-id bs-rphns-0.8.1-8278ebd6
package-id nrdrd-cntnrs-0.2.10.0-aa1cccfd
package-id d-typs-1.0.3-31ba9c26
package-id rndm-1.1-46d8c4d3
package-id vctr-0.12.0.3-5b4473dc
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"label": "Build",
"type": "shell",
"command": "bash",
"args": ["-lc", "cabal new-build --enable-tests --enable-benchmarks && echo 'Done'"],
"args": ["-lc", "./project.sh build && echo 'Done'"],
"group": {
"kind": "build",
"isDefault": true
Expand Down Expand Up @@ -37,7 +37,7 @@
"label": "Test",
"type": "shell",
"command": "bash",
"args": ["-lc", "cabal new-test --enable-tests --enable-benchmarks --test-show-details=direct && echo 'Done'"],
"args": ["-lc", "./project.sh test && echo 'Done'"],
"group": {
"kind": "test",
"isDefault": true
Expand Down
80 changes: 52 additions & 28 deletions project.sh
Original file line number Diff line number Diff line change
@@ -1,59 +1,83 @@
#!/usr/bin/env bash

CABAL_FLAGS=""
CABAL_FLAGS="-j8"

cmd="$1"

shift

cabal-install() {
cabal v2-install \
-j8 \
--installdir="$HOME/.local/bin" \
--overwrite-policy=always \
--disable-documentation \
$CABAL_FLAGS "$@"
}

cabal-build() {
cabal v2-build \
--enable-tests \
--write-ghc-environment-files=ghc8.4.4+ \
$CABAL_FLAGS "$@"
}

cabal-test() {
cabal v2-test \
--enable-tests \
--test-show-details=direct \
$CABAL_FLAGS "$@"
}

cabal-exec() {
cabal v2-exec "$(echo *.cabal | cut -d . -f 1)" "$@"
}

cabal-bench() {
cabal v2-bench -j8 \
$CABAL_FLAGS "$@"
}

cabal-repl() {
cabal v2-repl \
$CABAL_FLAGS "$@"
}

cabal-clean() {
cabal v2-clean
}

case "$cmd" in
install)
cabal new-install \
--symlink-bindir=$HOME/.local/bin \
-j8 --overwrite-policy=always --disable-documentation \
exe:hw-json
$CABAL_FLAGS "$@"
cabal-install
;;

build)
cabal new-build all -j8 \
--disable-tests --disable-benchmarks \
$CABAL_FLAGS "$@"
cabal-build
;;

exec)
cabal new-exec "$(echo *.cabal | cut -d . -f 1)" "$@"
cabal-exec
;;

test)
cabal new-test -j8 --enable-tests --disable-documentation \
$CABAL_FLAGS "$@"
cabal-build
cabal-test
;;

bench)
cabal new-bench -j8 \
$CABAL_FLAGS "$@"
cabal-bench
;;

repl)
cabal new-repl \
$CABAL_FLAGS "$@"
cabal-repl
;;

clean)
cabal new-clean
cabal-clean
;;

*)
echo "Unrecognised command: $cmd"
exit 1
;;
esac

# haskell-ide-engine work-around
for x in $(find dist-newstyle -name setup-config | grep '/opt/setup-config$' | sed 's|/opt/setup-config$||g'); do
( cd $x
ln -fs opt/setup-config setup-config
)
done

0 comments on commit 6d1eee8

Please sign in to comment.