From f73a945489756894aeacd160e3adcc0c24fa6016 Mon Sep 17 00:00:00 2001 From: Maxime Mangel Date: Wed, 16 Aug 2023 16:05:51 +0200 Subject: [PATCH] Improve cache system Fix #3464 - Invalidate the cache if the target language changed - Always delete the fable_modules folder if the cache is invalide --- src/Fable.Cli/ProjectCracker.fs | 6 ++++++ src/Fable.Cli/RELEASE_NOTES.md | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/Fable.Cli/ProjectCracker.fs b/src/Fable.Cli/ProjectCracker.fs index fa6c6cfb74..1907f226e4 100644 --- a/src/Fable.Cli/ProjectCracker.fs +++ b/src/Fable.Cli/ProjectCracker.fs @@ -722,6 +722,7 @@ let getFullProjectOpts (opts: CrackerOptions) = cacheInfo.Version = Literals.VERSION && cacheInfo.Exclude = opts.Exclude + && cacheInfo.FableOptions.Language = opts.FableOptions.Language && ( [ cacheInfo.ProjectPath @@ -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 diff --git a/src/Fable.Cli/RELEASE_NOTES.md b/src/Fable.Cli/RELEASE_NOTES.md index bc53a9b7ad..1abb7814b2 100644 --- a/src/Fable.Cli/RELEASE_NOTES.md +++ b/src/Fable.Cli/RELEASE_NOTES.md @@ -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