Fix handling errors when saving scripting API parsing cache
This commit is contained in:
@@ -164,6 +164,8 @@ namespace Flax.Build.Bindings
|
|||||||
|
|
||||||
private static void SaveCache(ModuleInfo moduleInfo, BuildOptions moduleOptions, List<string> headerFiles)
|
private static void SaveCache(ModuleInfo moduleInfo, BuildOptions moduleOptions, List<string> headerFiles)
|
||||||
{
|
{
|
||||||
|
if (!Directory.Exists(moduleOptions.IntermediateFolder))
|
||||||
|
return;
|
||||||
var path = GetCachePath(moduleInfo.Module, moduleOptions);
|
var path = GetCachePath(moduleInfo.Module, moduleOptions);
|
||||||
using (var stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
|
using (var stream = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read))
|
||||||
using (var writer = new BinaryWriter(stream, Encoding.UTF8))
|
using (var writer = new BinaryWriter(stream, Encoding.UTF8))
|
||||||
|
|||||||
@@ -152,9 +152,17 @@ namespace Flax.Build.Bindings
|
|||||||
|
|
||||||
// Save cache
|
// Save cache
|
||||||
using (new ProfileEventScope("SaveCache"))
|
using (new ProfileEventScope("SaveCache"))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
SaveCache(moduleInfo, moduleOptions, headerFiles);
|
SaveCache(moduleInfo, moduleOptions, headerFiles);
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Log.Error($"Failed to save API cache for module {moduleInfo.Module.Name}");
|
||||||
|
Log.Exception(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize API
|
// Initialize API
|
||||||
using (new ProfileEventScope("Init"))
|
using (new ProfileEventScope("Init"))
|
||||||
|
|||||||
@@ -751,8 +751,10 @@ namespace Flax.Build
|
|||||||
using (new ProfileEventScope("BuildBindings"))
|
using (new ProfileEventScope("BuildBindings"))
|
||||||
{
|
{
|
||||||
if (!buildData.Target.IsPreBuilt)
|
if (!buildData.Target.IsPreBuilt)
|
||||||
|
{
|
||||||
BuildTargetBindings(rules, graph, buildData);
|
BuildTargetBindings(rules, graph, buildData);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Link modules into a target
|
// Link modules into a target
|
||||||
var outputTargetFilePath = target.GetOutputFilePath(targetBuildOptions);
|
var outputTargetFilePath = target.GetOutputFilePath(targetBuildOptions);
|
||||||
|
|||||||
Reference in New Issue
Block a user