packages feed

proto3-suite-0.9.4: proto3-suite.cabal

cabal-version:       2.2
name:                proto3-suite
version:             0.9.4
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-2025 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 attoparsec-aeson
  Description:   Depend upon the Haskell package "attoparsec-aeson".
  Default:       True
  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

common common
  default-language: Haskell2010
  default-extensions:
    BlockArguments ExplicitNamespaces DeriveDataTypeable DeriveGeneric
    ImportQualifiedPost ViewPatterns

  if flag(development)
    ghc-options:
      -Werror

  build-depends:
      base >=4.15 && <5.0
    , proto3-wire >= 1.4.6 && < 1.5

  ghc-options:
    -O2 
    -Wall

library
  import:           common
  hs-source-dirs:   src

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

  if flag(swagger)
    build-depends:
      swagger2 >=2.1.6 && <2.9

    cpp-options:       
      -DSWAGGER

    exposed-modules:
      Proto3.Suite.DotProto.Generate.Swagger
      Proto3.Suite.DotProto.Generate.Swagger.Wrappers

    if flag(swagger-wrapper-format)
      hs-source-dirs: src/swagger-wrapper-format
    else
      hs-source-dirs: src/no-swagger-wrapper-format

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

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

    Proto3.Suite.DotProto.Internal
    Proto3.Suite.Haskell.Parser
    Proto3.Suite.JSONPB.Class

  other-modules:
    Proto3.Suite.Form.Encode.Core
    Turtle.Compat

  build-depends:       
      aeson >= 1.1.1.0 && < 2.3
    , aeson-pretty >= 0.8.10 && < 0.9
    , attoparsec >= 0.13.0.1 && < 0.15
    , base64-bytestring >= 1.0.0.1 && < 1.3
    , binary >=0.8.3 && <= 0.9
    , bytestring >=0.10.6.0 && <0.13
    , deepseq >=1.4 && <1.6
    , cereal >= 0.5.1 && <0.6
    , containers >=0.5 && <0.8
    , contravariant >=1.4 && <1.6
    , filepath >= 1.5.2 && < 1.6
    , foldl >= 1.4.18 && < 1.5
    , ghc-lib-parser >=9.2.8 && <9.13
    , hashable >= 1.4.7 && < 1.5
    , insert-ordered-containers >= 0.2.7 && < 0.3
    , lens >= 5.3.5 && < 5.4
    , mtl >=2.2 && <2.4
    , neat-interpolation >= 0.5.1 && < 0.6
    , parsec >= 3.1.9 && <3.2
    , parsers >= 0.12 && <0.13
    , pretty ==1.1.*
    , pretty-show >= 1.6.12 && < 2
    , QuickCheck >=2.10 && <2.17
    , quickcheck-instances >=0.3.26 && < 0.4
    , safe ==0.3.*
    , split >= 0.2.5 && < 0.3
    , system-filepath >= 0.4.14 && < 0.5
    , template-haskell >=2.17 && <2.24
    , text >= 0.2 && <2.2
    , text-short >=0.1.3 && <0.2
    , time >= 1.12.2 && < 1.13
    , transformers >=0.4 && <0.7
    , turtle < 1.6.0 || >= 1.6.1 && < 1.7
    , vector >=0.11 && <0.14

  if flag(attoparsec-aeson)
    build-depends:
      attoparsec-aeson >= 2.2.0.0 && < 2.3

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

  hs-source-dirs:
    gen
    tests

  cpp-options:         -DTYPE_LEVEL_FORMAT

  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

  autogen-modules:
    TestProto
    TestProtoImport
    TestProtoNegativeEnum
    TestProtoNestedMessage
    TestProtoOneof
    TestProtoOneofImport
    TestProtoOptional
    TestProtoWrappers

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

  build-depends:
      aeson
    , attoparsec >= 0.13.0.1
    , base64-bytestring >= 1.0.0.1 && < 1.3
    , bytestring >=0.10.6.0 && <0.13
    , cereal >= 0.5.1 && <0.6
    , containers >=0.5 && <0.8
    , deepseq >=1.4 && <1.6
    , doctest
    , generic-arbitrary
    , ghc-lib-parser >= 9.10.2 && < 9.11
    , hedgehog
    , mtl >=2.2 && <2.4
    , parsec >= 3.1.9 && <3.2.0
    , pretty ==1.1.*
    , pretty-show >= 1.6.12 && < 2.0
    , proto3-suite
    , QuickCheck >=2.10 && <2.17
    , record-hasfield
    , tasty >= 0.11 && <1.6
    , tasty-hedgehog
    , tasty-hunit >= 0.9 && <0.11
    , tasty-quickcheck >= 0.8.4 && <0.12
    , text >= 0.2 && <2.2
    , text-short >=0.1.3 && <0.2
    , transformers >=0.4 && <0.7
    , turtle < 1.6.0 || >= 1.6.1 && < 1.7
    , vector >=0.11 && <0.14

executable compile-proto-file
  main-is:          Main.hs
  hs-source-dirs:   tools/compile-proto-file
  default-language: Haskell2010

  build-depends: 
      base >=4.15 && <5.0
    , ghc-lib-parser >= 9.10.2 && < 9.11
    , optparse-applicative >= 0.18.1 && < 0.19
    , proto3-suite
    , system-filepath >= 0.4.14 && < 0.5
    , text >= 2.1.1 && < 2.2
    , turtle < 1.6.0 || >= 1.6.1 && < 1.7

  ghc-options:
    -O2
    -Wall

executable canonicalize-proto-file
  import:           common
  main-is:          Main.hs
  hs-source-dirs:   tools/canonicalize-proto-file

  build-depends:       
      containers >=0.5 && <0.8
    , mtl >=2.2 && <2.4
    , optparse-generic >= 1.5.2 && < 1.6
    , proto3-suite
    , system-filepath >= 0.4.14 && < 0.5
    , turtle < 1.6.0 || >= 1.6.1 && < 1.7