2019-12-26 23:01:54 -05:00
|
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
2018-01-02 15:30:26 -05:00
|
|
|
|
|
|
|
|
|
|
using System;
|
Copying //UE4/Dev-Core to //UE4/Dev-Main (Source: //UE4/Dev-Core @ 3420477)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3386262 on 2017/04/10 by Ben.Marsh
Add app-local deployment of DirectX components that are no longer included with newer versions of Windows by default (XAudio 2.7, XInput 1.3). Also add a one-click button to the packaging settings to include the default app-local dependencies, rather than having to specify the path.
Change 3386999 on 2017/04/10 by Ben.Marsh
Plugins: Add support for explicit dependencies from one plugin onto another. Required plugins can be configured in an identical manner to project files, by adding a "Plugins" key to the .uplugin file. Dependencies are automatically built and loaded, and the plugin browser will warn if you try to disable a plugin that something else has a dependency on.
Change 3387073 on 2017/04/10 by Ben.Marsh
Move FLightPropagationRuntimeSettings into the Renderer module, to remove engine dependency on a plugin.
Change 3387988 on 2017/04/11 by Steve.Robb
Comments added to clarify the role of DestructItem and DestructItems.
Change 3388085 on 2017/04/11 by Ben.Marsh
UBT: Fix bEnabled flag on plugin references being ignored. Now collect up all the plugin references in order of priority before creating plugin instances for them. Fixes CIS fail for UT.
Change 3390048 on 2017/04/12 by Richard.Hinckley
#jira UE-43876
Fixed description of Streaming settings (within Project Settings).
Change 3390697 on 2017/04/12 by Steve.Robb
CLASS_PointersDefaultToAutoWeak and CLASS_PointersDefaultToWeak removed.
Change 3390711 on 2017/04/12 by Steve.Robb
AGRESSIVE_ARRAY_FORCEINLINE removed.
Change 3392167 on 2017/04/13 by Robert.Manuszewski
UObject can be added to GC cluster only if all of its Outers can also be added to it.
Fixing asserts caused by components that are added to GC clusters even if their owner actors that can't be in GC clusters.
#jira UE-42948
Change 3392309 on 2017/04/13 by Robert.Manuszewski
When adding objects to clusters after these clusters have been created it's possible to come across objects that are already in the cluster we're adding the object to so instead of crashing, allow it.
Change 3392620 on 2017/04/13 by Ben.Marsh
UGS: Only check for updates every 5 minutes.
Change 3392623 on 2017/04/13 by Ben.Marsh
UGS: Only poll for new changes every 60 seconds.
Change 3392744 on 2017/04/13 by Ben.Marsh
UGS: Query changelist descriptions individually to determine whether changes affect code or content, to hopefully reduce Perforce server load.
Change 3392874 on 2017/04/13 by Ben.Marsh
UGS: Allow specifying regexes in the project config file which filters which changes to be displayed. Useful for changes submitted by build machines, updates to collections, etc...
Change 3392878 on 2017/04/13 by Ben.Marsh
Update UGS to version 1.96
Change 3395635 on 2017/04/17 by Ben.Marsh
UAT: Prefix log output from executing UAT commands through BuildGraph with the name of that command.
Change 3395655 on 2017/04/17 by Ben.Marsh
UAT: Add a command for syncing a DDC over the network (SyncDDC). Allows specifying a maximum size to copy, number of days worth of modified files to copy, and time limit not to be exceeded.
Change 3396989 on 2017/04/17 by Wes.Hunt
CrashReporter configurable tweaks.
* Added QueueWaitingTimeAlertThreshold (used to be hardcoded to 1 min).
- When the queue waiting time gets beyond this many seconds, trigger a slack alert message. Default is 10 min.
- Zero means never alert.
* Added DiskSpaceAvailableAlertInterval (used to be hardcoded to 1 day).
- Interval by which to report disk space availability.
- Default is never (Zero)
* Updated config file to match production config.
#codereview:jin.zhang
Change 3397656 on 2017/04/18 by Ben.Marsh
UBT: Allow modules to opt-out of getting the default include paths from being added, by setting bAddDefaultIncludePaths = false from their build.cs file.
Change 3397677 on 2017/04/18 by Robert.Manuszewski
PR #3167 : Adding more descriptive error text to DetatchLinker error check (by rooneym)
Change 3397722 on 2017/04/18 by Robert.Manuszewski
PR #2252: Increase linker reporting for failed imports (Contributed by FineRedMist)
Change 3397739 on 2017/04/18 by Richard.Hinckley
#jira UE-44100
Fixed SanitizePackageName() to remove double-slash, triple-slash, etc. from package names. Also updated CreatePackage() to call SanitizePackageName() before creating.
Change 3398023 on 2017/04/18 by Ben.Marsh
PR #3105: Cook/package with editor and debugger attached (Contributed by projectgheist)
Change 3398095 on 2017/04/18 by Ben.Marsh
PR #3051: Generate map file from UAT (Contributed by projectgheist)
Change 3398212 on 2017/04/18 by Ben.Marsh
PR #2915: UE-38232: Removed duplicate stats (Contributed by projectgheist)
Change 3399304 on 2017/04/19 by Ben.Marsh
UGS: Prevent editor target files being removed when running custom tools.
Change 3399306 on 2017/04/19 by Robert.Manuszewski
Moved InitPropertiesFromCustomList to UbLueprintGeneratedClass and made it thread safe
Change 3399729 on 2017/04/19 by Steve.Robb
Simple optimization to TBitArray::RemoveAt() when all removed bits are at the end of the array.
RemoveAtSwap() now simply decrements the count instead of calling RemoveAt().
Checks for a positive count added to RemoveAt() and RemoveAtSwap().
Change 3399750 on 2017/04/19 by Jin.Zhang
Order branch alphabetically #RB
Change 3400186 on 2017/04/19 by Steve.Robb
Per-header generated code.
Change 3401458 on 2017/04/20 by Steve.Robb
Static log categories moved out of headers to prevent duplicates when the header is included multiple times.
#jira UE-37507
Change 3401657 on 2017/04/20 by Gil.Gribb
UE4 - Simplified and reworked lock free lists and the task graph bringing all platforms under the same scheme.
Change 3401735 on 2017/04/20 by Gil.Gribb
UE4 - Updated apple platform atomics with a new clang version which is intended to be shared among all clang platforms.
Change 3403362 on 2017/04/21 by Steve.Robb
Algo::Sort() fixed to support C arrays.
Size+count versions of Also::IsSorted() deprecated.
Algo::IsSortedBy() added.
Algo::FindBy() added to allow an element to be found by projection.
Simplifications and generalizations.
Change 3404017 on 2017/04/21 by Ben.Marsh
Fix issue where referenced plugin descriptors were missing from console builds, and prevent monolithic builds from offering to disable missing plugins.
Change 3405299 on 2017/04/24 by Steve.Robb
Clarified the class of the incompatible function in the error message about incompatible BP event specifiers.
#jira UE-35106
Change 3405302 on 2017/04/24 by Ben.Marsh
UBT: Allow excluding documentation from generated project files, by setting <ProjectFileGenerator><bIncludeDocumentation>false</bIncludeDocumentation></ProjectFileGenerator> in the XML configuration file.
Change 3405629 on 2017/04/24 by Ben.Marsh
Rename CPPEnvironment to CppCompileEnvironment, to reflect the class name.
Change 3406431 on 2017/04/24 by Ben.Marsh
UAT: Fix incorrect handling of P4SubmitOptions when multiple values are present.
Change 3406670 on 2017/04/24 by Ben.Marsh
UBT: Enable warnings for classes with virtual functions and no virtual destructor (C4265 on Windows, -fdelete-non-virtual-dtor on Clang).
Change 3407080 on 2017/04/25 by Gil.Gribb
UE4 - Critical fix: Propoerly disambiguate imports with the same name and the same outer name. This fixes an assert: LocalExportIndex.IsNull.
Change 3407486 on 2017/04/25 by Gil.Gribb
UE4 - Made changes so that servers, programs and non-engine executables do not create background or high priority threads.
Change 3407495 on 2017/04/25 by Gil.Gribb
UE4 - Tweaked out XBox and Windows low level file IO.
Change 3407497 on 2017/04/25 by Gil.Gribb
UE4 - Fixed bug in the pak precacher that would result in blocks being discarded too soon, which, in turn, resulted in redudnant reads.
Change 3407705 on 2017/04/25 by Ben.Marsh
Removing most of the junk in DotNETUtilities.
Change 3409701 on 2017/04/26 by Ben.Marsh
Disable another static analyzer warning for third party libraries.
Change 3410074 on 2017/04/26 by Daniel.Lamb
Network platform file runs heart beats and responds to modified file changes.
Cook on the fly server in the editor (COTS) now detects changes to content and notifies client.
Fixed issue with network platform file not using correct sandbox.
#test cook on the side shootergame
Change 3411131 on 2017/04/27 by Steve.Robb
TIsTriviallyDestructible now supports forward-declared enums.
Change 3411186 on 2017/04/27 by Steve.Robb
Fix for #includes in generated code for Within classes which are in a different module from the generated class.
Change 3411917 on 2017/04/27 by Steve.Robb
Fixes to pushing/popping the CPP macro.
Change 3411966 on 2017/04/27 by Steve.Robb
Include spam reduced in generated code.
Change 3412155 on 2017/04/27 by Ben.Marsh
Fix for PVS Studio warning: VFOVInRadians used instead of HFOVInRadians.
Change 3412223 on 2017/04/27 by Ben.Marsh
Fix for PVS-Studio warning: Calling SetHelperA.Num() twice.
Change 3412273 on 2017/04/27 by Ben.Marsh
Fix for PVS-Studio warning: Duplicated variable name.
Change 3412511 on 2017/04/27 by Ben.Marsh
PR #3462: Fixed PVS-Studio issues (Part 1) (Contributed by PaulEremeeff)
Change 3412582 on 2017/04/27 by Ben.Marsh
Fix for PVS-Studio warning: Incorrect variable name in copy/pasted code
Change 3413136 on 2017/04/28 by Robert.Manuszewski
Helper functions for dissolving specific GC clusters
Change 3413310 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Incorrect variable name in copy/pasted code.
Change 3413341 on 2017/04/28 by Gil.Gribb
UE4 - Add prestream capability to allow us to preload always loaded sublevels. Only turned on for Shootergame.
Change 3413351 on 2017/04/28 by Ben.Marsh
Include code analysis macros directly from Platform.h, so that macros are available to everything.
Change 3413352 on 2017/04/28 by Ben.Marsh
Fixing a few more PVS studio warnings.
Change 3413437 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Comparison is always true.
Change 3413759 on 2017/04/28 by Ben.Marsh
Suppressing warnings for PVS-Studio.
Change 3413784 on 2017/04/28 by Ben.Marsh
Fix PVS-Studio warning.
Change 3413898 on 2017/04/28 by Ben.Marsh
Fix PVS-Studio warning: Same conditional is checked twice.
Change 3413915 on 2017/04/28 by Ben.Marsh
Fix PVS-Studio warning: LHS of expression is identical to RHS.
Change 3413989 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: If CurrentGraph->SubGraphs.Num() == 1, it will always enter the first conditional block.
Change 3414053 on 2017/04/28 by Ben.Marsh
More PVS-Studio fixes.
Change 3414062 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Pointer to object goes out of scope without being freed.
Change 3414070 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Fix incorrect condition.
Change 3414071 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Array index is always zero.
Change 3414116 on 2017/04/28 by Ben.Marsh
BuildGraph: Allow marking compile tasks as unsuitable for use with the parallel executor, via an AllowParallelExecutor="false" attribute.
Change 3414160 on 2017/04/28 by Ben.Marsh
Add support for running PVS-Studio through UnrealBuildTool. To use, pass -StaticAnalyzer=PVSStudio to the build command line (similarly, the Visual C++ analyzer can now be invoked using -StaticAnalyzer=VisualCpp). A log file will be written to the Engine/Saved/PVS-Studio or <Project>/Saved/PVS-Studio directory containing diagnostics, which can be opened using the "unparsed output" filter in the PVS-Studio standalone application. High priority warnings are printed to stdout.
Change 3414237 on 2017/04/28 by Ben.Marsh
EC: Allow disabling and enabling the log preprocessor via special markers in the log.
To disable: <-- Suspend Log Parsing -->
To enable: <-- Resume Log Parsing -->
Change 3414343 on 2017/04/28 by Ben.Marsh
UBT: Exclude ThirdParty folders from PVS output.
Change 3414392 on 2017/04/28 by Ben.Marsh
Fix regular strings being casted to BSTRs; BSTRs have a hidden length prefix in the two bytes before the first character, so passing a regular TCHAR* is reading random memory.
Change 3414459 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Object goes out of scope without being freed.
Change 3414495 on 2017/04/28 by Ben.Marsh
Suppress some more PVS-Studio warnings.
Change 3414514 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Testing WorldType being equal to EditorPreview and not equal to Inactive is redundant; changing to match description in comment instead.
Change 3414526 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Variable assigned to itself has no effect.
Change 3415183 on 2017/04/29 by Ben.Marsh
Fix conflict in macro definitions for ENABLE_HTTP_FOR_NFS - rename the macro defined by NetworkFile to ENABLE_HTTP_FOR_NF. Hopefully fix CIS.
Change 3415765 on 2017/05/01 by Ben.Marsh
Suppressing PVS-Studio warning to get things building cleanly. Not sure if FContentHelper is being leaked or not.
Change 3415853 on 2017/05/01 by Ben.Marsh
EC: Fix jobs never completing if a "Sync & Build" step fails. Dependent jobs should evaluate their run conditions as soon as the parent step finishes, rather than waiting for child job steps to be created.
Change 3416138 on 2017/05/01 by Ben.Marsh
Fix Fortnite cook failures. Not sure what the exact problem is here, but my hunch is that discarded "const" causes blueprint compile failures due to not being able to connect output pins between nodes for overloaded functions, or something like that.
Change 3416309 on 2017/05/01 by Ben.Marsh
Build: Fix node names for static analysis.
Change 3416360 on 2017/05/01 by Ben.Marsh
UBT: Remove unused arguments to PrepForUATPackageOrDeploy for Windows.
Change 3416398 on 2017/05/01 by Daniel.Lamb
Cook on the fly NetworkFileServerConnection Remove FileModifiedCallback delegate when the connection is closed.
#test Cook on the side shootergame.
Change 3416826 on 2017/05/01 by Daniel.Lamb
Added callback to game when files are requested reload from networkfileserver.
Game will need to unload / reload effected objects.
Working on simple reload capability in shootergame.
#test Cook on the side shootergame with reloading
Change 3417983 on 2017/05/02 by Ben.Marsh
EC: Remove warning for lines not matching p4 tag syntax when running preflights; multi-line descriptions in shelved changelists break this pattern.
Change 3418747 on 2017/05/02 by Steve.Robb
Fix for const pointer properties.
Fix for UHT debugging manifest.
Test added for pointer properties.
Change 3420477 on 2017/05/03 by Gil.Gribb
UE4 - Removed check from windows async IO layer.
[CL 3421020 by Ben Marsh in Main branch]
2017-05-03 14:18:32 -04:00
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2020-12-21 23:07:37 -04:00
|
|
|
|
using EpicGames.Core;
|
Copying //UE4/Dev-Core to //UE4/Dev-Main (Source: //UE4/Dev-Core @ 3420477)
#lockdown Nick.Penwarden
#rb none
==========================
MAJOR FEATURES + CHANGES
==========================
Change 3386262 on 2017/04/10 by Ben.Marsh
Add app-local deployment of DirectX components that are no longer included with newer versions of Windows by default (XAudio 2.7, XInput 1.3). Also add a one-click button to the packaging settings to include the default app-local dependencies, rather than having to specify the path.
Change 3386999 on 2017/04/10 by Ben.Marsh
Plugins: Add support for explicit dependencies from one plugin onto another. Required plugins can be configured in an identical manner to project files, by adding a "Plugins" key to the .uplugin file. Dependencies are automatically built and loaded, and the plugin browser will warn if you try to disable a plugin that something else has a dependency on.
Change 3387073 on 2017/04/10 by Ben.Marsh
Move FLightPropagationRuntimeSettings into the Renderer module, to remove engine dependency on a plugin.
Change 3387988 on 2017/04/11 by Steve.Robb
Comments added to clarify the role of DestructItem and DestructItems.
Change 3388085 on 2017/04/11 by Ben.Marsh
UBT: Fix bEnabled flag on plugin references being ignored. Now collect up all the plugin references in order of priority before creating plugin instances for them. Fixes CIS fail for UT.
Change 3390048 on 2017/04/12 by Richard.Hinckley
#jira UE-43876
Fixed description of Streaming settings (within Project Settings).
Change 3390697 on 2017/04/12 by Steve.Robb
CLASS_PointersDefaultToAutoWeak and CLASS_PointersDefaultToWeak removed.
Change 3390711 on 2017/04/12 by Steve.Robb
AGRESSIVE_ARRAY_FORCEINLINE removed.
Change 3392167 on 2017/04/13 by Robert.Manuszewski
UObject can be added to GC cluster only if all of its Outers can also be added to it.
Fixing asserts caused by components that are added to GC clusters even if their owner actors that can't be in GC clusters.
#jira UE-42948
Change 3392309 on 2017/04/13 by Robert.Manuszewski
When adding objects to clusters after these clusters have been created it's possible to come across objects that are already in the cluster we're adding the object to so instead of crashing, allow it.
Change 3392620 on 2017/04/13 by Ben.Marsh
UGS: Only check for updates every 5 minutes.
Change 3392623 on 2017/04/13 by Ben.Marsh
UGS: Only poll for new changes every 60 seconds.
Change 3392744 on 2017/04/13 by Ben.Marsh
UGS: Query changelist descriptions individually to determine whether changes affect code or content, to hopefully reduce Perforce server load.
Change 3392874 on 2017/04/13 by Ben.Marsh
UGS: Allow specifying regexes in the project config file which filters which changes to be displayed. Useful for changes submitted by build machines, updates to collections, etc...
Change 3392878 on 2017/04/13 by Ben.Marsh
Update UGS to version 1.96
Change 3395635 on 2017/04/17 by Ben.Marsh
UAT: Prefix log output from executing UAT commands through BuildGraph with the name of that command.
Change 3395655 on 2017/04/17 by Ben.Marsh
UAT: Add a command for syncing a DDC over the network (SyncDDC). Allows specifying a maximum size to copy, number of days worth of modified files to copy, and time limit not to be exceeded.
Change 3396989 on 2017/04/17 by Wes.Hunt
CrashReporter configurable tweaks.
* Added QueueWaitingTimeAlertThreshold (used to be hardcoded to 1 min).
- When the queue waiting time gets beyond this many seconds, trigger a slack alert message. Default is 10 min.
- Zero means never alert.
* Added DiskSpaceAvailableAlertInterval (used to be hardcoded to 1 day).
- Interval by which to report disk space availability.
- Default is never (Zero)
* Updated config file to match production config.
#codereview:jin.zhang
Change 3397656 on 2017/04/18 by Ben.Marsh
UBT: Allow modules to opt-out of getting the default include paths from being added, by setting bAddDefaultIncludePaths = false from their build.cs file.
Change 3397677 on 2017/04/18 by Robert.Manuszewski
PR #3167 : Adding more descriptive error text to DetatchLinker error check (by rooneym)
Change 3397722 on 2017/04/18 by Robert.Manuszewski
PR #2252: Increase linker reporting for failed imports (Contributed by FineRedMist)
Change 3397739 on 2017/04/18 by Richard.Hinckley
#jira UE-44100
Fixed SanitizePackageName() to remove double-slash, triple-slash, etc. from package names. Also updated CreatePackage() to call SanitizePackageName() before creating.
Change 3398023 on 2017/04/18 by Ben.Marsh
PR #3105: Cook/package with editor and debugger attached (Contributed by projectgheist)
Change 3398095 on 2017/04/18 by Ben.Marsh
PR #3051: Generate map file from UAT (Contributed by projectgheist)
Change 3398212 on 2017/04/18 by Ben.Marsh
PR #2915: UE-38232: Removed duplicate stats (Contributed by projectgheist)
Change 3399304 on 2017/04/19 by Ben.Marsh
UGS: Prevent editor target files being removed when running custom tools.
Change 3399306 on 2017/04/19 by Robert.Manuszewski
Moved InitPropertiesFromCustomList to UbLueprintGeneratedClass and made it thread safe
Change 3399729 on 2017/04/19 by Steve.Robb
Simple optimization to TBitArray::RemoveAt() when all removed bits are at the end of the array.
RemoveAtSwap() now simply decrements the count instead of calling RemoveAt().
Checks for a positive count added to RemoveAt() and RemoveAtSwap().
Change 3399750 on 2017/04/19 by Jin.Zhang
Order branch alphabetically #RB
Change 3400186 on 2017/04/19 by Steve.Robb
Per-header generated code.
Change 3401458 on 2017/04/20 by Steve.Robb
Static log categories moved out of headers to prevent duplicates when the header is included multiple times.
#jira UE-37507
Change 3401657 on 2017/04/20 by Gil.Gribb
UE4 - Simplified and reworked lock free lists and the task graph bringing all platforms under the same scheme.
Change 3401735 on 2017/04/20 by Gil.Gribb
UE4 - Updated apple platform atomics with a new clang version which is intended to be shared among all clang platforms.
Change 3403362 on 2017/04/21 by Steve.Robb
Algo::Sort() fixed to support C arrays.
Size+count versions of Also::IsSorted() deprecated.
Algo::IsSortedBy() added.
Algo::FindBy() added to allow an element to be found by projection.
Simplifications and generalizations.
Change 3404017 on 2017/04/21 by Ben.Marsh
Fix issue where referenced plugin descriptors were missing from console builds, and prevent monolithic builds from offering to disable missing plugins.
Change 3405299 on 2017/04/24 by Steve.Robb
Clarified the class of the incompatible function in the error message about incompatible BP event specifiers.
#jira UE-35106
Change 3405302 on 2017/04/24 by Ben.Marsh
UBT: Allow excluding documentation from generated project files, by setting <ProjectFileGenerator><bIncludeDocumentation>false</bIncludeDocumentation></ProjectFileGenerator> in the XML configuration file.
Change 3405629 on 2017/04/24 by Ben.Marsh
Rename CPPEnvironment to CppCompileEnvironment, to reflect the class name.
Change 3406431 on 2017/04/24 by Ben.Marsh
UAT: Fix incorrect handling of P4SubmitOptions when multiple values are present.
Change 3406670 on 2017/04/24 by Ben.Marsh
UBT: Enable warnings for classes with virtual functions and no virtual destructor (C4265 on Windows, -fdelete-non-virtual-dtor on Clang).
Change 3407080 on 2017/04/25 by Gil.Gribb
UE4 - Critical fix: Propoerly disambiguate imports with the same name and the same outer name. This fixes an assert: LocalExportIndex.IsNull.
Change 3407486 on 2017/04/25 by Gil.Gribb
UE4 - Made changes so that servers, programs and non-engine executables do not create background or high priority threads.
Change 3407495 on 2017/04/25 by Gil.Gribb
UE4 - Tweaked out XBox and Windows low level file IO.
Change 3407497 on 2017/04/25 by Gil.Gribb
UE4 - Fixed bug in the pak precacher that would result in blocks being discarded too soon, which, in turn, resulted in redudnant reads.
Change 3407705 on 2017/04/25 by Ben.Marsh
Removing most of the junk in DotNETUtilities.
Change 3409701 on 2017/04/26 by Ben.Marsh
Disable another static analyzer warning for third party libraries.
Change 3410074 on 2017/04/26 by Daniel.Lamb
Network platform file runs heart beats and responds to modified file changes.
Cook on the fly server in the editor (COTS) now detects changes to content and notifies client.
Fixed issue with network platform file not using correct sandbox.
#test cook on the side shootergame
Change 3411131 on 2017/04/27 by Steve.Robb
TIsTriviallyDestructible now supports forward-declared enums.
Change 3411186 on 2017/04/27 by Steve.Robb
Fix for #includes in generated code for Within classes which are in a different module from the generated class.
Change 3411917 on 2017/04/27 by Steve.Robb
Fixes to pushing/popping the CPP macro.
Change 3411966 on 2017/04/27 by Steve.Robb
Include spam reduced in generated code.
Change 3412155 on 2017/04/27 by Ben.Marsh
Fix for PVS Studio warning: VFOVInRadians used instead of HFOVInRadians.
Change 3412223 on 2017/04/27 by Ben.Marsh
Fix for PVS-Studio warning: Calling SetHelperA.Num() twice.
Change 3412273 on 2017/04/27 by Ben.Marsh
Fix for PVS-Studio warning: Duplicated variable name.
Change 3412511 on 2017/04/27 by Ben.Marsh
PR #3462: Fixed PVS-Studio issues (Part 1) (Contributed by PaulEremeeff)
Change 3412582 on 2017/04/27 by Ben.Marsh
Fix for PVS-Studio warning: Incorrect variable name in copy/pasted code
Change 3413136 on 2017/04/28 by Robert.Manuszewski
Helper functions for dissolving specific GC clusters
Change 3413310 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Incorrect variable name in copy/pasted code.
Change 3413341 on 2017/04/28 by Gil.Gribb
UE4 - Add prestream capability to allow us to preload always loaded sublevels. Only turned on for Shootergame.
Change 3413351 on 2017/04/28 by Ben.Marsh
Include code analysis macros directly from Platform.h, so that macros are available to everything.
Change 3413352 on 2017/04/28 by Ben.Marsh
Fixing a few more PVS studio warnings.
Change 3413437 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Comparison is always true.
Change 3413759 on 2017/04/28 by Ben.Marsh
Suppressing warnings for PVS-Studio.
Change 3413784 on 2017/04/28 by Ben.Marsh
Fix PVS-Studio warning.
Change 3413898 on 2017/04/28 by Ben.Marsh
Fix PVS-Studio warning: Same conditional is checked twice.
Change 3413915 on 2017/04/28 by Ben.Marsh
Fix PVS-Studio warning: LHS of expression is identical to RHS.
Change 3413989 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: If CurrentGraph->SubGraphs.Num() == 1, it will always enter the first conditional block.
Change 3414053 on 2017/04/28 by Ben.Marsh
More PVS-Studio fixes.
Change 3414062 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Pointer to object goes out of scope without being freed.
Change 3414070 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Fix incorrect condition.
Change 3414071 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Array index is always zero.
Change 3414116 on 2017/04/28 by Ben.Marsh
BuildGraph: Allow marking compile tasks as unsuitable for use with the parallel executor, via an AllowParallelExecutor="false" attribute.
Change 3414160 on 2017/04/28 by Ben.Marsh
Add support for running PVS-Studio through UnrealBuildTool. To use, pass -StaticAnalyzer=PVSStudio to the build command line (similarly, the Visual C++ analyzer can now be invoked using -StaticAnalyzer=VisualCpp). A log file will be written to the Engine/Saved/PVS-Studio or <Project>/Saved/PVS-Studio directory containing diagnostics, which can be opened using the "unparsed output" filter in the PVS-Studio standalone application. High priority warnings are printed to stdout.
Change 3414237 on 2017/04/28 by Ben.Marsh
EC: Allow disabling and enabling the log preprocessor via special markers in the log.
To disable: <-- Suspend Log Parsing -->
To enable: <-- Resume Log Parsing -->
Change 3414343 on 2017/04/28 by Ben.Marsh
UBT: Exclude ThirdParty folders from PVS output.
Change 3414392 on 2017/04/28 by Ben.Marsh
Fix regular strings being casted to BSTRs; BSTRs have a hidden length prefix in the two bytes before the first character, so passing a regular TCHAR* is reading random memory.
Change 3414459 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Object goes out of scope without being freed.
Change 3414495 on 2017/04/28 by Ben.Marsh
Suppress some more PVS-Studio warnings.
Change 3414514 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Testing WorldType being equal to EditorPreview and not equal to Inactive is redundant; changing to match description in comment instead.
Change 3414526 on 2017/04/28 by Ben.Marsh
Fix for PVS-Studio warning: Variable assigned to itself has no effect.
Change 3415183 on 2017/04/29 by Ben.Marsh
Fix conflict in macro definitions for ENABLE_HTTP_FOR_NFS - rename the macro defined by NetworkFile to ENABLE_HTTP_FOR_NF. Hopefully fix CIS.
Change 3415765 on 2017/05/01 by Ben.Marsh
Suppressing PVS-Studio warning to get things building cleanly. Not sure if FContentHelper is being leaked or not.
Change 3415853 on 2017/05/01 by Ben.Marsh
EC: Fix jobs never completing if a "Sync & Build" step fails. Dependent jobs should evaluate their run conditions as soon as the parent step finishes, rather than waiting for child job steps to be created.
Change 3416138 on 2017/05/01 by Ben.Marsh
Fix Fortnite cook failures. Not sure what the exact problem is here, but my hunch is that discarded "const" causes blueprint compile failures due to not being able to connect output pins between nodes for overloaded functions, or something like that.
Change 3416309 on 2017/05/01 by Ben.Marsh
Build: Fix node names for static analysis.
Change 3416360 on 2017/05/01 by Ben.Marsh
UBT: Remove unused arguments to PrepForUATPackageOrDeploy for Windows.
Change 3416398 on 2017/05/01 by Daniel.Lamb
Cook on the fly NetworkFileServerConnection Remove FileModifiedCallback delegate when the connection is closed.
#test Cook on the side shootergame.
Change 3416826 on 2017/05/01 by Daniel.Lamb
Added callback to game when files are requested reload from networkfileserver.
Game will need to unload / reload effected objects.
Working on simple reload capability in shootergame.
#test Cook on the side shootergame with reloading
Change 3417983 on 2017/05/02 by Ben.Marsh
EC: Remove warning for lines not matching p4 tag syntax when running preflights; multi-line descriptions in shelved changelists break this pattern.
Change 3418747 on 2017/05/02 by Steve.Robb
Fix for const pointer properties.
Fix for UHT debugging manifest.
Test added for pointer properties.
Change 3420477 on 2017/05/03 by Gil.Gribb
UE4 - Removed check from windows async IO layer.
[CL 3421020 by Ben Marsh in Main branch]
2017-05-03 14:18:32 -04:00
|
|
|
|
|
|
|
|
|
|
namespace AutomationTool
|
|
|
|
|
|
{
|
|
|
|
|
|
[Help("Merge one or more remote DDC shares into a local share, taking files with the newest timestamps and keeping the size below a certain limit")]
|
|
|
|
|
|
[Help("LocalDir=<Path>", "The local DDC directory to add/remove files from")]
|
|
|
|
|
|
[Help("RemoteDir=<Path>", "The remote DDC directory to pull from. May be specified multiple times.")]
|
|
|
|
|
|
[Help("MaxSize=<Size>", "Maximum size of the local DDC directory. TB/MB/GB/KB units are allowed.")]
|
|
|
|
|
|
[Help("MaxDays=<Num>", "Only copies files with modified timestamps in the past number of days.")]
|
|
|
|
|
|
[Help("TimeLimit=<Time>", "Maximum time to run for. h/m/s units are allowed.")]
|
|
|
|
|
|
class SyncDDC : BuildCommand
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Stores information about a file in the DDC
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
class CacheFile
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Relative path from the root of the DDC store
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string RelativePath;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Full path to the actual location on the store
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string FullName;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Size of the file
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public long Length;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Last time the file was written to
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public DateTime LastWriteTimeUtc;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Constructor
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="RelativePath">Relative path for this file</param>
|
|
|
|
|
|
/// <param name="File">File information</param>
|
|
|
|
|
|
public CacheFile(string RelativePath, string FullName, long Length, DateTime LastWriteTimeUtc)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.RelativePath = RelativePath;
|
|
|
|
|
|
this.FullName = FullName;
|
|
|
|
|
|
this.Length = Length;
|
|
|
|
|
|
this.LastWriteTimeUtc = LastWriteTimeUtc;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Format this object as a string for debugging
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns>Relative path to the file</returns>
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
|
{
|
|
|
|
|
|
return RelativePath;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Statistics for copying files
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
class CopyStats
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The number of files transferred
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public int NumFiles;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The number of bytes transferred
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public long NumBytes;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Execute the command
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public override void ExecuteBuild()
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
|
|
|
|
// Parse the command line arguments
|
|
|
|
|
|
string LocalDirName = ParseParamValue("LocalDir", null);
|
|
|
|
|
|
if(LocalDirName == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new AutomationException("Missing -LocalDir=... argument");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
long MaxSize;
|
|
|
|
|
|
if(!TryParseSize(ParseParamValue("MaxSize", "0mb"), out MaxSize))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new AutomationException("Invalid -MaxSize=... argument");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string[] RemoteDirNames = ParseParamValues("RemoteDir");
|
|
|
|
|
|
if(RemoteDirNames.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new AutomationException("Missing -RemoteDir=... argument");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MaxDays;
|
|
|
|
|
|
if(!int.TryParse(ParseParamValue("MaxDays", "3"), out MaxDays))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new AutomationException("Invalid -MaxDays=... argument");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int TimeLimit;
|
|
|
|
|
|
if(!TryParseTime(ParseParamValue("TimeLimit", "0m"), out TimeLimit))
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new AutomationException("Invalid -TimeLimit=... argument");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool bPreview = ParseParam("Preview");
|
|
|
|
|
|
|
|
|
|
|
|
// Make sure the source directory exists
|
|
|
|
|
|
List<DirectoryInfo> RemoteDirs = new List<DirectoryInfo>();
|
|
|
|
|
|
foreach(string RemoteDirName in RemoteDirNames)
|
|
|
|
|
|
{
|
|
|
|
|
|
DirectoryInfo RemoteDir = new DirectoryInfo(RemoteDirName);
|
|
|
|
|
|
if(!RemoteDir.Exists)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new AutomationException("Remote directory '{0}' does not exist", RemoteDirName);
|
|
|
|
|
|
}
|
|
|
|
|
|
RemoteDirs.Add(RemoteDir);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Get the local directory
|
|
|
|
|
|
DirectoryInfo LocalDir = new DirectoryInfo(LocalDirName);
|
|
|
|
|
|
if(!LocalDir.Exists)
|
|
|
|
|
|
{
|
|
|
|
|
|
LocalDir.Create();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Create all the base DDC directory names. These are three entries deep, each numbered 0-9.
|
|
|
|
|
|
List<string> BasePathPrefixes = new List<string>();
|
|
|
|
|
|
for(int IndexA = 0; IndexA <= 9; IndexA++)
|
|
|
|
|
|
{
|
|
|
|
|
|
for(int IndexB = 0; IndexB <= 9; IndexB++)
|
|
|
|
|
|
{
|
|
|
|
|
|
for(int IndexC = 0; IndexC <= 9; IndexC++)
|
|
|
|
|
|
{
|
|
|
|
|
|
BasePathPrefixes.Add(String.Format("{0}{3}{1}{3}{2}{3}", IndexA, IndexB, IndexC, Path.DirectorySeparatorChar));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Find all the local files
|
|
|
|
|
|
ConcurrentBag<CacheFile> LocalFiles = new ConcurrentBag<CacheFile>();
|
|
|
|
|
|
Console.WriteLine("Enumerating local files from {0}", LocalDir.FullName);
|
|
|
|
|
|
ForEach(BasePathPrefixes, (BasePath, Messages) => (() => EnumerateFiles(LocalDir, BasePath, LocalFiles)), "Enumerating files...");
|
|
|
|
|
|
Console.WriteLine("Found {0} files, {1}mb.", LocalFiles.Count, LocalFiles.Sum(x => x.Length) / (1024 * 1024));
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
|
|
|
|
// Find all the remote files
|
|
|
|
|
|
ConcurrentBag<CacheFile> RemoteFiles = new ConcurrentBag<CacheFile>();
|
|
|
|
|
|
foreach(DirectoryInfo RemoteDir in RemoteDirs)
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine("Enumerating remote files from {0}", RemoteDir.FullName);
|
|
|
|
|
|
ForEach(BasePathPrefixes, (BasePath, Messages) => (() => EnumerateFiles(RemoteDir, BasePath, RemoteFiles)), "Enumerating files...");
|
|
|
|
|
|
Console.WriteLine("Found {0} files, {1}mb.", RemoteFiles.Count, RemoteFiles.Sum(x => x.Length) / (1024 * 1024));
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Get the oldest file that we want to copy
|
|
|
|
|
|
DateTime OldestLastWriteTimeUtc = DateTime.Now - TimeSpan.FromDays(MaxDays);
|
|
|
|
|
|
|
|
|
|
|
|
// Build a lookup of remote files by name
|
|
|
|
|
|
Dictionary<string, CacheFile> RelativePathToRemoteFile = new Dictionary<string, CacheFile>(StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
|
|
foreach(CacheFile RemoteFile in RemoteFiles)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(RemoteFile.LastWriteTimeUtc > OldestLastWriteTimeUtc)
|
|
|
|
|
|
{
|
|
|
|
|
|
RelativePathToRemoteFile[RemoteFile.RelativePath] = RemoteFile;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Build a lookup of local files by name
|
|
|
|
|
|
Dictionary<string, CacheFile> RelativePathToLocalFile = LocalFiles.ToDictionary(x => x.RelativePath, x => x, StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
|
|
|
|
|
|
|
|
// Build a list of target files that we want in the DDC
|
|
|
|
|
|
long TotalSize = 0;
|
|
|
|
|
|
Dictionary<string, CacheFile> RelativePathToTargetFile = new Dictionary<string, CacheFile>(StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
|
|
foreach(CacheFile TargetFile in Enumerable.Concat<CacheFile>(RelativePathToLocalFile.Values, RelativePathToRemoteFile.Values).OrderByDescending(x => x.LastWriteTimeUtc))
|
|
|
|
|
|
{
|
|
|
|
|
|
if(MaxSize > 0 && TotalSize + TargetFile.Length > MaxSize)
|
|
|
|
|
|
{
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(!RelativePathToTargetFile.ContainsKey(TargetFile.RelativePath))
|
|
|
|
|
|
{
|
|
|
|
|
|
RelativePathToTargetFile.Add(TargetFile.RelativePath, TargetFile);
|
|
|
|
|
|
TotalSize += TargetFile.Length;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Print measure of how coherent the cache is
|
|
|
|
|
|
double CoherencyPct = RelativePathToTargetFile.Values.Count(x => RelativePathToLocalFile.ContainsKey(x.RelativePath)) * 100.0 / RelativePathToTargetFile.Count;
|
|
|
|
|
|
Console.WriteLine("Cache is {0:0.0}% coherent with remote.", CoherencyPct);
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
|
|
|
|
|
|
// Remove any outdated files
|
|
|
|
|
|
List<CacheFile> FilesToRemove = RelativePathToLocalFile.Values.Where(x => !RelativePathToTargetFile.ContainsKey(x.RelativePath)).ToList();
|
|
|
|
|
|
if(bPreview)
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine("Sync would remove {0} files ({1}mb)", FilesToRemove.Count, FilesToRemove.Sum(x => x.Length) / (1024 * 1024));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if(FilesToRemove.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine("Deleting {0} files ({1}mb)...", FilesToRemove.Count, FilesToRemove.Sum(x => x.Length) / (1024 * 1024));
|
|
|
|
|
|
ForEach(FilesToRemove, (File, Messages) => (() => RemoveFile(LocalDir, File.RelativePath, Messages)), "Deleting files");
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Add any new files
|
|
|
|
|
|
List<CacheFile> FilesToAdd = RelativePathToTargetFile.Values.Where(x => !RelativePathToLocalFile.ContainsKey(x.RelativePath)).ToList();
|
|
|
|
|
|
if(bPreview)
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine("Sync would add {0} files ({1}mb)", FilesToAdd.Count, FilesToAdd.Sum(x => x.Length) / (1024 * 1024));
|
|
|
|
|
|
}
|
|
|
|
|
|
else if(FilesToAdd.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine("Copying {0} files ({1}mb)...", FilesToAdd.Count, FilesToAdd.Sum(x => x.Length) / (1024 * 1024));
|
|
|
|
|
|
|
|
|
|
|
|
CancellationTokenSource CancellationTokenSource = new CancellationTokenSource();
|
|
|
|
|
|
if (TimeLimit > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
CancellationTokenSource.CancelAfter(TimeLimit * 1000);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DateTime StartTime = DateTime.UtcNow;
|
|
|
|
|
|
CopyStats Stats = new CopyStats();
|
|
|
|
|
|
ForEach(FilesToAdd, (File, Messages) => (() => CopyFile(File, LocalDir, Messages, Stats)), "Copying files...", CancellationTokenSource.Token);
|
|
|
|
|
|
|
|
|
|
|
|
double TotalSizeMb = Stats.NumBytes / (1024.0 * 1024.0);
|
|
|
|
|
|
Console.WriteLine("Copied {0} files totalling {1:0.0}mb ({2:0.00}mb/s).", Stats.NumFiles, TotalSizeMb, TotalSizeMb / (DateTime.UtcNow - StartTime).TotalSeconds);
|
|
|
|
|
|
|
|
|
|
|
|
double FinalCoherencyPct = (RelativePathToTargetFile.Values.Count(x => RelativePathToLocalFile.ContainsKey(x.RelativePath)) + Stats.NumFiles) * 100.0 / RelativePathToTargetFile.Count;
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
Console.WriteLine("Final cache is {0:0.0}% coherent with remote.", FinalCoherencyPct);
|
|
|
|
|
|
|
|
|
|
|
|
if (CancellationTokenSource.IsCancellationRequested)
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine("Halting due to expired time limit.");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Execute a command for each item in the given list, printing progress messages and queued up error strings
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <typeparam name="T">Type of the item to process</typeparam>
|
|
|
|
|
|
/// <param name="Items">List of items</param>
|
|
|
|
|
|
/// <param name="CreateAction">Delegate which will create an action to execute for an item</param>
|
|
|
|
|
|
/// <param name="Message">Prefix to add to progress messages</param>
|
|
|
|
|
|
static void ForEach<T>(IList<T> Items, Func<T, ConcurrentQueue<string>, Action> CreateAction, string Message, CancellationToken? CancellationToken = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
using (ThreadPoolWorkQueue Queue = new ThreadPoolWorkQueue())
|
|
|
|
|
|
{
|
|
|
|
|
|
ConcurrentQueue<string> Warnings = new ConcurrentQueue<string>();
|
|
|
|
|
|
foreach(T Item in Items)
|
|
|
|
|
|
{
|
|
|
|
|
|
Action ThisAction = CreateAction(Item, Warnings);
|
|
|
|
|
|
if(CancellationToken.HasValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
Action OriginalAction = ThisAction;
|
|
|
|
|
|
CancellationToken Token = CancellationToken.Value;
|
|
|
|
|
|
ThisAction = () => { if (!Token.IsCancellationRequested) OriginalAction(); };
|
|
|
|
|
|
}
|
|
|
|
|
|
Queue.Enqueue(ThisAction);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DateTime StartTime = DateTime.UtcNow;
|
|
|
|
|
|
DateTime NextUpdateTime = DateTime.UtcNow + TimeSpan.FromSeconds(0.5);
|
|
|
|
|
|
for(;;)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool bResult = Queue.Wait(2000);
|
|
|
|
|
|
|
|
|
|
|
|
if (!CancellationToken.HasValue || !CancellationToken.Value.IsCancellationRequested)
|
|
|
|
|
|
{
|
|
|
|
|
|
DateTime CurrentTime = DateTime.UtcNow;
|
|
|
|
|
|
if (CurrentTime >= NextUpdateTime || bResult)
|
|
|
|
|
|
{
|
|
|
|
|
|
int NumRemaining = Queue.NumRemaining;
|
|
|
|
|
|
Console.WriteLine("{0} ({1}/{2}; {3}%)", Message, Items.Count - NumRemaining, Items.Count, (int)((Items.Count - NumRemaining) * 100.0f / Items.Count));
|
|
|
|
|
|
NextUpdateTime = CurrentTime + TimeSpan.FromSeconds(10.0);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(bResult)
|
|
|
|
|
|
{
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<string> WarningsList = new List<string>(Warnings);
|
|
|
|
|
|
if(WarningsList.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
const int MaxWarnings = 50;
|
|
|
|
|
|
if (WarningsList.Count > MaxWarnings)
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine("{0} warnings, showing first {1}:", WarningsList.Count, MaxWarnings);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine("{0} {1}:", WarningsList.Count, (WarningsList.Count == 1) ? "warning" : "warnings");
|
|
|
|
|
|
}
|
|
|
|
|
|
for(int Idx = 0; Idx < WarningsList.Count && Idx < MaxWarnings; Idx++)
|
|
|
|
|
|
{
|
|
|
|
|
|
Console.WriteLine(" {0}", WarningsList[Idx]);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Enumerates all the files in a given directory, and adds them to a bag
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="BaseDir">Base directory to enumerate</param>
|
|
|
|
|
|
/// <param name="PathPrefix">Path from the base directory containing files to enumerate</param>
|
|
|
|
|
|
/// <param name="Files">Collection of found files</param>
|
|
|
|
|
|
static void EnumerateFiles(DirectoryInfo BaseDir, string PathPrefix, ConcurrentBag<CacheFile> Files)
|
|
|
|
|
|
{
|
|
|
|
|
|
DirectoryInfo SearchDir = new DirectoryInfo(Path.Combine(BaseDir.FullName, PathPrefix));
|
|
|
|
|
|
if(SearchDir.Exists)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach(FileInfo File in SearchDir.EnumerateFiles("*.udd"))
|
|
|
|
|
|
{
|
|
|
|
|
|
CacheFile CacheFile = new CacheFile(PathPrefix + File.Name, File.FullName, File.Length, File.LastAccessTimeUtc);
|
|
|
|
|
|
Files.Add(CacheFile);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Copies a file from one DDC to another
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="SourceFile">File to copy</param>
|
|
|
|
|
|
/// <param name="TargetDir">Target DDC directory</param>
|
|
|
|
|
|
/// <param name="Messages">Queue to receieve error messages</param>
|
|
|
|
|
|
/// <param name="Stats">Stats for the files copied</param>
|
|
|
|
|
|
static void CopyFile(CacheFile SourceFile, DirectoryInfo TargetDir, ConcurrentQueue<string> Messages, CopyStats Stats)
|
|
|
|
|
|
{
|
|
|
|
|
|
int NumRetries = 0;
|
|
|
|
|
|
for (;;)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Try to copy the file, and return if we succeed
|
|
|
|
|
|
string Message;
|
|
|
|
|
|
if (TryCopyFile(SourceFile, TargetDir, out Message))
|
|
|
|
|
|
{
|
|
|
|
|
|
Interlocked.Increment(ref Stats.NumFiles);
|
|
|
|
|
|
Interlocked.Add(ref Stats.NumBytes, SourceFile.Length);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Increment the number of retries
|
|
|
|
|
|
NumRetries++;
|
|
|
|
|
|
|
|
|
|
|
|
// Give up after retrying 5 times, and report the last error
|
|
|
|
|
|
if (NumRetries >= 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
// Check that the source file still actually exists. If it doesn't, we'll ignore the errors.
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!File.Exists(SourceFile.FullName))
|
|
|
|
|
|
{
|
|
|
|
|
|
Interlocked.Increment(ref Stats.NumFiles);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Otherwise queue up the error message
|
|
|
|
|
|
Messages.Enqueue(Message);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Tries to copy a file from one DDC to another
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="SourceFile">File to copy</param>
|
|
|
|
|
|
/// <param name="TargetDir">Target DDC directory</param>
|
|
|
|
|
|
/// <param name="Message">Queue to receieve error messages</param>
|
|
|
|
|
|
/// <returns>True if the file was copied successfully, false otherwise</returns>
|
|
|
|
|
|
static bool TryCopyFile(CacheFile SourceFile, DirectoryInfo TargetDir, out string Message)
|
|
|
|
|
|
{
|
|
|
|
|
|
string TargetFileName = Path.Combine(TargetDir.FullName, SourceFile.RelativePath);
|
|
|
|
|
|
string IntermediateFileName = TargetFileName + ".temp";
|
|
|
|
|
|
string IntermediateDir = Path.GetDirectoryName(IntermediateFileName);
|
|
|
|
|
|
|
|
|
|
|
|
// Create the target directory
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
Directory.CreateDirectory(IntermediateDir);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception Ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
Message = String.Format("Unable to create {0}: {1}", IntermediateDir, Ex.Message.TrimEnd());
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Copy the file from the remote location to the intermediate file
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
File.Copy(SourceFile.FullName, IntermediateFileName);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception Ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
Message = String.Format("Unable to copy {0} to {1}: {2}", SourceFile.FullName, IntermediateFileName, Ex.Message.TrimEnd());
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Rename the file into place as a transactional operation
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
File.Move(IntermediateFileName, TargetFileName);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception Ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
Message = String.Format("Unable to rename {0} to {1}: {2}", IntermediateFileName, TargetFileName, Ex.Message.TrimEnd());
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Message = null;
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Removes a file from the DDC
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="BaseDir">Base directory for the DDC</param>
|
|
|
|
|
|
/// <param name="RelativePath">Relative path for the file to remove</param>
|
|
|
|
|
|
/// <param name="Messages">Queue to receieve error messages</param>
|
|
|
|
|
|
static void RemoveFile(DirectoryInfo BaseDir, string RelativePath, ConcurrentQueue<string> Messages)
|
|
|
|
|
|
{
|
|
|
|
|
|
string FileName = Path.Combine(BaseDir.FullName, RelativePath);
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
File.Delete(FileName);
|
|
|
|
|
|
}
|
|
|
|
|
|
catch(Exception Ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
Messages.Enqueue(String.Format("Unable to delete {0}: {1}", FileName, Ex.Message.TrimEnd()));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Parses a size argument as number of bytes, which may be specified in tb/gb/mb/kb units.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="Text">Text to parse</param>
|
|
|
|
|
|
/// <param name="Size">Receives the parsed argument, in bytes</param>
|
|
|
|
|
|
/// <returns>True if a size could be parsed</returns>
|
|
|
|
|
|
static bool TryParseSize(string Text, out long Size)
|
|
|
|
|
|
{
|
|
|
|
|
|
Match Match = Regex.Match(Text, "^(\\d+)(tb|gb|mb|kb)$");
|
|
|
|
|
|
if(!Match.Success)
|
|
|
|
|
|
{
|
|
|
|
|
|
Size = 0;
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Size = long.Parse(Match.Groups[1].Value);
|
|
|
|
|
|
switch(Match.Groups[2].Value.ToLowerInvariant())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "tb":
|
|
|
|
|
|
Size *= 1024 * 1024 * 1024 * 1024L;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "gb":
|
|
|
|
|
|
Size *= 1024 * 1024 * 1024L;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "mb":
|
|
|
|
|
|
Size *= 1024 * 1024L;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "kb":
|
|
|
|
|
|
Size *= 1024L;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Parses a time argument as number of seconds, which may be specified in h/m/s units.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="Text">Text to parse</param>
|
|
|
|
|
|
/// <param name="TimeSection">Receives the parsed argument, in seconds</param>
|
|
|
|
|
|
/// <returns>True if a size could be parsed</returns>
|
|
|
|
|
|
static bool TryParseTime(string Text, out int TimeSeconds)
|
|
|
|
|
|
{
|
|
|
|
|
|
Match Match = Regex.Match(Text, "^(\\d+)(h|m|s)$");
|
|
|
|
|
|
if (!Match.Success)
|
|
|
|
|
|
{
|
|
|
|
|
|
TimeSeconds = 0;
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TimeSeconds = int.Parse(Match.Groups[1].Value);
|
|
|
|
|
|
switch (Match.Groups[2].Value.ToLowerInvariant())
|
|
|
|
|
|
{
|
|
|
|
|
|
case "h":
|
|
|
|
|
|
TimeSeconds *= 60 * 60;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "m":
|
|
|
|
|
|
TimeSeconds *= 60;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|