Proper build directory handling

This commit is contained in:
Cj 2024-06-20 15:03:17 -04:00
parent b9f8e34339
commit 88e524c974
2 changed files with 32 additions and 14 deletions

View File

@ -128,13 +128,6 @@ public static class ProjectManager
return; return;
} }
// Make sure the project is clean
if (Path.Exists(proj.VisualStudioClonedSolutionPath))
{
Logger.Log("Cleaning old project files", ConsoleColor.Yellow);
Directory.Delete(proj.VisualStudioClonedSolutionDirectory, true);
}
var solutionName = Path.GetFileNameWithoutExtension(solutionFiles.First()); var solutionName = Path.GetFileNameWithoutExtension(solutionFiles.First());
var destination = Path.Combine(DataProvider.ReCodeItProjectsPath, solutionName); var destination = Path.Combine(DataProvider.ReCodeItProjectsPath, solutionName);

View File

@ -153,13 +153,38 @@ public class ReCodeItCrossCompiler
private void MoveResult() private void MoveResult()
{ {
Logger.Log("-----------------------------------------------", ConsoleColor.Green); var builtDll = Directory
.GetFiles(ActiveProject.VisualStudioClonedSolutionDirectory, "*.dll", SearchOption.AllDirectories)
.FirstOrDefault(file => file.Contains(ActiveProject.ProjectDllName));
if (builtDll == null)
{
Logger.Log($"ERROR: No {ActiveProject.ProjectDllName} found at path {ActiveProject.VisualStudioClonedSolutionDirectory}, build failed.", ConsoleColor.Red);
CleanUp();
return;
}
var dest = Path.Combine(ActiveProject.BuildDirectory, ActiveProject.ProjectDllName);
// Create it if it doesnt exist
if (!Directory.Exists(ActiveProject.BuildDirectory))
{
Directory.CreateDirectory(ActiveProject.BuildDirectory);
}
File.Copy(builtDll, dest, true);
Logger.Log($"Copying {ActiveProject.ProjectDllName} to {dest}", ConsoleColor.Yellow);
Logger.Log($"Successfully Cross Compiled Project {ActiveProject.SolutionName}", ConsoleColor.Green); Logger.Log($"Successfully Cross Compiled Project {ActiveProject.SolutionName}", ConsoleColor.Green);
Logger.Log($"Reversed {_identifiersChanged} Remaps", ConsoleColor.Green); CleanUp();
Logger.Log($"Original assembly path: {ActiveProject.OriginalAssemblyPath}", ConsoleColor.Green); }
Logger.Log($"Original assembly hash: {ActiveProject.OriginalAssemblyHash}", ConsoleColor.Green);
Logger.Log($"Final build directory: {ActiveProject.BuildDirectory}", ConsoleColor.Green); private void CleanUp()
//Logger.Log($"Original patched assembly hash: {ActiveProject.RemappedAssemblyHash}", ConsoleColor.Green); {
Logger.Log("-----------------------------------------------", ConsoleColor.Green); if (Path.Exists(ActiveProject.VisualStudioClonedSolutionDirectory))
{
Logger.Log("Cleaning up cloned project files", ConsoleColor.Yellow);
Directory.Delete(ActiveProject.VisualStudioClonedSolutionDirectory, true);
}
} }
} }