on master help sign in
Revert idea about having build artifacts use same time as .elm code
25bffb6Evan Czaplicki
builder/src/Deps/Verify.hs+3−3
@@ -334,7 +334,7 @@ crush pkg info results =
334
334
335
335
336crushHelp :: Set Module.Raw -> Module.Raw -> Compiler.Artifacts -> Maybe Module.Interface
336crushHelp :: Set Module.Raw -> Module.Raw -> Compiler.Artifacts -> Maybe Module.Interface
337−crushHelp exposed name (Compiler.Artifacts _ elmi _ _) =
337+crushHelp exposed name (Compiler.Artifacts elmi _ _) =
338 if Set.member name exposed then
338 if Set.member name exposed then
339 Just elmi
339 Just elmi
340
340
@@ -347,7 +347,7 @@ crushHelp exposed name (Compiler.Artifacts _ elmi _ _) =
347
347
348
348
349addDocs :: Compiler.Artifacts -> [Docs.Module] -> [Docs.Module]
349addDocs :: Compiler.Artifacts -> [Docs.Module] -> [Docs.Module]
350−addDocs (Compiler.Artifacts _ _ _ maybeDocs) docsList =
350+addDocs (Compiler.Artifacts _ _ maybeDocs) docsList =
351 case maybeDocs of
351 case maybeDocs of
352 Nothing ->
352 Nothing ->
353 docsList
353 docsList
@@ -361,7 +361,7 @@ addDocs (Compiler.Artifacts _ _ _ maybeDocs) docsList =
361
361
362
362
363addGraph :: Compiler.Artifacts -> Obj.Graph -> Obj.Graph
363addGraph :: Compiler.Artifacts -> Obj.Graph -> Obj.Graph
364−addGraph (Compiler.Artifacts _ _ elmo _) graph =
364+addGraph (Compiler.Artifacts _ elmo _) graph =
365 Obj.union elmo graph
365 Obj.union elmo graph
366
366
367
367
builder/src/Elm/Project.hs+1−1
@@ -78,7 +78,7 @@ compileForRepl noColors localizer source maybeName =
78 (dirty, ifaces) <- Plan.plan Nothing summary graph
78 (dirty, ifaces) <- Plan.plan Nothing summary graph
79 answers <- Compile.compile project Nothing ifaces dirty
79 answers <- Compile.compile project Nothing ifaces dirty
80 results <- Artifacts.write root answers
80 results <- Artifacts.write root answers
81− let (Compiler.Artifacts _ elmi _ _) = results ! N.replModule
81+ let (Compiler.Artifacts elmi _ _) = results ! N.replModule
82 traverse (Output.generateReplFile noColors localizer summary graph elmi) maybeName
82 traverse (Output.generateReplFile noColors localizer summary graph elmi) maybeName
83
83
84
84
builder/src/File/Artifacts.hs+3−6
@@ -15,7 +15,6 @@ import Data.Map (Map)
15import qualified Data.Map as Map
15import qualified Data.Map as Map
16import qualified Data.Maybe as Maybe
16import qualified Data.Maybe as Maybe
17import qualified Data.Text.Encoding as Text
17import qualified Data.Text.Encoding as Text
18−import qualified System.Directory as Dir
19
18
20import qualified Elm.Compiler as Compiler
19import qualified Elm.Compiler as Compiler
21import qualified Elm.Compiler.Module as Module
20import qualified Elm.Compiler.Module as Module
@@ -49,13 +48,11 @@ ignore answers =
49write :: FilePath -> Map Module.Raw Answer -> Task.Task (Map Module.Raw Compiler.Artifacts)
48write :: FilePath -> Map Module.Raw Answer -> Task.Task (Map Module.Raw Compiler.Artifacts)
50write root answers =
49write root answers =
51 let
50 let
52− writer name result@(Compiler.Artifacts time elmi elmo _) =
51+ writer name result@(Compiler.Artifacts elmi elmo _) =
53 do mvar <- newEmptyMVar
52 do mvar <- newEmptyMVar
54 void $ forkIO $
53 void $ forkIO $
55− do let ifacePath = Path.elmi root name
54+ do Binary.encodeFile (Path.elmi root name) elmi
56− Binary.encodeFile ifacePath elmi
57 Binary.encodeFile (Path.elmo root name) elmo
55 Binary.encodeFile (Path.elmo root name) elmo
58− Dir.setModificationTime ifacePath time
59 putMVar mvar result
56 putMVar mvar result
60 return mvar
57 return mvar
61 in
58 in
@@ -66,7 +63,7 @@ write root answers =
66writeDocs :: Map Module.Raw Compiler.Artifacts -> FilePath -> Task.Task Docs.Documentation
63writeDocs :: Map Module.Raw Compiler.Artifacts -> FilePath -> Task.Task Docs.Documentation
67writeDocs results path =
64writeDocs results path =
68 let
65 let
69− getDocs (Compiler.Artifacts _ _ _ docs) =
66+ getDocs (Compiler.Artifacts _ _ docs) =
70 docs
67 docs
71 in
68 in
72 case Maybe.mapMaybe getDocs (Map.elems results) of
69 case Maybe.mapMaybe getDocs (Map.elems results) of
builder/src/File/Compile.hs+3−3
@@ -84,15 +84,15 @@ compileModule tell project maybeDocsPath answersMVar ifacesMVar name info =
84 let docs = toDocsFlag name project maybeDocsPath
84 let docs = toDocsFlag name project maybeDocsPath
85 let imports = makeImports project info
85 let imports = makeImports project info
86 ifaces <- readMVar ifacesMVar
86 ifaces <- readMVar ifacesMVar
87− let time = Plan._time info
88 let source = Plan._src info
87 let source = Plan._src info
89− case Compiler.compile docs pkg imports ifaces time source of
88+ case Compiler.compile docs pkg imports ifaces source of
90 (_warnings, Left errors) ->
89 (_warnings, Left errors) ->
91 do tell (Progress.CompileFileEnd name Progress.Bad)
90 do tell (Progress.CompileFileEnd name Progress.Bad)
91+ let time = Plan._time info
92 let path = Plan._path info
92 let path = Plan._path info
93 putMVar mvar (Bad path time source errors)
93 putMVar mvar (Bad path time source errors)
94
94
95− (_warnings, Right result@(Compiler.Artifacts _ elmi _ _)) ->
95+ (_warnings, Right result@(Compiler.Artifacts elmi _ _)) ->
96 do tell (Progress.CompileFileEnd name Progress.Good)
96 do tell (Progress.CompileFileEnd name Progress.Good)
97 let canonicalName = Module.Canonical pkg name
97 let canonicalName = Module.Canonical pkg name
98 lock <- takeMVar ifacesMVar
98 lock <- takeMVar ifacesMVar
builder/src/File/Plan.hs+1−1
@@ -158,7 +158,7 @@ isFresh srcTime cachedFile =
158 andM
158 andM
159 [ Dir.doesFileExist cachedFile
159 [ Dir.doesFileExist cachedFile
160 , do cacheTime <- Dir.getModificationTime cachedFile
160 , do cacheTime <- Dir.getModificationTime cachedFile
161− return (cacheTime == srcTime)
161+ return (cacheTime >= srcTime)
162 ]
162 ]
163
163
164
164
builder/src/Generate/Output.hs+1−1
@@ -88,7 +88,7 @@ getInterfaces :: Summary.Summary -> Map.Map Module.Raw Compiler.Artifacts -> I.I
88getInterfaces (Summary.Summary _ project _ interfaces _) artifacts =
88getInterfaces (Summary.Summary _ project _ interfaces _) artifacts =
89 let
89 let
90 pkg = Project.getName project
90 pkg = Project.getName project
91− addArtifact home (Compiler.Artifacts _ elmi _ _) ifaces =
91+ addArtifact home (Compiler.Artifacts elmi _ _) ifaces =
92 Map.insert (ModuleName.Canonical pkg home) elmi ifaces
92 Map.insert (ModuleName.Canonical pkg home) elmi ifaces
93 in
93 in
94 Map.foldrWithKey addArtifact interfaces artifacts
94 Map.foldrWithKey addArtifact interfaces artifacts
compiler/src/Compile.hs+4−7
@@ -9,7 +9,6 @@ module Compile
9
9
10import qualified Data.ByteString as BS
10import qualified Data.ByteString as BS
11import qualified Data.Map as Map
11import qualified Data.Map as Map
12−import qualified Data.Time.Clock as Time
13
12
14import qualified AST.Canonical as Can
13import qualified AST.Canonical as Can
15import qualified AST.Optimized as Opt
14import qualified AST.Optimized as Opt
@@ -46,15 +45,14 @@ type ImportDict =
46
45
47data Artifacts =
46data Artifacts =
48 Artifacts
47 Artifacts
49− { _time :: Time.UTCTime
50− , _elmi :: I.Interface
48+ { _elmi :: I.Interface
51 , _elmo :: Opt.Graph
49 , _elmo :: Opt.Graph
52 , _docs :: Maybe Docs.Module
50 , _docs :: Maybe Docs.Module
53 }
51 }
54
52
55
53
56−compile :: DocsFlag -> Pkg.Name -> ImportDict -> I.Interfaces -> Time.UTCTime -> BS.ByteString -> Result i Artifacts
54+compile :: DocsFlag -> Pkg.Name -> ImportDict -> I.Interfaces -> BS.ByteString -> Result i Artifacts
57−compile flag pkg importDict interfaces time source =
55+compile flag pkg importDict interfaces source =
58 do
56 do
59 valid <- Result.mapError Error.Syntax $
57 valid <- Result.mapError Error.Syntax $
60 Parse.program pkg source
58 Parse.program pkg source
@@ -78,8 +76,7 @@ compile flag pkg importDict interfaces time source =
78
76
79 Result.ok $
77 Result.ok $
80 Artifacts
78 Artifacts
81− { _time = time
82− , _elmi = I.fromModule annotations canonical
79+ { _elmi = I.fromModule annotations canonical
83 , _elmo = graph
80 , _elmo = graph
84 , _docs = documentation
81 , _docs = documentation
85 }
82 }
compiler/src/Elm/Compiler.hs+2−4
@@ -15,7 +15,6 @@ module Elm.Compiler
15import qualified Data.ByteString as BS
15import qualified Data.ByteString as BS
16import qualified Data.Map as Map
16import qualified Data.Map as Map
17import qualified Data.Text as Text
17import qualified Data.Text as Text
18−import qualified Data.Time.Clock as Time
19
18
20import qualified Compile
19import qualified Compile
21import qualified Elm.Compiler.Module as M
20import qualified Elm.Compiler.Module as M
@@ -49,11 +48,10 @@ compile
49 -> Pkg.Name
48 -> Pkg.Name
50 -> Map.Map M.Raw M.Canonical
49 -> Map.Map M.Raw M.Canonical
51 -> M.Interfaces
50 -> M.Interfaces
52− -> Time.UTCTime
53 -> BS.ByteString
51 -> BS.ByteString
54 -> ( [Warning.Warning], Either [Error.Error] Compile.Artifacts )
52 -> ( [Warning.Warning], Either [Error.Error] Compile.Artifacts )
55−compile docsFlag pkg importDict interfaces time source =
53+compile docsFlag pkg importDict interfaces source =
56− Result.run $ Compile.compile docsFlag pkg importDict interfaces time source
54+ Result.run $ Compile.compile docsFlag pkg importDict interfaces source
57
55
58
56
59
57