Fix doctest with Cabal-2.0 by requiring c-i>=1.24

This commit is contained in:
Daniel Gröber 2017-09-18 12:27:45 +02:00
parent 6282cd306b
commit 9b3f346807
4 changed files with 33 additions and 27 deletions

View File

@ -5,9 +5,10 @@ stages:
before_script: before_script:
- ls -l .. - ls -l ..
- apt-get update && apt-get install alex happy - apt-get update && apt-get install alex happy
- ghc-pkg list
- cabal update && cabal install --only-dependencies -j2 --enable-tests --enable-documentation
- mkdir -p ../ghc-mod.sdist-$CI_PIPELINE_ID - mkdir -p ../ghc-mod.sdist-$CI_PIPELINE_ID
- touch ChangeLog - touch ChangeLog
- cabal update
- cabal sdist --output-directory=../ghc-mod.sdist-$CI_PIPELINE_ID - cabal sdist --output-directory=../ghc-mod.sdist-$CI_PIPELINE_ID
- cd ../ghc-mod.sdist-$CI_PIPELINE_ID - cd ../ghc-mod.sdist-$CI_PIPELINE_ID
@ -19,8 +20,6 @@ after_script:
.script_template: &common_script .script_template: &common_script
script: script:
- echo $PWD - echo $PWD
- ghc-pkg list
- cabal install --user --only-dependencies -j2 --force-reinstalls --upgrade-dependencies --enable-tests --enable-documentation
- which cabal - which cabal
- cabal --version - cabal --version
- cabal configure --enable-tests - cabal configure --enable-tests

View File

@ -1,9 +1,23 @@
#!/usr/bin/env runhaskell #!/usr/bin/env runhaskell
{-# LANGUAGE CPP #-}
#ifndef MIN_VERSION_cabal_doctest
#error \
Your version of cabal-install does not seem to support the 'custom-setup' section. \
Please see https://github.com/DanielG/ghc-mod/wiki/Installing#checking-and-installing-prerequisites for instrutions on how to upgrade. \
It is also possible that you forgot to install cabal-doctest before running Setup.hs
#endif
import Distribution.Simple import Distribution.Simple
import Distribution.Simple.Program import Distribution.Simple.Program
import Distribution.Extra.Doctest
main :: IO () main :: IO ()
main = defaultMainWithHooks $ simpleUserHooks { main =
hookedPrograms = [ simpleProgram "shelltest" ] defaultMainWithHooks $
} addDoctestsUserHook "doctest" $
simpleUserHooks {
hookedPrograms = [ simpleProgram "shelltest" ]
}

View File

@ -24,7 +24,7 @@ Description:
Category: GHC, Development Category: GHC, Development
Cabal-Version: >= 1.18 Cabal-Version: >= 1.24
Build-Type: Custom Build-Type: Custom
Data-Files: elisp/Makefile Data-Files: elisp/Makefile
elisp/*.el elisp/*.el
@ -92,7 +92,8 @@ Extra-Source-Files: ChangeLog
Custom-Setup Custom-Setup
Setup-Depends: base Setup-Depends: base
, Cabal >= 1.18 && < 2.1 , Cabal < 2.1 && >= 1.24
, cabal-doctest < 1.1 && >= 1
, containers , containers
, filepath , filepath
, directory , directory
@ -273,7 +274,10 @@ Test-Suite doctest
Main-Is: doctests.hs Main-Is: doctests.hs
Build-Depends: base < 4.11 && >= 4.6.0.1 Build-Depends: base < 4.11 && >= 4.6.0.1
, doctest < 0.12 && >= 0.9.3 , doctest < 0.12 && >= 0.9.3
, directory
, ghc
, mtl
, transformers
Test-Suite spec Test-Suite spec
Default-Language: Haskell2010 Default-Language: Haskell2010

View File

@ -1,23 +1,12 @@
{-# LANGUAGE CPP #-}
module Main where module Main where
import Test.DocTest import Build_doctests (flags, pkgs, module_sources)
import System.Environment import Data.Foldable (traverse_)
import Data.Maybe import Test.DocTest (doctest)
main :: IO () main :: IO ()
main = do main = do
distdir <- (fromMaybe "dist" . lookup "DOCTEST_DIST_DIR") `fmap` getEnvironment traverse_ putStrLn args -- optionally print arguments
doctest doctest args
[ "-package", "ghc-" ++ VERSION_ghc where
, "-package", "transformers-" ++ VERSION_transformers args = flags ++ pkgs ++ module_sources
, "-package", "mtl-" ++ VERSION_mtl
, "-package", "directory-" ++ VERSION_directory
, "-XScopedTypeVariables", "-XRecordWildCards", "-XNamedFieldPuns", "-XConstraintKinds", "-XFlexibleContexts", "-XDataKinds", "-XKindSignatures", "-XTypeOperators", "-XViewPatterns"
, "-i" ++ distdir ++ "/build/autogen/"
, "-icore/"
, "-ishared"
-- , "-optP-include"
-- , "-optP" ++ distdir ++ "/build/autogen/cabal_macros.h"
, "GhcMod.hs"
]