UnrealBuildTool: More automated code cleanup

#rnx

[CL 25694864 by joe kirchoff in ue5-main branch]
This commit is contained in:
joe kirchoff
2023-05-30 19:36:05 -04:00
parent ec974790d6
commit 7ed1a39679
82 changed files with 32 additions and 364 deletions

View File

@@ -377,7 +377,6 @@ namespace UnrealBuildTool
string ParamArchitectureList = Arguments.GetStringOrDefault("-Architecture=", "") + Arguments.GetStringOrDefault("-Architectures=", "");
UnrealArchitectures? ParamArchitectures = UnrealArchitectures.FromString(ParamArchitectureList, Platform);
foreach (UnrealTargetConfiguration Configuration in Configurations)
{
// Create all the target descriptors for targets specified by type

View File

@@ -361,7 +361,7 @@ namespace UnrealBuildTool
/// Attribute used to mark fields which must match between targets in the shared build environment
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
class RequiresUniqueBuildEnvironmentAttribute : Attribute
sealed class RequiresUniqueBuildEnvironmentAttribute : Attribute
{
}
@@ -369,7 +369,7 @@ namespace UnrealBuildTool
/// Attribute used to mark configurable sub-objects
/// </summary>
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
class ConfigSubObjectAttribute : Attribute
sealed class ConfigSubObjectAttribute : Attribute
{
}
@@ -1030,7 +1030,6 @@ namespace UnrealBuildTool
}
private bool bCompileAgainstCoreUObjectPrivate = true;
/// <summary>
/// Enabled for builds that need to initialize the ApplicationCore module. Command line utilities do not normally need this.
/// </summary>
@@ -3255,7 +3254,6 @@ namespace UnrealBuildTool
public bool bIsEngineInstalled => Inner.bIsEngineInstalled;
public IReadOnlyList<string>? DisableUnityBuildForModules => Inner.DisableUnityBuildForModules;
public IReadOnlyList<string>? EnableOptimizeCodeForModules => Inner.EnableOptimizeCodeForModules;

View File

@@ -147,7 +147,6 @@ namespace UnrealBuildTool
}
}
#pragma warning disable 8602
#pragma warning disable 8604
/// <summary>
@@ -249,7 +248,6 @@ namespace UnrealBuildTool
GenPropsDoc.Save(GeneratedPropertiesScriptFile);
// Platform-specific configurations
string GeneratedPropertiesPlatformFile;
@@ -361,9 +359,8 @@ namespace UnrealBuildTool
{
IEnumerable<XElement> NextChunk = ElementUpsertAfter.ElementsAfterSelf(BuildGraphNamespace + "Property")
.Where(prop => prop.Attribute("Name").Value.EndsWith(FlagSuffix));
if (NextChunk
.Where(prop => prop.Attribute("Name").Value == TestName + FlagSuffix)
.Count() == 0)
if (!NextChunk
.Where(prop => prop.Attribute("Name").Value == TestName + FlagSuffix).Any())
{
XElement ElementInsert = new XElement(BuildGraphNamespace + "Property");
ElementInsert.SetAttributeValue("Name", TestName + FlagSuffix);
@@ -382,9 +379,8 @@ namespace UnrealBuildTool
{
IEnumerable<XElement> NextChunk = ElementUpsertAfter.ElementsAfterSelf(BuildGraphNamespace + "Option")
.Where(prop => prop.Attribute("Name").Value.StartsWith(OptionPrefix) && prop.Attribute("Name").Value.EndsWith(OptionSuffix));
if (NextChunk
.Where(prop => prop.Attribute("Name").Value == OptionPrefix + OptionRadix + OptionSuffix)
.Count() == 0)
if (!NextChunk
.Where(prop => prop.Attribute("Name").Value == OptionPrefix + OptionRadix + OptionSuffix).Any())
{
XElement ElementInsert = new XElement(BuildGraphNamespace + "Option");
ElementInsert.SetAttributeValue("Name", OptionPrefix + OptionRadix + OptionSuffix);

View File

@@ -747,7 +747,6 @@ namespace UnrealBuildTool
Module.SetupPrivateLinkEnvironment(this, BinaryLinkEnvironment, BinaryDependencies, LinkEnvironmentVisitedModules, ExeDir);
}
// Allow the binary dependencies to modify the link environment.
foreach (UEBuildBinary BinaryDependency in BinaryDependencies)
{
@@ -821,7 +820,6 @@ namespace UnrealBuildTool
// Allow the platform to modify the binary link environment for platform-specific resources etc.
UEBuildPlatform.GetBuildPlatform(Target.Platform).ModifyBinaryLinkEnvironment(BinaryLinkEnvironment, BinaryCompileEnvironment, Target, ToolChain, Graph);
return BinaryLinkEnvironment;
}

View File

@@ -938,7 +938,6 @@ namespace UnrealBuildTool
return new List<FileItem>();
}
public void CopyDebuggerVisualizers(UEToolChain ToolChain, IActionGraphBuilder Graph, ILogger Logger)
{
if (NatvisSourceFile != null)

View File

@@ -665,7 +665,7 @@ namespace UnrealBuildTool
{
Unity.GetAdaptiveFiles(Target, CPPFiles, InputFiles.HeaderFiles, CompileEnvironment, WorkingSet, Rules.ShortName ?? Name, IntermediateDirectory, Graph,
out List<FileItem> NormalFiles, out List<FileItem> AdaptiveFiles);
if (NormalFiles.Where(file => !file.HasExtension(".gen.cpp")).Count() == 0)
if (!NormalFiles.Where(file => !file.HasExtension(".gen.cpp")).Any())
{
NormalFiles = CPPFiles;
AdaptiveFiles.RemoveAll(new HashSet<FileItem>(NormalFiles).Contains);

View File

@@ -64,7 +64,6 @@ namespace UnrealBuildTool
return UnrealTargetPlatform.GetValidPlatforms().Where(x => UEBuildPlatform.TryGetBuildPlatform(x, out _)).Select(x => UEBuildPlatform.GetBuildPlatform(x).ArchitectureConfig);
}
/// <summary>
/// The multi-architecture mode for this platform (potentially single-architecture)
/// </summary>
@@ -101,7 +100,6 @@ namespace UnrealBuildTool
return ActiveArchitectures(ProjectFile, TargetName);
}
/// <summary>
/// Returns the set all architectures potentially supported by this project. Can be used by project file gnenerators to restrict IDE architecture options
/// Defaults to AllSupportedArchitectures
@@ -167,8 +165,6 @@ namespace UnrealBuildTool
return AllSupportedArchitectures.SingleArchitecture;
}
/// <summary>
/// Simple constructor for platforms with a single architecture
/// </summary>
@@ -190,12 +186,8 @@ namespace UnrealBuildTool
AllSupportedArchitectures = new UnrealArchitectures(SupportedArchitectures);
}
}
abstract class UEBuildPlatform
{
private static Dictionary<UnrealTargetPlatform, UEBuildPlatform> BuildPlatformDictionary = new Dictionary<UnrealTargetPlatform, UEBuildPlatform>();
@@ -296,7 +288,6 @@ namespace UnrealBuildTool
continue;
}
// We need all platforms to be registered when we run -validateplatform command to check SDK status of each
if (bIncludeNonInstalledPlatforms || InstalledPlatformInfo.IsValidPlatform(TempInst.TargetPlatform))
{
@@ -1232,7 +1223,6 @@ namespace UnrealBuildTool
{
}
/// <summary>
/// Allows the platform to modify the binary link environment before the binary is built
/// </summary>
@@ -1259,7 +1249,6 @@ namespace UnrealBuildTool
return false;
}
/// <summary>
/// Checks if platform is part of a given platform group
/// </summary>

