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

Warnings aren't visible #298

Closed
mgsloan opened this issue Jun 14, 2015 · 12 comments
Closed

Warnings aren't visible #298

mgsloan opened this issue Jun 14, 2015 · 12 comments
Milestone

Comments

@mgsloan
Copy link
Contributor

mgsloan commented Jun 14, 2015

Currently there isn't any indication that a warning was outputted while building a package. This can be resolved by grepping for Warning: in logs, but that's a bit hacky and you need to remember to do it.

I realize that it could be a bit problematic to extract out the warnings from the rest of GHC's output. Instead of going for that level of support, it would be helpful to simply inform the user that there appear to be warnings (by searching for Warning: in the logs. This might look like this:

foo-0.0.1: configure
foo-0.0.1: build
foo-0.0.1: warnings encountered - see /home/mgsloan/foo/.stack-work/logs/foo-0.0.1.log
foo-0.0.1: install
@chrisdone
Copy link
Member

We discussed parsing GHC's and having a Conduit ByteString m Message kind of conduit that would have use in a number of applications. I don't think it'd be too problematic or unreasonable to print out any messages captured. Niklas also requested this.

@snoyberg snoyberg added this to the Later improvements milestone Jun 15, 2015
@snoyberg
Copy link
Contributor

I'm not opposed to this change, but given the way stack works now I think it's not terribly urgent. When working on a single package, all output is sent to the console, so you'll see the warnings. The only time when the warnings are hidden away in a log file is when you're building multiple packages at once, where (IME) not seeing the warnings is acceptable.

Another option to work around this is to use the --pedantic flag.

@alanz
Copy link
Contributor

alanz commented Jun 24, 2015

A note:

"When working on a single package, all output is sent to the console"

I just ran this against a single package with a warning, and it is silent, although there are warnings in the log file.

--pedantic shows the output, but then also enables -Werror which breaks the build.

Version 0.1.0.0, Git revision 2354251bb06d761c8e63d6993c6971673a729d8a

@snoyberg
Copy link
Contributor

I need a little more information about what's going on here. When I run stack build on a single project, I see all output generated by GHC stream to the console. Are you seeing that? If not, we should understand why that's not triggering here.

@alanz
Copy link
Contributor

alanz commented Jun 24, 2015

The project in question is https://github.com/alanz/ghc-exactprint/tree/wip at commit 27e90e45729f81b7a1b439ca2a04cc4d169d2d56

Using current ghc-7.10 head, and
stack Version 0.1.0.0, Git revision cbde66a

What I see after deleting .stack-work is

alanz@alanz-laptop:~/mysrc/github/alanz/ghc-exactprint$ rm -fr .stack-work
alanz@alanz-laptop:~/mysrc/github/alanz/ghc-exactprint$ stack build
refact-0.1.0.0: configure
ghc-syb-utils-0.2.3: configure
refact-0.1.0.0: build
ghc-syb-utils-0.2.3: build
refact-0.1.0.0: install
ghc-syb-utils-0.2.3: install
ghc-exactprint-0.3: configure
ghc-exactprint-0.3: build
ghc-exactprint-0.3: install
Completed all 3 actions.

However, the log file has

[ 9 of 10] Compiling Language.Haskell.GHC.ExactPrint.Transform ( src/Language/Haskell/GHC/ExactPrint/Transform.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Language/Haskell/GHC/ExactPrint/Transform.o )

src/Language/Haskell/GHC/ExactPrint/Transform.hs:153:5: Warning:
    Pattern match(es) are non-exhaustive
    In an equation for ‘go’: Patterns not matched: GetSortKey _ _
[10 of 10] Compiling Language.Haskell.GHC.ExactPrint ( src/Language/Haskell/GHC/ExactPrint.hs, .stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/Language/Haskell/GHC/ExactPrint.o )

Perhaps it is related to a git ref for a location?

@snoyberg
Copy link
Contributor

Try running stack build ghc-exactprint instead. If that works for showing the output, I believe this will fix the problem correctly:

flags: {}
packages:
- '.'
- location:
    git: [email protected]:mpickering/refact
    commit: 5fc6585cefb50a0fddba0f56cc8dabb9fad832e8
  valid-wanted: false
extra-deps:
  # - ghc-7.10.1.20150612
  - ghc-syb-utils-0.2.3
resolver: nightly-2015-06-16
# resolver: lts-2.14

The valid-wanted thing is a bad name, and is fixed on master to be dependency... anyway, give that a shot, if it works, you can switch to dependency: true when you upgrade stack next.

@alanz
Copy link
Contributor

alanz commented Jun 24, 2015

Using stack build ghc-exactprint does show the warnings.

Setting either valid-wanted: false or dependency: true made no difference to the bare stack build case (after upgrade to current master)

@snoyberg
Copy link
Contributor

Sorry, I got the syntax incorrect, it's extra-dep: true. For me, I get the expected behavior with the following stack.yaml:

flags: {}
packages:
- '.'
- location:
    git: [email protected]:mpickering/refact
    commit: 5fc6585cefb50a0fddba0f56cc8dabb9fad832e8
  extra-dep: true
extra-deps:
  # - ghc-7.10.1.20150612
  - ghc-syb-utils-0.2.3
resolver: nightly-2015-06-16
# resolver: lts-2.14
$ stack --version
Version 0.1.0.0, Git revision 5b6794647eef2c87f9c1cfb12a0dd23ad541b656

@alanz
Copy link
Contributor

alanz commented Jun 24, 2015

I actually saw via the wiki it should be extra-dep, but put it at the same level as the git and commit lines, lining it up with location does the trick.

Perhaps there should be an error message for attributes that are not processed.

@snoyberg
Copy link
Contributor

It's planned, see #48.

@mgsloan
Copy link
Contributor Author

mgsloan commented Jul 2, 2015

I'm closing this in favor of #426, which proposes adding a flag to send ghc output to stdout.

@snoyberg
Copy link
Contributor

Relevant PR: #4097

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

4 participants