From 11f3d83c746a60fd3efda68b3badf68ebb0e1d7f Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Mon, 28 Dec 2020 00:22:55 +0200 Subject: [PATCH] Use cabal-docspec ... make package build-type: Simple --- .github/workflows/haskell-ci.yml | 18 ++++++++++++++---- CHANGELOG.markdown | 3 ++- Setup.lhs | 30 +----------------------------- Warning.hs | 5 ----- cabal.haskell-ci | 11 +---------- comonad.cabal | 29 +---------------------------- tests/doctests.hs | 25 ------------------------- 7 files changed, 19 insertions(+), 102 deletions(-) delete mode 100644 Warning.hs delete mode 100644 tests/doctests.hs diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 6291a43..0cd33c8 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -8,9 +8,9 @@ # # For more information, see https://github.com/haskell-CI/haskell-ci # -# version: 0.11.20201223 +# version: 0.11.20201230 # -# REGENDATA ("0.11.20201223",["github","--config=cabal.haskell-ci","cabal.project"]) +# REGENDATA ("0.11.20201230",["github","--config=cabal.haskell-ci","cabal.project"]) # name: Haskell-CI on: @@ -145,6 +145,15 @@ jobs: rm -f cabal-plan.xz chmod a+x $HOME/.cabal/bin/cabal-plan cabal-plan --version + - name: install cabal-docspec + run: | + mkdir -p $HOME/.cabal/bin + curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20201230.1/cabal-docspec-0.0.0.20201230.1.xz > cabal-docspec.xz + echo '18caf4f361fadd978782f08e78f42d21d4f177567419055ffccae19b8214852d cabal-docspec.xz' | sha256sum -c - + xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec + rm -f cabal-docspec.xz + chmod a+x $HOME/.cabal/bin/cabal-docspec + cabal-docspec --version - name: checkout uses: actions/checkout@v2 with: @@ -194,9 +203,10 @@ jobs: - name: build run: | $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always - - name: tests + - name: docspec run: | - $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all + $CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all + cabal-docspec $ARG_COMPILER - name: cabal check run: | cd ${PKGDIR_comonad} || false diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index b4da6b2..9e79c69 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -1,6 +1,7 @@ -next [202y.mm.dd] +5.0.8 [202y.mm.dd] ----------------- * Explicitly mark modules as Safe or Trustworthy +* Use `build-type: Simple` 5.0.7 [2020.12.15] ------------------ diff --git a/Setup.lhs b/Setup.lhs index faedcd3..ef6602c 100644 --- a/Setup.lhs +++ b/Setup.lhs @@ -1,34 +1,6 @@ \begin{code} -{-# LANGUAGE CPP #-} -{-# OPTIONS_GHC -Wall #-} module Main (main) where - -#ifndef MIN_VERSION_cabal_doctest -#define MIN_VERSION_cabal_doctest(x,y,z) 0 -#endif - -#if MIN_VERSION_cabal_doctest(1,0,0) - -import Distribution.Extra.Doctest ( defaultMainWithDoctests ) -main :: IO () -main = defaultMainWithDoctests "doctests" - -#else - -#ifdef MIN_VERSION_Cabal --- If the macro is defined, we have new cabal-install, --- but for some reason we don't have cabal-doctest in package-db --- --- Probably we are running cabal sdist, when otherwise using new-build --- workflow -import Warning () -#endif - -import Distribution.Simple - +import Distribution.Simple (defaultMain) main :: IO () main = defaultMain - -#endif - \end{code} diff --git a/Warning.hs b/Warning.hs deleted file mode 100644 index a5a14a9..0000000 --- a/Warning.hs +++ /dev/null @@ -1,5 +0,0 @@ -module Warning - {-# WARNING ["You are configuring this package without cabal-doctest installed.", - "The doctests test-suite will not work as a result.", - "To fix this, install cabal-doctest before configuring."] #-} - () where diff --git a/cabal.haskell-ci b/cabal.haskell-ci index 17bdf46..3e67112 100644 --- a/cabal.haskell-ci +++ b/cabal.haskell-ci @@ -5,13 +5,4 @@ irc-channels: irc.freenode.org#haskell-lens irc-if-in-origin-repo: True -- Work around https://github.com/haskell/haddock/issues/242 haddock: <7.6 || >=7.8 - --- Because we use a custom Setup script, --test-show-details can only support --- the options that come with the version of Cabal that is linked against. --- Unfortunately, --test-show-details=direct wasn't introduced until --- Cabal-1.24.*, and GHC 7.10 and earlier ship with an older version of Cabal --- than that. As a result, trying to pass --test-show-details=direct won't work --- on these GHC versions unless we rebuild Cabal from scratch, which is --- time-consuming. As a result, we simply disable --test-show-details=direct --- as a quick-but-dirty workaround. -test-output-direct: False +docspec: True diff --git a/comonad.cabal b/comonad.cabal index 37245d1..c55a32c 100644 --- a/comonad.cabal +++ b/comonad.cabal @@ -13,7 +13,7 @@ copyright: Copyright (C) 2008-2014 Edward A. Kmett, Copyright (C) 2004-2008 Dave Menendez synopsis: Comonads description: Comonads. -build-type: Custom +build-type: Simple tested-with: GHC == 7.0.4 , GHC == 7.2.2 , GHC == 7.4.2 @@ -34,18 +34,6 @@ extra-source-files: README.markdown CHANGELOG.markdown examples/History.hs - Warning.hs - -custom-setup - setup-depends: - base >= 4 && < 5, - Cabal, - cabal-doctest >= 1 && < 1.1 - --- You can disable the doctests test suite with -f-test-doctests -flag test-doctests - default: True - manual: True flag containers description: @@ -134,18 +122,3 @@ library FunctionalDependencies FlexibleInstances UndecidableInstances - -test-suite doctests - type: exitcode-stdio-1.0 - default-language: Haskell2010 - main-is: doctests.hs - ghc-options: -Wall -threaded - hs-source-dirs: tests - - if !flag(test-doctests) - buildable: False - else - build-depends: - base, - comonad, - doctest >= 0.11.1 && < 0.18 diff --git a/tests/doctests.hs b/tests/doctests.hs deleted file mode 100644 index 2d080e7..0000000 --- a/tests/doctests.hs +++ /dev/null @@ -1,25 +0,0 @@ ------------------------------------------------------------------------------ --- | --- Module : Main (doctests) --- Copyright : (C) 2012-14 Edward Kmett --- License : BSD-style (see the file LICENSE) --- Maintainer : Edward Kmett --- Stability : provisional --- Portability : portable --- --- This module provides doctests for a project based on the actual versions --- of the packages it was built with. It requires a corresponding Setup.lhs --- to be added to the project ------------------------------------------------------------------------------ -module Main where - -import Build_doctests (flags, pkgs, module_sources) -import Data.Foldable (traverse_) -import Test.DocTest - -main :: IO () -main = do - traverse_ putStrLn args - doctest args - where - args = flags ++ pkgs ++ module_sources