packages feed

proto3-suite-0.7.0: proto3-suite.cabal

cabal-version:       2.2
name:                proto3-suite
version:             0.7.0
synopsis:            A higher-level API to the proto3-wire library
description:
  This library provides a higher-level API to <https://github.com/awakesecurity/proto3-wire the `proto3-wire` library>
  that supports:
  .
  - Type classes for encoding and decoding messages, and instances for all wire
    formats identified in the specification
  - A higher-level approach to encoding and decoding, based on `GHC.Generics`
  - A way of creating `.proto` files from Haskell types.
  .
  See <https://hackage.haskell.org/package/proto3-suite/docs/Proto3-Suite-Tutorial.html the `Proto3.Suite.Tutorial` module>
  for more details.
  .
license:             Apache-2.0
author:              Arista Networks <opensource@awakesecurity.com>
maintainer:          Arista Networks <opensource@awakesecurity.com>
copyright:           2017-2020 Awake Security, 2021-2022 Arista Networks
category:            Codec
build-type:          Simple
data-files:          test-files/*.bin tests/encode.sh tests/decode.sh
extra-source-files:  CHANGELOG.md, gen/.gitignore

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

flag swagger
  Description:   Turn on Swagger doc generation.
  Default:       True
  Manual:        True

flag swagger-wrapper-format
  Description:   Change Swagger schema format for Protobuf wrapper types
  Default:       False
  Manual:        True

flag large-records
  Description:   Generate records with smaller core code size using the large-records library
  Default:       True
  Manual:        True

source-repository head
  type:     git
  location: https://github.com/awakesecurity/proto3-suite

common common
  default-extensions:
    DeriveDataTypeable DeriveGeneric

library
  import: common

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

  if flag(swagger)
    exposed-modules:   Proto3.Suite.DotProto.Generate.Swagger
                       Proto3.Suite.DotProto.Generate.Swagger.Wrappers
    build-depends:     swagger2 >=2.1.6 && <2.9
    cpp-options:       -DSWAGGER
    if flag(swagger-wrapper-format)
      hs-source-dirs:  src/swagger-wrapper-format
    else
      hs-source-dirs:  src/no-swagger-wrapper-format

  if flag(large-records)
    -- large-records support uses newer Dhall APIs. So we need at least 1.34.
    build-depends:     dhall >=1.34 && < 1.43,
                       large-generics,
                       large-records
    cpp-options:       -DLARGE_RECORDS

  exposed-modules:     Proto3.Suite
                       Proto3.Suite.Class
                       Proto3.Suite.DotProto
                       Proto3.Suite.DotProto.Generate
                       Proto3.Suite.DotProto.Generate.LargeRecord
                       Proto3.Suite.DotProto.Generate.Record
                       Proto3.Suite.DotProto.Generate.Syntax
                       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

                       Google.Protobuf.Timestamp
                       Google.Protobuf.Wrappers.Polymorphic

                       Proto3.Suite.DotProto.Internal
                       Proto3.Suite.JSONPB.Class

  other-modules:       Turtle.Compat

  build-depends:       aeson >= 1.1.1.0 && < 2.2,
                       aeson-pretty,
                       attoparsec >= 0.13.0.1,
                       base >=4.8 && <5.0,
                       base64-bytestring >= 1.0.0.1 && < 1.3,
                       binary >=0.8.3,
                       bytestring >=0.10.6.0 && <0.12.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.2 && < 1.5,
                       QuickCheck >=2.10 && <2.15,
                       quickcheck-instances >=0.3.26 && < 0.4,
                       safe ==0.3.*,
                       split,
                       system-filepath,
                       time,
                       text >= 0.2 && <2.1,
                       text-short >=0.1.3 && <0.2,
                       transformers >=0.4 && <0.6,
                       turtle < 1.6.0 || >= 1.6.1 && < 1.7.0,
                       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
  import:           common
  default-language: Haskell2010
  type:             exitcode-stdio-1.0
  main-is:          Main.hs

  hs-source-dirs:
    gen
    tests

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

  if flag(swagger)
    build-depends:     swagger2
    cpp-options:       -DSWAGGER
    if flag(swagger-wrapper-format)
      cpp-options:       -DSWAGGER_WRAPPER_FORMAT

  if flag(large-records)
    build-depends:     large-generics,
                       large-records
    cpp-options:       -DLARGE_RECORDS

  autogen-modules:
    TestProto
    TestProtoImport
    TestProtoOneof
    TestProtoOneofImport
    TestProtoWrappers
    TestProtoNestedMessage

  other-modules:
    ArbitraryGeneratedTestTypes
    TestCodeGen
    TestProto
    TestProtoImport
    TestProtoOneof
    TestProtoOneofImport
    TestProtoWrappers
    --TestProtoLeadingDot
    TestProtoNestedMessage
    --TestProtoProtocPlugin
    Test.Proto.Generate.Name
    Test.Proto.Generate.Name.Gen
    Test.Proto.Parse.Gen
    Test.Proto.Parse.Option

  build-depends:
      aeson >= 1.1.1.0 && < 2.2
    , attoparsec >= 0.13.0.1
    , base >=4.8 && <5.0
    , base64-bytestring >= 1.0.0.1 && < 1.3
    , bytestring >=0.10.6.0 && <0.12.0
    , cereal >= 0.5.1 && <0.6
    , containers >=0.5 && < 0.7
    , deepseq ==1.4.*
    , doctest
    , generic-arbitrary
    , hedgehog
    , mtl ==2.2.*
    , parsec >= 3.1.9 && <3.2.0
    , pretty ==1.1.*
    , pretty-show >= 1.6.12 && < 2.0
    , proto3-suite
    , proto3-wire >= 1.2 && < 1.5
    , QuickCheck >=2.10 && <2.15
    , record-hasfield
    , tasty >= 0.11 && <1.5
    , tasty-hedgehog
    , tasty-hunit >= 0.9 && <0.11
    , tasty-quickcheck >= 0.8.4 && <0.11
    , text >= 0.2 && <2.1
    , text-short >=0.1.3 && <0.2
    , 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.11.0.0 && <5.0
                       , containers >=0.5 && <0.7
                       , mtl ==2.2.*
                       , optparse-generic
                       , proto3-suite
                       , proto3-wire >= 1.2 && <1.5
                       , range-set-list >=0.1.2 && <0.2
                       , system-filepath
                       , turtle
  ghc-options:         -O2 -Wall