cabal-version:      2.4
name:               package-version
version:            0.2
x-revision: 2
license:            BSD-3-Clause
license-file:       LICENSE
tested-with:        GHC ==8.10.7 || ==9.0.2 || ==9.2.3
copyright:          2021-2022 Thomas Bidne
author:             Thomas Bidne
maintainer:         tbidne@protonmail.com
homepage:           https://github.com/tbidne/package-version/
bug-reports:        https://github.com/tbidne/package-version/issues
synopsis:           A package for retrieving a package's version number.
description:
  @package-version@ reads the package version number from a cabal file.
  This version number can be retrieved at compile-time via @TemplateHaskell@
  or runtime via ordinary functions.

category:           Development
extra-source-files:
  CHANGELOG.md
  README.md

source-repository head
  type:     git
  location: https://github.com/tbidne/package-version

common common-exts
  default-extensions:
    BangPatterns
    DeriveGeneric
    DeriveLift
    DerivingStrategies
    DerivingVia
    ImportQualifiedPost
    LambdaCase
    NumericUnderscores
    OverloadedStrings
    PatternSynonyms
    ScopedTypeVariables
    TypeApplications

library
  import:           common-exts
  exposed-modules:
    Data.Version.Package
    Data.Version.Package.Internal

  build-depends:
    , base              >=4.14.1.0  && <4.18
    , bytestring        >=0.10.10.0 && <0.12
    , deepseq           ^>=1.4.4.0
    , prettyprinter     >=1.4.0     && <1.8
    , safe-exceptions   ^>=0.1.7.0
    , template-haskell  >=2.16.0.0  && <2.20
    , text              >=1.2.3.2   && <2.1

  hs-source-dirs:   src
  default-language: Haskell2010

test-suite unit
  import:           common-exts
  type:             exitcode-stdio-1.0
  main-is:          Main.hs
  other-modules:
    Tests.IO
    Tests.TH

  build-depends:
    , base
    , package-version
    , safe-exceptions
    , tasty            >=1.1.0.3 && <1.5
    , tasty-hunit      >=0.9     && <0.11

  hs-source-dirs:   test/unit
  default-language: Haskell2010

test-suite props
  import:           common-exts
  type:             exitcode-stdio-1.0
  main-is:          Main.hs
  other-modules:
    Gens
    MaxRuns
    Tests.ListInt
    Tests.Text
    Tests.Version
    Utils

  build-depends:
    , base
    , hedgehog         >=1.0.2   && <1.2
    , package-version
    , tagged           ^>=0.8.6
    , tasty
    , tasty-hedgehog   >=1.0.0.2 && <1.4
    , text

  hs-source-dirs:   test/props
  default-language: Haskell2010

test-suite doctest
  import:           common-exts
  type:             exitcode-stdio-1.0
  main-is:          Main.hs
  build-depends:
    , base
    , doctest    >=0.16.3 && <0.21
    , env-guard  ^>=0.2

  hs-source-dirs:   test/doctest
  default-language: Haskell2010