Merge remote-tracking branch 'origin/master' into persistent11
This commit is contained in:
commit
4d6aab02d4
@ -1,5 +1,5 @@
|
|||||||
name: yesod-core
|
name: yesod-core
|
||||||
version: 1.1.6
|
version: 1.1.6.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-platform
|
name: yesod-platform
|
||||||
version: 1.1.4.1
|
version: 1.1.5
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
@ -14,82 +14,93 @@ homepage: http://www.yesodweb.com/
|
|||||||
|
|
||||||
library
|
library
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, SHA == 1.5.1
|
, ReadArgs == 1.2.1
|
||||||
|
, SHA == 1.6.1
|
||||||
, aeson == 0.6.0.2
|
, aeson == 0.6.0.2
|
||||||
, ansi-terminal == 0.5.5
|
, ansi-terminal == 0.5.5
|
||||||
, asn1-data == 0.7.1
|
, asn1-data == 0.7.1
|
||||||
, attoparsec == 0.10.2.0
|
, attoparsec == 0.10.2.0
|
||||||
, attoparsec-conduit == 0.5.0.2
|
, attoparsec-conduit == 0.5.0.3
|
||||||
, authenticate == 1.3.1.1
|
, authenticate == 1.3.2
|
||||||
, base-unicode-symbols == 0.2.2.4
|
, base-unicode-symbols == 0.2.2.4
|
||||||
, base64-bytestring == 1.0.0.0
|
, base64-bytestring == 1.0.0.0
|
||||||
|
, basic-prelude == 0.3.1.0
|
||||||
, blaze-builder == 0.3.1.0
|
, blaze-builder == 0.3.1.0
|
||||||
, blaze-builder-conduit == 0.5.0.1
|
, blaze-builder-conduit == 0.5.0.3
|
||||||
, blaze-html == 0.5.1.0
|
, blaze-html == 0.5.1.1
|
||||||
, blaze-markup == 0.5.1.1
|
, blaze-markup == 0.5.1.2
|
||||||
, byteorder == 1.0.3
|
, byteorder == 1.0.3
|
||||||
, case-insensitive == 0.4.0.3
|
, case-insensitive == 0.4.0.3
|
||||||
, cereal == 0.3.5.2
|
, cereal == 0.3.5.2
|
||||||
, certificate == 1.2.8
|
, certificate == 1.3.3
|
||||||
|
, classy-prelude == 0.4.1
|
||||||
|
, classy-prelude-conduit == 0.4.1
|
||||||
, clientsession == 0.8.0.1
|
, clientsession == 0.8.0.1
|
||||||
, conduit == 0.5.2.7
|
, conduit == 0.5.5
|
||||||
, cookie == 0.4.0.1
|
, cookie == 0.4.0.1
|
||||||
, cprng-aes == 0.2.4
|
, cprng-aes == 0.2.4
|
||||||
, cpu == 0.1.1
|
, cpu == 0.1.1
|
||||||
, crypto-api == 0.10.2
|
, crypto-api == 0.10.2
|
||||||
, crypto-conduit == 0.4.0.1
|
, crypto-conduit == 0.4.1
|
||||||
, crypto-pubkey-types == 0.1.1
|
, crypto-pubkey-types == 0.2.0
|
||||||
, cryptocipher == 0.3.5
|
, cryptocipher == 0.3.6
|
||||||
, cryptohash == 0.7.5
|
, cryptohash == 0.7.9
|
||||||
, css-text == 0.1.1
|
, css-text == 0.1.1
|
||||||
, data-default == 0.5.0
|
, data-default == 0.5.0
|
||||||
, date-cache == 0.3.0
|
, date-cache == 0.3.0
|
||||||
, dlist == 0.5
|
, dlist == 0.5
|
||||||
, email-validate == 0.2.8
|
, email-validate == 0.3.2
|
||||||
, entropy == 0.2.1
|
, entropy == 0.2.1
|
||||||
, failure == 0.2.0.1
|
, failure == 0.2.0.1
|
||||||
, fast-logger == 0.3.1
|
, fast-logger == 0.3.1
|
||||||
, file-embed == 0.0.4.6
|
, file-embed == 0.0.4.6
|
||||||
, filesystem-conduit == 0.5.0.1
|
, filesystem-conduit == 0.5.0.2
|
||||||
, hamlet == 1.1.1
|
, fsnotify == 0.0.4
|
||||||
|
, ghc-paths == 0.1.0.8
|
||||||
|
, hamlet == 1.1.1.1
|
||||||
, hashable == 1.1.2.5
|
, hashable == 1.1.2.5
|
||||||
, hjsmin == 0.1.3
|
, hjsmin == 0.1.3
|
||||||
, hspec == 1.3.0.1
|
, hspec == 1.4.2
|
||||||
, hspec-expectations == 0.3.0.2
|
, hspec-expectations == 0.3.0.3
|
||||||
, html-conduit == 0.1.0.2
|
, html-conduit == 0.1.0.4
|
||||||
, http-conduit == 1.6.1.2
|
, http-conduit == 1.8.4.3
|
||||||
, http-date == 0.0.2
|
, http-date == 0.0.3
|
||||||
|
, http-reverse-proxy == 0.1.0.6
|
||||||
, http-types == 0.7.3.0.1
|
, http-types == 0.7.3.0.1
|
||||||
, language-javascript == 0.5.6
|
, language-javascript == 0.5.7
|
||||||
, largeword == 1.0.3
|
, largeword == 1.0.3
|
||||||
, lifted-base == 0.2
|
, lifted-base == 0.2
|
||||||
, mime-mail == 0.4.1.2
|
, mime-mail == 0.4.1.2
|
||||||
, mime-types == 0.1.0.0
|
, mime-types == 0.1.0.0
|
||||||
, monad-control == 0.3.1.4
|
, monad-control == 0.3.1.4
|
||||||
, monad-logger == 0.2.1
|
, monad-logger == 0.2.3
|
||||||
, network-conduit == 0.6.1.1
|
, network-conduit == 0.6.1.1
|
||||||
|
, optparse-applicative == 0.4.2
|
||||||
, path-pieces == 0.1.2
|
, path-pieces == 0.1.2
|
||||||
, pem == 0.1.1
|
, pem == 0.1.1
|
||||||
, persistent == 1.0.1.3
|
, persistent == 1.0.2.2
|
||||||
, persistent-template == 1.0.0.2
|
, persistent-template == 1.0.0.2
|
||||||
, pool-conduit == 0.1.0.3
|
, pool-conduit == 0.1.0.3
|
||||||
, primitive == 0.5.0.1
|
, primitive == 0.5.0.1
|
||||||
|
, project-template == 0.1.0.1
|
||||||
, pureMD5 == 2.1.2.1
|
, pureMD5 == 2.1.2.1
|
||||||
, pwstore-fast == 2.3
|
, pwstore-fast == 2.3
|
||||||
, ranges == 0.2.4
|
, ranges == 0.2.4
|
||||||
, resource-pool == 0.2.1.1
|
, resource-pool == 0.2.1.1
|
||||||
, resourcet == 0.4.0.2
|
, resourcet == 0.4.4
|
||||||
, safe == 0.3.3
|
, safe == 0.3.3
|
||||||
, semigroups == 0.8.4.1
|
, semigroups == 0.8.4.1
|
||||||
, shakespeare == 1.0.1.4
|
, setenv == 0.1.0
|
||||||
, shakespeare-css == 1.0.1.5
|
, shakespeare == 1.0.2
|
||||||
|
, shakespeare-css == 1.0.2
|
||||||
, shakespeare-i18n == 1.0.0.2
|
, shakespeare-i18n == 1.0.0.2
|
||||||
, shakespeare-js == 1.0.0.6
|
, shakespeare-js == 1.1.0
|
||||||
, shakespeare-text == 1.0.0.5
|
, shakespeare-text == 1.0.0.5
|
||||||
, silently == 1.2.0.2
|
, silently == 1.2.4
|
||||||
, simple-sendfile == 0.2.8
|
, simple-sendfile == 0.2.8
|
||||||
, skein == 0.1.0.9
|
, skein == 0.1.0.10
|
||||||
, socks == 0.4.2
|
, socks == 0.4.2
|
||||||
|
, split == 0.2.1.1
|
||||||
, stringsearch == 0.3.6.4
|
, stringsearch == 0.3.6.4
|
||||||
, system-fileio == 0.3.10
|
, system-fileio == 0.3.10
|
||||||
, system-filepath == 0.4.7
|
, system-filepath == 0.4.7
|
||||||
@ -97,8 +108,8 @@ library
|
|||||||
, tagsoup == 0.12.8
|
, tagsoup == 0.12.8
|
||||||
, tagstream-conduit == 0.5.3
|
, tagstream-conduit == 0.5.3
|
||||||
, tar == 0.4.0.1
|
, tar == 0.4.0.1
|
||||||
, tls == 0.9.11
|
, tls == 1.0.2
|
||||||
, tls-extra == 0.4.7
|
, tls-extra == 0.5.0
|
||||||
, transformers-base == 0.4.1
|
, transformers-base == 0.4.1
|
||||||
, unix-compat == 0.4.0.0
|
, unix-compat == 0.4.0.0
|
||||||
, unordered-containers == 0.2.2.1
|
, unordered-containers == 0.2.2.1
|
||||||
@ -108,27 +119,28 @@ library
|
|||||||
, vector == 0.10.0.1
|
, vector == 0.10.0.1
|
||||||
, void == 0.5.8
|
, void == 0.5.8
|
||||||
, wai == 1.3.0.1
|
, wai == 1.3.0.1
|
||||||
, wai-app-static == 1.3.0.2
|
, wai-app-static == 1.3.0.4
|
||||||
, wai-extra == 1.3.0.3
|
, wai-extra == 1.3.0.4
|
||||||
, wai-logger == 0.3.0
|
, wai-logger == 0.3.0
|
||||||
, wai-test == 1.3.0
|
, wai-test == 1.3.0
|
||||||
, warp == 1.3.4.1
|
, warp == 1.3.5
|
||||||
, xml-conduit == 1.0.3.1
|
, word8 == 0.0.2
|
||||||
|
, xml-conduit == 1.0.3.3
|
||||||
, xml-types == 0.3.3
|
, xml-types == 0.3.3
|
||||||
, xss-sanitize == 0.3.2
|
, xss-sanitize == 0.3.2
|
||||||
, yaml == 0.8.1
|
, yaml == 0.8.1.1
|
||||||
, yesod == 1.1.2
|
, yesod == 1.1.4.1
|
||||||
, yesod-auth == 1.1.1.2
|
, yesod-auth == 1.1.2
|
||||||
, yesod-core == 1.1.3.1
|
, yesod-core == 1.1.6.1
|
||||||
, yesod-default == 1.1.0.2
|
, yesod-default == 1.1.2
|
||||||
, yesod-form == 1.1.3
|
, yesod-form == 1.2.0.1
|
||||||
, yesod-json == 1.1.0
|
, yesod-json == 1.1.2
|
||||||
, yesod-persistent == 1.1.0
|
, yesod-persistent == 1.1.0
|
||||||
, yesod-routes == 1.1.0.2
|
, yesod-routes == 1.1.1.1
|
||||||
, yesod-static == 1.1.0.1
|
, yesod-static == 1.1.1.1
|
||||||
, yesod-test == 0.3.0.1
|
, yesod-test == 0.3.1.1
|
||||||
, zlib-bindings == 0.1.1.1
|
, zlib-bindings == 0.1.1.2
|
||||||
, zlib-conduit == 0.5.0.1
|
, zlib-conduit == 0.5.0.3
|
||||||
|
|
||||||
exposed-modules: Yesod.Platform
|
exposed-modules: Yesod.Platform
|
||||||
|
|
||||||
|
|||||||
@ -65,22 +65,8 @@ module Yesod.Test (
|
|||||||
|
|
||||||
where
|
where
|
||||||
|
|
||||||
-- In in Hspec < 1.3 the Example instance for IO () (== Assertion/Expectation)
|
|
||||||
-- is orphan and only export from Test.Hspec.HUnit.
|
|
||||||
--
|
|
||||||
-- In Hspec 1.3.* it is still orphan, but re-exported from Test.Hspec.
|
|
||||||
--
|
|
||||||
-- Starting with Hspec 1.4.0 it is not orphan anymore.
|
|
||||||
--
|
|
||||||
-- As we only support Hspec >= 1.3, we import Test.Hspec to bring the orphan
|
|
||||||
-- instance into scope. This is better than importing Test.Hspec.HUnit, as
|
|
||||||
-- Test.Hspec.HUnit may be removed in the future.
|
|
||||||
--
|
|
||||||
-- As soon as we decide to drop support for Hspec 1.3.*, we can remove this
|
|
||||||
-- comment and the following import.
|
|
||||||
import qualified Test.Hspec ()
|
|
||||||
|
|
||||||
import qualified Test.Hspec.Core as Core
|
import qualified Test.Hspec.Core as Core
|
||||||
|
import qualified Test.Hspec.Runner as Runner
|
||||||
import qualified Data.List as DL
|
import qualified Data.List as DL
|
||||||
import qualified Data.Maybe as DY
|
import qualified Data.Maybe as DY
|
||||||
import qualified Data.ByteString.Char8 as BS8
|
import qualified Data.ByteString.Char8 as BS8
|
||||||
@ -108,7 +94,7 @@ import Data.Conduit.Pool (Pool)
|
|||||||
import Control.Monad.Trans.Control (MonadBaseControl)
|
import Control.Monad.Trans.Control (MonadBaseControl)
|
||||||
|
|
||||||
-- | The state used in 'describe' to build a list of specs
|
-- | The state used in 'describe' to build a list of specs
|
||||||
data SpecsData conn = SpecsData Application (Pool conn) [Core.Spec]
|
data SpecsData conn = SpecsData Application (Pool conn) [Core.SpecTree]
|
||||||
|
|
||||||
-- | The specs state monad is where 'describe' runs.
|
-- | The specs state monad is where 'describe' runs.
|
||||||
-- parameterized by a database connection.
|
-- parameterized by a database connection.
|
||||||
@ -156,7 +142,7 @@ type CookieValue = ByteString
|
|||||||
runTests :: Application -> Pool conn -> SpecsConn conn -> IO ()
|
runTests :: Application -> Pool conn -> SpecsConn conn -> IO ()
|
||||||
runTests app connection specsDef = do
|
runTests app connection specsDef = do
|
||||||
(SpecsData _ _ specs) <- ST.execStateT specsDef (SpecsData app connection [])
|
(SpecsData _ _ specs) <- ST.execStateT specsDef (SpecsData app connection [])
|
||||||
Core.hspec specs
|
(Runner.hspec . Core.fromSpecList) specs
|
||||||
|
|
||||||
-- | Start describing a Tests suite keeping cookies and a reference to the tested 'Application'
|
-- | Start describing a Tests suite keeping cookies and a reference to the tested 'Application'
|
||||||
-- and 'ConnectionPool'
|
-- and 'ConnectionPool'
|
||||||
|
|||||||
@ -23,7 +23,7 @@ library
|
|||||||
, network >= 2.2
|
, network >= 2.2
|
||||||
, http-types >= 0.7 && < 0.8
|
, http-types >= 0.7 && < 0.8
|
||||||
, HUnit >= 1.2 && < 1.3
|
, HUnit >= 1.2 && < 1.3
|
||||||
, hspec >= 1.3
|
, hspec >= 1.4
|
||||||
, bytestring >= 0.9
|
, bytestring >= 0.9
|
||||||
, case-insensitive >= 0.2
|
, case-insensitive >= 0.2
|
||||||
, text
|
, text
|
||||||
|
|||||||
133
yesod/Devel.hs
133
yesod/Devel.hs
@ -15,6 +15,7 @@ import qualified Distribution.Package as D
|
|||||||
import qualified Distribution.PackageDescription as D
|
import qualified Distribution.PackageDescription as D
|
||||||
import qualified Distribution.PackageDescription.Parse as D
|
import qualified Distribution.PackageDescription.Parse as D
|
||||||
import qualified Distribution.Simple.Build as D
|
import qualified Distribution.Simple.Build as D
|
||||||
|
import qualified Distribution.Simple.Compiler as D
|
||||||
import qualified Distribution.Simple.Configure as D
|
import qualified Distribution.Simple.Configure as D
|
||||||
import qualified Distribution.Simple.LocalBuildInfo as D
|
import qualified Distribution.Simple.LocalBuildInfo as D
|
||||||
import qualified Distribution.Simple.Program as D
|
import qualified Distribution.Simple.Program as D
|
||||||
@ -28,11 +29,10 @@ import Control.Concurrent (forkIO, threadDelay)
|
|||||||
import Control.Concurrent.MVar (MVar, newEmptyMVar,
|
import Control.Concurrent.MVar (MVar, newEmptyMVar,
|
||||||
takeMVar, tryPutMVar)
|
takeMVar, tryPutMVar)
|
||||||
import qualified Control.Exception as Ex
|
import qualified Control.Exception as Ex
|
||||||
import Control.Monad (unless, void,
|
import Control.Monad (forever, unless, void,
|
||||||
when, forever)
|
when)
|
||||||
|
|
||||||
import Control.Monad.Trans.State (evalStateT, get)
|
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
import Control.Monad.Trans.State (evalStateT, get)
|
||||||
|
|
||||||
import Data.Char (isNumber, isUpper)
|
import Data.Char (isNumber, isUpper)
|
||||||
import qualified Data.List as L
|
import qualified Data.List as L
|
||||||
@ -49,22 +49,16 @@ import System.FilePath (dropExtension,
|
|||||||
splitDirectories,
|
splitDirectories,
|
||||||
takeExtension, (</>))
|
takeExtension, (</>))
|
||||||
import System.FSNotify
|
import System.FSNotify
|
||||||
import System.IO (hClose, hGetLine,
|
|
||||||
hIsEOF, hPutStrLn,
|
|
||||||
stderr, stdout)
|
|
||||||
import System.IO.Error (isDoesNotExistError)
|
import System.IO.Error (isDoesNotExistError)
|
||||||
import System.Posix.Types (EpochTime)
|
import System.Posix.Types (EpochTime)
|
||||||
import System.PosixCompat.Files (getFileStatus,
|
import System.PosixCompat.Files (getFileStatus,
|
||||||
modificationTime)
|
modificationTime)
|
||||||
import System.Process (ProcessHandle,
|
import System.Process (ProcessHandle,
|
||||||
createProcess,
|
createProcess, env,
|
||||||
getProcessExitCode,
|
getProcessExitCode,
|
||||||
proc, rawSystem,
|
proc, readProcess,
|
||||||
readProcess,
|
|
||||||
runInteractiveProcess,
|
|
||||||
system,
|
system,
|
||||||
terminateProcess,
|
terminateProcess)
|
||||||
env)
|
|
||||||
import System.Timeout (timeout)
|
import System.Timeout (timeout)
|
||||||
|
|
||||||
import Build (getDeps, isNewerThan,
|
import Build (getDeps, isNewerThan,
|
||||||
@ -73,13 +67,14 @@ import GhcBuild (buildPackage,
|
|||||||
getBuildFlags)
|
getBuildFlags)
|
||||||
|
|
||||||
import qualified Config as GHC
|
import qualified Config as GHC
|
||||||
import SrcLoc (Located)
|
|
||||||
import Network.HTTP.ReverseProxy (waiProxyTo, ProxyDest (ProxyDest))
|
|
||||||
import Network (withSocketsDo)
|
import Network (withSocketsDo)
|
||||||
import Network.Wai (responseLBS)
|
import Network.HTTP.Conduit (def, newManager)
|
||||||
|
import Network.HTTP.ReverseProxy (ProxyDest (ProxyDest),
|
||||||
|
waiProxyTo)
|
||||||
import Network.HTTP.Types (status200)
|
import Network.HTTP.Types (status200)
|
||||||
|
import Network.Wai (responseLBS)
|
||||||
import Network.Wai.Handler.Warp (run)
|
import Network.Wai.Handler.Warp (run)
|
||||||
import Network.HTTP.Conduit (newManager, def)
|
import SrcLoc (Located)
|
||||||
|
|
||||||
lockFile :: DevelOpts -> FilePath
|
lockFile :: DevelOpts -> FilePath
|
||||||
lockFile _opts = "yesod-devel/devel-terminate"
|
lockFile _opts = "yesod-devel/devel-terminate"
|
||||||
@ -109,10 +104,6 @@ data DevelOpts = DevelOpts
|
|||||||
getBuildDir :: DevelOpts -> String
|
getBuildDir :: DevelOpts -> String
|
||||||
getBuildDir opts = fromMaybe "dist" (buildDir opts)
|
getBuildDir opts = fromMaybe "dist" (buildDir opts)
|
||||||
|
|
||||||
cabalCommand :: DevelOpts -> FilePath
|
|
||||||
cabalCommand opts | isCabalDev opts = "cabal-dev"
|
|
||||||
| otherwise = "cabal"
|
|
||||||
|
|
||||||
defaultDevelOpts :: DevelOpts
|
defaultDevelOpts :: DevelOpts
|
||||||
defaultDevelOpts = DevelOpts False False False (-1) Nothing Nothing Nothing
|
defaultDevelOpts = DevelOpts False False False (-1) Nothing Nothing Nothing
|
||||||
|
|
||||||
@ -156,16 +147,16 @@ devel opts passThroughArgs = withManager $ \manager -> do
|
|||||||
|
|
||||||
-- outer loop re-reads the cabal file
|
-- outer loop re-reads the cabal file
|
||||||
mainOuterLoop filesModified = do
|
mainOuterLoop filesModified = do
|
||||||
cabal <- liftIO $ D.findPackageDesc "."
|
ghcVer <- liftIO ghcVersion
|
||||||
gpd <- liftIO $ D.readPackageDescription D.normal cabal
|
cabal <- liftIO $ D.findPackageDesc "."
|
||||||
ldar <- liftIO lookupLdAr
|
gpd <- liftIO $ D.readPackageDescription D.normal cabal
|
||||||
|
ldar <- liftIO lookupLdAr
|
||||||
(hsSourceDirs, lib) <- liftIO $ checkCabalFile gpd
|
(hsSourceDirs, lib) <- liftIO $ checkCabalFile gpd
|
||||||
liftIO $ removeFileIfExists (bd </> "setup-config")
|
liftIO $ removeFileIfExists (bd </> "setup-config")
|
||||||
liftIO $ configure cabal gpd opts
|
liftIO $ configure cabal ghcVer gpd opts
|
||||||
liftIO $ removeFileIfExists "yesod-devel/ghcargs.txt" -- these files contain the wrong data after
|
liftIO $ removeFileIfExists "yesod-devel/ghcargs.txt" -- these files contain the wrong data after
|
||||||
liftIO $ removeFileIfExists "yesod-devel/arargs.txt" -- the configure step, remove them to force
|
liftIO $ removeFileIfExists "yesod-devel/arargs.txt" -- the configure step, remove them to force
|
||||||
liftIO $ removeFileIfExists "yesod-devel/ldargs.txt" -- a cabal build first
|
liftIO $ removeFileIfExists "yesod-devel/ldargs.txt" -- a cabal build first
|
||||||
ghcVer <- liftIO ghcVersion
|
|
||||||
rebuild <- liftIO $ mkRebuild gpd ghcVer cabal opts ldar
|
rebuild <- liftIO $ mkRebuild gpd ghcVer cabal opts ldar
|
||||||
mainInnerLoop hsSourceDirs filesModified cabal gpd lib ghcVer rebuild
|
mainInnerLoop hsSourceDirs filesModified cabal gpd lib ghcVer rebuild
|
||||||
|
|
||||||
@ -227,16 +218,14 @@ runBuildHook Nothing = return ()
|
|||||||
cabal-dev uses the command-line tool, we can fall back to
|
cabal-dev uses the command-line tool, we can fall back to
|
||||||
cabal-dev buildopts if required
|
cabal-dev buildopts if required
|
||||||
-}
|
-}
|
||||||
configure :: FilePath -> D.GenericPackageDescription -> DevelOpts -> IO ()
|
configure :: FilePath -> String -> D.GenericPackageDescription -> DevelOpts -> IO ()
|
||||||
configure _cabalFile gpd opts
|
configure _cabalFile ghcVer gpd opts = do
|
||||||
| isCabalDev opts = rawSystem (cabalCommand opts) args >> return ()
|
lbi <- D.configure (gpd, hookedBuildInfo) configFlags
|
||||||
| otherwise = do
|
D.writePersistBuildConfig (getBuildDir opts) lbi -- fixme we could keep this in memory instead of file
|
||||||
lbi <- D.configure (gpd, hookedBuildInfo) configFlags
|
|
||||||
D.writePersistBuildConfig (getBuildDir opts) lbi -- fixme we could keep this in memory instead of file
|
|
||||||
where
|
where
|
||||||
hookedBuildInfo = (Nothing, [])
|
hookedBuildInfo = (Nothing, [])
|
||||||
configFlags | forceCabal opts = config
|
configFlags0 | forceCabal opts = config
|
||||||
| otherwise = config
|
| otherwise = config
|
||||||
{ DSS.configProgramPaths =
|
{ DSS.configProgramPaths =
|
||||||
[ ("ar", "yesod-ar-wrapper")
|
[ ("ar", "yesod-ar-wrapper")
|
||||||
, ("ld", "yesod-ld-wrapper")
|
, ("ld", "yesod-ld-wrapper")
|
||||||
@ -244,34 +233,32 @@ configure _cabalFile gpd opts
|
|||||||
]
|
]
|
||||||
, DSS.configHcPkg = DSS.Flag "ghc-pkg"
|
, DSS.configHcPkg = DSS.Flag "ghc-pkg"
|
||||||
}
|
}
|
||||||
|
#if MIN_VERSION_Cabal(1,16,0)
|
||||||
|
configFlags | isCabalDev opts = configFlags0
|
||||||
|
{ DSS.configPackageDBs =
|
||||||
|
[ Nothing
|
||||||
|
, Just D.GlobalPackageDB
|
||||||
|
, Just cabalDevPackageDb
|
||||||
|
]
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
configFlags | isCabalDev opts = configFlags0
|
||||||
|
{ DSS.configPackageDB = DSS.Flag cabalDevPackageDb
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
| otherwise = configFlags0
|
||||||
|
|
||||||
|
cabalDevPackageDb = D.SpecificPackageDB ("cabal-dev/packages-" ++ ghcVer ++ ".conf")
|
||||||
|
|
||||||
|
|
||||||
config = (DSS.defaultConfigFlags D.defaultProgramConfiguration)
|
config = (DSS.defaultConfigFlags D.defaultProgramConfiguration)
|
||||||
{ DSS.configConfigurationsFlags =
|
{ DSS.configConfigurationsFlags =
|
||||||
[ (D.FlagName "devel", True) -- legaxy
|
[ (D.FlagName "devel", True) -- legacy
|
||||||
, (D.FlagName "library-only", True)
|
, (D.FlagName "library-only", True)
|
||||||
]
|
]
|
||||||
, DSS.configProfLib = DSS.Flag False
|
, DSS.configProfLib = DSS.Flag False
|
||||||
, DSS.configUserInstall = DSS.Flag True
|
, DSS.configUserInstall = DSS.Flag True
|
||||||
}
|
}
|
||||||
cabalArgs
|
|
||||||
| isCabalDev opts = map ("--cabal-install-arg=" ++) as
|
|
||||||
| otherwise = as
|
|
||||||
where
|
|
||||||
as =
|
|
||||||
[ "-fdevel" -- legacy
|
|
||||||
, "-flibrary-only"
|
|
||||||
] ++ wrapperArgs
|
|
||||||
wrapperArgs
|
|
||||||
| forceCabal opts = []
|
|
||||||
| otherwise =
|
|
||||||
[ "--with-compiler=yesod-ghc-wrapper"
|
|
||||||
, "--with-hc-pkg=ghc-pkg"
|
|
||||||
, "--with-ld=yesod-ld-wrapper"
|
|
||||||
, "--with-ar=yesod-ar-wrapper"
|
|
||||||
]
|
|
||||||
args :: [String]
|
|
||||||
args = "configure":cabalArgs ++ ["--disable-library-profiling" ]
|
|
||||||
|
|
||||||
|
|
||||||
removeFileIfExists :: FilePath -> IO ()
|
removeFileIfExists :: FilePath -> IO ()
|
||||||
removeFileIfExists file = removeFile file `Ex.catch` handler
|
removeFileIfExists file = removeFile file `Ex.catch` handler
|
||||||
@ -302,15 +289,7 @@ rebuildGhc bf ld ar = do
|
|||||||
buildPackage bf ld ar
|
buildPackage bf ld ar
|
||||||
|
|
||||||
rebuildCabal :: D.GenericPackageDescription -> DevelOpts -> IO Bool
|
rebuildCabal :: D.GenericPackageDescription -> DevelOpts -> IO Bool
|
||||||
rebuildCabal _gpd opts
|
rebuildCabal _gpd opts = do
|
||||||
| isCabalDev opts = do
|
|
||||||
let cmd = cabalCommand opts
|
|
||||||
putStrLn $ "Rebuilding application... (using " ++ cmd ++ ")"
|
|
||||||
exit <- (if verbose opts then rawSystem else rawSystemFilter) cmd ["build"]
|
|
||||||
return $ case exit of
|
|
||||||
ExitSuccess -> True
|
|
||||||
_ -> False
|
|
||||||
| otherwise = do
|
|
||||||
putStrLn $ "Rebuilding application... (using Cabal library)"
|
putStrLn $ "Rebuilding application... (using Cabal library)"
|
||||||
lbi <- getPersistBuildConfig opts -- fixme we could cache this from the configure step
|
lbi <- getPersistBuildConfig opts -- fixme we could cache this from the configure step
|
||||||
let buildFlags | verbose opts = DSS.defaultBuildFlags
|
let buildFlags | verbose opts = DSS.defaultBuildFlags
|
||||||
@ -407,11 +386,12 @@ ghcVersion = fmap getNumber $ readProcess "runghc" ["--numeric-version", "0"] []
|
|||||||
|
|
||||||
ghcPackageArgs :: DevelOpts -> String -> D.PackageDescription -> D.Library -> IO [String]
|
ghcPackageArgs :: DevelOpts -> String -> D.PackageDescription -> D.Library -> IO [String]
|
||||||
ghcPackageArgs opts ghcVer cabal lib = do
|
ghcPackageArgs opts ghcVer cabal lib = do
|
||||||
lbi <- getPersistBuildConfig opts
|
lbi <- getPersistBuildConfig opts
|
||||||
cbi <- fromMaybeErr errCbi (D.libraryConfig lbi)
|
cbi <- fromMaybeErr errCbi (D.libraryConfig lbi)
|
||||||
if isCabalDev opts
|
if isCabalDev opts
|
||||||
then return ("-hide-all-packages" : "-no-user-package-conf" : inplaceConf : selfPkgArg lbi : cabalDevConf : depArgs lbi cbi)
|
then return ("-hide-all-packages" : "-no-user-package-conf" : inplaceConf
|
||||||
else return ("-hide-all-packages" : inplaceConf : selfPkgArg lbi : depArgs lbi cbi)
|
: selfPkgArg lbi : cabalDevConf : depArgs lbi cbi)
|
||||||
|
else return ("-hide-all-packages" : inplaceConf : selfPkgArg lbi : depArgs lbi cbi)
|
||||||
where
|
where
|
||||||
selfPkgArg lbi = pkgArg . D.inplacePackageId . D.package . D.localPkgDescr $ lbi
|
selfPkgArg lbi = pkgArg . D.inplacePackageId . D.package . D.localPkgDescr $ lbi
|
||||||
pkgArg (D.InstalledPackageId pkgId) = "-package-id" ++ pkgId
|
pkgArg (D.InstalledPackageId pkgId) = "-package-id" ++ pkgId
|
||||||
@ -477,23 +457,6 @@ lookupLdAr' = do
|
|||||||
where
|
where
|
||||||
look pgm pdb = fmap D.programPath (D.lookupProgram pgm pdb)
|
look pgm pdb = fmap D.programPath (D.lookupProgram pgm pdb)
|
||||||
|
|
||||||
-- | Acts like @rawSystem@, but filters out lines from the output that we're not interested in seeing.
|
|
||||||
rawSystemFilter :: String -> [String] -> IO ExitCode
|
|
||||||
rawSystemFilter command args = do
|
|
||||||
(inh, outh, errh, ph) <- runInteractiveProcess command args Nothing Nothing
|
|
||||||
hClose inh
|
|
||||||
let go handlein handleout = do
|
|
||||||
isEof <- hIsEOF handlein
|
|
||||||
if isEof
|
|
||||||
then hClose handlein
|
|
||||||
else do
|
|
||||||
line <- hGetLine handlein
|
|
||||||
unless ("Loading package " `L.isPrefixOf` line) $ hPutStrLn handleout line
|
|
||||||
go handlein handleout
|
|
||||||
_ <- forkIO $ go outh stdout
|
|
||||||
_ <- forkIO $ go errh stderr
|
|
||||||
waitForProcess' ph
|
|
||||||
|
|
||||||
-- | nonblocking version of @waitForProcess@
|
-- | nonblocking version of @waitForProcess@
|
||||||
waitForProcess' :: ProcessHandle -> IO ExitCode
|
waitForProcess' :: ProcessHandle -> IO ExitCode
|
||||||
waitForProcess' pid = go
|
waitForProcess' pid = go
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod
|
name: yesod
|
||||||
version: 1.1.4
|
version: 1.1.4.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user