This repository was archived by the owner on Apr 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 457
Expand file tree
/
Copy pathghci-flags
More file actions
executable file
·100 lines (82 loc) · 2.99 KB
/
ghci-flags
File metadata and controls
executable file
·100 lines (82 loc) · 2.99 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env bash
# Computes the flags for ghcide to pass to ghci. You probably won’t be running this yourself, but rather script/repl will.
set -e
cd "$(dirname "$0")/.."
ghc_version="$(ghc --numeric-version)"
build_dir="dist-newstyle/build/x86_64-osx/ghc-$ghc_version"
build_products_dir="$build_dir/build-repl"
function add_autogen_includes {
echo "-optP-include"
echo "-optP$1/cabal_macros.h"
# autogenerated files, .h and .hs
echo "-i$1"
echo "-I$1"
}
cores=$(sysctl -n machdep.cpu.core_count || echo 4)
# disable optimizations for faster loading
echo "-O0"
# don’t load .ghci files (for ghcide)
echo "-ignore-dot-ghci"
# use as many jobs as there are physical cores
echo "-j$cores"
# 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"
if [ -d "$build_dir/semantic-0.11.0.0/build/autogen" ]
then add_autogen_includes "$build_dir/semantic-0.11.0.0/build/autogen"
elif [ -d "$build_dir/semantic-0.11.0.0/noopt/build/autogen" ]
then add_autogen_includes "$build_dir/semantic-0.11.0.0/noopt/build/autogen"
fi
echo "-optP-Wno-macro-redefined"
echo "-DBAZEL_BUILD=0"
# .hs source dirs
# TODO: would be nice to figure this out from cabal.project & the .cabal files
echo "-isemantic/app"
echo "-isemantic/src"
echo "-isemantic/bench"
echo "-isemantic/test"
echo "-isemantic-analysis/src"
echo "-isemantic-ast/src"
echo "-isemantic-codeql/src"
echo "-isemantic-codeql/test"
echo "-isemantic-go/src"
echo "-isemantic-java/src"
echo "-isemantic-json/src"
echo "-isemantic-json/test"
echo "-isemantic-parse/src"
echo "-isemantic-php/src"
echo "-isemantic-proto/src"
echo "-isemantic-python/src"
echo "-isemantic-python/test"
echo "-isemantic-ruby/src"
echo "-isemantic-rust/src"
echo "-isemantic-scope-graph/src"
echo "-isemantic-tsx/src"
echo "-isemantic-typescript/src"
echo "-isemantic-tags/src"
# disable automatic selection of packages
echo "-hide-all-packages"
echo "-package proto-lens-jsonpb"
# 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/^/-/'
# default language extensions
echo "-XHaskell2010"
echo "-XStrictData"
# 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.* ]] || [[ "$ghc_version" = 8.10.* ]] && echo "-Wno-star-is-type" || true
[[ "$ghc_version" = 8.8.* ]] || [[ "$ghc_version" = 8.10.* ]] && echo "-Wno-missing-deriving-strategies" || true
[[ "$ghc_version" = 8.10.* ]] && echo "-Wno-missing-safe-haskell-mode" && echo "-Wno-prepositive-qualified-module" && echo "-Wno-unused-packages"