Skip to content

Commit

Permalink
Improve cache system
Browse files Browse the repository at this point in the history
Fix #3464

- Invalidate the cache if the target language changed
- Always delete the fable_modules folder if the cache is invalide
  • Loading branch information
Maxime Mangel committed Aug 16, 2023
1 parent 1a2ffae commit f73a945
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Fable.Cli/ProjectCracker.fs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,7 @@ let getFullProjectOpts (opts: CrackerOptions) =

cacheInfo.Version = Literals.VERSION
&& cacheInfo.Exclude = opts.Exclude
&& cacheInfo.FableOptions.Language = opts.FableOptions.Language
&& (
[
cacheInfo.ProjectPath
Expand Down Expand Up @@ -789,6 +790,11 @@ let getFullProjectOpts (opts: CrackerOptions) =
| None ->
let projRefs, mainProj = retryGetCrackedProjects opts

// The cache was considered outdated / invalid so it is better to make
// make sure we have are in a clean state
if IO.Directory.Exists(opts.FableModulesDir) then
IO.Directory.Delete(opts.FableModulesDir, true)

let fableLibDir, pkgRefs =
match opts.FableOptions.Language with
| Python -> copyFableLibraryAndPackageSourcesPy opts mainProj.PackageReferences
Expand Down
2 changes: 2 additions & 0 deletions src/Fable.Cli/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* Remove fable-py support
* Fix #3461: Don't default to javascript if the language requested by the user is unknown (help detect typo)
* Improve --help message for the --lang section
* Fix #3464: Invalidate cache when the target language changes
* Always delete the `fable_modules` folder when the cache is invalidated

### 4.1.4

Expand Down

0 comments on commit f73a945

Please sign in to comment.