1{-# OPTIONS_GHC -Wall #-}
8import Control.Monad (liftM2, liftM4)
12import qualified Elm.Compiler.Module as Module
13import Elm.Package (Name, Version)
15import qualified Deps.Verify as Verify
16import qualified Elm.Project.Json as Project
17import qualified Elm.Project.Constraint as Con
18import qualified Elm.Project.Summary as Summary
19import qualified File.IO as IO
20import qualified Reporting.Task as Task
21import qualified Stuff.Paths as Path
28verify :: FilePath -> Project.Project -> Task.Task Summary.Summary
30 do exists <- IO.exists Path.summary
33 do (MiniSummary deps exposed ifaces graph) <- IO.readBinary Path.summary
34 if isValidMiniSummary deps project
36 return (Summary.Summary root project exposed ifaces graph)
38 do IO.remove Path.summary
39 cacheSummary root project
41 cacheSummary root project
44cacheSummary :: FilePath -> Project.Project -> Task.Task Summary.Summary
45cacheSummary root project =
46 do summary@(Summary.Summary _ _ exposed ifaces graph) <- Verify.verify root project
47 IO.writeBinary Path.summary (MiniSummary (getDeps project) exposed ifaces graph)
57 { _deps :: ProjectDeps
58 , _exposed :: Summary.ExposedModules
59 , _ifaces :: Module.Interfaces
60 , _depsGraph :: Summary.DepsGraph
65 = App (Map Name Version) (Map Name Version) (Map Name Version) (Map Name Version)
66 | Pkg (Map Name Con.Constraint) (Map Name Con.Constraint)
69getDeps :: Project.Project -> ProjectDeps
72 Project.App (Project.AppInfo _ _ depsDirect depsTrans testDirect testTrans) ->
73 App depsDirect depsTrans testDirect testTrans
75 Project.Pkg (Project.PkgInfo _ _ _ _ _ direct test _) ->
79isValidMiniSummary :: ProjectDeps -> Project.Project -> Bool
80isValidMiniSummary deps project =
87 Project.App (Project.AppInfo _ _ a2 b2 c2 d2) ->
88 a == a2 && b == b2 && c == c2 && d == d2
92 Project.Pkg (Project.PkgInfo _ _ _ _ _ a2 b2 _) ->
103instance Binary MiniSummary where
104 get = liftM4 MiniSummary get get get get
105 put (MiniSummary a b c d) = put a >> put b >> put c >> put d
109instance Binary ProjectDeps where
112 App a b c d -> putWord8 0 >> put a >> put b >> put c >> put d
113 Pkg a b -> putWord8 1 >> put a >> put b
118 0 -> liftM4 App get get get get
119 1 -> liftM2 Pkg get get
120 _ -> error "binary encoding of ProjectDeps was corrupted"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list