Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(hie-bios): Multi-cradle, ignore directories #147

Merged
merged 2 commits into from
Jun 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -497,15 +497,27 @@ args = ["--lsp"]

### Hacking on haskell-language-server

Haskell-language-server can be used on its own project. We have supplied
preset samples of `hie.yaml` files for stack and cabal, simply copy
the appropriate template to `hie.yaml` and it should work.
Haskell-language-server can be used on itself. We provide
preset samples of `hie.yaml` for Cabal and Stack.

- `hie.yaml.cbl` for cabal
- `hie.yaml.stack` for stack
Note: the `./install/` folder is not directly tied to the project so it has dedicated `./install/hie.yaml.[cbl|stack]`
templates.

Two sample `hie.yaml` files are provided, `hie.yaml.stack` for stack
usage, `hie.yaml.cbl` for cabal. Simply copy the relevant one to be
`hie.yaml` and it should work.
#### Using Cabal

The developers tend to hang out at [our IRC channel](https://webchat.freenode.net/?channels=haskell-ide-engine) at `#haskell-ide-engine` on `freenode`.
```shell
$ cp hie.yaml.cbl hie.yaml
$ cp install/hie.yaml.cbl install/hie.yaml
```

#### Using Stack

Note: Stack project must also be built once until [this issue](https://github.com/commercialhaskell/stack/issues/5213) is fixed.

```shell
$ cp hie.yaml.stack hie.yaml
$ cp install/hie.yaml.stack install/hie.yaml
$ stack build --test --no-run-tests
$ cd install
$ stack build
```
48 changes: 30 additions & 18 deletions hie.yaml.cbl
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,37 @@
# in hie, using cabal as the build system. To use is, copy it to a
# file called 'hie.yaml'
cradle:
cabal:
multi:
- path: "./test/testdata/"
config: { cradle: { none: } }

- path: "./test/functional/"
component: "haskell-language-server:func-test"
- path: "./"
config:
cradle:
cabal:
- path: "./test/functional/"
component: "haskell-language-server:func-test"

- path: "./test/utils/"
component: "haskell-language-server:func-test"
- path: "./test/utils/"
component: "haskell-language-server:func-test"

- path: "./exe/Main.hs"
component: "haskell-language-server:exe:haskell-language-server"

- path: "./exe/Arguments.hs"
component: "haskell-language-server:exe:haskell-language-server"

- path: "./exe/Main.hs"
component: "haskell-language-server:exe:haskell-language-server"
- path: "./exe/Wrapper.hs"
component: "haskell-language-server:exe:haskell-language-server-wrapper"

- path: "./src"
component: "lib:haskell-language-server"

- path: "./exe/Wrapper.hs"
component: "haskell-language-server:exe:haskell-language-server-wrapper"

- path: "./src"
component: "lib:haskell-language-server"

- path: "./ghcide/src"
component: "ghcide:lib:ghcide"

- path: "./ghcide/exe"
component: "ghcide:exe:ghcide"
- path: "./.stack-work/"
component: "lib:haskell-language-server"

- path: "./ghcide/src"
component: "ghcide:lib:ghcide"

- path: "./ghcide/exe"
component: "ghcide:exe:ghcide"
45 changes: 29 additions & 16 deletions hie.yaml.stack
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,37 @@
# in hie, using stack as the build system. To use is, copy it to a
# file called 'hie.yaml'
cradle:
stack:
- path: "./test/functional/"
component: "haskell-language-server:func-test"
multi:
- path: "./test/testdata/"
config: { cradle: { none: } }

- path: "./test/utils/"
component: "haskell-language-server:func-test"
- path: "./"
config:
cradle:
stack:
- path: "./test/functional/"
component: "haskell-language-server:func-test"

- path: "./exe/Main.hs"
component: "haskell-language-server:exe:haskell-language-server"
- path: "./test/utils/"
component: "haskell-language-server:func-test"

- path: "./exe/Wrapper.hs"
component: "haskell-language-server:exe:haskell-language-server-wrapper"
- path: "./exe/Main.hs"
component: "haskell-language-server:exe:haskell-language-server"

- path: "./exe/Arguments.hs"
component: "haskell-language-server:exe:haskell-language-server"

- path: "./src"
component: "haskell-language-server:lib"
- path: "./exe/Wrapper.hs"
component: "haskell-language-server:exe:haskell-language-server-wrapper"

- path: "./src"
component: "haskell-language-server:lib"

- path: "./ghcide/src"
component: "ghcide:lib:ghcide"

- path: "./ghcide/exe"
component: "ghcide:exe:ghcide"
- path: "./.stack-work/"
component: "haskell-language-server:lib"

- path: "./ghcide/src"
component: "ghcide:lib:ghcide"

- path: "./ghcide/exe"
component: "ghcide:exe:ghcide"
3 changes: 3 additions & 0 deletions install/hie.yaml.cbl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cradle:
cabal:
component: "lib:hls-install"
3 changes: 3 additions & 0 deletions install/hie.yaml.stack
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cradle:
stack:
component: "hls-install:lib"
13 changes: 13 additions & 0 deletions install/stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resolver: lts-14.27 # Last 8.6.5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could use only one stack.yaml, removing shake.yaml?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it still wouldn't AFAIR there were inconsistencies with the Cabal dependency (not 100% sure though). But as long as there's a dependency on Shake, we can't do much...

Copy link
Member

@jneira jneira Jun 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm not sure what was the problem, but i've tried:

  • add
flags:
  hls-install:
    run-from-stack: true

to ./install/stack.yaml

  • remove ./install/shake.yaml
  • replace in ./install.hs,--stack-yaml=install/shake.yaml with --stack-yaml=install/stack.yaml

And both stack install.hs <target> and opening ./install/src/BuildSystem.hs seems to work fine.

Copy link
Member

@jneira jneira Jun 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sir4ur0n we could do the suggested change above in another pr if you prefer and merge this as is

Copy link
Member

@Ailrun Ailrun Jun 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not in hurry since I currently don't work with files under /install directory, and somehow managed HLS to work with itself in other directories, so please do whatever you are in favor of.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ailrun sorry, bad mention 😅


packages:
- .

extra-deps:
- cabal-install-parsers-0.3.0.1
- Cabal-3.2.0.0
- binary-instances-1.0.0.1
- lukko-0.1.1.2

nix:
packages: [ icu libcxx zlib ]