Fix all the stack related things

This commit is contained in:
Daniel Gröber
2015-08-19 06:48:27 +02:00
parent d660e7cd85
commit 78bdf86a95
11 changed files with 75 additions and 59 deletions

View File

@@ -58,10 +58,9 @@ spec = do
it "handles stack project" $ do
let tdir = "test/data/stack-project"
opts <- map gmcGhcOpts <$> runD' tdir getComponents
let ghcOpts = head opts
pkgs = pkgOptions ghcOpts
pkgs `shouldBe` ["Cabal","base","new-template"]
[ghcOpts] <- map gmcGhcOpts . filter ((==ChExeName "new-template-exe") . gmcName) <$> runD' tdir getComponents
let pkgs = pkgOptions ghcOpts
pkgs `shouldBe` ["base", "bytestring"]
it "extracts build dependencies" $ do
let tdir = "test/data/cabal-project"

View File

@@ -28,12 +28,6 @@ main = do
genSandboxCfg `mapM_` sandboxes
genGhcPkgCache `mapM_` pkgDirs
let stackDir = "test/data/stack-project"
void $ withDirectory_ stackDir $ do
void $ system "stack init --force"
void $ system "stack setup"
void $ system "stack build"
let caches = [ "setup-config"
, "setup-config.ghc-mod.cabal-helper"
, "setup-config.ghc-mod.cabal-components"
@@ -42,16 +36,26 @@ main = do
, "setup-config.ghc-mod.package-db-stack"
, "ghc-mod.cache"
]
cachesFindExp :: String
cachesFindExp = unwords $ intersperse "-o " $ map ("-name "++) caches
findExp = unwords $ intersperse "-o " $ concat [
stackWorkFindExp,
cachesFindExp
]
cachesFindExp = map ("-name "++) caches
stackWorkFindExp = ["-name .stack-work -type d"]
cleanCmd = "find test \\( "++ cachesFindExp ++" \\) -exec rm {} \\;"
cleanCmd = "find test \\( "++ findExp ++" \\) -exec rm -r {} \\;"
putStrLn $ "$ " ++ cleanCmd
void $ system cleanCmd
void $ system "cabal --version"
void $ system "ghc --version"
let stackDir = "test/data/stack-project"
void $ withDirectory_ stackDir $ do
-- void $ system "stack init --force"
void $ system "stack setup"
void $ system "stack build"
(putStrLn =<< runD debugInfo)
`E.catch` (\(_ :: E.SomeException) -> return () )

View File

@@ -7,10 +7,10 @@ homepage: http://github.com/name/project
-- license-file: LICENSE
author: Your name here
maintainer: your.address@example.com
-- copyright:
-- copyright:
category: Web
build-type: Simple
-- extra-source-files:
-- extra-source-files:
cabal-version: >=1.10
library
@@ -25,6 +25,7 @@ executable new-template-exe
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base
, new-template
, bytestring
default-language: Haskell2010
test-suite new-template-test

View File

@@ -0,0 +1,5 @@
flags: {}
packages:
- '.'
extra-deps: []
resolver: lts-2.17