Merge pull request #830 from DanielG/stack-test-project-resolver

Stack test project resolver
This commit is contained in:
Nikolay Yakimov 2016-08-30 00:38:59 +03:00 committed by GitHub
commit 8be4cdfe5f
3 changed files with 12 additions and 23 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ elisp/*.elc
*~
/.cabal-sandbox/
/.stack-work/
/test/data/**/stack.yaml
add-source-timestamps
package.cache
cabal.sandbox.config

View File

@ -4,7 +4,6 @@ import Dir
import Control.Exception as E
import Control.Monad (void)
import Data.List
import Language.Haskell.GhcMod (debugInfo)
import System.Process
import System.Environment
@ -29,34 +28,24 @@ main = do
, "test/data/duplicate-pkgver/.cabal-sandbox/i386-osx-ghc-7.6.3-packages.conf.d"]
genGhcPkgCache dir = system $ "ghc-pkg recache --force -f" ++ dir
genSandboxCfg `mapM_` sandboxes
genGhcPkgCache `mapM_` pkgDirs
let caches = [ "setup-config"
, "setup-config.ghc-mod.cabal-helper"
, "setup-config.ghc-mod.cabal-components"
, "setup-config.ghc-mod.resolved-components"
, "setup-config.ghc-mod.package-options"
, "setup-config.ghc-mod.package-db-stack"
, "ghc-mod.cache"
]
findExp = unwords $ intersperse "-o " $ concat [
stackWorkFindExp,
cachesFindExp
]
cachesFindExp = map ("-name "++) caches
stackWorkFindExp = ["-name .stack-work -type d"]
cleanCmd = "find test \\( "++ findExp ++" \\) -exec rm -r {} \\;"
let cleanCmd = "git clean -dXf test/data/"
putStrLn $ "$ " ++ cleanCmd
void $ system cleanCmd
void $ system "cabal --version"
void $ system "ghc --version"
genSandboxCfg `mapM_` sandboxes
genGhcPkgCache `mapM_` pkgDirs
let stackDir = "test/data/stack-project"
void $ withDirectory_ stackDir $ do
-- void $ system "stack init --force"
let ghcver = let gvn = show (__GLASGOW_HASKELL__ :: Int)
(major, minor') = splitAt (length gvn - 2) gvn
minor = case dropWhile (=='0') minor' of
"" -> "0"
x -> x
in major ++ "." ++ minor
void $ system $ "sed '$ a resolver: ghc-" ++ ghcver ++ "' stack.yaml.in > stack.yaml"
void $ system "stack setup"
void $ system "stack build"

View File

@ -2,4 +2,3 @@ flags: {}
packages:
- '.'
extra-deps: []
resolver: lts-2.17