protected override void GenerateHelper() { base.GenerateHelper(); if (string.IsNullOrEmpty(SDKHelpRoot)) { SDKHelpRoot = "http://docs.aws.amazon.com/sdkfornet/v3/apidocs/"; } else if (!SDKHelpRoot.EndsWith("/")) { SDKHelpRoot = SDKHelpRoot + "/"; } Console.WriteLine("Generating web help documentation:"); Console.WriteLine(".... SDK help base URI set to {0}", SDKHelpRoot); Console.WriteLine(".... writing doc output to {0}", OutputFolder); var buildLogsPath = Path.Combine(this.Options.RootPath, "logs"); if (!Directory.Exists(buildLogsPath)) { Directory.CreateDirectory(buildLogsPath); } ServiceCmdletBaseClass = CmdletAssembly.GetType("Amazon.PowerShell.Common.ServiceCmdlet"); var logFile = Path.Combine(buildLogsPath, Name + ".dll-WebHelp.log"); var oldWriter = Console.Out; try { using (var consoleWriter = new StreamWriter(File.OpenWrite(logFile))) { Console.SetOut(consoleWriter); CleanWebHelpOutputFolder(OutputFolder); CopyWebHelpStaticFiles(OutputFolder); CreateVersionInfoFile(Path.Combine(OutputFolder, "items")); var tocWriter = new TOCWriter(Options, OutputFolder); tocWriter.AddFixedSection(); foreach (var cmdletType in CmdletTypes) { var(moduleName, serviceName) = DetermineCmdletServiceOwner(cmdletType); InspectCmdletAttributes(cmdletType); string synopsis = null; if (AWSCmdletAttribute == null) { Console.WriteLine("Unable to find AWSCmdletAttribute for type " + cmdletType.FullName); } else { var cmdletReturnAttributeType = AWSCmdletAttribute.GetType(); synopsis = cmdletReturnAttributeType.GetProperty("Synopsis").GetValue(AWSCmdletAttribute, null) as string; } foreach (var cmdletAttribute in CmdletAttributes) { var hasDynamicParams = DynamicParamsType.IsAssignableFrom(cmdletType); var typeDocumentation = DocumentationUtils.GetTypeDocumentation(cmdletType, AssemblyDocumentation); typeDocumentation = DocumentationUtils.FormatXMLForPowershell(typeDocumentation, true); Console.WriteLine("Cmdlet = {0}", cmdletType.FullName); if (hasDynamicParams) { Console.WriteLine("This cmdlet has dynamic parameters!"); } Console.WriteLine("Documentation = {0}", typeDocumentation); var cmdletName = cmdletAttribute.VerbName + "-" + cmdletAttribute.NounName; var allProperties = GetRootSimpleProperties(cmdletType); var parameterPartitioning = new CmdletParameterSetPartitions(allProperties, cmdletAttribute.DefaultParameterSetName); var serviceAbbreviation = GetServiceAbbreviation(cmdletType); var cmdletPageWriter = new CmdletPageWriter(Options, OutputFolder, serviceName, moduleName, cmdletName); WriteDetails(cmdletPageWriter, typeDocumentation, synopsis); WriteSyntax(cmdletPageWriter, cmdletName, parameterPartitioning); WriteParameters(cmdletPageWriter, cmdletName, allProperties, false); WriteParameters(cmdletPageWriter, cmdletName, allProperties, true); WriteOutputs(cmdletPageWriter, AWSCmdletOutputAttributes); WriteNotes(cmdletPageWriter); WriteExamples(cmdletPageWriter, cmdletName); WriteRelatedLinks(cmdletPageWriter, serviceAbbreviation, cmdletName); cmdletPageWriter.Write(); var legacyAlias = InspectForLegacyAliasAttribution(moduleName, cmdletName); tocWriter.AddServiceCmdlet(moduleName, serviceName, cmdletName, cmdletPageWriter.GetTOCID(), synopsis, legacyAlias); } } tocWriter.Write(); WriteLegacyAliasesPage(); } } finally { Console.SetOut(oldWriter); } }
protected override void GenerateHelper() { Console.WriteLine("Generating Native PowerShell help (Get-Help) documentation file"); base.GenerateHelper(); var buildLogsPath = Path.Combine(this.Options.RootPath, "logs"); if (!Directory.Exists(buildLogsPath)) { Directory.CreateDirectory(buildLogsPath); } var logFilename = Path.Combine(buildLogsPath, Name + ".dll-Help.log"); var oldWriter = Console.Out; try { using (var consoleWriter = new StreamWriter(File.OpenWrite(logFilename))) { Console.SetOut(consoleWriter); var outputFile = Path.Combine(this.OutputFolder, Name + PsHelpFilenameTail); var settings = new XmlWriterSettings { Indent = true }; using (var psHelpWriter = new XmlTextWriter(outputFile, Encoding.UTF8)) { psHelpWriter.Formatting = Formatting.Indented; psHelpWriter.WriteStartElement("helpItems"); psHelpWriter.WriteAttributeString("schema", "maml"); foreach (var cmdletType in CmdletTypes) { InspectCmdletAttributes(cmdletType); string synopsis = null; if (AWSCmdletAttribute == null) { Console.WriteLine("Unable to find AWSCmdletAttribute for type " + cmdletType.FullName); } else { var cmdletReturnAttributeType = AWSCmdletAttribute.GetType(); synopsis = cmdletReturnAttributeType.GetProperty("Synopsis").GetValue(AWSCmdletAttribute, null) as string; } foreach (var cmdletAttribute in CmdletAttributes) { psHelpWriter.WriteStartElement("command"); psHelpWriter.WriteAttributeString("xmlns", "maml", null, "http://schemas.microsoft.com/maml/2004/10"); psHelpWriter.WriteAttributeString("xmlns", "command", null, "http://schemas.microsoft.com/maml/dev/command/2004/10"); psHelpWriter.WriteAttributeString("xmlns", "dev", null, "http://schemas.microsoft.com/maml/dev/2004/10"); { var hasDynamicParams = DynamicParamsType.IsAssignableFrom(cmdletType); var typeDocumentation = DocumentationUtils.GetTypeDocumentation(cmdletType, AssemblyDocumentation); typeDocumentation = DocumentationUtils.FormatXMLForPowershell(typeDocumentation); Console.WriteLine("Cmdlet = {0}", cmdletType.FullName); if (hasDynamicParams) { Console.WriteLine("This cmdlet has dynamic parameters!"); } Console.WriteLine("Documentation = {0}", typeDocumentation); var cmdletName = cmdletAttribute.VerbName + "-" + cmdletAttribute.NounName; var allProperties = GetRootSimpleProperties(cmdletType); var parameterPartitioning = new CmdletParameterSetPartitions(allProperties, cmdletAttribute.DefaultParameterSetName); var serviceAbbreviation = GetServiceAbbreviation(cmdletType); WriteDetails(psHelpWriter, cmdletAttribute, typeDocumentation, cmdletName, synopsis); WriteSyntax(psHelpWriter, cmdletName, parameterPartitioning); WriteParameters(psHelpWriter, cmdletName, allProperties); WriteReturnValues(psHelpWriter, AWSCmdletOutputAttributes); WriteRelatedLinks(psHelpWriter, serviceAbbreviation, cmdletName); WriteExamples(psHelpWriter, cmdletName); } psHelpWriter.WriteEndElement(); } } psHelpWriter.WriteEndElement(); } Console.WriteLine("Verifying help file {0} using XmlDocument...", outputFile); try { var document = new XmlDocument(); document.Load(outputFile); } catch (Exception e) { Logger.LogError(e, "Error when loading file {0} as XmlDocument", outputFile); } } } finally { Console.SetOut(oldWriter); } }