name:                proto3-suite
version:             0.4.0.2
synopsis:            A low level library for writing out data in the Protocol Buffers wire format
license:             Apache-2.0
author:              Awake Security
maintainer:          opensource@awakesecurity.com
copyright:           2017-2018 Awake Security
category:            Codec
build-type:          Simple
cabal-version:       >=1.10
data-files:          test-files/*.bin tests/encode.sh tests/decode.sh

Flag dhall
  Description:   Turn on Dhall interpret and inject codegen
  Default:       False
  Manual:        True

library

  if flag(dhall)
    exposed-modules:   Proto3.Suite.DhallPB
    build-depends:     dhall >=1.13 && < 1.34

    cpp-options:       -DDHALL

  exposed-modules:     Proto3.Suite
                       Proto3.Suite.Class
                       Proto3.Suite.DotProto
                       Proto3.Suite.DotProto.Generate
                       Proto3.Suite.DotProto.AST
                       Proto3.Suite.DotProto.AST.Lens
                       Proto3.Suite.DotProto.Parsing
                       Proto3.Suite.DotProto.Rendering
                       Proto3.Suite.JSONPB
                       Proto3.Suite.Tutorial
                       Proto3.Suite.Types

  other-modules:       Proto3.Suite.DotProto.Internal
                       Proto3.Suite.DotProto.Generate.Swagger
                       Proto3.Suite.JSONPB.Class
  build-depends:       aeson >= 1.1.1.0 && < 1.5,
                       aeson-pretty,
                       attoparsec >= 0.13.0.1,
                       base >=4.8 && <5.0,
                       base64-bytestring >= 1.0.0.1 && < 1.1,
                       binary >=0.8.3,
                       bytestring >=0.10.6.0 && <0.11.0,
                       deepseq ==1.4.*,
                       cereal >= 0.5.1 && <0.6,
                       containers >=0.5 && < 0.7,
                       contravariant >=1.4 && <1.6,
                       filepath,
                       foldl,
                       hashable,
                       haskell-src ==1.0.*,
                       insert-ordered-containers,
                       lens,
                       mtl ==2.2.*,
                       neat-interpolation,
                       parsec >= 3.1.9 && <3.2.0,
                       parsers >= 0.12 && <0.13,
                       pretty ==1.1.*,
                       pretty-show >= 1.6.12 && < 2.0,
                       proto3-wire == 1.2.*,
                       QuickCheck >=2.10 && <2.14,
                       quickcheck-instances < 0.4,
                       safe ==0.3.*,
                       swagger2 >=2.1.6 && <2.7,
                       system-filepath,
                       text >= 0.2 && <1.3,
                       transformers >=0.4 && <0.6,
                       turtle,
                       vector >=0.11 && < 0.13
  if !impl(ghc >= 8.0)
    build-depends:     semigroups >= 0.18 && < 0.20
  hs-source-dirs:      src
  default-language:    Haskell2010
  ghc-options:         -O2 -Wall

test-suite tests
  type:                exitcode-stdio-1.0
  main-is:             Main.hs

  if flag(dhall)
    other-modules:     TestDhall
    build-depends:     dhall >=1.13 && < 1.34
    cpp-options:       -DDHALL

  other-modules:       ArbitraryGeneratedTestTypes
                       TestProto
                       TestCodeGen
                       TestProtoImport
                       TestProtoOneof
                       TestProtoOneofImport

  hs-source-dirs:      tests gen
  default-language:    Haskell2010
  build-depends:       base >=4.8 && <5.0,
                       QuickCheck >=2.10 && <2.14,
                       aeson >= 1.1.1.0 && < 1.5,
                       attoparsec >= 0.13.0.1,
                       base >=4.8 && <5.0,
                       base64-bytestring >= 1.0.0.1 && < 1.1,
                       bytestring >=0.10.6.0 && <0.11.0,
                       cereal >= 0.5.1 && <0.6,
                       containers >=0.5 && < 0.7,
                       deepseq ==1.4.*,
                       doctest,
                       generic-arbitrary,
                       mtl ==2.2.*,
                       pretty-show >= 1.6.12 && < 2.0,
                       proto3-suite,
                       proto3-wire == 1.2.*,
                       swagger2,
                       tasty >= 0.11 && <1.3,
                       tasty-hunit >= 0.9 && <0.11,
                       tasty-quickcheck >= 0.8.4 && <0.11,
                       text >= 0.2 && <1.3,
                       transformers >=0.4 && <0.6,
                       turtle,
                       vector >=0.11 && < 0.13
  if !impl(ghc >= 8.0)
    build-depends:     semigroups >= 0.18 && < 0.20
  ghc-options:         -O2 -Wall

executable compile-proto-file
  main-is:             Main.hs
  hs-source-dirs:      tools/compile-proto-file
  default-language:    Haskell2010
  build-depends:       base >=4.12 && <5.0
                       , optparse-applicative
                       , proto3-suite
                       , system-filepath
                       , text
                       , turtle
  ghc-options:         -O2 -Wall

executable canonicalize-proto-file
  main-is:             Main.hs
  hs-source-dirs:      tools/canonicalize-proto-file
  default-language:    Haskell2010
  build-depends:       base >=4.8 && <5.0
                       , containers >=0.5 && <0.7
                       , mtl ==2.2.*
                       , optparse-generic
                       , proto3-suite
                       , proto3-wire == 1.2.*
                       , range-set-list >=0.1.2 && <0.2
                       , system-filepath
                       , turtle
  ghc-options:         -O2 -Wall