Documentation: Move HsColour invocation to after `need`
authorBen Gamari <ben@smart-cactus.org>
Sun, 20 Dec 2015 15:43:12 +0000 (16:43 +0100)
committerBen Gamari <ben@smart-cactus.org>
Sun, 20 Dec 2015 19:27:39 +0000 (20:27 +0100)
HsColour also depends upon the sources existing. Fixes #6.

src/Rules/Documentation.hs

index 2ebaa59..495a16c 100644 (file)
@@ -15,14 +15,18 @@ buildPackageDocumentation _ target @ (PartialTarget stage package) =
         haddockFile = pkgHaddockFile package
     in when (stage == Stage1) $ do
         haddockFile %> \file -> do
-            whenM (specified HsColour) $ do
-                need [cabalFile]
-                build $ fullTarget target GhcCabalHsColour [cabalFile] []
             srcs <- interpretPartial target getPackageSources
             deps <- interpretPartial target $ getPkgDataList DepNames
             let haddocks = [ pkgHaddockFile depPkg
                            | Just depPkg <- map findKnownPackage deps ]
             need $ srcs ++ haddocks
+
+            -- HsColour sources
+            whenM (specified HsColour) $ do
+                need [cabalFile]
+                build $ fullTarget target GhcCabalHsColour [cabalFile] []
+
+            -- Build Haddock documentation
             let haddockWay = if dynamicGhcPrograms then dynamic else vanilla
             build $ fullTargetWithWay target Haddock haddockWay srcs [file]