// Copyright Epic Games, Inc. All Rights Reserved. using System.Threading.Tasks; using EpicGames.Core; using Microsoft.Extensions.Logging; namespace UnrealBuildTool { /// /// Generates documentation from reflection data /// [ToolMode("WriteDocumentation", ToolModeOptions.None)] class WriteDocumentationMode : ToolMode { /// /// Enum for the type of documentation to generate /// enum DocumentationType { BuildConfiguration, ModuleRules, TargetRules, } /// /// Type of documentation to generate /// [CommandLine(Required = true)] DocumentationType Type = DocumentationType.BuildConfiguration; /// /// The HTML file to write to /// [CommandLine(Required = true)] FileReference OutputFile = null!; /// /// Entry point for this command /// /// public override Task ExecuteAsync(CommandLineArguments Arguments, ILogger Logger) { Arguments.ApplyTo(this); Arguments.CheckAllArgumentsUsed(); switch (Type) { case DocumentationType.BuildConfiguration: XmlConfig.WriteDocumentation(OutputFile, Logger); break; case DocumentationType.ModuleRules: RulesDocumentation.WriteDocumentation(typeof(ModuleRules), OutputFile, Logger); break; case DocumentationType.TargetRules: RulesDocumentation.WriteDocumentation(typeof(TargetRules), OutputFile, Logger); break; default: throw new BuildException("Invalid documentation type: {0}", Type); } return Task.FromResult(0); } } }