Merge branch 'buildrules_cache_fix' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-buildrules_cache_fix

This commit is contained in:
Wojtek Figat
2025-04-13 20:28:26 +02:00
2 changed files with 8 additions and 3 deletions

View File

@@ -106,7 +106,10 @@ namespace Flax.Build
if (File.Exists(cacheAssemblyPath) && File.Exists(cacheInfoPath)) if (File.Exists(cacheAssemblyPath) && File.Exists(cacheInfoPath))
{ {
var lines = File.ReadAllLines(cacheInfoPath); var lines = File.ReadAllLines(cacheInfoPath);
if (lines.Length == 2 && long.TryParse(lines[0], out var cacheTimeTicks) && string.Equals(buildInfo, lines[1], StringComparison.Ordinal)) if (lines.Length == 3 &&
long.TryParse(lines[0], out var cacheTimeTicks) &&
string.Equals(buildInfo, lines[1], StringComparison.Ordinal) &&
!lines[2].Split(';').Except(SourceFiles).Any())
{ {
// Cached time and // Cached time and
var cacheTime = DateTime.FromBinary(cacheTimeTicks); var cacheTime = DateTime.FromBinary(cacheTimeTicks);
@@ -199,7 +202,8 @@ namespace Flax.Build
File.WriteAllLines(cacheInfoPath, new[] File.WriteAllLines(cacheInfoPath, new[]
{ {
recentWriteTime.ToBinary().ToString(), recentWriteTime.ToBinary().ToString(),
buildInfo buildInfo,
string.Join(';', SourceFiles)
}); });
} }

View File

@@ -174,6 +174,7 @@ namespace Flax.Build.Projects.VisualStudio
} }
} }
var rootPath = project.WorkspaceRootPath.Replace('/', '\\') + '\\';
foreach (var file in files) foreach (var file in files)
{ {
string fileType; string fileType;
@@ -185,7 +186,7 @@ namespace Flax.Build.Projects.VisualStudio
var filePath = file.Replace('/', '\\'); // Normalize path var filePath = file.Replace('/', '\\'); // Normalize path
var projectPath = Utilities.MakePathRelativeTo(filePath, projectDirectory); var projectPath = Utilities.MakePathRelativeTo(filePath, projectDirectory);
string linkPath = null; string linkPath = null;
if (projectPath.StartsWith(@"..\..\..\")) if (!filePath.StartsWith(rootPath))
{ {
// Create folder structure for project external files // Create folder structure for project external files
var sourceIndex = filePath.LastIndexOf(@"\Source\"); var sourceIndex = filePath.LastIndexOf(@"\Source\");