on master help sign in
Revert idea about having build artifacts use same time as .elm code

After learning more information, there is no clear benefit to this idea, and it comes with significant risks on less common platforms. Better to stick with what currently exists I think.

commit25bffb606e4b707911dba07770db3008c523859a authorEvan Czaplicki <evancz@users.noreply.github.com> dateWed 23 May 2018, 13:41 (8 years ago) parent6356535
8 files changed+18−26
builder/src/Deps/Verify.hs+3−3 builder/src/Elm/Project.hs+1−1 builder/src/File/Artifacts.hs+3−6 builder/src/File/Compile.hs+3−3 builder/src/File/Plan.hs+1−1 builder/src/Generate/Output.hs+1−1 compiler/src/Compile.hs+4−7 compiler/src/Elm/Compiler.hs+2−4
builder/src/Deps/Verify.hs+3−3
@@ -334,7 +334,7 @@ crush pkg info results =
334334
335335
336336crushHelp :: Set Module.Raw -> Module.Raw -> Compiler.Artifacts -> Maybe Module.Interface
337−crushHelp exposed name (Compiler.Artifacts _ elmi _ _) =
337+crushHelp exposed name (Compiler.Artifacts elmi _ _) =
338338 if Set.member name exposed then
339339 Just elmi
340340
@@ -347,7 +347,7 @@ crushHelp exposed name (Compiler.Artifacts _ elmi _ _) =
347347
348348
349349addDocs :: Compiler.Artifacts -> [Docs.Module] -> [Docs.Module]
350−addDocs (Compiler.Artifacts _ _ _ maybeDocs) docsList =
350+addDocs (Compiler.Artifacts _ _ maybeDocs) docsList =
351351 case maybeDocs of
352352 Nothing ->
353353 docsList
@@ -361,7 +361,7 @@ addDocs (Compiler.Artifacts _ _ _ maybeDocs) docsList =
361361
362362
363363addGraph :: Compiler.Artifacts -> Obj.Graph -> Obj.Graph
364−addGraph (Compiler.Artifacts _ _ elmo _) graph =
364+addGraph (Compiler.Artifacts _ elmo _) graph =
365365 Obj.union elmo graph
366366
367367
builder/src/Elm/Project.hs+1−1
@@ -78,7 +78,7 @@ compileForRepl noColors localizer source maybeName =
7878 (dirty, ifaces) <- Plan.plan Nothing summary graph
7979 answers <- Compile.compile project Nothing ifaces dirty
8080 results <- Artifacts.write root answers
81− let (Compiler.Artifacts _ elmi _ _) = results ! N.replModule
81+ let (Compiler.Artifacts elmi _ _) = results ! N.replModule
8282 traverse (Output.generateReplFile noColors localizer summary graph elmi) maybeName
8383
8484
builder/src/File/Artifacts.hs+3−6
@@ -15,7 +15,6 @@ import Data.Map (Map)
1515import qualified Data.Map as Map
1616import qualified Data.Maybe as Maybe
1717import qualified Data.Text.Encoding as Text
18−import qualified System.Directory as Dir
1918
2019import qualified Elm.Compiler as Compiler
2120import qualified Elm.Compiler.Module as Module
@@ -49,13 +48,11 @@ ignore answers =
4948write :: FilePath -> Map Module.Raw Answer -> Task.Task (Map Module.Raw Compiler.Artifacts)
5049write root answers =
5150 let
52− writer name result@(Compiler.Artifacts time elmi elmo _) =
51+ writer name result@(Compiler.Artifacts elmi elmo _) =
5352 do mvar <- newEmptyMVar
5453 void $ forkIO $
55− do let ifacePath = Path.elmi root name
56− Binary.encodeFile ifacePath elmi
54+ do Binary.encodeFile (Path.elmi root name) elmi
5755 Binary.encodeFile (Path.elmo root name) elmo
58− Dir.setModificationTime ifacePath time
5956 putMVar mvar result
6057 return mvar
6158 in
@@ -66,7 +63,7 @@ write root answers =
6663writeDocs :: Map Module.Raw Compiler.Artifacts -> FilePath -> Task.Task Docs.Documentation
6764writeDocs results path =
6865 let
69− getDocs (Compiler.Artifacts _ _ _ docs) =
66+ getDocs (Compiler.Artifacts _ _ docs) =
7067 docs
7168 in
7269 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 =
8484 let docs = toDocsFlag name project maybeDocsPath
8585 let imports = makeImports project info
8686 ifaces <- readMVar ifacesMVar
87− let time = Plan._time info
8887 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
9089 (_warnings, Left errors) ->
9190 do tell (Progress.CompileFileEnd name Progress.Bad)
91+ let time = Plan._time info
9292 let path = Plan._path info
9393 putMVar mvar (Bad path time source errors)
9494
95− (_warnings, Right result@(Compiler.Artifacts _ elmi _ _)) ->
95+ (_warnings, Right result@(Compiler.Artifacts elmi _ _)) ->
9696 do tell (Progress.CompileFileEnd name Progress.Good)
9797 let canonicalName = Module.Canonical pkg name
9898 lock <- takeMVar ifacesMVar
builder/src/File/Plan.hs+1−1
@@ -158,7 +158,7 @@ isFresh srcTime cachedFile =
158158 andM
159159 [ Dir.doesFileExist cachedFile
160160 , do cacheTime <- Dir.getModificationTime cachedFile
161− return (cacheTime == srcTime)
161+ return (cacheTime >= srcTime)
162162 ]
163163
164164
builder/src/Generate/Output.hs+1−1
@@ -88,7 +88,7 @@ getInterfaces :: Summary.Summary -> Map.Map Module.Raw Compiler.Artifacts -> I.I
8888getInterfaces (Summary.Summary _ project _ interfaces _) artifacts =
8989 let
9090 pkg = Project.getName project
91− addArtifact home (Compiler.Artifacts _ elmi _ _) ifaces =
91+ addArtifact home (Compiler.Artifacts elmi _ _) ifaces =
9292 Map.insert (ModuleName.Canonical pkg home) elmi ifaces
9393 in
9494 Map.foldrWithKey addArtifact interfaces artifacts
compiler/src/Compile.hs+4−7
@@ -9,7 +9,6 @@ module Compile
99
1010import qualified Data.ByteString as BS
1111import qualified Data.Map as Map
12−import qualified Data.Time.Clock as Time
1312
1413import qualified AST.Canonical as Can
1514import qualified AST.Optimized as Opt
@@ -46,15 +45,14 @@ type ImportDict =
4645
4746data Artifacts =
4847 Artifacts
49− { _time :: Time.UTCTime
50− , _elmi :: I.Interface
48+ { _elmi :: I.Interface
5149 , _elmo :: Opt.Graph
5250 , _docs :: Maybe Docs.Module
5351 }
5452
5553
56−compile :: DocsFlag -> Pkg.Name -> ImportDict -> I.Interfaces -> Time.UTCTime -> BS.ByteString -> Result i Artifacts
57−compile flag pkg importDict interfaces time source =
54+compile :: DocsFlag -> Pkg.Name -> ImportDict -> I.Interfaces -> BS.ByteString -> Result i Artifacts
55+compile flag pkg importDict interfaces source =
5856 do
5957 valid <- Result.mapError Error.Syntax $
6058 Parse.program pkg source
@@ -78,8 +76,7 @@ compile flag pkg importDict interfaces time source =
7876
7977 Result.ok $
8078 Artifacts
81− { _time = time
82− , _elmi = I.fromModule annotations canonical
79+ { _elmi = I.fromModule annotations canonical
8380 , _elmo = graph
8481 , _docs = documentation
8582 }
compiler/src/Elm/Compiler.hs+2−4
@@ -15,7 +15,6 @@ module Elm.Compiler
1515import qualified Data.ByteString as BS
1616import qualified Data.Map as Map
1717import qualified Data.Text as Text
18−import qualified Data.Time.Clock as Time
1918
2019import qualified Compile
2120import qualified Elm.Compiler.Module as M
@@ -49,11 +48,10 @@ compile
4948 -> Pkg.Name
5049 -> Map.Map M.Raw M.Canonical
5150 -> M.Interfaces
52− -> Time.UTCTime
5351 -> BS.ByteString
5452 -> ( [Warning.Warning], Either [Error.Error] Compile.Artifacts )
55−compile docsFlag pkg importDict interfaces time source =
56− Result.run $ Compile.compile docsFlag pkg importDict interfaces time source
53+compile docsFlag pkg importDict interfaces source =
54+ Result.run $ Compile.compile docsFlag pkg importDict interfaces source
5755
5856
5957