summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-13 19:07:15 +0200
committerJasper Van der Jeugt <jaspervdj@gmail.com>2011-05-13 19:07:15 +0200
commit52a06f13e726c1089000590c3ef4fb5e805fc78a (patch)
tree920091caa1139dfffdd3c4d2a5d6bdb76c6bf78f /src/Hakyll
parent28b8420a86e495f97f240951ac12d1a313a73055 (diff)
downloadhakyll-52a06f13e726c1089000590c3ef4fb5e805fc78a.tar.gz
Fix dependency edge case for singletons
Diffstat (limited to 'src/Hakyll')
-rw-r--r--src/Hakyll/Core/Run.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Hakyll/Core/Run.hs b/src/Hakyll/Core/Run.hs
index e2cab3c..9b49b74 100644
--- a/src/Hakyll/Core/Run.hs
+++ b/src/Hakyll/Core/Run.hs
@@ -46,8 +46,9 @@ run configuration rules = do
provider <- timed logger "Creating provider" $
fileResourceProvider configuration
- -- Fetch the old graph from the store
- oldGraph <- fromMaybe mempty <$>
+ -- Fetch the old graph from the store. If we don't find it, we consider this
+ -- to be the first run
+ (firstRun, oldGraph) <- fromMaybe (True, mempty) . fmap ((,) False) <$>
storeGet store "Hakyll.Core.Run.run" "dependencies"
let ruleSet = runRules rules provider
@@ -61,6 +62,7 @@ run configuration rules = do
, hakyllRoutes = rulesRoutes ruleSet
, hakyllResourceProvider = provider
, hakyllStore = store
+ , hakyllFirstRun = firstRun
}
-- Run the program and fetch the resulting state
@@ -83,6 +85,7 @@ data RuntimeEnvironment = RuntimeEnvironment
, hakyllRoutes :: Routes
, hakyllResourceProvider :: ResourceProvider
, hakyllStore :: Store
+ , hakyllFirstRun :: Bool
}
data RuntimeState = RuntimeState
@@ -105,6 +108,7 @@ addNewCompilers newCompilers = Runtime $ do
section logger "Adding new compilers"
provider <- hakyllResourceProvider <$> ask
store <- hakyllStore <$> ask
+ firstRun <- hakyllFirstRun <$> ask
-- Old state information
oldCompilers <- hakyllCompilers <$> get
@@ -124,9 +128,10 @@ addNewCompilers newCompilers = Runtime $ do
-- Check which items have been modified
modified <- fmap S.fromList $ flip filterM (map fst newCompilers) $
liftIO . resourceModified provider store . fromIdentifier
+ let checkModified = if firstRun then const True else (`S.member` modified)
-- Create a new analyzer and append it to the currect one
- let newAnalyzer = makeDependencyAnalyzer newGraph (`S.member` modified) $
+ let newAnalyzer = makeDependencyAnalyzer newGraph checkModified $
analyzerPreviousGraph oldAnalyzer
analyzer = mappend oldAnalyzer newAnalyzer