Tweak .cabal to avoid unneeded recompilation

Previously when making a change and running `stack test`, it would
compile each module 3 times: for the library, the executable, and the
test suite.

This change more cleanly segregates the hs-source-dirs for each target,
which avoids recompilation. The only source change is moving Main.hs
into its own directory (but it's otherwise unchanged). See also:
<http://stackoverflow.com/questions/6711151/how-to-avoid-recompiling-in-this-cabal-file>
This commit is contained in:
Christopher League
2016-05-18 09:55:52 -04:00
parent a21464ddca
commit b089e0a7dd
2 changed files with 4 additions and 27 deletions
+4 -27
View File
@@ -22,7 +22,7 @@ Flag CI
Default: False
executable postgrest
main-is: PostgREST/Main.hs
main-is: Main.hs
default-extensions: OverloadedStrings, ScopedTypeVariables, QuasiQuotes
ghc-options: -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010
@@ -65,19 +65,7 @@ executable postgrest
if !os(windows)
build-depends: unix >= 2.7 && < 3
hs-source-dirs: src
other-modules: Paths_postgrest
, PostgREST.App
, PostgREST.Auth
, PostgREST.Config
, PostgREST.Error
, PostgREST.Middleware
, PostgREST.Parsers
, PostgREST.DbStructure
, PostgREST.QueryBuilder
, PostgREST.RangeQuery
, PostgREST.ApiRequest
, PostgREST.Types
hs-source-dirs: main
library
default-language: Haskell2010
@@ -136,7 +124,7 @@ Test-Suite spec
Default-Language: Haskell2010
default-extensions: OverloadedStrings, ScopedTypeVariables, QuasiQuotes
ghc-options: -threaded -rtsopts -with-rtsopts=-N
Hs-Source-Dirs: test, src
Hs-Source-Dirs: test
Main-Is: Main.hs
Other-Modules: Feature.AuthSpec
, Feature.ConcurrentSpec
@@ -148,18 +136,6 @@ Test-Suite spec
, Feature.RangeSpec
, Feature.StructureSpec
, Feature.UnicodeSpec
, Paths_postgrest
, PostgREST.App
, PostgREST.Auth
, PostgREST.Config
, PostgREST.Error
, PostgREST.Middleware
, PostgREST.Parsers
, PostgREST.DbStructure
, PostgREST.QueryBuilder
, PostgREST.RangeQuery
, PostgREST.ApiRequest
, PostgREST.Types
, SpecHelper
, TestTypes
Build-Depends: aeson
@@ -188,6 +164,7 @@ Test-Suite spec
, mtl
, optparse-applicative
, parsec
, postgrest
, process
, regex-tdfa
, safe