-
Notifications
You must be signed in to change notification settings - Fork 38
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
Enable tests and benchmarks for stack #92
Conversation
I am not able to reproduce haskell/haskell-ide-engine#1564 in my windows 10 without this patch. @fendor do you have a reproducible case to test this against? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have two objections here:
- No regression test
The ghc-session
suite already has a test case with a test and benchmark (exelib
) but we just build the components we do detect, so you'd have to add support for specifying which components should be there in the test config.
- Performance
I'm concerned that by unconditionally enabling tests and benchmarks for c-h invocations of stack build
we'll force the user's stack build
calls to reconfigure the packages without those components again. Which gets us into a sort of ping-pong situation which I'd like to avoid.
I'm not sure what stack's mechanism for avoiding that is, in principle it could be looking at the existing LocalBuildInfo and figure out what to build based on that, that's what v1-build did after all which they likely copied. You should test that out.
lib/Distribution/Helper.hs
Outdated
@@ -518,17 +518,15 @@ buildProjectTarget qe mu stage = do | |||
} -> do | |||
let projdir = plStackProjectDir qeProjLoc | |||
let workdir_opts = Stack.workdirArg qe | |||
let opts = workdir_opts ++ | |||
[ "--stack-yaml="++plStackYaml, "build", "." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, you're changing the behaviour here. That "."
is load-bearing :)
Without it Stack build the whole project, even when in a package sub-directory, but with it it will only build the package it's currently in. Hence the two cases below.
Stack docs say this:
Finally: if you provide no targets (e.g., running
stack build
), stack will implicitly pass in all of your local packages. If you only want to target packages in the current directory or deeper, you can pass in ., e.g.stack build .
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jum, to be honest i didn't spot the difference, good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should probably add a comment clarifying the situation then :)
@jneira I have a reproducable case, I will try out the PR. |
Thanks for the review and sorry if it was a little bit hasty
Yeah, they are needed. In fact i can't reproduce anymore manually the hie error without this so that is the first step.
... and user experience. I was wondering if it could be conditioned to some already exixting info. To get the minimum info i suppose we have to build the project with |
Yeah something like that. I'd like to stress again that already just rewriting As for detecting if a file belongs to a (currently disabled) test/bench component: I'm pretty sure that's going to be somewhat involved to impossible since we can't rely on the info we usually have for enabled components. So you'd have to build a model of what is in a package just by looking at the (unconfigured) package description. I had a related discussion with someone (@fendor or @bubba probably) a while ago about detecting if a file is part of a project or not regardless of component enablement but this is going a step beyond that even. We should have a discussion about that seperately it's a pretty tricky topic. My gut feeling is that we'd need changes in Cabal to support this though so beware.
I'm not so concerned with a one time delay here, the problem is the ping-pong behaviour. As long as the switch to tests/benchmarks enabled happens once and then sticks, its fine. But if cabal-helper and the user keep fighting over the enable/disable state that's bad :) |
24afd10
to
88accca
Compare
One caveat i've think out: test/bench component could be broken (included its dependencies), and configure/build with them active would fail so user may want to no activate them. |
stack build --test
we were not able to load the ghc flags using cabal-helper+hie-bios--test --benchmarks
to all stack stages triggered bycabal-helper
to ensure all components are enabled (with--no-run.tests
andno-run-benchamrks
to avoid unwanted work)