Merge pull request #830 from DanielG/stack-test-project-resolver
Stack test project resolver
This commit is contained in:
commit
8be4cdfe5f
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@ elisp/*.elc
|
|||||||
*~
|
*~
|
||||||
/.cabal-sandbox/
|
/.cabal-sandbox/
|
||||||
/.stack-work/
|
/.stack-work/
|
||||||
|
/test/data/**/stack.yaml
|
||||||
add-source-timestamps
|
add-source-timestamps
|
||||||
package.cache
|
package.cache
|
||||||
cabal.sandbox.config
|
cabal.sandbox.config
|
||||||
|
33
test/Main.hs
33
test/Main.hs
@ -4,7 +4,6 @@ import Dir
|
|||||||
|
|
||||||
import Control.Exception as E
|
import Control.Exception as E
|
||||||
import Control.Monad (void)
|
import Control.Monad (void)
|
||||||
import Data.List
|
|
||||||
import Language.Haskell.GhcMod (debugInfo)
|
import Language.Haskell.GhcMod (debugInfo)
|
||||||
import System.Process
|
import System.Process
|
||||||
import System.Environment
|
import System.Environment
|
||||||
@ -29,34 +28,24 @@ main = do
|
|||||||
, "test/data/duplicate-pkgver/.cabal-sandbox/i386-osx-ghc-7.6.3-packages.conf.d"]
|
, "test/data/duplicate-pkgver/.cabal-sandbox/i386-osx-ghc-7.6.3-packages.conf.d"]
|
||||||
genGhcPkgCache dir = system $ "ghc-pkg recache --force -f" ++ dir
|
genGhcPkgCache dir = system $ "ghc-pkg recache --force -f" ++ dir
|
||||||
|
|
||||||
genSandboxCfg `mapM_` sandboxes
|
let cleanCmd = "git clean -dXf test/data/"
|
||||||
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 {} \\;"
|
|
||||||
|
|
||||||
putStrLn $ "$ " ++ cleanCmd
|
putStrLn $ "$ " ++ cleanCmd
|
||||||
void $ system cleanCmd
|
void $ system cleanCmd
|
||||||
void $ system "cabal --version"
|
void $ system "cabal --version"
|
||||||
void $ system "ghc --version"
|
void $ system "ghc --version"
|
||||||
|
|
||||||
|
genSandboxCfg `mapM_` sandboxes
|
||||||
|
genGhcPkgCache `mapM_` pkgDirs
|
||||||
|
|
||||||
let stackDir = "test/data/stack-project"
|
let stackDir = "test/data/stack-project"
|
||||||
void $ withDirectory_ stackDir $ do
|
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 setup"
|
||||||
void $ system "stack build"
|
void $ system "stack build"
|
||||||
|
|
||||||
|
@ -2,4 +2,3 @@ flags: {}
|
|||||||
packages:
|
packages:
|
||||||
- '.'
|
- '.'
|
||||||
extra-deps: []
|
extra-deps: []
|
||||||
resolver: lts-2.17
|
|
Loading…
Reference in New Issue
Block a user