{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeApplications #-}
module NvFetcher.Types.ShakeExtras
(
ShakeExtras (..),
initShakeExtras,
getShakeExtras,
lookupPackage,
getAllPackageKeys,
isPackageKeyTarget,
recordVersionChange,
getVersionChanges,
withRetry,
getBuildDir,
getKeyfilePath,
getLastVersionOnDisk,
getRecentLastVersion,
updateLastVersion,
getAllOnDiskVersions,
getLastVersionUpdated,
nvcheckerCacheEnabled,
nvcheckerKeepGoing,
)
where
import Control.Concurrent.Extra
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Development.Shake
import NvFetcher.Config
import NvFetcher.Types
data LastVersion
= OnDisk Version
| Updated
(Maybe Version)
Version
data =
{ ShakeExtras -> Config
config :: Config,
ShakeExtras -> Var [VersionChange]
versionChanges :: Var [VersionChange],
ShakeExtras -> Map PackageKey Package
targetPackages :: Map PackageKey Package,
ShakeExtras -> Var (Map PackageKey LastVersion)
lastVersions :: Var (Map PackageKey LastVersion)
}
getShakeExtras :: Action ShakeExtras
=
forall a. Typeable a => Action (Maybe a)
getShakeExtra @ShakeExtras Action (Maybe ShakeExtras)
-> (Maybe ShakeExtras -> Action ShakeExtras) -> Action ShakeExtras
forall a b. Action a -> (a -> Action b) -> Action b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \case
Just ShakeExtras
x -> ShakeExtras -> Action ShakeExtras
forall a. a -> Action a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ShakeExtras
x
Maybe ShakeExtras
_ -> String -> Action ShakeExtras
forall a. String -> Action a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"ShakeExtras is missing!"
initShakeExtras :: Config -> Map PackageKey Package -> Map PackageKey Version -> IO ShakeExtras
Config
config Map PackageKey Package
targetPackages Map PackageKey Version
lv = do
Var [VersionChange]
versionChanges <- [VersionChange] -> IO (Var [VersionChange])
forall a. a -> IO (Var a)
newVar [VersionChange]
forall a. Monoid a => a
mempty
Var (Map PackageKey LastVersion)
lastVersions <- Map PackageKey LastVersion -> IO (Var (Map PackageKey LastVersion))
forall a. a -> IO (Var a)
newVar (Map PackageKey LastVersion
-> IO (Var (Map PackageKey LastVersion)))
-> Map PackageKey LastVersion
-> IO (Var (Map PackageKey LastVersion))
forall a b. (a -> b) -> a -> b
$ (Version -> LastVersion)
-> Map PackageKey Version -> Map PackageKey LastVersion
forall a b k. (a -> b) -> Map k a -> Map k b
Map.map Version -> LastVersion
OnDisk Map PackageKey Version
lv
ShakeExtras -> IO ShakeExtras
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
config :: Config
targetPackages :: Map PackageKey Package
versionChanges :: Var [VersionChange]
lastVersions :: Var (Map PackageKey LastVersion)
..}
getAllPackageKeys :: Action [PackageKey]
getAllPackageKeys :: Action [PackageKey]
getAllPackageKeys = do
ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: ShakeExtras -> Config
versionChanges :: ShakeExtras -> Var [VersionChange]
targetPackages :: ShakeExtras -> Map PackageKey Package
lastVersions :: ShakeExtras -> Var (Map PackageKey LastVersion)
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
..} <- Action ShakeExtras
getShakeExtras
[PackageKey] -> Action [PackageKey]
forall a. a -> Action a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([PackageKey] -> Action [PackageKey])
-> [PackageKey] -> Action [PackageKey]
forall a b. (a -> b) -> a -> b
$ Map PackageKey Package -> [PackageKey]
forall k a. Map k a -> [k]
Map.keys Map PackageKey Package
targetPackages
lookupPackage :: PackageKey -> Action (Maybe Package)
lookupPackage :: PackageKey -> Action (Maybe Package)
lookupPackage PackageKey
key = do
ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: ShakeExtras -> Config
versionChanges :: ShakeExtras -> Var [VersionChange]
targetPackages :: ShakeExtras -> Map PackageKey Package
lastVersions :: ShakeExtras -> Var (Map PackageKey LastVersion)
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
..} <- Action ShakeExtras
getShakeExtras
Maybe Package -> Action (Maybe Package)
forall a. a -> Action a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe Package -> Action (Maybe Package))
-> Maybe Package -> Action (Maybe Package)
forall a b. (a -> b) -> a -> b
$ PackageKey -> Map PackageKey Package -> Maybe Package
forall k a. Ord k => k -> Map k a -> Maybe a
Map.lookup PackageKey
key Map PackageKey Package
targetPackages
isPackageKeyTarget :: PackageKey -> Action Bool
isPackageKeyTarget :: PackageKey -> Action Bool
isPackageKeyTarget PackageKey
k = PackageKey -> Map PackageKey Package -> Bool
forall k a. Ord k => k -> Map k a -> Bool
Map.member PackageKey
k (Map PackageKey Package -> Bool)
-> (ShakeExtras -> Map PackageKey Package) -> ShakeExtras -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShakeExtras -> Map PackageKey Package
targetPackages (ShakeExtras -> Bool) -> Action ShakeExtras -> Action Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Action ShakeExtras
getShakeExtras
recordVersionChange :: PackageName -> Maybe Version -> Version -> Action ()
recordVersionChange :: PackageName -> Maybe Version -> Version -> Action ()
recordVersionChange PackageName
vcName Maybe Version
vcOld Version
vcNew = do
ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: ShakeExtras -> Config
versionChanges :: ShakeExtras -> Var [VersionChange]
targetPackages :: ShakeExtras -> Map PackageKey Package
lastVersions :: ShakeExtras -> Var (Map PackageKey LastVersion)
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
..} <- Action ShakeExtras
getShakeExtras
IO () -> Action ()
forall a. IO a -> Action a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> Action ()) -> IO () -> Action ()
forall a b. (a -> b) -> a -> b
$ Var [VersionChange]
-> ([VersionChange] -> IO [VersionChange]) -> IO ()
forall a. Var a -> (a -> IO a) -> IO ()
modifyVar_ Var [VersionChange]
versionChanges ([VersionChange] -> IO [VersionChange]
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ([VersionChange] -> IO [VersionChange])
-> ([VersionChange] -> [VersionChange])
-> [VersionChange]
-> IO [VersionChange]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([VersionChange] -> [VersionChange] -> [VersionChange]
forall a. [a] -> [a] -> [a]
++ [VersionChange {Maybe Version
PackageName
Version
vcName :: PackageName
vcOld :: Maybe Version
vcNew :: Version
vcName :: PackageName
vcOld :: Maybe Version
vcNew :: Version
..}]))
getVersionChanges :: Action [VersionChange]
getVersionChanges :: Action [VersionChange]
getVersionChanges = do
ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: ShakeExtras -> Config
versionChanges :: ShakeExtras -> Var [VersionChange]
targetPackages :: ShakeExtras -> Map PackageKey Package
lastVersions :: ShakeExtras -> Var (Map PackageKey LastVersion)
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
..} <- Action ShakeExtras
getShakeExtras
IO [VersionChange] -> Action [VersionChange]
forall a. IO a -> Action a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [VersionChange] -> Action [VersionChange])
-> IO [VersionChange] -> Action [VersionChange]
forall a b. (a -> b) -> a -> b
$ Var [VersionChange] -> IO [VersionChange]
forall a. Var a -> IO a
readVar Var [VersionChange]
versionChanges
withRetry :: Action a -> Action a
withRetry :: forall a. Action a -> Action a
withRetry Action a
a = Action ShakeExtras
getShakeExtras Action ShakeExtras -> (ShakeExtras -> Action a) -> Action a
forall a b. Action a -> (a -> Action b) -> Action b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: ShakeExtras -> Config
versionChanges :: ShakeExtras -> Var [VersionChange]
targetPackages :: ShakeExtras -> Map PackageKey Package
lastVersions :: ShakeExtras -> Var (Map PackageKey LastVersion)
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
..} -> Int -> Action a -> Action a
forall a. Int -> Action a -> Action a
actionRetry (Config -> Int
retry Config
config) Action a
a
getBuildDir :: Action FilePath
getBuildDir :: Action String
getBuildDir = Config -> String
buildDir (Config -> String)
-> (ShakeExtras -> Config) -> ShakeExtras -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShakeExtras -> Config
config (ShakeExtras -> String) -> Action ShakeExtras -> Action String
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Action ShakeExtras
getShakeExtras
getKeyfilePath :: Action (Maybe FilePath)
getKeyfilePath :: Action (Maybe String)
getKeyfilePath = Config -> Maybe String
keyfile (Config -> Maybe String)
-> (ShakeExtras -> Config) -> ShakeExtras -> Maybe String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShakeExtras -> Config
config (ShakeExtras -> Maybe String)
-> Action ShakeExtras -> Action (Maybe String)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Action ShakeExtras
getShakeExtras
getLastVersionOnDisk :: PackageKey -> Action (Maybe Version)
getLastVersionOnDisk :: PackageKey -> Action (Maybe Version)
getLastVersionOnDisk PackageKey
k = do
ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: ShakeExtras -> Config
versionChanges :: ShakeExtras -> Var [VersionChange]
targetPackages :: ShakeExtras -> Map PackageKey Package
lastVersions :: ShakeExtras -> Var (Map PackageKey LastVersion)
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
..} <- Action ShakeExtras
getShakeExtras
Map PackageKey LastVersion
versions <- IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion)
forall a. IO a -> Action a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion))
-> IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion)
forall a b. (a -> b) -> a -> b
$ Var (Map PackageKey LastVersion) -> IO (Map PackageKey LastVersion)
forall a. Var a -> IO a
readVar Var (Map PackageKey LastVersion)
lastVersions
Maybe Version -> Action (Maybe Version)
forall a. a -> Action a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe Version -> Action (Maybe Version))
-> Maybe Version -> Action (Maybe Version)
forall a b. (a -> b) -> a -> b
$ case Map PackageKey LastVersion
versions Map PackageKey LastVersion -> PackageKey -> Maybe LastVersion
forall k a. Ord k => Map k a -> k -> Maybe a
Map.!? PackageKey
k of
Just (Updated Maybe Version
v Version
_) -> Maybe Version
v
Just (OnDisk Version
v) -> Version -> Maybe Version
forall a. a -> Maybe a
Just Version
v
Maybe LastVersion
_ -> Maybe Version
forall a. Maybe a
Nothing
getRecentLastVersion :: PackageKey -> Action (Maybe Version)
getRecentLastVersion :: PackageKey -> Action (Maybe Version)
getRecentLastVersion PackageKey
k = do
ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: ShakeExtras -> Config
versionChanges :: ShakeExtras -> Var [VersionChange]
targetPackages :: ShakeExtras -> Map PackageKey Package
lastVersions :: ShakeExtras -> Var (Map PackageKey LastVersion)
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
..} <- Action ShakeExtras
getShakeExtras
Map PackageKey LastVersion
versions <- IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion)
forall a. IO a -> Action a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion))
-> IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion)
forall a b. (a -> b) -> a -> b
$ Var (Map PackageKey LastVersion) -> IO (Map PackageKey LastVersion)
forall a. Var a -> IO a
readVar Var (Map PackageKey LastVersion)
lastVersions
Maybe Version -> Action (Maybe Version)
forall a. a -> Action a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe Version -> Action (Maybe Version))
-> Maybe Version -> Action (Maybe Version)
forall a b. (a -> b) -> a -> b
$ case Map PackageKey LastVersion
versions Map PackageKey LastVersion -> PackageKey -> Maybe LastVersion
forall k a. Ord k => Map k a -> k -> Maybe a
Map.!? PackageKey
k of
Just (Updated Maybe Version
_ Version
v) -> Version -> Maybe Version
forall a. a -> Maybe a
Just Version
v
Just (OnDisk Version
v) -> Version -> Maybe Version
forall a. a -> Maybe a
Just Version
v
Maybe LastVersion
_ -> Maybe Version
forall a. Maybe a
Nothing
getLastVersionUpdated :: PackageKey -> Action (Maybe Version)
getLastVersionUpdated :: PackageKey -> Action (Maybe Version)
getLastVersionUpdated PackageKey
k = do
ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: ShakeExtras -> Config
versionChanges :: ShakeExtras -> Var [VersionChange]
targetPackages :: ShakeExtras -> Map PackageKey Package
lastVersions :: ShakeExtras -> Var (Map PackageKey LastVersion)
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
..} <- Action ShakeExtras
getShakeExtras
Map PackageKey LastVersion
versions <- IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion)
forall a. IO a -> Action a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion))
-> IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion)
forall a b. (a -> b) -> a -> b
$ Var (Map PackageKey LastVersion) -> IO (Map PackageKey LastVersion)
forall a. Var a -> IO a
readVar Var (Map PackageKey LastVersion)
lastVersions
Maybe Version -> Action (Maybe Version)
forall a. a -> Action a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe Version -> Action (Maybe Version))
-> Maybe Version -> Action (Maybe Version)
forall a b. (a -> b) -> a -> b
$ case Map PackageKey LastVersion
versions Map PackageKey LastVersion -> PackageKey -> Maybe LastVersion
forall k a. Ord k => Map k a -> k -> Maybe a
Map.!? PackageKey
k of
Just (Updated Maybe Version
_ Version
v) -> Version -> Maybe Version
forall a. a -> Maybe a
Just Version
v
Maybe LastVersion
_ -> Maybe Version
forall a. Maybe a
Nothing
updateLastVersion :: PackageKey -> Version -> Action ()
updateLastVersion :: PackageKey -> Version -> Action ()
updateLastVersion PackageKey
k Version
v = do
ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: ShakeExtras -> Config
versionChanges :: ShakeExtras -> Var [VersionChange]
targetPackages :: ShakeExtras -> Map PackageKey Package
lastVersions :: ShakeExtras -> Var (Map PackageKey LastVersion)
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
..} <- Action ShakeExtras
getShakeExtras
IO () -> Action ()
forall a. IO a -> Action a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> Action ()) -> IO () -> Action ()
forall a b. (a -> b) -> a -> b
$
Var (Map PackageKey LastVersion)
-> (Map PackageKey LastVersion -> IO (Map PackageKey LastVersion))
-> IO ()
forall a. Var a -> (a -> IO a) -> IO ()
modifyVar_ Var (Map PackageKey LastVersion)
lastVersions ((Map PackageKey LastVersion -> IO (Map PackageKey LastVersion))
-> IO ())
-> (Map PackageKey LastVersion -> IO (Map PackageKey LastVersion))
-> IO ()
forall a b. (a -> b) -> a -> b
$ \Map PackageKey LastVersion
versions -> Map PackageKey LastVersion -> IO (Map PackageKey LastVersion)
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Map PackageKey LastVersion -> IO (Map PackageKey LastVersion))
-> Map PackageKey LastVersion -> IO (Map PackageKey LastVersion)
forall a b. (a -> b) -> a -> b
$ case Map PackageKey LastVersion
versions Map PackageKey LastVersion -> PackageKey -> Maybe LastVersion
forall k a. Ord k => Map k a -> k -> Maybe a
Map.!? PackageKey
k of
Just (Updated Maybe Version
o Version
_) -> PackageKey
-> LastVersion
-> Map PackageKey LastVersion
-> Map PackageKey LastVersion
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert PackageKey
k (Maybe Version -> Version -> LastVersion
Updated Maybe Version
o Version
v) Map PackageKey LastVersion
versions
Just (OnDisk Version
lv) -> PackageKey
-> LastVersion
-> Map PackageKey LastVersion
-> Map PackageKey LastVersion
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert PackageKey
k (Maybe Version -> Version -> LastVersion
Updated (Version -> Maybe Version
forall a. a -> Maybe a
Just Version
lv) Version
v) Map PackageKey LastVersion
versions
Maybe LastVersion
_ -> PackageKey
-> LastVersion
-> Map PackageKey LastVersion
-> Map PackageKey LastVersion
forall k a. Ord k => k -> a -> Map k a -> Map k a
Map.insert PackageKey
k (Maybe Version -> Version -> LastVersion
Updated Maybe Version
forall a. Maybe a
Nothing Version
v) Map PackageKey LastVersion
versions
getAllOnDiskVersions :: Action (Map PackageKey Version)
getAllOnDiskVersions :: Action (Map PackageKey Version)
getAllOnDiskVersions = do
ShakeExtras {Map PackageKey Package
Var [VersionChange]
Var (Map PackageKey LastVersion)
Config
config :: ShakeExtras -> Config
versionChanges :: ShakeExtras -> Var [VersionChange]
targetPackages :: ShakeExtras -> Map PackageKey Package
lastVersions :: ShakeExtras -> Var (Map PackageKey LastVersion)
config :: Config
versionChanges :: Var [VersionChange]
targetPackages :: Map PackageKey Package
lastVersions :: Var (Map PackageKey LastVersion)
..} <- Action ShakeExtras
getShakeExtras
Map PackageKey LastVersion
versions <- IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion)
forall a. IO a -> Action a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion))
-> IO (Map PackageKey LastVersion)
-> Action (Map PackageKey LastVersion)
forall a b. (a -> b) -> a -> b
$ Var (Map PackageKey LastVersion) -> IO (Map PackageKey LastVersion)
forall a. Var a -> IO a
readVar Var (Map PackageKey LastVersion)
lastVersions
let xs :: [(PackageKey, Maybe Version)]
xs = Map PackageKey (Maybe Version) -> [(PackageKey, Maybe Version)]
forall k a. Map k a -> [(k, a)]
Map.toList (Map PackageKey (Maybe Version) -> [(PackageKey, Maybe Version)])
-> Map PackageKey (Maybe Version) -> [(PackageKey, Maybe Version)]
forall a b. (a -> b) -> a -> b
$
((LastVersion -> Maybe Version)
-> Map PackageKey LastVersion -> Map PackageKey (Maybe Version))
-> Map PackageKey LastVersion
-> (LastVersion -> Maybe Version)
-> Map PackageKey (Maybe Version)
forall a b c. (a -> b -> c) -> b -> a -> c
flip (LastVersion -> Maybe Version)
-> Map PackageKey LastVersion -> Map PackageKey (Maybe Version)
forall a b k. (a -> b) -> Map k a -> Map k b
Map.map Map PackageKey LastVersion
versions ((LastVersion -> Maybe Version) -> Map PackageKey (Maybe Version))
-> (LastVersion -> Maybe Version) -> Map PackageKey (Maybe Version)
forall a b. (a -> b) -> a -> b
$ \case
OnDisk Version
v -> Version -> Maybe Version
forall a. a -> Maybe a
Just Version
v
Updated Maybe Version
v Version
_ -> Maybe Version
v
Map PackageKey Version -> Action (Map PackageKey Version)
forall a. a -> Action a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Map PackageKey Version -> Action (Map PackageKey Version))
-> Map PackageKey Version -> Action (Map PackageKey Version)
forall a b. (a -> b) -> a -> b
$ [(PackageKey, Version)] -> Map PackageKey Version
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [(PackageKey
k, Version
v) | (PackageKey
k, Just Version
v) <- [(PackageKey, Maybe Version)]
xs]
nvcheckerCacheEnabled :: Action Bool
nvcheckerCacheEnabled :: Action Bool
nvcheckerCacheEnabled = Config -> Bool
cacheNvchecker (Config -> Bool) -> (ShakeExtras -> Config) -> ShakeExtras -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShakeExtras -> Config
config (ShakeExtras -> Bool) -> Action ShakeExtras -> Action Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Action ShakeExtras
getShakeExtras
nvcheckerKeepGoing :: Action Bool
nvcheckerKeepGoing :: Action Bool
nvcheckerKeepGoing = Config -> Bool
keepGoing (Config -> Bool) -> (ShakeExtras -> Config) -> ShakeExtras -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ShakeExtras -> Config
config (ShakeExtras -> Bool) -> Action ShakeExtras -> Action Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Action ShakeExtras
getShakeExtras