Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
13 changes: 13 additions & 0 deletions .ghci
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Default `-Werror` flags that should be disabled in GHCi
:set -Wno-error=identities
:set -Wno-error=redundant-constraints
:set -Wno-error=unused-imports

-- Default warning flags that should be disabled in GHCi
:set -Wno-unused-local-binds
:set -Wno-unused-packages
:set -Wno-unused-pattern-binds
:set -Wno-unused-top-binds

-- Set the GHCi prompt for "proto3-suite" sessions.
:set prompt "proto3-suite> "
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ testing). From the root of this repository, run:

```bash
$ nix-shell
[nix-shell]$ cabal configure -f development
[nix-shell]$ cabal build
```

Once your source code compiles and you want to test, run this instead:
To enable testing, configure `cabal` with `--enable-test` and (optionally) with the [`development`](./proto3-suite.cabal) flag to enable `-Werror`. Once your source code compiles and you want to test, run:

```bash
$ nix-shell
[nix-shell]$ cabal configure --enable-tests
[nix-shell]$ cabal configure -f development --enable-tests
[nix-shell]$ cabal build
[nix-shell]$ cabal test
```
Expand Down
4 changes: 4 additions & 0 deletions nix/overlays/haskell-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ in {

postPatch = (oldArgs.postPatch or "") + copyGeneratedCode + patchTestScripts;

configureFlags = (oldArgs.configureFlags or []) ++ [
"-fdevelopment"
];

testHaskellDepends =
(oldArgs.testHaskellDepends or [ ]) ++ [
haskellPackagesNew.proto3-suite-boot
Expand Down
19 changes: 14 additions & 5 deletions proto3-suite.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ flag attoparsec-aeson
Manual: False
-- "Manual: False" to automatically skip "attoparsec-aeson" if it is not available

flag development
description: Enable development-specific options.
default: False
manual: true

source-repository head
type: git
location: https://github.com/awakesecurity/proto3-suite
Expand All @@ -53,6 +58,10 @@ common common
BlockArguments ExplicitNamespaces DeriveDataTypeable DeriveGeneric
ImportQualifiedPost ViewPatterns

if flag(development)
ghc-options:
-Werror

library
import: common

Expand Down Expand Up @@ -111,7 +120,7 @@ library
contravariant >=1.4 && <1.6,
filepath,
foldl,
ghc-lib-parser >=9.2.8 && <9.13,
ghc-lib-parser >=9.2.8 && <9.11,
Comment thread
j6carey marked this conversation as resolved.
Outdated
hashable,
insert-ordered-containers,
lens,
Expand All @@ -138,7 +147,7 @@ library
build-depends: attoparsec-aeson >= 2.2.0.0
hs-source-dirs: src
default-language: Haskell2010
ghc-options: -O2 -Wall -Werror
ghc-options: -O2 -Wall

test-suite tests
import: common
Expand Down Expand Up @@ -226,7 +235,7 @@ test-suite tests
, turtle
, vector >=0.11 && <0.14

ghc-options: -O2 -Wall
ghc-options: -O2
Comment thread
j6carey marked this conversation as resolved.
Outdated

executable compile-proto-file
main-is: Main.hs
Expand All @@ -239,7 +248,7 @@ executable compile-proto-file
, system-filepath
, text
, turtle
ghc-options: -O2 -Wall -Werror
ghc-options: -O2 -Wall

executable canonicalize-proto-file
import: common
Expand All @@ -254,4 +263,4 @@ executable canonicalize-proto-file
, proto3-wire >= 1.4.6 && < 1.5
, system-filepath
, turtle
ghc-options: -O2 -Wall -Werror
ghc-options: -O2 -Wall