-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
212 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
open SharedTypes | ||
|
||
type cached = { | ||
projectFiles: FileSet.t; | ||
dependenciesFiles: FileSet.t; | ||
pathsForModule: (file, paths) Hashtbl.t; | ||
} | ||
|
||
let writeCache filename (data : cached) = | ||
let oc = open_out_bin filename in | ||
Marshal.to_channel oc data []; | ||
close_out oc | ||
|
||
let readCache filename = | ||
if !Cfg.useProjectConfigCache && Sys.file_exists filename then | ||
try | ||
let ic = open_in_bin filename in | ||
let data : cached = Marshal.from_channel ic in | ||
close_in ic; | ||
Some data | ||
with _ -> None | ||
else None | ||
|
||
let targetFileFromLibBs libBs = Filename.concat libBs ".project-files-cache" | ||
|
||
let cacheProject (package : package) = | ||
let cached = | ||
{ | ||
projectFiles = package.projectFiles; | ||
dependenciesFiles = package.dependenciesFiles; | ||
pathsForModule = package.pathsForModule; | ||
} | ||
in | ||
match BuildSystem.getLibBs package.rootPath with | ||
| None -> () | ||
| Some libBs -> | ||
let targetFile = targetFileFromLibBs libBs in | ||
writeCache targetFile cached; | ||
print_endline "OK" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters