You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 7, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: docs/Build.md
+45-19Lines changed: 45 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -10,41 +10,67 @@ The design of the build system has the following main goals:
10
10
11
11
* works identically on every platform
12
12
* has minimal run-time dependencies:
13
-
-a working installation of `stack`
13
+
-`stack`
14
14
-`git`
15
-
* is completely functional right after simple `git clone`
16
-
* one-stop-shop for building all executables required for using `hie` in IDEs.
15
+
* is completely functional right after a simple `git clone` and after every `git pull`
16
+
* one-stop-shop for building and naming all executables required for using `hie` in IDEs.
17
+
* fails with meaningful error messages in known circumstances
18
+
* is able to modify the environment such that `hie` can be run
19
+
- setup `hoogle` database
20
+
- setup `hlint` data-files
17
21
18
22
See the project's `README` for detailed information about installing `hie`.
19
23
20
-
### Tradeoffs
24
+
### Targets
21
25
22
-
#### `shake.yaml`
26
+
The build script `install.hs` defines several targets using the `shake` build system. The targets are roughly:
23
27
24
-
A `shake.yaml` is required for executing the `install.hs` file.
28
+
*`hie-*`: builds and installs the `hie` binaries. Also renames the binaries to contain the correct version-number.
29
+
*`build`: builds and installs `hie` binaries for all supported `ghc` versions.
30
+
*`build-doc`: builds the hoogle-db required by `hie`
31
+
*`cabal-*`: execute the same task as the original target, but with `cabal` instead of `stack`
25
32
26
-
* It contains the required version of `shake`.
27
-
* In contrast to the other `*.yaml` it does not contain the submodules, which is necessary for `stack` to work even before the submodules have been initialized.
33
+
Each `stack-*.yaml` contains references to packages in the submodules. Calling `stack` with one of those causes the build to fail if the submodules have not been initialized already. The file `shake.yaml` solves this issue. Moreover, it specifies the correct version of `shake` and is used for installing all run-time dependencies such as `cabal` and `hoogle` if necessary.
28
34
29
-
It is necessary to update the `resolver` field of the `shake.yaml` if the script should run with a different `GHC`.
35
+
### Run-time dependencies
30
36
31
-
#### `install.hs` installs a GHC
37
+
`hie` depends on a correct environment in order to function properly:
32
38
33
-
Before the code in `install.hs` can be executed, `stack` installs a `GHC`, depending on the `resolver` field in `shake.yaml`. This is necessary if `install.hs` should be completely functional right after a fresh `git clone` without further configuration.
39
+
*`cabal-install`: If no `cabal` executable can be found or has an outdated version, `cabal-install` is installed via `stack`.
40
+
* The `hoogle` database: `hoogle generate` needs to be called with the most-recent `hoogle` version.
34
41
35
-
This may lead to an extra `GHC` to be installed by `stack` if not all versions of `haskell-ide-engine` are installed.
3. ensure that `cabal-install` is installed in the correct version
49
+
4.`stack --stack-yaml=stack-<X>.yaml install` or `cabal new-install -w ghc-<X>`
50
+
5. rename `hie` binary to `hie-<X>` in `$HOME/.local/bin`, where `<X>` is the GHC version used
51
+
6. repeat step 4 and 5 for all desired GHC versions
52
+
53
+
This ensures that a complete install is always possible after each `git pull` or a `git clone`.
54
+
55
+
### Safety checks
56
+
57
+
The `install.hs` script performs some checks to ensure that a correct installation is possible and provide meaningful error messages for known issues.
58
+
59
+
*`stack` needs to be up-to-date. Version `1.9.3` is required
60
+
*`ghc-8.6.3` does not work in windows. Trying to install `hie-8.6.3` on windows is not possible
61
+
*`cabal new-build` does not work on windows at the moment. All `cabal-*` targets exit with an error message about that.
62
+
* When the build fails, an error message, that suggests to remove `.stack-work` directory, is displayed.
63
+
64
+
### Tradeoffs
36
65
37
66
#### `stack` is a build dependency
38
67
39
68
Currently, it is not possible to build all `hie-*` executables automatically without `stack`, since the `install.hs` script is executed by `stack`.
40
69
41
-
Other parts of the script also depend on `stack`:
70
+
We are open to suggestions of other build systems that honor the requirements above, but are executable without `stack`.
42
71
43
-
* finding the local install-dir `stack path --local-bin`
44
-
* finding and installing different `ghc` versions
72
+
#### `install.hs` installs a GHC before running
45
73
46
-
#### `install.hs` executes `cabal install Cabal`
47
-
48
-
`ghc-mod` installs `cabal-helper` at runtime depending on the `ghc` used by the project, which can take a long time upon startup of `hie`. The `install.hs` script speeds up this process by calling `cabal install Cabal` upon build.
74
+
Before the code in `install.hs` can be executed, `stack` installs a `GHC`, depending on the `resolver` field in `shake.yaml`. This is necessary if `install.hs` should be completely functional right after a fresh `git clone` without further configuration.
49
75
50
-
Hopefully, this behaviour can be removed in the future.
76
+
This may lead to an extra `GHC` to be installed by `stack` if not all versions of `haskell-ide-engine` are installed.
0 commit comments