ProjectBuilderWorker.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #if !defined(Q_MOC_RUN)
  10. #include <ProjectInfo.h>
  11. #include <AzCore/Outcome/Outcome.h>
  12. #include <QObject>
  13. #include <QProcessEnvironment>
  14. #endif
  15. QT_FORWARD_DECLARE_CLASS(QProcess)
  16. namespace O3DE::ProjectManager
  17. {
  18. class ProjectBuilderWorker : public QObject
  19. {
  20. // QProcess::waitForFinished uses -1 to indicate that the process should not timeout
  21. static constexpr int MaxBuildTimeMSecs = -1;
  22. // Build was cancelled
  23. inline static const QString BuildCancelled = QObject::tr("Build Cancelled.");
  24. Q_OBJECT
  25. public:
  26. explicit ProjectBuilderWorker(const ProjectInfo& projectInfo);
  27. ~ProjectBuilderWorker() = default;
  28. QString GetLogFilePath() const;
  29. public slots:
  30. void BuildProject();
  31. signals:
  32. void UpdateProgress(QString lastLine);
  33. void Done(QString result = "");
  34. private:
  35. AZ::Outcome<void, QString> BuildProjectForPlatform();
  36. void QStringToAZTracePrint(const QString& error);
  37. // Command line argument builders
  38. AZ::Outcome<QStringList, QString> ConstructCmakeGenerateProjectArguments(const QString& thirdPartyPath) const;
  39. AZ::Outcome<QStringList, QString> ConstructCmakeBuildCommandArguments() const;
  40. AZ::Outcome<QStringList, QString> ConstructKillProcessCommandArguments(const QString& pidToKill) const;
  41. QProcess* m_configProjectProcess = nullptr;
  42. QProcess* m_buildProjectProcess = nullptr;
  43. ProjectInfo m_projectInfo;
  44. };
  45. } // namespace O3DE::ProjectManager