Fix handling errors when saving scripting API parsing cache

This commit is contained in:
Wojtek Figat
2021-02-19 12:25:53 +01:00
parent ce9df56a97
commit 2f12e67356
3 changed files with 13 additions and 1 deletions

View File

@@ -164,6 +164,8 @@ namespace Flax.Build.Bindings
private static void SaveCache(ModuleInfo moduleInfo, BuildOptions moduleOptions, List<string> headerFiles)
{
if (!Directory.Exists(moduleOptions.IntermediateFolder))
return;
var path = GetCachePath(moduleInfo.Module, moduleOptions);
using (var stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
using (var writer = new BinaryWriter(stream, Encoding.UTF8))

View File

@@ -153,7 +153,15 @@ namespace Flax.Build.Bindings
// Save cache
using (new ProfileEventScope("SaveCache"))
{
SaveCache(moduleInfo, moduleOptions, headerFiles);
try
{
SaveCache(moduleInfo, moduleOptions, headerFiles);
}
catch (Exception ex)
{
Log.Error($"Failed to save API cache for module {moduleInfo.Module.Name}");
Log.Exception(ex);
}
}
// Initialize API

View File

@@ -751,7 +751,9 @@ namespace Flax.Build
using (new ProfileEventScope("BuildBindings"))
{
if (!buildData.Target.IsPreBuilt)
{
BuildTargetBindings(rules, graph, buildData);
}
}
// Link modules into a target