cabal-version: 3.0
Name:          aftok
Version:       0.1
Synopsis:      The Aftok Collaboration Platform
Description:   A time logging and payment distribution service to enable groups of trusted contributors 
               to collaboratively develop commercial applications.
License:       NONE
Author:        Kris Nuttycombe
Maintainer:    kris@aftok.com
Stability:     Experimental
Category:      Web
Build-type:    Simple

common buildenv
  default-language:   Haskell2010
  ghc-options:        -Wall -Werror
  default-extensions: GADTs
                    , KindSignatures
                    , LambdaCase
                    , MultiParamTypeClasses
                    , OverloadedStrings
                    , RankNTypes
                    , ScopedTypeVariables
  build-depends:      
      base                
    , relude
  mixins: base hiding (Prelude)
        , relude (Relude as Prelude)

library
  import:             buildenv
  hs-source-dirs:     lib
  exposed-modules:    Aftok.Auction
                      Aftok.Billing
                      Aftok.Config
                      Aftok.Currency
                      Aftok.Currency.Bitcoin
                      Aftok.Currency.Bitcoin.Payments
                      Aftok.Currency.Bitcoin.Bip70
                      Aftok.Currency.Zcash
                      Aftok.Currency.Zcash.Types
                      Aftok.Currency.Zcash.Payments
                      Aftok.Currency.Zcash.Zip321
                      Aftok.Database
                      Aftok.Database.PostgreSQL
                      Aftok.Database.PostgreSQL.Json
                      Aftok.Database.PostgreSQL.Types
                      Aftok.Database.PostgreSQL.Auctions
                      Aftok.Database.PostgreSQL.Billing
                      Aftok.Database.PostgreSQL.Events
                      Aftok.Database.PostgreSQL.Projects
                      Aftok.Database.PostgreSQL.Users
                      Aftok.Interval
                      Aftok.Json
                      Aftok.Payments
                      Aftok.Payments.Types
                      Aftok.Payments.Bitcoin
                      Aftok.Payments.Zcash
                      Aftok.Payments.Util
                      Aftok.Project
                      Aftok.TimeLog
                      Aftok.TimeLog.Serialization
                      Aftok.Types
                      Aftok.Util
                      Aftok.Util.Http
  build-depends:      
    , basement
    , bippy               
    , blake2
    , aeson              
    , attoparsec         
    , base64
    , bifunctors
    , blaze-builder       
    , bytestring
    , cereal
    , containers       
    , configurator             
    , cryptonite
    , either          
    , errors         
    , free
    , from-sum
    , groups        
    , HStringTemplate          
    , haskoin-core 
    , heaps       
    , hourglass  
    , http-client
    , http-types
    , kan-extensions
    , lens     
    , lens-aeson
    , MonadRandom
    , mtl
    , network                   
    , network-uri
    , old-locale        
    , postgresql-simple
    , protobuf
    , relude
    , safe            
    , scientific
    , semigroups
    , semigroupoids
    , smtp-mail               
    , system-filepath
    , template-haskell
    , text           
    , thyme
    , transformers
    , uuid         
    , unordered-containers
    , uri-encode
    , vector-space
    , x509
    , x509-store

Test-Suite spec
  import:             buildenv
  type:               exitcode-stdio-1.0
  hs-source-dirs:     test
  main-is:            Spec.hs
  other-modules: Aftok.AuctionSpec
               , Aftok.Generators
               , Aftok.PaymentsSpec
               , Aftok.TimeLogSpec
               , Aftok.Util.HttpSpec

  build-depends:    
      aftok
    , aeson
    , attoparsec
    , bifunctors
    , bippy
    , containers
    , hspec      
    , HUnit
    , haskoin-core 
    , hourglass
    , iso8601-time
    , lens
    , QuickCheck 
    , semigroups
    , text
    , thyme
    , uuid
    , vector-space

  build-tool-depends: hspec-discover:hspec-discover

Executable aftok-server
  import:             buildenv
  ghc-options:        -Wall -Werror
  hs-source-dirs:     server

  main-is:            Main.hs

  other-modules: Aftok.ServerConfig
               , Aftok.Snaplet
               , Aftok.Snaplet.Auctions
               , Aftok.Snaplet.Auth
               , Aftok.Snaplet.Billing
               , Aftok.Snaplet.Json
               , Aftok.Snaplet.Payments
               , Aftok.Snaplet.Projects
               , Aftok.Snaplet.Users
               , Aftok.Snaplet.Util
               , Aftok.Snaplet.WorkLog

  build-depends:      
      aftok
    , aeson
    , attoparsec
    , base64-bytestring
    , bytestring
    , bippy
    , cereal
    , containers
    , configurator              
    , cryptonite
    , directory
    , either
    , errors
    , from-sum
    , hourglass
    , HStringTemplate          
    , iso8601-time
    , haskoin-core 
    , HsOpenSSL
    , http-client
    , http-client-tls
    , http-client-openssl
    , http-types
    , lens
    , mime-mail
    , mtl                     
    , network                   
    , optparse-applicative      
    , postgresql-simple
    , protobuf
    , smtp-mail               
    , snap                    
    , snap-core              
    , snap-server           
    , snaplet-postgresql-simple
    , system-filepath
    , text
    , thyme
    , transformers
    , unordered-containers
    , uuid                
    , vector-space
    , wreq        
    , x509
    , x509-store

Executable aftok-daemon
  import:             buildenv
  hs-source-dirs:     daemon

  main-is:            Main.hs
  other-modules:      AftokD
                    , AftokD.AftokM
  build-depends:      
      aftok
    , aeson
    , attoparsec
    , base64-bytestring
    , bytestring
    , bippy
    , cereal
    , containers
    , configurator              
    , cryptonite
    , either
    , errors
    , haskoin-core 
    , hourglass
    , HStringTemplate          
    , iso8601-time
    , HsOpenSSL
    , http-client
    , http-client-openssl
    , lens
    , mime-mail
    , mtl                     
    , network                   
    , network-uri
    , optparse-applicative      
    , postgresql-simple
    , protobuf
    , smtp-mail               
    , system-filepath
    , text
    , thyme
    , transformers
    , uuid                
    , wreq        
    , x509
    , x509-store