|
| 1 | +## Build system |
| 2 | + |
| 3 | +`haskell-ide-engine` is built using the library `shake`. The build descriptions are defined in the file `install.hs`. |
| 4 | + |
| 5 | +Previously, `haskell-ide-engine` was built using a `Makefile` on Unix systems and a `PowerShell` script on Windows. By replacing both scripts by a Haskell-based solution, the build process is unified. |
| 6 | + |
| 7 | +### Design goals |
| 8 | + |
| 9 | +The design of the build system has the following main goals: |
| 10 | + |
| 11 | +* works identically on every platform |
| 12 | +* has minimal run-time dependencies: |
| 13 | + - a working installation of `stack` |
| 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. |
| 17 | + |
| 18 | +See the project's `README` for detailed information about installing `hie`. |
| 19 | + |
| 20 | +### Tradeoffs |
| 21 | + |
| 22 | +#### `shake.yaml` |
| 23 | + |
| 24 | +A `shake.yaml` is required for executing the `install.hs` file. |
| 25 | + |
| 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. |
| 28 | + |
| 29 | +It is necessary to update the `resolver` field of the `shake.yaml` if the script should run with a different `GHC`. |
| 30 | + |
| 31 | +#### `install.hs` installs a GHC |
| 32 | + |
| 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. |
| 34 | + |
| 35 | +This may lead to an extra `GHC` to be installed by `stack` if not all versions of `haskell-ide-engine` are installed. |
| 36 | + |
| 37 | +#### `stack` is a build dependency |
| 38 | + |
| 39 | +Currently, it is not possible to build all `hie-*` executables automatically without `stack`, since the `install.hs` script is executed by `stack`. |
| 40 | + |
| 41 | +Other parts of the script also depend on `stack`: |
| 42 | + |
| 43 | +* finding the local install-dir `stack path --local-bin` |
| 44 | +* finding and installing different `ghc` versions |
| 45 | + |
| 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. |
| 49 | + |
| 50 | +Hopefully, this behaviour can be removed in the future. |
0 commit comments