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

Add optional list of components to stack cradle options #65

Closed
mitchellwrosen opened this issue Oct 1, 2019 · 9 comments
Closed

Add optional list of components to stack cradle options #65

mitchellwrosen opened this issue Oct 1, 2019 · 9 comments

Comments

@mitchellwrosen
Copy link
Contributor

mitchellwrosen commented Oct 1, 2019

This would allow you to use the stack cradle in a context where you may not want to load every package defined in your stack.yaml at once (e.g. in a big monorepo).

@mpickering
Copy link
Collaborator

I think this is an issue with how ghcide uses the stack cradle. AFAIU, it just passes an empty path to the cradle which means that stack loads everything.

@ndmitchell
Copy link
Contributor

Currently, yes, ghcide does that. It's something that needs fixing at some point.

@istathar
Copy link
Contributor

I'm not sure if this is the same issue, but I'm not sure how to get cradle: {stack} to load test dependencies? Running in a checkout of ghcide I get errors like

File:     ./test/exe/Main.hs
Range:    26:7-26:23
Source:   not found
Severity: DsError
Message: 
  Could not find module ‘Test.Tasty.HUnit’
  It is not a module in the current program, or in any known package.
...
Files that failed:
 * ./test/exe/Main.hs
 * ./test/src/Development/IDE/Test.hs

Completed (39 files worked, 2 files failed)

@ndmitchell I'm pretty sure you showed dogfooding the ghcide program in your own code, so I'm missing something obvious, I assume.

@jneira
Copy link
Member

jneira commented Oct 11, 2019

I've hit the same issue than @afcowie using directly hie-bios (master):

D:\ws\haskell\hie-bios>hie-bios check tests\ParserTests.hs
cradle
  Cradle {cradleRootDir = "D:\\ws\\haskell\\hie-bios", cradleOptsProg = CradleAction: stack}
hie-bios: <command line>: cannot satisfy -package tasty-1.2.3
    (use -v for more information)

But clearly it is a separate issue: hie-bios should be able to load all stack components before optionally only load some of them!

@mpickering
Copy link
Collaborator

@afcowie I don't know how to reproduce your issue but I would like to if you can tell me how.

@jneira I reproduce your issue. The problem is that stack repl tests/ParserTests.hs fails. If you can debug that then the stack cradle would work but it's a mystery to me why it fails.

@istathar
Copy link
Contributor

@mpickering ok, let's see. As far as I can tell it's any project with e.g. a library and a test-suite where the tests binaries depend on things (like say hspec or hedgehog) that the core library does not.

Do you want an example project you can clone/unpack and try for yourself?

@mpickering
Copy link
Collaborator

You can now explicitly specify a component.

@zzantares
Copy link

Hi @mpickering, sorry to ask here but it seems relevant, will this:

cradle:
  stack:
    component: "myproject:test:myproject-tests"

also load the lib component? Or should be ...

cradle:
  stack:
    component:
      - "myproject:test:myproject-tests"
      - "myproject:lib"

?

@fendor
Copy link
Collaborator

fendor commented Dec 15, 2019

You can do this with a mulit-cradle, e.g.

cradle:
  stack:
    - path: "./src"
      component: "myproject:lib"
    - path: "./test"
      component: "myproject:test:myproject-tests"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants