packages feed

hup-0.3.0.2: hup.cabal

name:                hup
version:             0.3.0.2
synopsis:            Upload packages or documentation to a hackage server
description:
  Upload packages or documentation to a hackage server
  .
  See the README for details
  (at <https://github.com/phlummox/hup#readme>)
homepage:            https://github.com/phlummox/hup
license:             BSD2
license-file:        LICENSE
author:              phlummox
maintainer:          phlummox2@gmail.com
copyright:           phlummox 2016-2020, others where indicated
category:            Distribution, Web, Documentation
build-type:          Simple
tested-with:         GHC == 7.10.3, GHC == 8.0.1, GHC == 8.2.2
cabal-version:       >=1.10

extra-source-files:
    ChangeLog.md
  , stack-lts-3.yaml
  , stack-lts-7.yaml
  , stack-lts-11.yaml

source-repository head
  type:     git
  location: https://github.com/phlummox/hup

Flag EnableWebTests
  Description: Enable tests that do a (pretty minimal) check by running an actual
    Warp web server. (Slower to build and run than other tests.)
  Default:     False
  Manual:      True

Flag PatchHelpMessage
  Description:
    Use patched version of cmdargs-0.10.14.1 with more informative help
    message. The patched version will need to be pulled from github
    (or a stack.yaml file must point to it) - see stack.yaml for details.
  Default:     False
  Manual:      True

Flag ExtraGhcWarnings
  Description: Enable extra ghc warnings
  Default:     True
  Manual:      True

-- This enables (or disables) tests that rely on
-- stack at runtime. (viz, tests using doctest.)
-- You can enable these tests from stack using
-- `--flag hup:BuildStackBasedTests`
Flag BuildStackBasedTests
  Description: Enable tests requiring stack
  Manual:      True
  Default:     False


library
  hs-source-dirs:      lib
  exposed-modules:
      Distribution.Hup
    , Distribution.Hup.BuildTar
    , Distribution.Hup.Parse
    , Distribution.Hup.Types
    , Distribution.Hup.Upload
  build-depends:
      base >= 4.7 && < 5
    , bytestring
    , directory
    , filepath
    , http-client
    , http-client-tls
    , http-types
    , mtl
    , split
    , tar
    , zlib
  default-language:    Haskell2010
  if flag(ExtraGhcWarnings)
    if impl(ghc >= 8.0.1)
      -- -new-style warn options, plus
      -- can use a few new warnings
      ghc-options:  -Wall
                    -Wcompat
                    -Wincomplete-record-updates
                    -Wincomplete-uni-patterns
                    -Wredundant-constraints
                    -Wno-name-shadowing
                    -Wno-orphans
                    -Wno-type-defaults
                    -fwarn-tabs
    else
      ghc-options:  -Wall
                    -fno-warn-name-shadowing
                    -fwarn-incomplete-record-updates
                    -fwarn-incomplete-uni-patterns
                    -fno-warn-type-defaults
                    -fwarn-tabs


executable hup
  hs-source-dirs:      src
  main-is:             Main.hs
  other-modules:
      CmdArgs
    , CmdArgs.PatchHelp
    , DefaultServerUrl
    , Paths_hup
    , SanityCheck
    , Types
    , Upload
    , Stack
    , DocBuilding
  if flag(PatchHelpMessage)
    other-modules: CmdArgs.PatchHelp
    cpp-options:   -DPATCH_HELP
    build-depends: cmdargs == 0.10.14.1
  else
    build-depends: cmdargs
  default-language:    Haskell2010
  build-depends:
      base
    , bytestring
    , directory
    , mtl
    , shelly >= 1.6.6
    , tagsoup
    , text
    , transformers
    , hup
  ghc-options:    -threaded
                  -rtsopts
                  -with-rtsopts=-N
  if flag(ExtraGhcWarnings)
    if impl(ghc >= 8.0.1)
      -- -new-style warn options, plus
      -- can use a few new warnings
      ghc-options:  -Wall
                    -Wcompat
                    -Wincomplete-record-updates
                    -Wincomplete-uni-patterns
                    -Wredundant-constraints
                    -Wno-name-shadowing
                    -Wno-orphans
                    -Wno-type-defaults
                    -fwarn-tabs
    else
      ghc-options:  -Wall
                    -fno-warn-name-shadowing
                    -fwarn-incomplete-record-updates
                    -fwarn-incomplete-uni-patterns
                    -fno-warn-type-defaults
                    -fwarn-tabs


test-suite hup-spec
  type:                exitcode-stdio-1.0
  hs-source-dirs:      src-hspec-test
  main-is:             Spec.hs
  build-depends:
      base
    , bytestring
    , filepath
    , hspec-wai < 0.10
    , http-client
    , http-types
    , hup
    , hspec
    , hspec-core
    , QuickCheck
    , simple
    , temporary
    , transformers
    , wai
    , wai-extra
  if impl(ghc < 8.4.4)
    build-depends:
      -- simple-templates 0.9.0.0 has broken bounds.
      -- (<https://github.com/alevy/simple/issues/25>)
      -- It states bounds on base of "< 6",
      -- but the code only seems to build with
      -- base >= 4.11.1.0 / ghc >= 8.4.4.
      simple-templates < 0.9.0.0

  ghc-options:      -threaded
                    -rtsopts
                    -with-rtsopts=-N
  if flag(ExtraGhcWarnings)
    if impl(ghc >= 8.0.1)
      -- -new-style warn options, plus
      -- can use a few new warnings
      ghc-options:  -Wall
                    -Wcompat
                    -Wincomplete-record-updates
                    -Wincomplete-uni-patterns
                    -Wredundant-constraints
                    -Wno-name-shadowing
                    -Wno-orphans
                    -Wno-type-defaults
                    -fwarn-tabs
    else
      ghc-options:  -Wall
                    -fno-warn-name-shadowing
                    -fwarn-incomplete-record-updates
                    -fwarn-incomplete-uni-patterns
                    -fno-warn-type-defaults
                    -fwarn-tabs
  default-language:    Haskell2010
  other-modules:
      Distribution.Hup.WebTest
    , Distribution.Hup.ParseSpec
    , Distribution.Hup.Parse.Test
    , Distribution.Hup.UploadSpec
    , Distribution.Hup.Upload.Test
    , Distribution.Hup.Upload.MockWebApp
  if flag(EnableWebTests)
    build-depends:
        network
      , vector
      -- ridiculous. With cabal 1.24 and ghc 8.0.1, (a) installing dependencies
      -- fails if 'vector' isn't added here (despite it not being a direct
      -- dependency) and (b) the build takes much longer than with, e.g.
      -- ghc 7.10.3.
      -- TODO: track down the problem sometime.
      , warp
    cpp-options:         -DWEB_TESTS

-- **
-- - Only runs using stack, so is disabled
--   by default
-- - Doesn't seem to run w/ lts-3 ... possibly
--   a bug in doctest, who knows
test-suite hup-doctest
  type:                exitcode-stdio-1.0
  hs-source-dirs:      src-doctest
  main-is:             DocTest.hs
  if !(flag(BuildStackBasedTests))
    buildable: False
  else
   build-depends:       base
                      , hup
                      , doctest
                      , Glob
  ghc-options:         -threaded -rtsopts -with-rtsopts=-N
  default-language:    Haskell2010