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:
- ls -l ..
- 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
- touch ChangeLog
- cabal update
- cabal sdist --output-directory=../ghc-mod.sdist-$CI_PIPELINE_ID
- cd ../ghc-mod.sdist-$CI_PIPELINE_ID
@ -19,8 +20,6 @@ after_script:
.script_template: &common_script
script:
- echo $PWD
- ghc-pkg list
- cabal install --user --only-dependencies -j2 --force-reinstalls --upgrade-dependencies --enable-tests --enable-documentation
- which cabal
- cabal --version
- cabal configure --enable-tests

View File

@ -1,9 +1,23 @@
#!/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.Program
import Distribution.Extra.Doctest
main :: IO ()
main = defaultMainWithHooks $ simpleUserHooks {
hookedPrograms = [ simpleProgram "shelltest" ]
}
main =
defaultMainWithHooks $
addDoctestsUserHook "doctest" $
simpleUserHooks {
hookedPrograms = [ simpleProgram "shelltest" ]
}

View File

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

View File

@ -1,23 +1,12 @@
{-# LANGUAGE CPP #-}
module Main where
import Test.DocTest
import System.Environment
import Data.Maybe
import Build_doctests (flags, pkgs, module_sources)
import Data.Foldable (traverse_)
import Test.DocTest (doctest)
main :: IO ()
main = do
distdir <- (fromMaybe "dist" . lookup "DOCTEST_DIST_DIR") `fmap` getEnvironment
doctest
[ "-package", "ghc-" ++ VERSION_ghc
, "-package", "transformers-" ++ VERSION_transformers
, "-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"
]
traverse_ putStrLn args -- optionally print arguments
doctest args
where
args = flags ++ pkgs ++ module_sources