cabal-version: 2.2
name:          cabal-testsuite
version:       3
copyright:     2003-2021, Cabal Development Team (see AUTHORS file)
license:       BSD-3-Clause
license-file:  LICENSE
author:        Cabal Development Team <cabal-devel@haskell.org>
maintainer:    cabal-devel@haskell.org
homepage:      http://www.haskell.org/cabal/
bug-reports:   https://github.com/haskell/cabal/issues
synopsis:      Test suite for Cabal and cabal-install
description:
  This package defines a shared test suite for Cabal and cabal-install.
category:       Distribution
build-type:     Custom

extra-source-files:
  README.md

source-repository head
  type:     git
  location: https://github.com/haskell/cabal/
  subdir:   cabal-testsuite

common shared
  default-language: Haskell2010

  build-depends:
    , base >= 4.6 && <4.17
    -- this needs to match the in-tree lib:Cabal version
    , Cabal == 3.6.3.0

  ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns


library
  import: shared

  hs-source-dirs: src
  exposed-modules:
    Test.Cabal.CheckArMetadata
    Test.Cabal.Monad
    Test.Cabal.OutputNormalizer
    Test.Cabal.Plan
    Test.Cabal.Prelude
    Test.Cabal.Run
    Test.Cabal.Script
    Test.Cabal.Server
    Test.Cabal.TestCode
    Test.Cabal.Workdir

  other-modules:
    Test.Cabal.ScriptEnv0
  autogen-modules:
    Test.Cabal.ScriptEnv0

  build-depends:
    , aeson                 ^>= 1.4.2.0 || ^>= 1.5.0.0 || ^>= 2.0.0.0
    , async                 ^>= 2.2.1
    , attoparsec            ^>= 0.13.2.2 || ^>= 0.14.0.0
    , base16-bytestring     ^>= 0.1.1.6 || ^>= 1.0.0.0
    , bytestring            ^>= 0.10.0.2 || ^>= 0.11.0.0
    , containers            ^>= 0.5.0.0 || ^>= 0.6.0.1
    , cryptohash-sha256     ^>= 0.11.101.0
    , directory             ^>= 1.2.0.1 || ^>= 1.3.0.0
    , exceptions            ^>= 0.10.0
    , filepath              ^>= 1.3.0.1 || ^>= 1.4.0.0
    , optparse-applicative  ^>= 0.14.3.0 || ^>=0.15.1.0 || ^>=0.16.0.0
    , process               ^>= 1.1.0.2 || ^>= 1.2.0.0 || ^>= 1.4.2.0 || ^>= 1.6.1.0
    , regex-base            ^>= 0.94.0.1
    , regex-tdfa            ^>= 1.2.3.1 || ^>=1.3.1.0
    , array                 ^>= 0.4.0.1 || ^>= 0.5.0.0
    , temporary             ^>= 1.3
    , text                  ^>= 1.2.3.1
    , transformers          ^>= 0.3.0.0 || ^>= 0.4.2.0 || ^>= 0.5.2.0

  if !impl(ghc >= 8.0)
    build-depends:  semigroups

  if !os(windows)
    build-depends:
      , unix                ^>= 2.6.0.0 || ^>= 2.7.0.0
  else
    build-depends:
      , Win32

executable cabal-tests
  import: shared
  main-is: cabal-tests.hs
  hs-source-dirs: main
  ghc-options: -threaded
  build-depends:
    , cabal-testsuite
    -- cosntraints inherited via lib:cabal-testsuite component
    , async
    , exceptions
    , filepath
    , optparse-applicative
    , process
    , transformers
    -- dependencies specific to exe:cabal-tests
    , clock                 ^>= 0.7.2 || ^>=0.8

  build-tool-depends: cabal-testsuite:setup

-- this executable is needed by lib:cabal-testsuite
executable setup
  import: shared
  main-is: Setup.simple.hs

custom-setup
  -- we only depend on even stable releases of lib:Cabal
  setup-depends: Cabal == 2.2.* || == 2.4.* || == 3.0.* || ==3.2.* || ==3.4.* || ==3.6.*,
                 base, filepath, directory
