Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit cef6893

Browse files
authored
Merge pull request #374 from github/multi-component-ghcide-setup
Multi component ghcide setup
2 parents 2175bbb + 7662ee7 commit cef6893

File tree

6 files changed

+88
-47
lines changed

6 files changed

+88
-47
lines changed

.ghci.semantic

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,17 @@
11
-- GHCI settings for semantic, collected by running cabal repl -v and checking out the flags cabal passes to ghc.
22
-- These live here instead of script/repl for ease of commenting.
33
-- These live here instead of .ghci so cabal repl remains unaffected.
4+
-- These live here instead of script/ghci-flags so ghcide remains unaffected.
45

56
-- Basic verbosity
67
:set -v1
78

8-
-- No optimizations
9-
:set -O0
10-
119
-- Compile to object code
1210
:set -fwrite-interface -fobject-code
1311

14-
-- Write build products to dist-repl (so that we don’t clobber 'cabal build' outputs)
15-
:set -outputdir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build
16-
:set -odir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build
17-
:set -hidir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build
18-
:set -stubdir dist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build
19-
20-
-- Look for autogen’d files in dist-repl
21-
:set -idist-repl/build/x86_64-osx/ghc-8.6.5/semantic-0.8.0.0/build/autogen
22-
23-
-- Load all our sources… remember to keep this up to date when we add new packages!
24-
-- But don’t add semantic-source, it’s important that we get that from hackage.
25-
:set -isemantic-analysis/src
26-
:set -isemantic-ast/src
27-
:set -isemantic-core/src
28-
:set -isemantic-java/src
29-
:set -isemantic-json/src
30-
:set -isemantic-python/src
31-
:set -isemantic-tags/src
32-
:set -iapp
33-
:set -isrc
34-
:set -ibench
35-
:set -itest
36-
37-
-- Default language mode & extensions
38-
:set -XHaskell2010
39-
:set -XStrictData
40-
41-
-- Warnings for compiling .hs files
42-
:set -Weverything
43-
:set -Wno-all-missed-specialisations
44-
:set -Wno-implicit-prelude
45-
:set -Wno-missed-specialisations
46-
:set -Wno-missing-import-lists
47-
:set -Wno-missing-local-signatures
48-
:set -Wno-monomorphism-restriction
49-
:set -Wno-name-shadowing
50-
:set -Wno-safe
51-
:set -Wno-unsafe
52-
:set -Wno-star-is-type
5312
-- Bonus: silence “add these modules to your .cabal file” warnings for files we :load
5413
:set -Wno-missing-home-modules
5514

56-
-- Don’t fail on warnings when in the repl
57-
:set -Wwarn
58-
5915
-- Warnings for code written in the repl
6016
:seti -Weverything
6117
:seti -Wno-all-missed-specialisations

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ tmp/
2626
*.hp
2727
*.prof
2828
*.pyc
29-
/hie.yaml
3029

3130
/test.*
3231
/*.html

hie.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cradle:
2+
bios:
3+
program: script/ghci-flags
4+
dependency-program: script/ghci-flags-dependencies

script/ghci-flags

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
# Computes the flags for ghcide to pass to ghci. You probably won’t be running this yourself, but rather ghcide will via configuration in hie.yaml.
3+
4+
set -e
5+
6+
cd $(dirname "$0")/..
7+
8+
root="$(pwd)"
9+
ghc_version="$(ghc --numeric-version)"
10+
11+
if [ "$1" == "--builddir" ]; then
12+
repl_builddir="$2"
13+
shift 2
14+
else
15+
repl_builddir=dist-newstyle
16+
fi
17+
18+
echo "-O0"
19+
echo "-ignore-dot-ghci"
20+
21+
echo "-outputdir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build"
22+
echo "-odir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build"
23+
echo "-hidir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build"
24+
echo "-stubdir $repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build"
25+
26+
echo "-i$root/$repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build/autogen"
27+
28+
echo "-I$root/$repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build/autogen"
29+
30+
echo "-i$root/semantic-analysis/src"
31+
echo "-i$root/semantic-ast/src"
32+
echo "-i$root/semantic-core/src"
33+
echo "-i$root/semantic-java/src"
34+
echo "-i$root/semantic-json/src"
35+
echo "-i$root/semantic-python/src"
36+
echo "-i$root/semantic-tags/src"
37+
echo "-i$root/app"
38+
echo "-i$root/src"
39+
echo "-i$root/bench"
40+
echo "-i$root/test"
41+
42+
echo "-optP-include"
43+
echo "-optP$root/$repl_builddir/build/x86_64-osx/ghc-$ghc_version/semantic-0.8.0.0/build/autogen/cabal_macros.h"
44+
45+
echo "-hide-all-packages"
46+
47+
# Emit package flags from the environment file, removing comments & prefixing with -
48+
cabal exec --builddir=$repl_builddir -v0 bash -- -c 'cat $GHC_ENVIRONMENT' | grep -v '^--' | sed -e 's/^/-/'
49+
50+
echo "-XHaskell2010"
51+
echo "-XStrictData"
52+
53+
echo "-Wwarn"
54+
55+
echo "-Weverything"
56+
echo "-Wno-all-missed-specialisations"
57+
echo "-Wno-implicit-prelude"
58+
echo "-Wno-missed-specialisations"
59+
echo "-Wno-missing-import-lists"
60+
echo "-Wno-missing-local-signatures"
61+
echo "-Wno-monomorphism-restriction"
62+
echo "-Wno-name-shadowing"
63+
echo "-Wno-safe"
64+
echo "-Wno-unsafe"
65+
echo "-Wno-star-is-type"

script/ghci-flags-dependencies

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
# Computes the paths to files causing changes to the ghci flags. You probably won’t be running this yourself, but rather ghcide will via configuration in hie.yaml.
3+
4+
set -e
5+
6+
cd $(dirname "$0")/..
7+
8+
echo "cabal.project"
9+
10+
echo "semantic.cabal"
11+
echo "semantic-analysis/semantic-analysis.cabal"
12+
echo "semantic-ast/semantic-ast.cabal"
13+
echo "semantic-core/semantic-core.cabal"
14+
echo "semantic-java/semantic-java.cabal"
15+
echo "semantic-json/semantic-json.cabal"
16+
echo "semantic-python/semantic-python.cabal"
17+
echo "semantic-tags/semantic-tags.cabal"

script/repl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ repl_builddir=dist-repl
1111
if [[ ! -d $repl_builddir ]]; then
1212
echo "$repl_builddir does not exist, first run 'cabal repl --builddir=$repl_builddir', exit, and then re-run $0"
1313
else
14-
cabal exec --builddir=$repl_builddir ghci -- -ghci-script=.ghci.semantic $@
14+
cabal exec --builddir=$repl_builddir ghci -- -ghci-script=.ghci.semantic $(script/ghci-flags --builddir "$repl_builddir") -no-ignore-dot-ghci $@
1515
fi

0 commit comments

Comments
 (0)