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

Allow making the cabal builds totally silent #1208

Merged
merged 6 commits into from
Jan 14, 2020
Merged

Conversation

thufschmitt
Copy link
Contributor

Give an option in cabal_haskell_library and stack_snapshot to make the builds totally silent (except in case of failure).

This is useful to enforce quietness even for build steps for which cabal can't enforce it (like cabal configure or cabal haddock).

I didn't add a test for it because I don't know how to test for the console output of a rule in bazel. If someone knows a way, I'd be happy to add a test for it.

Comment on lines 44 to 45
print(err.stdout.decode())
print(err.stderr.decode(), file=sys.stderr)
Copy link
Member

Choose a reason for hiding this comment

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

I think you can avoid the decode with sys.std(out|err).buffer.write.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh thanks, didn't know that. I'll try this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice, that works indeed.

haskell/private/cabal_wrapper.py.tpl Outdated Show resolved Hide resolved
Comment on lines +977 to +982
"verbose": attr.bool(
default = False,
doc = "Whether to show the output of the build",
),
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be forwarded to the generated calls to haskell_cabal_library to have any effect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, just noticed that. Should be good now

Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

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

Looks good, thank you!

One small comment.

Comment on lines 46 to 47
# print(err.stdout.decode())
# print(err.stderr.decode(), file=sys.stderr)
Copy link
Member

Choose a reason for hiding this comment

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

Remove those?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops 😇

Done

@aherrmann aherrmann added the merge-queue merge on green CI label Jan 14, 2020
Théophane Hufschmitt and others added 6 commits January 14, 2020 17:01
Give an option in `cabal_haskell_library` and `stack_snapshot` to make
the builds totally silent (except in case of failure).

This is useful to enforce quietness even for build steps for which cabal
can't enforce it (like `cabal configure` or `cabal haddock`)
…han true

Co-Authored-By: Andreas Herrmann <andreas.herrmann@tweag.io>
@mergify mergify bot merged commit d76a16e into master Jan 14, 2020
@mergify mergify bot deleted the quiet-cabal-builds branch January 14, 2020 17:22
@mergify mergify bot removed the merge-queue merge on green CI label Jan 14, 2020
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

Successfully merging this pull request may close these issues.

2 participants