on master help sign in
Merge branch 'master' into patch-1
bfc371fHenrikh Kantuni
builder/src/Build.hs+29−23
@@ -50,6 +50,7 @@ import qualified Parse.Module as Parse
50import qualified Reporting
50import qualified Reporting
51import qualified Reporting.Annotation as A
51import qualified Reporting.Annotation as A
52import qualified Reporting.Error as Error
52import qualified Reporting.Error as Error
53+import qualified Reporting.Error.Docs as EDocs
53import qualified Reporting.Error.Syntax as Syntax
54import qualified Reporting.Error.Syntax as Syntax
54import qualified Reporting.Error.Import as Import
55import qualified Reporting.Error.Import as Import
55import qualified Reporting.Exit as Exit
56import qualified Reporting.Exit as Exit
@@ -706,25 +707,30 @@ compile (Env key root projectType _ buildID _ _) docsNeed (Details.Local path ti
706 in
707 in
707 case Compile.compile pkg ifaces modul of
708 case Compile.compile pkg ifaces modul of
708 Right (Compile.Artifacts canonical annotations objects) ->
709 Right (Compile.Artifacts canonical annotations objects) ->
710+ case makeDocs docsNeed canonical of
711+ Left err ->
712+ return $ RProblem $
713+ Error.Module (Src.getName modul) path time source (Error.BadDocs err)
714+
715+ Right docs ->
709− do let name = Src.getName modul
716+ do let name = Src.getName modul
710− let iface = I.fromModule pkg canonical annotations
717+ let iface = I.fromModule pkg canonical annotations
711− let docs = makeDocs docsNeed canonical
712− let elmi = Stuff.elmi root name
718+ let elmi = Stuff.elmi root name
713− File.writeBinary (Stuff.elmo root name) objects
719+ File.writeBinary (Stuff.elmo root name) objects
714− maybeOldi <- File.readBinary elmi
720+ maybeOldi <- File.readBinary elmi
715− case maybeOldi of
721+ case maybeOldi of
716− Just oldi | oldi == iface ->
722+ Just oldi | oldi == iface ->
717− do -- iface should be fully forced by equality check
723+ do -- iface should be fully forced by equality check
718− Reporting.report key Reporting.BDone
724+ Reporting.report key Reporting.BDone
719− let local = Details.Local path time deps main lastChange buildID
725+ let local = Details.Local path time deps main lastChange buildID
720− return (RSame local iface objects docs)
726+ return (RSame local iface objects docs)
721−
727+
722− _ ->
728+ _ ->
723− do -- iface may be lazy still
729+ do -- iface may be lazy still
724− File.writeBinary elmi iface
730+ File.writeBinary elmi iface
725− Reporting.report key Reporting.BDone
731+ Reporting.report key Reporting.BDone
726− let local = Details.Local path time deps main buildID buildID
732+ let local = Details.Local path time deps main buildID buildID
727− return (RNew local iface objects docs)
733+ return (RNew local iface objects docs)
728
734
729 Left err ->
735 Left err ->
730 return $ RProblem $
736 return $ RProblem $
@@ -825,14 +831,14 @@ toDocsNeed goal =
825 KeepDocs -> DocsNeed True
831 KeepDocs -> DocsNeed True
826
832
827
833
828−makeDocs :: DocsNeed -> Can.Module -> Maybe Docs.Module
834+makeDocs :: DocsNeed -> Can.Module -> Either EDocs.Error (Maybe Docs.Module)
829makeDocs (DocsNeed isNeeded) modul =
835makeDocs (DocsNeed isNeeded) modul =
830 if isNeeded then
836 if isNeeded then
831 case Docs.fromModule modul of
837 case Docs.fromModule modul of
832− Right docs -> Just docs
838+ Right docs -> Right (Just docs)
833− Left _ -> Nothing
839+ Left err -> Left err
834 else
840 else
835− Nothing
841+ Right Nothing
836
842
837
843
838finalizeDocs :: DocsGoal docs -> Map.Map ModuleName.Raw Result -> IO docs
844finalizeDocs :: DocsGoal docs -> Map.Map ModuleName.Raw Result -> IO docs