You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb none #jira UE-174785 #rnx #preflight 63ff0ceeae54ee4ce912c17c - Recently how we discover packages for the VA commandlets was changed to be much faster but it was also changed to automatically filter out all engine content as we removed the optional (opt in) feature of virtualizing engine content. - This meant that 'CheckForVirtualizedContent' would not be able to check engine packages if '-CheckEngine' was set as we were not providing the commandlet with them. - ::FindAllPackages has been renamed ::FindPackages and both it and ::DiscoverPackages now accept a flags parameter that allows the caller to request that engine content be excluded. - Although most commandlets do not want engine content, having the engine content filter as opt in closer matches existing apis and will probably lead to less mistakes. [CL 24459148 by paul chipchase in ue5-main branch]
87 lines
3.0 KiB
C++
87 lines
3.0 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "RehydrateProjectCommandlet.h"
|
|
|
|
#include "CommandletUtils.h"
|
|
#include "Virtualization/VirtualizationSystem.h"
|
|
|
|
#include "ISourceControlModule.h"
|
|
#include "ISourceControlProvider.h"
|
|
#include "SourceControlHelpers.h"
|
|
#include "SourceControlOperations.h"
|
|
|
|
URehydrateProjectCommandlet::URehydrateProjectCommandlet(const FObjectInitializer& ObjectInitializer)
|
|
: Super(ObjectInitializer)
|
|
{
|
|
|
|
}
|
|
|
|
int32 URehydrateProjectCommandlet::Main(const FString& Params)
|
|
{
|
|
TRACE_CPUPROFILER_EVENT_SCOPE(URehydrateProjectCommandlet);
|
|
|
|
if (!ParseCmdline(Params))
|
|
{
|
|
UE_LOG(LogVirtualization, Error, TEXT("Failed to parse the command line correctly"));
|
|
return -1;
|
|
}
|
|
|
|
UE_LOG(LogVirtualization, Display, TEXT("Scanning for project packages..."));
|
|
TArray<FString> Packages = UE::Virtualization::FindPackages(UE::Virtualization::EFindPackageFlags::ExcludeEngineContent);
|
|
|
|
UE_LOG(LogVirtualization, Display, TEXT("Rehydrating packages..."));
|
|
|
|
UE::Virtualization::IVirtualizationSystem& System = UE::Virtualization::IVirtualizationSystem::Get();
|
|
UE::Virtualization::FRehydrationResult Result = System.TryRehydratePackages(Packages, UE::Virtualization::ERehydrationOptions::Checkout);
|
|
if (Result.WasSuccessful())
|
|
{
|
|
UE_LOG(LogVirtualization, Display, TEXT("Rehydrated %d package(s)"), Result.RehydratedPackages.Num());
|
|
if (!Result.CheckedOutPackages.IsEmpty())
|
|
{
|
|
UE_LOG(LogVirtualization, Display, TEXT("Checked out %d package(s) from revision control"), Result.CheckedOutPackages.Num());
|
|
}
|
|
|
|
if (bAutoCheckIn && !Result.CheckedOutPackages.IsEmpty())
|
|
{
|
|
UE_LOG(LogVirtualization, Display, TEXT("Attempting to check in modified packages to revision control..."));
|
|
|
|
TArray<FString> CheckedOutPackages = SourceControlHelpers::PackageFilenames(Result.CheckedOutPackages);
|
|
|
|
const FText FinalDescription = FText::FromString(TEXT("Rehydrating project packages - automated submit from the RehydrateProject commandlet"));
|
|
|
|
TSharedRef<FCheckIn, ESPMode::ThreadSafe> CheckInOperation = ISourceControlOperation::Create<FCheckIn>();
|
|
CheckInOperation->SetDescription(FinalDescription);
|
|
|
|
ISourceControlProvider& SourceControlProvider = ISourceControlModule::Get().GetProvider();
|
|
if (SourceControlProvider.Execute(CheckInOperation, CheckedOutPackages) == ECommandResult::Succeeded)
|
|
{
|
|
UE_LOG(LogVirtualization, Display, TEXT("Success! - %s"), *CheckInOperation->GetSuccessMessage().ToString());
|
|
}
|
|
else
|
|
{
|
|
// The FCheckIn operation tends to log error messages so we don't need to extract the result info
|
|
// from the operation.
|
|
UE_LOG(LogVirtualization, Error, TEXT("Failed to check in the package(s) see the above LogSourceControl errors"));
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
return -1;
|
|
}
|
|
}
|
|
|
|
bool URehydrateProjectCommandlet::ParseCmdline(const FString& Params)
|
|
{
|
|
TArray<FString> Tokens;
|
|
TArray<FString> Switches;
|
|
|
|
ParseCommandLine(*Params, Tokens, Switches);
|
|
|
|
bAutoCheckIn = Switches.Contains(TEXT("AutoCheckIn"));
|
|
|
|
return true;
|
|
}
|