mirror of
https://github.com/github/semantic.git
synced 2024-11-24 00:42:33 +03:00
Merge pull request #411 from github/ghcide-is-painless
Update script/repl & ghcide support for 8.8.1
This commit is contained in:
commit
5ac48ee676
@ -1,4 +1,4 @@
|
||||
-- GHCI settings for semantic, collected by running cabal repl -v and checking out the flags cabal passes to ghc.
|
||||
-- GHCI settings for script/repl.
|
||||
-- These live here instead of script/repl for ease of commenting.
|
||||
-- These live here instead of .ghci so cabal repl remains unaffected.
|
||||
-- These live here instead of script/ghci-flags so ghcide remains unaffected.
|
||||
@ -24,3 +24,4 @@
|
||||
:seti -Wno-safe
|
||||
:seti -Wno-unsafe
|
||||
:seti -Wno-star-is-type
|
||||
:seti -Wno-missing-deriving-strategies
|
@ -3,63 +3,78 @@
|
||||
|
||||
set -e
|
||||
|
||||
cd $(dirname "$0")/..
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
root="$(pwd)"
|
||||
ghc_version="$(ghc --numeric-version)"
|
||||
|
||||
if [ "$1" == "--builddir" ]; then
|
||||
repl_builddir="$2"
|
||||
shift 2
|
||||
else
|
||||
repl_builddir=dist-newstyle
|
||||
fi
|
||||
# recent hie-bios requires us to output to the file at $HIE_BIOS_OUTPUT, but older builds & script/repl don’t set that var, so we default it to stdout
|
||||
output_file="${HIE_BIOS_OUTPUT:-/dev/stdout}"
|
||||
|
||||
echo "-O0"
|
||||
echo "-ignore-dot-ghci"
|
||||
# do a build of dependencies up front to ensure they’re all available
|
||||
cabal v2-build -v0 all --only-dependencies
|
||||
|
||||
echo "-outputdir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build"
|
||||
echo "-odir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build"
|
||||
echo "-hidir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build"
|
||||
echo "-stubdir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build"
|
||||
build_products_dir="dist-newstyle/build/x86_64-osx/ghc-$ghc_version/build-repl"
|
||||
|
||||
echo "-i$root/$repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build/autogen"
|
||||
function flags {
|
||||
# disable optimizations for faster loading
|
||||
echo "-O0"
|
||||
# don’t load .ghci files (for ghcide)
|
||||
echo "-ignore-dot-ghci"
|
||||
|
||||
echo "-I$root/$repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build/autogen"
|
||||
# where to put build products
|
||||
echo "-outputdir $build_products_dir"
|
||||
echo "-odir $build_products_dir"
|
||||
echo "-hidir $build_products_dir"
|
||||
echo "-stubdir $build_products_dir"
|
||||
|
||||
echo "-i$root/semantic-analysis/src"
|
||||
echo "-i$root/semantic-ast/src"
|
||||
echo "-i$root/semantic-core/src"
|
||||
echo "-i$root/semantic-java/src"
|
||||
echo "-i$root/semantic-json/src"
|
||||
echo "-i$root/semantic-python/src"
|
||||
echo "-i$root/semantic-tags/src"
|
||||
echo "-i$root/app"
|
||||
echo "-i$root/src"
|
||||
echo "-i$root/bench"
|
||||
echo "-i$root/test"
|
||||
# preprocessor options, for -XCPP
|
||||
echo "-optP-include"
|
||||
echo "-optP$build_products_dir/autogen/cabal_macros.h"
|
||||
|
||||
echo "-optP-include"
|
||||
echo "-optP$root/$repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build/autogen/cabal_macros.h"
|
||||
# autogenerated sources, both .hs and .h (e.g. Foo_paths.hs)
|
||||
echo "-i$build_products_dir/autogen"
|
||||
echo "-I$build_products_dir/autogen"
|
||||
|
||||
echo "-hide-all-packages"
|
||||
# .hs source dirs
|
||||
# TODO: would be nice to figure this out from cabal.project & the .cabal files
|
||||
echo "-isemantic-analysis/src"
|
||||
echo "-isemantic-ast/src"
|
||||
echo "-isemantic-core/src"
|
||||
echo "-isemantic-java/src"
|
||||
echo "-isemantic-json/src"
|
||||
echo "-isemantic-python/src"
|
||||
echo "-isemantic-tags/src"
|
||||
echo "-iapp"
|
||||
echo "-isrc"
|
||||
echo "-ibench"
|
||||
echo "-itest"
|
||||
|
||||
# Emit package flags from the environment file, removing comments & prefixing with -
|
||||
cabal exec --builddir=$repl_builddir -v0 bash -- -c 'cat $GHC_ENVIRONMENT' | grep -v '^--' | sed -e 's/^/-/'
|
||||
# disable automatic selection of packages
|
||||
echo "-hide-all-packages"
|
||||
|
||||
echo "-XHaskell2010"
|
||||
echo "-XStrictData"
|
||||
# run cabal and emit package flags from the environment file, removing comments & prefixing with -
|
||||
cabal v2-exec -v0 bash -- -c 'cat "$GHC_ENVIRONMENT"' | grep -v '^--' | sed -e 's/^/-/'
|
||||
|
||||
echo "-Wwarn"
|
||||
# default language extensions
|
||||
echo "-XHaskell2010"
|
||||
echo "-XStrictData"
|
||||
|
||||
echo "-Weverything"
|
||||
echo "-Wno-all-missed-specialisations"
|
||||
echo "-Wno-implicit-prelude"
|
||||
echo "-Wno-missed-specialisations"
|
||||
echo "-Wno-missing-import-lists"
|
||||
echo "-Wno-missing-local-signatures"
|
||||
echo "-Wno-monomorphism-restriction"
|
||||
echo "-Wno-name-shadowing"
|
||||
echo "-Wno-safe"
|
||||
echo "-Wno-unsafe"
|
||||
echo "-Wno-star-is-type"
|
||||
# treat warnings as warnings
|
||||
echo "-Wwarn"
|
||||
|
||||
# default warning flags
|
||||
echo "-Weverything"
|
||||
echo "-Wno-all-missed-specialisations"
|
||||
echo "-Wno-implicit-prelude"
|
||||
echo "-Wno-missed-specialisations"
|
||||
echo "-Wno-missing-import-lists"
|
||||
echo "-Wno-missing-local-signatures"
|
||||
echo "-Wno-monomorphism-restriction"
|
||||
echo "-Wno-name-shadowing"
|
||||
echo "-Wno-safe"
|
||||
echo "-Wno-unsafe"
|
||||
[[ "$ghc_version" = 8.6.* ]] || [[ "$ghc_version" = 8.8.* ]] && echo "-Wno-star-is-type" || true
|
||||
[[ "$ghc_version" = 8.8.* ]] && echo "-Wno-missing-deriving-strategies" || true
|
||||
}
|
||||
|
||||
flags > "$output_file"
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
cd $(dirname "$0")/..
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
echo "cabal.project"
|
||||
|
||||
|
11
script/repl
11
script/repl
@ -4,12 +4,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
cd $(dirname "$0")/..
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
repl_builddir=dist-repl
|
||||
|
||||
if [[ ! -d $repl_builddir ]]; then
|
||||
echo "$repl_builddir does not exist, first run 'cabal repl --builddir=$repl_builddir', exit, and then re-run $0"
|
||||
else
|
||||
cabal exec --builddir=$repl_builddir ghci -- -ghci-script=.ghci.semantic $(script/ghci-flags --builddir "$repl_builddir") -no-ignore-dot-ghci $@
|
||||
fi
|
||||
# exec ghci with the appropriate flags, and without the $GHC_ENVIRONMENT variable interfering
|
||||
cabal v2-exec env -- -u GHC_ENVIRONMENT ghci -ghci-script=.ghci.repl $(script/ghci-flags) -no-ignore-dot-ghci $@
|
||||
|
Loading…
Reference in New Issue
Block a user