Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
@@ -0,0 +1,54 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
ly_add_target(
NAME ToolsCrashHandler STATIC
NAMESPACE AZ
AUTOMOC
FILES_CMAKE
tools_crash_handler_files.cmake
Platform/${PAL_PLATFORM_NAME}/tools_crash_handler_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
.
BUILD_DEPENDENCIES
PRIVATE
3rdParty::Qt::Core
AZ::CrashHandler
AZ::CrashSupport
AZ::AzToolsFramework
)
ly_add_target(
NAME ToolsCrashUploader APPLICATION
NAMESPACE AZ
AUTOMOC
AUTOUIC
FILES_CMAKE
tools_crash_uploader_files.cmake
Platform/${PAL_PLATFORM_NAME}/tools_crash_uploader_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
.
Uploader
BUILD_DEPENDENCIES
PRIVATE
3rdParty::Qt::Core
3rdParty::Qt::Gui
3rdParty::Qt::Widgets
3rdParty::Crashpad
3rdParty::Crashpad::Handler
AZ::CrashUploaderSupport
AZ::AzQtComponents
AZ::CrashSupport
TARGET_PROPERTIES
Qt5_NO_LINK_QTMAIN TRUE
)
@@ -0,0 +1,14 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(FILES
../../ToolsCrashHandler_win.cpp
)
@@ -0,0 +1,14 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(FILES
../../Uploader/platforms/win/main.cpp
)
@@ -0,0 +1,81 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// LY Editor Crashpad Hook
#include <ToolsCrashHandler.h>
#include <CrashSupport.h>
#include <AzCore/IO/FileIO.h>
#include <AzCore/PlatformIncl.h>
#include <AzCore/IO/SystemFile.h>
#include <QOperatingSystemVersion>
#include <QString>
namespace CrashHandler
{
void ToolsCrashHandler::InitCrashHandler(const std::string& moduleTag, const std::string& devRoot, const std::string& crashUrl, const std::string& crashToken, const std::string& handlerFolder, const CrashHandlerAnnotations& baseAnnotations, const CrashHandlerArguments& arguments)
{
ToolsCrashHandler crashHandler;
crashHandler.Initialize( moduleTag, devRoot, crashUrl, crashToken, handlerFolder, baseAnnotations, arguments);
}
std::string ToolsCrashHandler::GetCrashSubmissionURL() const
{
#if defined(CRASH_HANDLER_URL)
return MAKE_DEFINE_STRING(CRASH_HANDLER_URL);
#else
return "https://lumberyard.sp.backtrace.io:8443/";
#endif
}
std::string ToolsCrashHandler::GetCrashSubmissionToken() const
{
std::string configToken = GetConfigSubmissionToken();
if (configToken.length())
{
return configToken;
}
#if defined(CRASH_HANDLER_TOKEN)
return MAKE_DEFINE_STRING(CRASH_HANDLER_TOKEN);
#else
return "8f562f6bf0ecb674e5f64344d76e6afeccb3244b4a9ea191ee61dc4e3528c5bd";
#endif
}
std::string ToolsCrashHandler::DetermineAppPath() const
{
AZ::IO::FileIOBase* fileIO = AZ::IO::FileIOBase::GetInstance();
if (fileIO)
{
// If our devroot alias is available, use that
const char* devAlias = fileIO->GetAlias("@devroot@");
if (devAlias)
{
return devAlias;
}
}
return GetAppRootFromCWD();
}
void ToolsCrashHandler::GetOSAnnotations(CrashHandlerAnnotations& annotations) const
{
CrashHandlerBase::GetOSAnnotations(annotations);
std::string annotationBuf = QOperatingSystemVersion::current().name().toUtf8().data();
annotations["os.qtversion"] = annotationBuf;
}
}
@@ -0,0 +1,40 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// LY Editor Crashpad Hook
#pragma once
#include <CrashHandler.h>
namespace CrashHandler
{
class ToolsCrashHandler : public CrashHandler::CrashHandlerBase
{
public:
ToolsCrashHandler() = default;
virtual ~ToolsCrashHandler() = default;
static void InitCrashHandler(const std::string& moduleTag, const std::string& devRoot, const std::string& crashUrl = {}, const std::string& crashToken = {}, const std::string& handlerFolder = {}, const CrashHandlerAnnotations& baseAnnotations = CrashHandlerAnnotations(), const CrashHandlerArguments& arguments = CrashHandlerArguments());
protected:
virtual std::string DetermineAppPath() const override;
virtual std::string GetCrashSubmissionURL() const override;
virtual std::string GetCrashSubmissionToken() const override;
// OS Dependent
virtual std::string GetAppRootFromCWD() const override;
virtual void GetOSAnnotations(CrashHandlerAnnotations& annotations) const override;
};
}
@@ -0,0 +1,37 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// LY Editor Tools Crash Handler support for Mac
#include <ToolsCrashHandler.h>
#include <AzCore/PlatformIncl.h>
#include <AzCore/IO/SystemFile.h>
#include <CrashSupport.h>
namespace CrashHandler
{
std::string ToolsCrashHandler::GetAppRootFromCWD() const
{
std::string returnPath;
GetExecutableFolder(returnPath);
std::string devRoot{ "/dev/" };
auto devpos = returnPath.rfind(devRoot);
if (devpos != std::string::npos)
{
/* Cut off everything beyond \\dev\\ */
returnPath.erase(devpos + devRoot.length());
}
return returnPath;
}
}
@@ -0,0 +1,36 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// LY Editor Crashpad Hook - Windows
#include <ToolsCrashHandler.h>
#include <AzCore/PlatformIncl.h>
#include <CrashSupport.h>
namespace CrashHandler
{
std::string ToolsCrashHandler::GetAppRootFromCWD() const
{
std::string returnPath;
GetExecutableFolder(returnPath);
std::string devRoot{ "/dev/" };
auto devpos = returnPath.rfind(devRoot);
if (devpos != std::string::npos)
{
/* Cut off everything beyond \\dev\\ */
returnPath.erase(devpos + devRoot.length());
}
return returnPath;
}
}
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/Icons">
<file>lyeditor.ico</file>
</qresource>
</RCC>
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2c9a6ddbfc423c717a03dacab45e134166a1b06030b4caf418d0a6a69c2d82d2
size 114333
@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SendReportDialog</class>
<widget class="QDialog" name="SendReportDialog">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>220</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>400</width>
<height>220</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>220</height>
</size>
</property>
<property name="windowTitle">
<string>Send Error Report</string>
</property>
<property name="windowIcon">
<iconset>
<normaloff>lyeditoricon.ico</normaloff>lyeditoricon.ico</iconset>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="modal">
<bool>true</bool>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>210</x>
<y>186</y>
<width>175</width>
<height>32</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>0</x>
<y>168</y>
<width>391</width>
<height>20</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>6</x>
<y>6</y>
<width>385</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Lumberyard has encountered a fatal error. We're sorry for the inconvenience.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>6</x>
<y>36</y>
<width>385</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>A Lumberyard Editor crash debugging file has been created at:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="dump_label">
<property name="geometry">
<rect>
<x>6</x>
<y>66</y>
<width>391</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>6</x>
<y>96</y>
<width>385</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>If you are willing to submit this file to Amazon it will help us improve the Lumberyard experience. We will treat this report as confidential.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>6</x>
<y>138</y>
<width>331</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Would you like to send the error report?</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</widget>
<resources>
<include location="../../../../Sandbox/Editor/MainWindow.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>SendReportDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>SendReportDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
@@ -0,0 +1,41 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include "SendReportDialog.h"
#include "UI/ui_submit_report.h"
namespace CrashUploader
{
SendReportDialog::SendReportDialog(QWidget* parent)
: QDialog(parent)
, ui(new Ui::SendReportDialog)
{
ui->setupUi(this);
}
SendReportDialog::~SendReportDialog()
{
}
void SendReportDialog::SetReportText(const char* reportText)
{
ui->dump_label->setText(reportText);
}
void SendReportDialog::SetApplicationName(const char* applicationName)
{
QString errorString{ applicationName };
errorString += " has encountered a fatal error. We're sorry for the inconvenience.";
ui->label->setText(errorString);
}
}
@@ -0,0 +1,40 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <QDialog>
#include <QScopedPointer>
#endif
namespace Ui {
class SendReportDialog;
}
namespace CrashUploader
{
class SendReportDialog : public QDialog
{
Q_OBJECT // AUTOMOC
public:
explicit SendReportDialog(QWidget* parent = nullptr);
~SendReportDialog() override;
void SetReportText(const char* reportPath);
void SetApplicationName(const char* appName);
private:
QScopedPointer<Ui::SendReportDialog> ui;
};
}
@@ -0,0 +1,111 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// LY Editor Crashpad Upload Handler Extension
#include <ToolsCrashUploader.h>
#include <SendReportDialog.h>
#include <CrashSupport.h>
#include <AzQtComponents/Components/StyleManager.h>
#include <AzCore/PlatformDef.h>
#include <AzCore/std/typetraits/underlying_type.h>
#include <QString>
#include <QApplication>
#include <memory>
#include "UI/ui_submit_report.h"
namespace Lumberyard
{
void InstallCrashUploader(int& argc, char* argv[])
{
Lumberyard::CrashUploader::SetCrashUploader(std::make_shared<Lumberyard::ToolsCrashUploader>(argc, argv));
}
QString GetReportString(const std::wstring& reportPath)
{
return QString::fromStdWString(reportPath);
}
QString GetReportString(const std::string& reportPath)
{
return QString::fromStdString( reportPath );
}
ToolsCrashUploader::ToolsCrashUploader(int& argCount, char** argv) :
CrashUploader(argCount, argv)
{
}
std::string ToolsCrashUploader::GetRootFolder()
{
std::string returnPath;
::CrashHandler::GetExecutableFolder(returnPath);
std::string devRoot{ "/dev/" };
auto devpos = returnPath.rfind(devRoot);
if (devpos != std::string::npos)
{
/* Cut off everything beyond \\dev\\ */
returnPath.erase(devpos + devRoot.length());
}
return returnPath;
}
bool ToolsCrashUploader::CheckConfirmation(const crashpad::CrashReportDatabase::Report& report)
{
if (m_noConfirmation)
{
return true;
}
#if !AZ_TRAIT_OS_PLATFORM_APPLE
AZ_PUSH_DISABLE_WARNING(4996, "-Wunknown-warning-option")
const char* noConfirmation = getenv("LY_NO_CONFIRM");
AZ_POP_DISABLE_WARNING
if (noConfirmation == nullptr)
{
int argCount = 0;
AzQtComponents::StyleManager styleManager{ nullptr };
QApplication app{ argCount, nullptr };
styleManager.Initialize(&app);
QString reportPath{ GetReportString(report.file_path.value()) };
QString reportString{ GetReportString(report.file_path.value()).toStdString().c_str() };
QAtomicInt dialogResult{ -1 };
::CrashUploader::SendReportDialog confirmDialog{ nullptr };
confirmDialog.SetApplicationName(m_executableName.c_str());
confirmDialog.setWindowIcon(QIcon(":/Icons/editor_icon.ico"));
confirmDialog.SetReportText(reportString.toStdString().c_str());
confirmDialog.setWindowFlags((confirmDialog.windowFlags() | Qt::WindowStaysOnTopHint) & ~Qt::WindowContextHelpButtonHint);
confirmDialog.exec();
while (dialogResult == -1)
{
app.processEvents();
dialogResult = confirmDialog.result();
}
return dialogResult == QDialog::Accepted;
}
#endif
return true;
}
}
@@ -0,0 +1,29 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// LY Editor Crashpad Upload Handler Extension
#pragma once
#include <Uploader/CrashUploader.h>
namespace Lumberyard
{
class ToolsCrashUploader : public CrashUploader
{
public:
ToolsCrashUploader(int& argcount, char** argv);
virtual bool CheckConfirmation(const crashpad::CrashReportDatabase::Report& report) override;
static std::string GetRootFolder();
};
}
@@ -0,0 +1,24 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// LY Editor Crashpad Upload Handler - Mac
#include <handler/handler_main.h>
#include <Uploader/CrashUploader.h>
int main(int argc, char** argv)
{
Lumberyard::InstallCrashUploader(argc, argv);
LOG(ERROR) << "Initializing posix crash uploader";
return crashpad::HandlerMain(argc, argv, Lumberyard::CrashUploader::GetCrashUploader()->GetUserStreamSources());
}
@@ -0,0 +1,38 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// LY Editor Crashpad Upload Handler Extension
#include <handler/handler_main.h>
#include <tools/tool_support.h>
#include <Uploader/CrashUploader.h>
#include <windows.h>
namespace
{
int HandlerMain(int argc, char* argv[])
{
Lumberyard::InstallCrashUploader(argc, argv);
LOG(ERROR) << "Initializing windows crash uploader";
int resultCode = crashpad::HandlerMain(argc, argv, Lumberyard::CrashUploader::GetCrashUploader()->GetUserStreamSources());
return resultCode;
}
}
int APIENTRY wWinMain(HINSTANCE, HINSTANCE, [[maybe_unused]] wchar_t* lpCmdLine, int)
{
return crashpad::ToolSupport::Wmain(__argc, __wargv, HandlerMain);
}
@@ -0,0 +1,15 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(FILES
ToolsCrashHandler.h
ToolsCrashHandler.cpp
)
@@ -0,0 +1,20 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(FILES
Uploader/ToolsCrashUploader.h
Uploader/ToolsCrashUploader.cpp
Uploader/SendReportDialog.h
Uploader/SendReportDialog.cpp
UI/submit_report.ui
UI/lyeditor.ico
UI/ToolsCrashHandler.qrc
)