View File

@@ -18,7 +18,6 @@ using Microsoft.Extensions.Logging;
using OpenTracing.Util;
using UnrealBuildBase;
namespace UnrealBuildTool
{
/// <summary>
@@ -98,7 +97,6 @@ namespace UnrealBuildTool
return Original;
}
/// <summary>
///
/// </summary>
@@ -199,7 +197,6 @@ namespace UnrealBuildTool
String.Join(",", GetUniqueStringRegistry().GetStringNames())));
}
/// <summary>
///
/// </summary>
@@ -459,7 +456,6 @@ namespace UnrealBuildTool
#endregion
/// <summary>
/// Return the string representation
/// </summary>
@@ -515,8 +511,6 @@ namespace UnrealBuildTool
return GetUniqueStringRegistry().HasString(Name);
}
/// <summary>
/// this group is just to lump Win32 and Win64 into Windows directories, removing the special Windows logic in MakeListOfUnsupportedPlatforms
/// </summary>
@@ -735,7 +729,6 @@ namespace UnrealBuildTool
return Name;
}
/// <summary>
///
/// </summary>
@@ -799,7 +792,6 @@ namespace UnrealBuildTool
String.Join(",", GetUniqueStringRegistry().GetStringNames())));
}
/// <summary>
///
/// </summary>
@@ -979,7 +971,6 @@ namespace UnrealBuildTool
return new UnrealArchitectures(ArchString, ValidationPlatform);
}
/// <summary>
/// The list of architecture names in this set, sorted by architecture name
/// </summary>
@@ -1244,7 +1235,6 @@ namespace UnrealBuildTool
RulesObject.DependencyListFileNames.Add(DependencyListFile);
}
// If we're compiling a plugin, and this target is monolithic, just create the object files
if (Descriptor.ForeignPlugin != null && RulesObject.LinkType == TargetLinkType.Monolithic)
{
@@ -3077,7 +3067,7 @@ namespace UnrealBuildTool
!IsRedistributable(DependencyModule) && DependencyModule.Name != AppName
);
if (NonRedistModules.Count() != 0)
if (NonRedistModules.Any())
{
IEnumerable<UEBuildModule> NonRedistDeps = AllDependencies.Where((DependantModule) =>
DependantModule.GetDirectDependencyModules().Intersect(NonRedistModules).Any()
@@ -5332,7 +5322,6 @@ namespace UnrealBuildTool
}
}
/// <summary>
/// Combines a list of paths with a base path.
/// </summary>