2016-12-08 08:52:44 -05:00
|
|
|
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#include "SAutomationExportMenu.h"
|
|
|
|
|
#include "Misc/Paths.h"
|
|
|
|
|
#include "Modules/ModuleManager.h"
|
|
|
|
|
#include "Interfaces/IAutomationControllerModule.h"
|
|
|
|
|
#include "Widgets/SBoxPanel.h"
|
|
|
|
|
#include "Styling/SlateTypes.h"
|
|
|
|
|
#include "Widgets/Text/STextBlock.h"
|
|
|
|
|
#include "Widgets/Input/SButton.h"
|
|
|
|
|
#include "Widgets/Input/SComboButton.h"
|
|
|
|
|
#include "Widgets/Input/SCheckBox.h"
|
|
|
|
|
#include "Widgets/Notifications/SNotificationList.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-09-21 20:35:48 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
#define LOCTEXT_NAMESPACE "AutomationExportMenu"
|
|
|
|
|
|
2014-09-21 20:35:48 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
SAutomationExportMenu::SAutomationExportMenu()
|
|
|
|
|
{
|
|
|
|
|
// Set up some variables
|
|
|
|
|
FileExportTypeMask = 0;
|
|
|
|
|
EFileExportType::SetFlag( FileExportTypeMask, EFileExportType::FET_All );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAutomationExportMenu::Construct( const FArguments& InArgs, const TSharedRef< SNotificationList >& InNotificationList )
|
|
|
|
|
{
|
|
|
|
|
// Used for setting the "Exported" notification on the parent window
|
|
|
|
|
NotificationListPtr = InNotificationList;
|
|
|
|
|
|
|
|
|
|
// Build the UI
|
|
|
|
|
ChildSlot
|
|
|
|
|
[
|
|
|
|
|
SAssignNew( ExportMenuComboButton, SComboButton )
|
|
|
|
|
.IsEnabled( this, &SAutomationExportMenu::AreReportsGenerated )
|
|
|
|
|
.ToolTipText( this, &SAutomationExportMenu::GetExportComboButtonTooltip )
|
|
|
|
|
.OnComboBoxOpened( this, &SAutomationExportMenu::HandleMenuOpen )
|
|
|
|
|
.ButtonContent()
|
|
|
|
|
[
|
|
|
|
|
SNew( STextBlock )
|
|
|
|
|
.Text( LOCTEXT("ExportButtonText", "Export") )
|
|
|
|
|
]
|
|
|
|
|
.ContentPadding( FMargin( 6.f, 2.f ) )
|
|
|
|
|
.MenuContent()
|
|
|
|
|
[
|
|
|
|
|
// Holder box for menu items
|
|
|
|
|
SAssignNew( MenuHolderBox, SVerticalBox )
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool SAutomationExportMenu::AreReportsGenerated() const
|
|
|
|
|
{
|
|
|
|
|
// Check with the manager to see if reports are ready
|
|
|
|
|
return FModuleManager::GetModuleChecked< IAutomationControllerModule >( "AutomationController" ).GetAutomationController()->CheckTestResultsAvailable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAutomationExportMenu::BuildMenuItems( const FText& InName, EFileExportType::Type InType )
|
|
|
|
|
{
|
|
|
|
|
MenuHolderBox->AddSlot()
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
[
|
|
|
|
|
SNew( SCheckBox )
|
|
|
|
|
.IsChecked( this, &SAutomationExportMenu::OnGetDisplayCheckState, InType )
|
|
|
|
|
.IsEnabled( IsCheckBoxEnabled( InType ) )
|
|
|
|
|
.OnCheckStateChanged( this, &SAutomationExportMenu::OnDisplayCheckStateChanged, InType )
|
|
|
|
|
[
|
|
|
|
|
SNew( SHorizontalBox )
|
|
|
|
|
+SHorizontalBox::Slot()
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
[
|
|
|
|
|
SNew( STextBlock ) .Text( InName )
|
|
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SAutomationExportMenu::CreateMenu()
|
|
|
|
|
{
|
|
|
|
|
// Clear old menu
|
|
|
|
|
MenuHolderBox->ClearChildren();
|
|
|
|
|
|
|
|
|
|
// Create new menu items
|
|
|
|
|
BuildMenuItems( LOCTEXT("ExportAllCheckbox", "Export All"), EFileExportType::FET_All );
|
|
|
|
|
BuildMenuItems( LOCTEXT("ExportStatusCheckBox", "Export Status"), EFileExportType::FET_Status );
|
|
|
|
|
BuildMenuItems( LOCTEXT("ExportErrorsCheckBox", "Export Errors"), EFileExportType::FET_Errors );
|
|
|
|
|
BuildMenuItems( LOCTEXT("ExportWarningsCheckBox", "Export Warning"), EFileExportType::FET_Warnings );
|
|
|
|
|
BuildMenuItems( LOCTEXT("ExportLogsCheckBox", "Export Logs"), EFileExportType::FET_Logs );
|
|
|
|
|
|
|
|
|
|
// Add the export button
|
|
|
|
|
MenuHolderBox->AddSlot()
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
[
|
|
|
|
|
SAssignNew( ExportButton, SButton )
|
|
|
|
|
.OnClicked( this, &SAutomationExportMenu::HandleExportDataClicked )
|
|
|
|
|
.IsEnabled( this, &SAutomationExportMenu::IsExportReady )
|
|
|
|
|
.ToolTipText( this, &SAutomationExportMenu::GetExportButtonTooltip )
|
|
|
|
|
.Text( LOCTEXT("ExportDataButton", "Export Data") )
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FText SAutomationExportMenu::GetExportButtonTooltip() const
|
|
|
|
|
{
|
|
|
|
|
// Export button tooltip
|
|
|
|
|
if ( ExportButton->IsEnabled() )
|
|
|
|
|
{
|
|
|
|
|
return LOCTEXT("ExportButtonEnabledText", "Export Data");
|
|
|
|
|
}
|
|
|
|
|
return LOCTEXT("ExportButtonFailedText", "No reports pass the export filter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FText SAutomationExportMenu::GetExportComboButtonTooltip() const
|
|
|
|
|
{
|
|
|
|
|
// Export combo too tip
|
|
|
|
|
if ( ExportMenuComboButton->IsEnabled() )
|
|
|
|
|
{
|
|
|
|
|
return LOCTEXT("ExportComboButtonEnabledText", "Export Data");
|
|
|
|
|
}
|
|
|
|
|
return LOCTEXT("ExportComboButtonFailedText", "Please generate the reports");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAutomationExportMenu::GetResults( )
|
|
|
|
|
{
|
|
|
|
|
// Get the automation controller to check what type of reports have been generated
|
|
|
|
|
IAutomationControllerManagerPtr AutomationController = FModuleManager::GetModuleChecked< IAutomationControllerModule >( "AutomationController" ).GetAutomationController();
|
|
|
|
|
|
|
|
|
|
// Reset the results mask
|
|
|
|
|
ResultMask = 0;
|
|
|
|
|
|
|
|
|
|
// Add result flags
|
|
|
|
|
|
|
|
|
|
// Always allow status and all
|
|
|
|
|
EFileExportType::SetFlag( ResultMask, EFileExportType::FET_Status );
|
|
|
|
|
|
|
|
|
|
EFileExportType::SetFlag( ResultMask, EFileExportType::FET_All );
|
|
|
|
|
|
|
|
|
|
if ( AutomationController->ReportsHaveErrors() )
|
|
|
|
|
{
|
|
|
|
|
EFileExportType::SetFlag( ResultMask, EFileExportType::FET_Errors );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( AutomationController->ReportsHaveWarnings() )
|
|
|
|
|
{
|
|
|
|
|
EFileExportType::SetFlag( ResultMask, EFileExportType::FET_Warnings );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( AutomationController->ReportsHaveLogs())
|
|
|
|
|
{
|
|
|
|
|
EFileExportType::SetFlag( ResultMask, EFileExportType::FET_Warnings );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FReply SAutomationExportMenu::HandleExportDataClicked()
|
|
|
|
|
{
|
|
|
|
|
// Time to display the completion message in the UI
|
|
|
|
|
static const float MessageTime = 3.0f;
|
|
|
|
|
|
|
|
|
|
// Generate the report
|
|
|
|
|
bool ReportExported = FModuleManager::GetModuleChecked< IAutomationControllerModule >( "AutomationController" ).GetAutomationController()->ExportReport( FileExportTypeMask );
|
|
|
|
|
|
|
|
|
|
// Notify UI depending on whether the report was generated
|
|
|
|
|
if (ReportExported)
|
|
|
|
|
{
|
|
|
|
|
// Create the file name. This is currently duplicated in the report manager
|
|
|
|
|
FFormatNamedArguments Args;
|
|
|
|
|
Args.Add( TEXT("FileName"), FText::FromString( FString::Printf( TEXT("Automation%s.csv"), *FDateTime::Now().ToString() ) ) );
|
|
|
|
|
Args.Add( TEXT("FileLocation"), FText::FromString( FPaths::ConvertRelativePathToFull( FPaths::AutomationDir() ) ) );
|
|
|
|
|
|
|
|
|
|
// Feedback that the file is written
|
|
|
|
|
FNotificationInfo NotificationInfo( FText::Format( LOCTEXT("SaveLogDialogExportSuccess", "Success!\n{FileName} exported to: {FileLocation}"), Args ) );
|
|
|
|
|
NotificationInfo.ExpireDuration = MessageTime;
|
|
|
|
|
NotificationInfo.bUseLargeFont = false;
|
|
|
|
|
NotificationListPtr->AddNotification( NotificationInfo );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
FNotificationInfo NotificationInfo( LOCTEXT("SaveLogDialogNothingValidError", "No reports pass the export filter") );
|
|
|
|
|
NotificationInfo.ExpireDuration = MessageTime;
|
|
|
|
|
|
|
|
|
|
// No file generated as there are no reports that pass the filters
|
|
|
|
|
NotificationListPtr->AddNotification( NotificationInfo );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// close the export window
|
|
|
|
|
ExportMenuComboButton->SetIsOpen( false );
|
|
|
|
|
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAutomationExportMenu::HandleMenuOpen()
|
|
|
|
|
{
|
|
|
|
|
// Get the results from the automation controller
|
|
|
|
|
GetResults();
|
|
|
|
|
|
|
|
|
|
// Set all flags is Set All is selected
|
|
|
|
|
if ( EFileExportType::IsSet( FileExportTypeMask, EFileExportType::FET_All ) )
|
|
|
|
|
{
|
|
|
|
|
EnableAvailableReports();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create the menu items
|
|
|
|
|
CreateMenu();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool SAutomationExportMenu::IsCheckBoxEnabled( EFileExportType::Type CheckType ) const
|
|
|
|
|
{
|
|
|
|
|
// Enable the button if there is a valid report
|
|
|
|
|
return EFileExportType::IsSet( ResultMask, CheckType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool SAutomationExportMenu::IsExportReady() const
|
|
|
|
|
{
|
|
|
|
|
// If we have a valid export mask, we can assume we are able to export a report
|
|
|
|
|
return FileExportTypeMask > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-12-10 14:24:09 -05:00
|
|
|
void SAutomationExportMenu::OnDisplayCheckStateChanged( ECheckBoxState InNewState, EFileExportType::Type CheckType )
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// set or unset the bit in the mask for the type changed
|
2014-12-10 14:24:09 -05:00
|
|
|
if ( InNewState == ECheckBoxState::Checked )
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
EFileExportType::SetFlag( FileExportTypeMask, CheckType );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
EFileExportType::RemoveFlag( FileExportTypeMask, CheckType );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If select all is selected, and we select something else, unset the "all selected" checkbox
|
|
|
|
|
if ( CheckType != EFileExportType::FET_All && EFileExportType::IsSet( FileExportTypeMask, EFileExportType::FET_All ) )
|
|
|
|
|
{
|
|
|
|
|
EFileExportType::RemoveFlag( FileExportTypeMask, EFileExportType::FET_All );
|
|
|
|
|
// Recreate the menu
|
|
|
|
|
CreateMenu();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If we check select all, set all the valid options to be active
|
2014-12-10 14:24:09 -05:00
|
|
|
if ( CheckType == EFileExportType::FET_All && InNewState == ECheckBoxState::Checked )
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
EnableAvailableReports();
|
|
|
|
|
// Recreate the menu
|
|
|
|
|
CreateMenu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-12-10 14:24:09 -05:00
|
|
|
ECheckBoxState SAutomationExportMenu::OnGetDisplayCheckState( EFileExportType::Type CheckType ) const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
// If the item is selected, set the box to be checked
|
|
|
|
|
if(EFileExportType::IsSet( FileExportTypeMask, CheckType ) )
|
|
|
|
|
{
|
2014-12-10 14:24:09 -05:00
|
|
|
return ECheckBoxState::Checked;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
2014-12-10 14:24:09 -05:00
|
|
|
return ECheckBoxState::Unchecked;
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SAutomationExportMenu::EnableAvailableReports()
|
|
|
|
|
{
|
|
|
|
|
// Set all valid reports to be exported
|
|
|
|
|
EFileExportType::SetFlag( FileExportTypeMask, EFileExportType::FET_Status );
|
|
|
|
|
|
|
|
|
|
if ( EFileExportType::IsSet( ResultMask, EFileExportType::FET_Errors ) )
|
|
|
|
|
{
|
|
|
|
|
EFileExportType::SetFlag( FileExportTypeMask, EFileExportType::FET_Errors );
|
|
|
|
|
}
|
|
|
|
|
if ( EFileExportType::IsSet( ResultMask, EFileExportType::FET_Warnings ) )
|
|
|
|
|
{
|
|
|
|
|
EFileExportType::SetFlag( FileExportTypeMask, EFileExportType::FET_Warnings );
|
|
|
|
|
}
|
|
|
|
|
if ( EFileExportType::IsSet( ResultMask, EFileExportType::FET_Logs ) )
|
|
|
|
|
{
|
|
|
|
|
EFileExportType::SetFlag( FileExportTypeMask, EFileExportType::FET_Logs );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FReply SAutomationExportMenu::SpawnNotification()
|
|
|
|
|
{
|
|
|
|
|
// Inform the UI that we have generated the report
|
|
|
|
|
NotificationListPtr->AddNotification( FNotificationInfo( LOCTEXT("ReportGeneratedSuccessfullyNotification", "Report Generated Successfully!" )) );
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-21 20:35:48 -04:00
|
|
|
|
Copying //UE4/Dev-Build to //UE4/Dev-Main (Source: //UE4/Dev-Build @ 3209340)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3209340 on 2016/11/23 by Ben.Marsh
Convert UE4 codebase to an "include what you use" model - where every header just includes the dependencies it needs, rather than every source file including large monolithic headers like Engine.h and UnrealEd.h.
Measured full rebuild times around 2x faster using XGE on Windows, and improvements of 25% or more for incremental builds and full rebuilds on most other platforms.
* Every header now includes everything it needs to compile.
* There's a CoreMinimal.h header that gets you a set of ubiquitous types from Core (eg. FString, FName, TArray, FVector, etc...). Most headers now include this first.
* There's a CoreTypes.h header that sets up primitive UE4 types and build macros (int32, PLATFORM_WIN64, etc...). All headers in Core include this first, as does CoreMinimal.h.
* Every .cpp file includes its matching .h file first.
* This helps validate that each header is including everything it needs to compile.
* No engine code includes a monolithic header such as Engine.h or UnrealEd.h any more.
* You will get a warning if you try to include one of these from the engine. They still exist for compatibility with game projects and do not produce warnings when included there.
* There have only been minor changes to our internal games down to accommodate these changes. The intent is for this to be as seamless as possible.
* No engine code explicitly includes a precompiled header any more.
* We still use PCHs, but they're force-included on the compiler command line by UnrealBuildTool instead. This lets us tune what they contain without breaking any existing include dependencies.
* PCHs are generated by a tool to get a statistical amount of coverage for the source files using it, and I've seeded the new shared PCHs to contain any header included by > 15% of source files.
Tool used to generate this transform is at Engine\Source\Programs\IncludeTool.
[CL 3209342 by Ben Marsh in Main branch]
2016-11-23 15:48:37 -05:00
|
|
|
#undef LOCTEXT_NAMESPACE
|