| ... |
... |
@@ -53,7 +53,7 @@ import GHC.Utils.Exception |
|
53
|
53
|
import GHC.Utils.Logger
|
|
54
|
54
|
import GHC.Utils.Constants (debugIsOn)
|
|
55
|
55
|
import qualified GHC.Data.ShortText as ST
|
|
56
|
|
-import GHC.Data.OsPath (unsafeDecodeUtf)
|
|
|
56
|
+import GHC.Data.OsPath (OsPath, unsafeDecodeUtf)
|
|
57
|
57
|
|
|
58
|
58
|
import GHC.Types.Annotations
|
|
59
|
59
|
import GHC.Types.Avail
|
| ... |
... |
@@ -195,9 +195,9 @@ data RecompReason |
|
195
|
195
|
| ModuleAdded (ImportLevel, UnitId, ModuleName)
|
|
196
|
196
|
| ModuleChangedRaw ModuleName
|
|
197
|
197
|
| ModuleChangedIface ModuleName
|
|
198
|
|
- | FileChanged FilePath
|
|
199
|
|
- | DirChanged FilePath
|
|
200
|
|
- | CustomReason String
|
|
|
198
|
+ | FileChanged !OsPath
|
|
|
199
|
+ | DirChanged !OsPath
|
|
|
200
|
+ | CustomReason !ST.ShortText
|
|
201
|
201
|
| FlagsChanged
|
|
202
|
202
|
| LinkFlagsChanged
|
|
203
|
203
|
| OptimFlagsChanged
|
| ... |
... |
@@ -232,9 +232,9 @@ instance Outputable RecompReason where |
|
232
|
232
|
ModuleChangedIface m -> ppr m <+> text "changed (interface)"
|
|
233
|
233
|
ModuleRemoved (_st, _uid, m) -> ppr m <+> text "removed"
|
|
234
|
234
|
ModuleAdded (_st, _uid, m) -> ppr m <+> text "added"
|
|
235
|
|
- FileChanged fp -> text fp <+> text "changed"
|
|
236
|
|
- DirChanged dp -> text "Contents of" <+> text dp <+> text "changed"
|
|
237
|
|
- CustomReason s -> text s
|
|
|
235
|
+ FileChanged fp -> text (unsafeDecodeUtf fp) <+> text "changed"
|
|
|
236
|
+ DirChanged dp -> text "Contents of" <+> text (unsafeDecodeUtf dp) <+> text "changed"
|
|
|
237
|
+ CustomReason s -> text (ST.unpack s)
|
|
238
|
238
|
FlagsChanged -> text "Flags changed"
|
|
239
|
239
|
LinkFlagsChanged -> text "Flags changed"
|
|
240
|
240
|
OptimFlagsChanged -> text "Optimisation flags changed"
|
| ... |
... |
@@ -812,10 +812,11 @@ checkModUsage fc UsageFile{ usg_file_path = file, |
|
812
|
812
|
if (old_hash /= new_hash)
|
|
813
|
813
|
then return recomp
|
|
814
|
814
|
else return UpToDate
|
|
815
|
|
- where
|
|
816
|
|
- reason = FileChanged $ unpackFS file
|
|
817
|
|
- recomp = needsRecompileBecause $ fromMaybe reason $ fmap (CustomReason . ST.unpack) mlabel
|
|
818
|
|
- handler = if debugIsOn
|
|
|
815
|
+ where
|
|
|
816
|
+ pathOs = fastStringToOsPath file
|
|
|
817
|
+ reason = FileChanged pathOs
|
|
|
818
|
+ recomp = needsRecompileBecause $ fromMaybe reason (CustomReason <$> mlabel)
|
|
|
819
|
+ handler = if debugIsOn
|
|
819
|
820
|
then \e -> pprTrace "UsageFile" (text (show e)) $ return recomp
|
|
820
|
821
|
else \_ -> return recomp -- if we can't find the file, just recompile, don't fail
|
|
821
|
822
|
|
| ... |
... |
@@ -828,10 +829,11 @@ checkModUsage fc UsageDirectory{ usg_dir_path = dir, |
|
828
|
829
|
if (old_hash /= new_hash)
|
|
829
|
830
|
then return recomp
|
|
830
|
831
|
else return UpToDate
|
|
831
|
|
- where
|
|
832
|
|
- reason = DirChanged $ unpackFS dir
|
|
833
|
|
- recomp = needsRecompileBecause $ fromMaybe reason $ fmap (CustomReason . ST.unpack) mlabel
|
|
834
|
|
- handler = if debugIsOn
|
|
|
832
|
+ where
|
|
|
833
|
+ dirOs = fastStringToOsPath dir
|
|
|
834
|
+ reason = DirChanged dirOs
|
|
|
835
|
+ recomp = needsRecompileBecause $ fromMaybe reason (CustomReason <$> mlabel)
|
|
|
836
|
+ handler = if debugIsOn
|
|
835
|
837
|
then \e -> pprTrace "UsageDirectory" (text (show e)) $ return recomp
|
|
836
|
838
|
else \_ -> return recomp -- if we can't find the dir, just recompile, don't fail
|
|
837
|
839
|
|