From bc20208f139568751c34bef92e8a8b80bf838ea7 Mon Sep 17 00:00:00 2001 From: AMZN-Phil Date: Thu, 11 Nov 2021 14:39:10 -0800 Subject: [PATCH] Create file in project directory on successful build for Project Manager Signed-off-by: AMZN-Phil --- .../Source/ProjectBuilderController.cpp | 15 ++++++++++++ .../ProjectManager/Source/ProjectsScreen.cpp | 23 ++++++++++++++++--- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/Code/Tools/ProjectManager/Source/ProjectBuilderController.cpp b/Code/Tools/ProjectManager/Source/ProjectBuilderController.cpp index 7981e9d758..e892336a6f 100644 --- a/Code/Tools/ProjectManager/Source/ProjectBuilderController.cpp +++ b/Code/Tools/ProjectManager/Source/ProjectBuilderController.cpp @@ -10,6 +10,8 @@ #include #include +#include + #include #include #include @@ -80,6 +82,10 @@ namespace O3DE::ProjectManager void ProjectBuilderController::HandleResults(const QString& result) { + AZ::IO::LocalFileIO fileIO; + AZStd::string successBuildFilePath = AZStd::string::format("%s/%s", + m_projectInfo.m_path.toStdString().c_str(), "ProjectManagerBuildSuccess"); + if (!result.isEmpty()) { if (result.contains(tr("log"))) @@ -109,12 +115,21 @@ namespace O3DE::ProjectManager emit NotifyBuildProject(m_projectInfo); } + fileIO.Remove(successBuildFilePath.c_str()); + emit Done(false); return; } else { m_projectInfo.m_buildFailed = false; + + AZ::IO::HandleType fileHandle; + if (fileIO.Open(successBuildFilePath.c_str(), AZ::IO::OpenMode::ModeWrite | AZ::IO::OpenMode::ModeText, fileHandle)) + { + // We just need the file to exist + fileIO.Close(fileHandle); + } } emit Done(true); diff --git a/Code/Tools/ProjectManager/Source/ProjectsScreen.cpp b/Code/Tools/ProjectManager/Source/ProjectsScreen.cpp index f86a689e59..11ff7e0a10 100644 --- a/Code/Tools/ProjectManager/Source/ProjectsScreen.cpp +++ b/Code/Tools/ProjectManager/Source/ProjectsScreen.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -269,17 +270,33 @@ namespace O3DE::ProjectManager // Add any missing project buttons and restore buttons to default state for (const ProjectInfo& project : projectsVector) { + ProjectButton* currentButton = nullptr; if (!m_projectButtons.contains(QDir::toNativeSeparators(project.m_path))) { - m_projectButtons.insert(QDir::toNativeSeparators(project.m_path), CreateProjectButton(project)); + currentButton = CreateProjectButton(project); + m_projectButtons.insert(QDir::toNativeSeparators(project.m_path), currentButton); } else { auto projectButtonIter = m_projectButtons.find(QDir::toNativeSeparators(project.m_path)); if (projectButtonIter != m_projectButtons.end()) { - projectButtonIter.value()->RestoreDefaultState(); - m_projectsFlowLayout->addWidget(projectButtonIter.value()); + currentButton = projectButtonIter.value(); + currentButton->RestoreDefaultState(); + m_projectsFlowLayout->addWidget(currentButton); + } + } + + // Check whether project manager has successfully built the project + if (currentButton) + { + AZStd::string successfulBuildFilePath = AZStd::string::format("%s/%s", + project.m_path.toStdString().c_str(), "ProjectManagerBuildSuccess"); + + AZ::IO::LocalFileIO fileIO; + if (!fileIO.Exists(successfulBuildFilePath.c_str())) + { + currentButton->ShowBuildRequired(); } } }