You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Change 8553543 by Wes.Fudala
We now set a fixed value of 24 to CEF screenInfo colorDepth when off screen rendering is enabled.
Change 8235770 by Wes.Fudala
Fix for CEFJsScripting memory stomp and memory alignment errors called out by the stomp memory allocator when running with -stompmalloc on the commandline.
Change 8065597 by Leigh.Swift
BuildPatchServices: Improving ChunkBuildDirectory behaviour when dealing with empty build or builds only containing empty files.
This is now fully supported as part of the generation flow rather than an early detected edge case.
Change 7641628 by Leigh.Swift
BuildPatchServices: Tweaks to serialisation safety.
BuildPatchServices: DiskChunkStore fix for crash when chunkdump serialisation fails due to disk space.
Change 7436869 by Leigh.Swift
BuildPatchServices: Fix regression in BPT package chunks for cloud save improvements now require message pumping.
Change 7326553 by Wes.Fudala
BuildPatchServices: Attempt to restore functionality of the -SkipBuildPatchPrereq commandline. This stopped functioning in CL# 6655502 with the BPS DLC related refactors.
The issue was reported by a number of users that were relying on this commandline as a last resort workaround for prereq install issues.
Change 7323945 by Leigh.Swift
BuildPatchServices: BuildPatchTool: Install time coefficient values exposed by DiffManifests.
This gives an indicative install duration.
The time is not necessarily accurate, but the simulation is a constant and so the value is highly comparable between different builds.
Change 7310352 by Antony.Carter
BuildPatchServices: Adding support for overriding http path for chunk requests. This allows the ability to support signed urls when downloading patch data.
Change 7095282 by Leigh.Swift
BuildPatchServices: Fix regression with manifests that have no core files.
Change 7092198 by leigh.swift
BuildPatchServices: Reuse existing code from FBuildPatchAppManifest::GetChunkShaHash in FBuildPatchManifestSet::GetChunkShaHash.
This fixes an issue where older manifest files that did not ship with chunk sha values in them, can skip sha validation of chunks like pre-DLC launcher did.
Change 6959115 by Wes.Fudala
Added functionality that will optionally expose embedded browser console logs to the client.
Change 6835841 by Leigh.Swift
BuildPatchServices: Rearranging manifest save logic to avoid unnecessary seeking forwards, which avoids an assert when undetected write failures occur.
Change 6684994 by Leigh.Swift
BuildPatchServices: Don't clean empty directories if staging only.
Change 6655502 by Mike.Erickson, Leigh.Swift, Wes.Fudala
BuildPatchServices: Restructuring how installers are configured and make use of manifest files in order to combine multiple actions on an installation directory into one installer.
This resembles a feature set for a better DLC installation experience.
Change 6404031 by Richard.Fawcett
BuildPatchTool: Only append ".manifest" to output filename if output filename has been specified on the command line.
This was causing a manifest file called literally ".manifest" to be output to the clouddir if -OutputFilename was not specified.
Change 6077240 by Wes.Fudala
Execution of browser resource load complete delegate now happens on the main thread.
Change 6076171 by Leigh.Swift
BuildPatchTool: PatchGeneration: ChunkDeltaOptimise: PackageChunks: Improved corrupt output protection against ill timed taskkill, by serialising to temp filename, and then rename on success.
BuildPatchTool: PatchGeneration: Manifest file extension added if not provided, fixing an oversight and inconsistency with other mode behaviours.
BuildPatchTool: Compactify: Only warn when failing to get a file size, if the file still exists. Otherwise log instead.
Change 6049003 by Leigh.Swift
BuildPatchServices: Adding ProcessRequiredDiskSpace to Launcher.Install.Stats which represents how much disk space the install/update process needed to complete.
BuildPatchServices: Adding ProcessAvailableDiskSpace to Launcher.Install.Stats which represents how much disk space was available at the time of checking required disk space.
Change 5915157 by Leigh.Swift
BuildPatchTool: Adding a statistic to diffmanifests for temporary disk space requirement to apply the patch.
Change 5934838 by Leigh.Swift
BuildPatchTool: PackageChunks: Adding support to provide a tagset for the previous build manifest when producing chunkdbs. This allows expanding the chunks saved out to cover tagsets not installed in the previous build.
Change 5838666 by wes.fudala
Browser can now bubble up the state of completed web resource loads.
Change 5689493 by Leigh.Swift
Adding new x86 and x64 MS VC141 CRT redist, version 14.16.27012
Change 5689462 by Leigh.Swift
Fixing process handle leaks on windows.
Core was leaking for getting an application name.
Change 5500917 by Leigh.Swift
BuildPatchTool: Adding new arg DiffAbortThreshold to ChunkDeltaOptimise mode which allows skipping of the operation if the original delta is so large that it would take too long to process, and likely have little benefit.
BuildPatchTool: Switching some Log output to use Display so that it will appear in EC and CMD windows.
Change 5337482 by Leigh.Swift
BuildPatchTool: Fix for DiffManifests mode not accurately representing delta size for tagged install sets.
Change 5261246 by Leigh.Swift
BuildPatchServices: Fix for file download needing to mock response codes for higher layer statistics code which tracks data sizes and speeds.
This is a regression from previous change to correct download failure vs corruption statistics.
Change 5224725 by Leigh.Swift
BuildPatchServices: Fix for delta download of more than 0 bytes when no update is necessary.
BuildPatchServices: Skip requesting delta metafile if no file changes are actually required for a patch.
BuildPatchTool: Reduce unnecessary data produced by BPT ChunkDeltaOptimise mode.
Change 5010941 by Mike.Erickson
BuildPatchServices: Add download scaling based on average speed per request, maximum count, and download health.
Change 5010845 by Wes.Fudala
BuildPatchServices: IDownload refactored to have specific request and response success functions, to make it clearer that a successful request does not mean the response was also good.
BuildPatchServices: Fixed issues with download failures reporting as corruptions.
Change 5000643 by Wes.Hunt
Remove HttpServiceTracker from UE4.
Change 4884381 by Leigh.Swift
BuildPatchTool: Fix for Package Chunks mode hanging when no chunks were required.
Change 4848675 by Justin.Sargent, Leigh.Swift
Speculative fixes for graphics device lost related crash, by adding additional d3d api result checks.
Improved logging for graphics device lost handling.
Improved logging for tracking down common font loading failure resulting in an ensure.
Change 4831134 by Leigh.Swift
BuildPatchTool: Fix for crash in patchgeneration when fast-forward path replays no match.
Change 4801714 by Wes.Fudala
Fix for CEF issue encountered when building using Mac Mojave + XCode10.
Change 4719149 by Leigh.Swift
BuildPatchTool: PatchGeneration mode cyclic data optimisation, reduces SHA calculation requirement counts for cyclic data.
BuildPatchTool: PatchGeneration mode fix for a bug causing non-optimal match insertion idx searching when there are 10k+ matches per scanner.
Change 4680963 by Leigh.Swift
BuildPatchTool: ChunkDeltaOptimise mode is now FeatureLevel upgrade / downgrade aware.
Change 4680947 by Leigh.Swift
BuildPatchTool: Compactify speed improvements for massive network cloud directories.
Change 4656991 by Leigh.Swift
BuildPatchServices: Make sure chunk writer robustly discovers if a chunk fails to save out.
Change 4647815 by Leigh.Swift
Upping the minimum wait time for UdpMessageBeacon thread so that it will not always wait 0ms when network sends are failing, reducing disconnect CPU usage.
Adding configurable tick rate logic to XmppConnectionJingle thread. It will now default to 100Hz max.
Change 4627355 by Michael.Trepka
Fixed a problem with CEF being unable to find locale pak files on Mac for certain language/region combinations
Change 4620800 by Leigh.Swift
Fix for CEF crash when disabling a web window that has not yet got a parent window. There's no need to worry about focus in this case.
Change 4590207 by Leigh.Swift
BuildPatchTool: PackageChunks mode now supports FeatureLevel arg
Change 4590103 by leigh.swift
BuildPatchTool: Adding new mode ChunkDeltaOptimise which reducing the download size when patching between two specific builds in a specific direction.
BuildPatchTool: Updated Enumeration, DiffManifests, Compactify, PackageChunks, and VerifyChunks modes to take account of new delta data.
BuildPatchServices: Installers now have a single shared memory chunk store, which reduces the requirement for booting
Change 4590089 by Leigh.Swift
BuildPatchTool: Adding new mode ChunkDeltaOptimise which reducing the download size when patching between two specific builds in a specific direction.
BuildPatchTool: Updated Enumeration, DiffManifests, Compactify, PackageChunks, and VerifyChunks modes to take account of new delta data.
BuildPatchServices: Installers now have a single shared memory chunk store, which reduces the requirement for booting
Change 4341076 by Leigh.Swift
BuildPatchServices: Making FBuildPatchAppManifest::GetRemovableFiles more robust to handle directories with or without trailing slash.
Change 4331754 by Leigh.Swift
BuildPatchTool: Added support for selecting ChunkWindowSize when generating patches.
BuildPatchTool: Added support for providing the FeatureLevel command-line argument to indicate the data version that should be saved out by patch generation. This warns about defaulting to LatestJson if not provided.
BuildPatchTool: Added support for generating patches with recognition for any chunks with any ChunkWindowSize found in the provided CloudDir.
BuildPatchTool: Added command-line -IgnoreOtherWindowSizes param which if provided, the generation code will only accept chunk matches that are the same as ChunkWindowSize.
BuildPatchServices: Fixes for supporting installations that use any ChunkWindowSize.
BuildPatchServices: New manifest file format to reduce file size, this is now raw compressed binary data.
#lockdown Nick.Penwarden
#rb none
[CL 8675597 by Leigh Swift in Main branch]
371 lines
18 KiB
C++
371 lines
18 KiB
C++
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "ToolModes/PatchGenerationMode.h"
|
|
#include "Misc/DefaultValueHelper.h"
|
|
#include "Misc/Paths.h"
|
|
#include "Misc/CommandLine.h"
|
|
#include "Interfaces/IBuildPatchServicesModule.h"
|
|
#include "BuildPatchFeatureLevel.h"
|
|
#include "BuildPatchTool.h"
|
|
|
|
using namespace BuildPatchTool;
|
|
|
|
namespace Constants
|
|
{
|
|
static const FString Comma(TEXT(","));
|
|
static const FString Equals(TEXT("="));
|
|
static const FString DoubleQuote(TEXT("\""));
|
|
static const FString SingleQuote(TEXT("'"));
|
|
static const FString Slash(TEXT("/"));
|
|
static const FString Backslash(TEXT("\\"));
|
|
static const FString Custom(TEXT("custom"));
|
|
static const FString CustomInt(TEXT("customint"));
|
|
static const FString CustomFloat(TEXT("customfloat"));
|
|
}
|
|
|
|
class FPatchGenerationToolMode : public IToolMode
|
|
{
|
|
public:
|
|
FPatchGenerationToolMode(IBuildPatchServicesModule& InBpsInterface)
|
|
: BpsInterface(InBpsInterface)
|
|
, ChunkWindowSize(1048576)
|
|
, bIgnoreOtherWindowSizes(false)
|
|
{}
|
|
|
|
virtual~FPatchGenerationToolMode()
|
|
{}
|
|
|
|
virtual EReturnCode Execute() override
|
|
{
|
|
// Parse commandline
|
|
if (ProcessCommandline() == false)
|
|
{
|
|
return EReturnCode::ArgumentProcessingError;
|
|
}
|
|
|
|
// Print help if requested
|
|
if (bHelp)
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT("GENERATE PATCH DATA MODE"));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT("This tool supports generating chunk based patches. Chunk based patch data will be generated by default."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(""));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT("Required arguments:"));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -mode=PatchGeneration Must be specified to launch the tool in patch generation mode."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -FeatureLevel=Latest Specifies the client feature level to output data for. See BuildPatchServices::EFeatureLevel for possible values."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -BuildRoot=\"\" Specifies in quotes the directory containing the build image to be read."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -CloudDir=\"\" Specifies in quotes the cloud directory where existing data will be recognized from, and new data added to."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -AppName=\"\" Specifies in quotes, the name of the app."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -BuildVersion=\"\" Specifies in quotes, the version string for the build image."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -AppLaunch=\"\" Specifies in quotes, the path to the app executable, must be relative to, and inside of BuildRoot."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -AppArgs=\"\" Specifies in quotes, the commandline to send to the app on launch."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(""));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT("Optional arguments:"));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -AppID=123456 Specifies without quotes, the ID number for the app. This will default to 0 if not provided."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -FileList=\"\" Specifies in quotes, the path to a text file containing BuildRoot relative files to be included in the build."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -FileIgnoreList=\"\" Specifies in quotes, the path to a text file containing BuildRoot relative files, separated by \\r\\n line endings, to not be included in the build."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -FileAttributeList=\"\" Specifies in quotes, the path to a text file containing quoted BuildRoot relative files followed by optional attribute keywords readonly compressed executable, separated by \\r\\n line endings. These attribute will be applied when build is installed client side."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -PrereqIds=\"\" Specifies in quotes, a comma-separated list of identifiers that the prerequisites satisfy. At install time, a machine which already has installed prerequisites with all of these ids will skip prerequisite installation."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -PrereqName=\"\" Specifies in quotes, the display name xfor the prerequisites installer."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -PrereqPath=\"\" Specifies in quotes, the prerequisites installer to launch on successful product install."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" This path supports a string replace for \"$[RootDirectory]\". This will be replaced with the root path before executing. The replacement will include trailing /."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -PrereqArgs=\"\" Specifies in quotes, the commandline to send to prerequisites installer on launch."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" This value supports string replacements for \"$[RootDirectory]\" and also \"$[LogDirectory]\". LogDirectory is the path to the program's log output directory so your prereq could create logs there. The replacement will include trailing /."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" \"$[Quote]\" can also be used to get a quote character, this is important because the BPT commandline already uses quotes for token parsing."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -DataAgeThreshold=12.5 Specified the maximum age (in days) of existing manifest files whose referenced patch data can be reused in the generated manifest."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -Custom=\"field=value\" Adds a custom string field to the build manifest."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -CustomInt=\"field=number\" Adds a custom int64 field to the build manifest."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -CustomFloat=\"field=number\" Adds a custom double field to the build manifest."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -OutputFilename=\"\" Specifies in quotes an override for the output manifest filename. Extension of .manifest will be added if not present."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -ChunkWindowSize=1000000 Specifies in bytes, the data window size that should be used when saving new chunks. Default is 1048576 (1MiB)."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(" -IgnoreOtherWindowSizes If provided, the generation code will only accept chunk matches that are the same as ChunkWindowSize."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(""));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT("NB: If -DataAgeThreshold is not supplied on the command-line, then all existing data is eligible for reuse in the generated manifest."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT("NB: If -OutputFilename is not supplied on the command-line, the default of AppNameBuildVersion.manifest will be used."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT("NB: -OutputFilename must be a clean filename with no path."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT("NB: If -ChunkWindowSize provided, it is clamped max 10485760 (10MiB) to min 32000 (32KB)."));
|
|
UE_LOG(LogBuildPatchTool, Display, TEXT(""));
|
|
return EReturnCode::OK;
|
|
}
|
|
|
|
// Check existence of the file list
|
|
if (!FileList.IsEmpty() && !FPaths::FileExists(FileList))
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("Provided file list was not found %s"), *FileList);
|
|
return EReturnCode::FileNotFound;
|
|
}
|
|
|
|
// Check existence of file ignore list
|
|
if (!FileIgnoreList.IsEmpty() && !FPaths::FileExists(FileIgnoreList))
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("Provided file ignore list was not found %s"), *FileIgnoreList);
|
|
return EReturnCode::FileNotFound;
|
|
}
|
|
|
|
// Check existence of file attributes list
|
|
if (!FileAttributeList.IsEmpty() && !FPaths::FileExists(FileAttributeList))
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("Provided file attribute list was not found %s"), *FileAttributeList);
|
|
return EReturnCode::FileNotFound;
|
|
}
|
|
|
|
// Default the OutputFilename if not provided
|
|
if (OutputFilename.IsEmpty())
|
|
{
|
|
OutputFilename = FDefaultValueHelper::RemoveWhitespaces(AppName + BuildVersion) + TEXT(".manifest");
|
|
}
|
|
// Otherwise check the parameter
|
|
else
|
|
{
|
|
if (OutputFilename.Contains(TEXT("/")))
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("Provided OutputFilename should be clean filename only. Invalid arg: %s"), *OutputFilename);
|
|
return EReturnCode::ArgumentProcessingError;
|
|
}
|
|
}
|
|
|
|
// Setup and run
|
|
BuildPatchServices::FChunkBuildConfiguration Settings;
|
|
const uint32 DefaultChunkWindowSize = Settings.OutputChunkWindowSize;
|
|
if (!BuildPatchServices::FeatureLevelFromString(*FeatureLevel, Settings.FeatureLevel))
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("Provided FeatureLevel is not recognised. Invalid arg: -FeatureLevel=%s"), *FeatureLevel);
|
|
return EReturnCode::ArgumentProcessingError;
|
|
}
|
|
Settings.RootDirectory = BuildRoot;
|
|
Settings.AppId = TCString<TCHAR>::Atoi64(*AppId);
|
|
Settings.AppName = AppName;
|
|
Settings.BuildVersion = BuildVersion;
|
|
Settings.LaunchExe = AppLaunch;
|
|
Settings.LaunchCommand = AppArgs;
|
|
Settings.InputListFile = FileList;
|
|
Settings.IgnoreListFile = FileIgnoreList;
|
|
Settings.AttributeListFile = FileAttributeList;
|
|
Settings.PrereqIds = PrereqIdsSet;
|
|
Settings.PrereqName = PrereqName;
|
|
Settings.PrereqPath = PrereqPath;
|
|
Settings.PrereqArgs = PrereqArgs;
|
|
Settings.DataAgeThreshold = TCString<TCHAR>::Atod(*DataAgeThreshold);
|
|
Settings.bShouldHonorReuseThreshold = DataAgeThreshold.IsEmpty() == false;
|
|
Settings.OutputChunkWindowSize = ChunkWindowSize;
|
|
Settings.bShouldMatchAnyWindowSize = !bIgnoreOtherWindowSizes && Settings.FeatureLevel >= BuildPatchServices::EFeatureLevel::VariableSizeChunks;
|
|
Settings.CustomFields = CustomFields;
|
|
Settings.CloudDirectory = CloudDir;
|
|
Settings.OutputFilename = OutputFilename;
|
|
|
|
// Check feature compatibility
|
|
const bool bHasCustomFields = Settings.CustomFields.Num() > 0;
|
|
if (Settings.FeatureLevel < BuildPatchServices::EFeatureLevel::CustomFields && bHasCustomFields)
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("Invalid args: FeatureLevel %s is not compatible with Custom, CustomInt, or CustomFloat."), BuildPatchServices::FeatureLevelToString(Settings.FeatureLevel));
|
|
return EReturnCode::ArgumentProcessingError;
|
|
}
|
|
const bool bHasAnyPrereqInfo = !PrereqName.IsEmpty() || !PrereqPath.IsEmpty() || !PrereqArgs.IsEmpty();
|
|
if (Settings.FeatureLevel < BuildPatchServices::EFeatureLevel::StoresPrerequisitesInfo && bHasAnyPrereqInfo)
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("Invalid args: FeatureLevel %s is not compatible with PrereqName, PrereqPath, or PrereqArgs."), BuildPatchServices::FeatureLevelToString(Settings.FeatureLevel));
|
|
return EReturnCode::ArgumentProcessingError;
|
|
}
|
|
const bool bHasPrereqIds = Settings.PrereqIds.Num() > 0;
|
|
if (Settings.FeatureLevel < BuildPatchServices::EFeatureLevel::StoresPrerequisiteIds && bHasPrereqIds)
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("Invalid args: FeatureLevel %s is not compatible with PrereqIds."), BuildPatchServices::FeatureLevelToString(Settings.FeatureLevel));
|
|
return EReturnCode::ArgumentProcessingError;
|
|
}
|
|
const bool bHasNonDefaultWindowSize = Settings.OutputChunkWindowSize != DefaultChunkWindowSize;
|
|
if (Settings.FeatureLevel < BuildPatchServices::EFeatureLevel::VariableSizeChunks && bHasNonDefaultWindowSize)
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("Invalid args: FeatureLevel %s is not compatible with -ChunkWindowSize=%u."), BuildPatchServices::FeatureLevelToString(Settings.FeatureLevel), Settings.OutputChunkWindowSize);
|
|
return EReturnCode::ArgumentProcessingError;
|
|
}
|
|
|
|
// Run the build generation
|
|
bool bSuccess = BpsInterface.ChunkBuildDirectory(Settings);
|
|
return bSuccess ? EReturnCode::OK : EReturnCode::ToolFailure;
|
|
}
|
|
|
|
private:
|
|
|
|
bool ParsePrereqIds(const FString& ParamValue, TSet<FString>& OutPrereqIds)
|
|
{
|
|
if (ParamValue.Contains(Constants::Slash)
|
|
|| ParamValue.Contains(Constants::Backslash)
|
|
|| ParamValue.Contains(Constants::DoubleQuote)
|
|
|| ParamValue.Contains(Constants::Slash))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
TArray<FString> ParamValues;
|
|
ParamValue.ParseIntoArray(ParamValues, *Constants::Comma);
|
|
OutPrereqIds.Append(ParamValues);
|
|
return true;
|
|
}
|
|
|
|
bool ParseCustomField(const FString& Switch, TMap<FString, FVariant>& Fields)
|
|
{
|
|
FString Type, Left, Right;
|
|
|
|
Switch.Split(Constants::Equals, &Type, &Right);
|
|
Type.ToLowerInline();
|
|
Right.Split(Constants::Equals, &Left, &Right);
|
|
Left.TrimStartAndEndInline();
|
|
Right.TrimStartAndEndInline();
|
|
if (Type.Equals(Constants::Custom, ESearchCase::CaseSensitive))
|
|
{
|
|
CustomFields.Add(Left, FVariant(Right));
|
|
}
|
|
else if (Type.Equals(Constants::CustomInt, ESearchCase::CaseSensitive))
|
|
{
|
|
if (!Right.IsNumeric())
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("An error occurred processing numeric token from commandline -%s"), *Switch);
|
|
return false;
|
|
}
|
|
CustomFields.Add(Left, FVariant(TCString<TCHAR>::Atoi64(*Right)));
|
|
}
|
|
else if (Type.Equals(Constants::CustomFloat, ESearchCase::CaseSensitive))
|
|
{
|
|
if (!Right.IsNumeric())
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("An error occurred processing numeric token from commandline -%s"), *Switch);
|
|
return false;
|
|
}
|
|
CustomFields.Add(Left, FVariant(TCString<TCHAR>::Atod(*Right)));
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool ProcessCommandline()
|
|
{
|
|
#define PARSE_SWITCH(Switch) ParseSwitch(TEXT(#Switch "="), Switch, Switches)
|
|
TArray<FString> Tokens, Switches;
|
|
FCommandLine::Parse(FCommandLine::Get(), Tokens, Switches);
|
|
|
|
bHelp = ParseOption(TEXT("help"), Switches);
|
|
if (bHelp)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
// Grab the FeatureLevel. This is required param but safe to default, we can change this to a warning after first release, and then an error later, as part of a friendly roll out.
|
|
PARSE_SWITCH(FeatureLevel);
|
|
FeatureLevel.TrimStartAndEndInline();
|
|
if (FeatureLevel.IsEmpty())
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Log, TEXT("FeatureLevel was not provided, defaulting to LatestJson. Please provide the FeatureLevel commandline argument which matches the existing client support."));
|
|
FeatureLevel = TEXT("LatestJson");
|
|
}
|
|
|
|
// Get all required parameters
|
|
if (!(PARSE_SWITCH(CloudDir)
|
|
&& PARSE_SWITCH(BuildRoot)
|
|
&& PARSE_SWITCH(AppName)
|
|
&& PARSE_SWITCH(BuildVersion)
|
|
&& PARSE_SWITCH(AppLaunch)
|
|
&& PARSE_SWITCH(AppArgs)))
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("CloudDir, BuildRoot, AppName, BuildVersion, AppLaunch, and AppArgs are required parameters"));
|
|
return false;
|
|
}
|
|
NormalizeUriPath(CloudDir);
|
|
NormalizeUriPath(BuildRoot);
|
|
NormalizeUriFile(AppLaunch);
|
|
|
|
// Get optional parameters
|
|
PARSE_SWITCH(AppId);
|
|
PARSE_SWITCH(FileList);
|
|
PARSE_SWITCH(FileIgnoreList);
|
|
PARSE_SWITCH(FileAttributeList);
|
|
PARSE_SWITCH(PrereqIds);
|
|
PARSE_SWITCH(PrereqName);
|
|
PARSE_SWITCH(PrereqPath);
|
|
PARSE_SWITCH(PrereqArgs);
|
|
PARSE_SWITCH(DataAgeThreshold);
|
|
PARSE_SWITCH(ChunkWindowSize);
|
|
bIgnoreOtherWindowSizes = ParseOption(TEXT("IgnoreOtherWindowSizes"), Switches);
|
|
PARSE_SWITCH(OutputFilename);
|
|
NormalizeUriFile(FileList);
|
|
NormalizeUriFile(FileIgnoreList);
|
|
NormalizeUriFile(FileAttributeList);
|
|
NormalizeUriFile(PrereqPath);
|
|
NormalizeUriFile(OutputFilename);
|
|
|
|
// Check manifest file extension.
|
|
const TCHAR* ManifestExtension = TEXT(".manifest");
|
|
if (!OutputFilename.IsEmpty() && !OutputFilename.EndsWith(ManifestExtension))
|
|
{
|
|
OutputFilename += ManifestExtension;
|
|
}
|
|
|
|
// Clamp ChunkWindowSize to sane range.
|
|
const uint32 RequestedChunkWindowSize = ChunkWindowSize;
|
|
ChunkWindowSize = FMath::Clamp<uint32>(ChunkWindowSize, 32000, 10485760);
|
|
if (RequestedChunkWindowSize != ChunkWindowSize)
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Warning, TEXT("Requested -ChunkWindowSize=%u is outside of allowed range 10485760 >= n >= 32000. Please update your args to be within range. Continuing with %u."), RequestedChunkWindowSize, ChunkWindowSize);
|
|
}
|
|
|
|
// Check numeric values
|
|
if (!AppId.IsEmpty() && !AppId.IsNumeric())
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("An error occurred processing numeric token from commandline -AppId=%s"), *AppId);
|
|
return false;
|
|
}
|
|
if (!DataAgeThreshold.IsEmpty() && !DataAgeThreshold.IsNumeric())
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("An error occurred processing numeric token from commandline -DataAgeThreshold=%s"), *DataAgeThreshold);
|
|
return false;
|
|
}
|
|
|
|
// Get custom fields to add to manifest
|
|
// These are optional, but a failure to parse one is an error
|
|
for (const FString& Switch : Switches)
|
|
{
|
|
if (Switch.StartsWith(Constants::Custom) && !ParseCustomField(Switch, CustomFields))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
if (!PrereqIds.IsEmpty() && !ParsePrereqIds(PrereqIds, PrereqIdsSet))
|
|
{
|
|
UE_LOG(LogBuildPatchTool, Error, TEXT("An error occurred processing comma-separated list from commandline -PrereqIds=%s"), *PrereqIds);
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
#undef PARSE_SWITCH
|
|
}
|
|
|
|
private:
|
|
IBuildPatchServicesModule& BpsInterface;
|
|
bool bHelp;
|
|
FString FeatureLevel;
|
|
FString BuildRoot;
|
|
FString CloudDir;
|
|
FString AppId;
|
|
FString AppName;
|
|
FString BuildVersion;
|
|
FString AppLaunch;
|
|
FString AppArgs;
|
|
FString PrereqIds;
|
|
TSet<FString> PrereqIdsSet;
|
|
FString PrereqName;
|
|
FString PrereqPath;
|
|
FString PrereqArgs;
|
|
FString FileList;
|
|
FString FileIgnoreList;
|
|
FString FileAttributeList;
|
|
FString DataAgeThreshold;
|
|
uint32 ChunkWindowSize;
|
|
bool bIgnoreOtherWindowSizes;
|
|
TMap<FString, FVariant> CustomFields;
|
|
FString OutputFilename;
|
|
};
|
|
|
|
BuildPatchTool::IToolModeRef BuildPatchTool::FPatchGenerationToolModeFactory::Create(IBuildPatchServicesModule& BpsInterface)
|
|
{
|
|
return MakeShareable(new FPatchGenerationToolMode(BpsInterface));
|
|
}
|