mirror of
https://github.com/enso-org/enso.git
synced 2024-11-22 22:10:15 +03:00
Do not invalidate caches when building engine distribution (#7106)
There is an issue that after a clean build, the compiler is unable to resolve some types, i.e ```py $ ./built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/enso --run ~/enso/projects/Unnamed/ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:24:11: error: The name `Connection_Details` could not be found. 24 | connect : Connection_Details -> Connection_Options -> Connection ! SQL_Error | ^~~~~~~~~~~~~~~~~~ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:24:33: error: The name `Connection_Options` could not be found. 24 | connect : Connection_Details -> Connection_Options -> Connection ! SQL_Error | ^~~~~~~~~~~~~~~~~~ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:24:55: error: The name `Connection` could not be found. 24 | connect : Connection_Details -> Connection_Options -> Connection ! SQL_Error | ^~~~~~~~~~ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:24:68: error: The name `SQL_Error` could not be found. 24 | connect : Connection_Details -> Connection_Options -> Connection ! SQL_Error | ^~~~~~~~~ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:25:25: error: The name `Connection_Options` could not be found. 25 | connect details options=Connection_Options.Value = | ^~~~~~~~~~~~~~~~~~ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:29:29: error: The name `Widget` could not be found. 29 | connection_details_widget : Widget | ^~~~~~ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:31:28: error: The name `Vector` could not be found. 31 | default_constructors = Vector.from_polyglot_array <| | ^~~~~~ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:32:63: error: The name `False` could not be found. 32 | DatabaseConnectionDetailsSPI.get_default_constructors False | ^~~~~ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:36:9: error: The name `Option` could not be found. 36 | Option name code | ^~~~~~ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:37:5: error: The name `Single_Choice` could not be found. 37 | Single_Choice display=Display.Always values=choices | ^~~~~~~~~~~~~ /home/dbushev/projects/luna/enso/built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/lib/Standard/Database/0.0.0-dev/src/Connection/Database.enso:37:27: error: The name `Display` could not be found. 37 | Single_Choice display=Display.Always values=choices | ^~~~~~~ Aborting due to 11 errors and 0 warnings. Execution finished with an error: Compilation aborted due to errors. ``` The compiler can't resolve those symbols because the `IR` cache for `Standard.Database.Connection.Database` is missing. What happens during the `buildEngineDistribution` is: - Compiler processes libraries one by one - Compiler processes (and compiles and generates caches) `Standard.Database` library - Compiler starts processing `Standard.Visualization` library - During the compilation of `Standard.Database.Connection.Database` module, it sees that the module was loaded from the cache. But some of the required dependencies from `Standard.Table` library were not loaded from the cache. But at this point, the `Standard.Table` library has not been processed yet and the caches for it don't exist. The compiler decides that the `Database` file was changed, and the cache is invalid and should be cleaned.
This commit is contained in:
parent
c769215214
commit
3937d21001
@ -268,22 +268,31 @@ class Compiler(
|
||||
modules.foreach(m => parseModule(m))
|
||||
|
||||
var requiredModules = modules.flatMap { module =>
|
||||
val modules = runImportsAndExportsResolution(module, generateCode)
|
||||
val importedModules = runImportsAndExportsResolution(module, generateCode)
|
||||
val isLoadedFromSource =
|
||||
(m: Module) => !m.wasLoadedFromCache() && !m.isSynthetic
|
||||
if (
|
||||
module
|
||||
.wasLoadedFromCache() && modules
|
||||
.exists(m => !m.wasLoadedFromCache() && !m.isSynthetic)
|
||||
shouldCompileDependencies &&
|
||||
module.wasLoadedFromCache() &&
|
||||
importedModules.exists(isLoadedFromSource)
|
||||
) {
|
||||
val importedModulesLoadedFromSource = importedModules
|
||||
.filter(isLoadedFromSource)
|
||||
.map(_.getName)
|
||||
logger.log(
|
||||
Compiler.defaultLogLevel,
|
||||
"Some imported modules' caches were invalided, forcing invalidation of {0}",
|
||||
module.getName.toString
|
||||
"{0} imported module caches were invalided, forcing invalidation of {1}. [{2}]",
|
||||
Array(
|
||||
importedModulesLoadedFromSource.length,
|
||||
module.getName.toString,
|
||||
importedModulesLoadedFromSource.take(10).mkString("", ",", "...")
|
||||
)
|
||||
)
|
||||
module.getCache.invalidate(context)
|
||||
parseModule(module)
|
||||
runImportsAndExportsResolution(module, generateCode)
|
||||
} else {
|
||||
modules
|
||||
importedModules
|
||||
}
|
||||
}.distinct
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user