Merge remote-tracking branch 'origin/master' into 1.8
# Conflicts: # Source/Editor/Utilities/EditorUtilities.cpp # Source/Editor/Utilities/EditorUtilities.h
This commit is contained in:
@@ -9,32 +9,30 @@ namespace Flax.Build
|
||||
/// </summary>
|
||||
public static class FileCache
|
||||
{
|
||||
private static Dictionary<string, FileInfo> fileInfoCache = new Dictionary<string, FileInfo>();
|
||||
private static readonly Dictionary<string, FileInfo> _cache = new();
|
||||
|
||||
public static void FileRemoveFromCache(string path)
|
||||
{
|
||||
//fileInfoCache[path].Refresh();
|
||||
fileInfoCache.Remove(path);
|
||||
_cache.Remove(path);
|
||||
}
|
||||
|
||||
|
||||
public static bool Exists(string path)
|
||||
{
|
||||
if (fileInfoCache.TryGetValue(path, out var fileInfo))
|
||||
if (_cache.TryGetValue(path, out var fileInfo))
|
||||
return fileInfo.Exists;
|
||||
|
||||
fileInfo = new FileInfo(path);
|
||||
fileInfoCache.Add(path, fileInfo);
|
||||
_cache.Add(path, fileInfo);
|
||||
return fileInfo.Exists;
|
||||
}
|
||||
|
||||
public static DateTime GetLastWriteTime(string path)
|
||||
{
|
||||
|
||||
if (fileInfoCache.TryGetValue(path, out var fileInfo))
|
||||
if (_cache.TryGetValue(path, out var fileInfo))
|
||||
return fileInfo.LastWriteTime;
|
||||
|
||||
fileInfo = new FileInfo(path);
|
||||
fileInfoCache.Add(path, fileInfo);
|
||||
_cache.Add(path, fileInfo);
|
||||
return fileInfo.LastWriteTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -845,11 +845,11 @@ namespace Flax.Build
|
||||
foreach (var moduleName in moduleOptions.PrivateDependencies.Concat(moduleOptions.PublicDependencies))
|
||||
{
|
||||
var dependencyModule = buildData.Rules.GetModule(moduleName);
|
||||
if (dependencyModule != null &&
|
||||
!string.IsNullOrEmpty(dependencyModule.BinaryModuleName) &&
|
||||
dependencyModule.BinaryModuleName != binaryModule.Key &&
|
||||
if (dependencyModule != null &&
|
||||
!string.IsNullOrEmpty(dependencyModule.BinaryModuleName) &&
|
||||
dependencyModule.BinaryModuleName != binaryModule.Key &&
|
||||
!moduleNamesUsed.Contains(dependencyModule.BinaryModuleName) &&
|
||||
GetModuleProject(dependencyModule, project) != null &&
|
||||
GetModuleProject(dependencyModule, project) != null &&
|
||||
buildData.Modules.TryGetValue(dependencyModule, out var dependencyOptions))
|
||||
{
|
||||
// Import symbols from referenced binary module
|
||||
|
||||
@@ -77,14 +77,10 @@ namespace Flax.Build
|
||||
var architectureId = RuntimeInformation.ProcessArchitecture;
|
||||
switch (architectureId)
|
||||
{
|
||||
case Architecture.X86:
|
||||
return TargetArchitecture.x86;
|
||||
case Architecture.X64:
|
||||
return TargetArchitecture.x64;
|
||||
case Architecture.Arm:
|
||||
return TargetArchitecture.ARM;
|
||||
case Architecture.Arm64:
|
||||
return TargetArchitecture.ARM64;
|
||||
case Architecture.X86: return TargetArchitecture.x86;
|
||||
case Architecture.X64: return TargetArchitecture.x64;
|
||||
case Architecture.Arm: return TargetArchitecture.ARM;
|
||||
case Architecture.Arm64: return TargetArchitecture.ARM64;
|
||||
default: throw new NotImplementedException(string.Format("Unsupported build platform {0}.", architectureId));
|
||||
}
|
||||
}
|
||||
@@ -290,12 +286,9 @@ namespace Flax.Build
|
||||
var subdir = "Binaries/Editor/";
|
||||
switch (Platform.BuildTargetPlatform)
|
||||
{
|
||||
case TargetPlatform.Windows:
|
||||
return subdir + "Win64";
|
||||
case TargetPlatform.Linux:
|
||||
return subdir + "Linux";
|
||||
case TargetPlatform.Mac:
|
||||
return subdir + "Mac";
|
||||
case TargetPlatform.Windows: return subdir + "Win64";
|
||||
case TargetPlatform.Linux: return subdir + "Linux";
|
||||
case TargetPlatform.Mac: return subdir + "Mac";
|
||||
}
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -802,9 +802,12 @@ namespace Flax.Build.Plugins
|
||||
// Serialize base type
|
||||
if (type.BaseType != null && type.BaseType.FullName != "System.ValueType" && type.BaseType.FullName != "FlaxEngine.Object" && type.BaseType.CanBeResolved())
|
||||
{
|
||||
GenerateSerializeCallback(module, il, type.BaseType.Resolve(), serialize);
|
||||
GenerateSerializeCallback(module, il, type.BaseType, serialize);
|
||||
}
|
||||
|
||||
if (type.HasGenericParameters) // TODO: implement network replication for generic classes
|
||||
MonoCecil.CompilationError($"Not supported generic type '{type.FullName}' for network replication.");
|
||||
|
||||
var ildContext = new DotnetIlContext(il);
|
||||
|
||||
// Serialize all type fields marked with NetworkReplicated attribute
|
||||
@@ -874,12 +877,13 @@ namespace Flax.Build.Plugins
|
||||
return m;
|
||||
}
|
||||
|
||||
private static void GenerateSerializeCallback(ModuleDefinition module, ILProcessor il, TypeDefinition type, bool serialize)
|
||||
private static void GenerateSerializeCallback(ModuleDefinition module, ILProcessor il, TypeReference type, bool serialize)
|
||||
{
|
||||
if (type.IsScriptingObject())
|
||||
{
|
||||
// NetworkReplicator.InvokeSerializer(typeof(<type>), instance, stream, <serialize>)
|
||||
il.Emit(OpCodes.Ldtoken, module.ImportReference(type));
|
||||
module.ImportReference(type);
|
||||
il.Emit(OpCodes.Ldtoken, type);
|
||||
module.GetType("System.Type", out var typeType);
|
||||
var getTypeFromHandle = typeType.Resolve().GetMethod("GetTypeFromHandle");
|
||||
il.Emit(OpCodes.Call, module.ImportReference(getTypeFromHandle));
|
||||
|
||||
Reference in New Issue
Block a user