Skip to content

Commit

Permalink
Merge pull request #80 from Ellerbach/mtirion/fix-nuget-publish-and-w…
Browse files Browse the repository at this point in the history
…arnings

Added logging in pipelines. Handles styling issues in DocFxTocGenerator
  • Loading branch information
mtirionMSFT authored Nov 21, 2024
2 parents 8b09e09 + 33a90b2 commit d034831
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 47 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@ dotnet_diagnostic.CA2007.severity = none
# CA2227: Collection properties should be read only
dotnet_diagnostic.CA2227.severity = none

# IDE ruleset
# IDE0160: Namespace declaration preferences.
dotnet_diagnostic.IDE0160.severity = none
# IDE0161: Namespace declaration preferences.
dotnet_diagnostic.IDE0161.severity = none
# IDE0028: Simplify collection initialization
dotnet_diagnostic.IDE0028.severity = none
# IDE0305: Use collection expression for fluent
dotnet_diagnostic.IDE0305.severity = none
# IDE0290: Use primary constructor
dotnet_diagnostic.IDE0290.severity = none
# IDE0078: Use pattern matching
dotnet_diagnostic.IDE0078.severity = none

# C# Test file
[**/{tests,test,Tests,Test}/**.cs]

Expand Down
7 changes: 4 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ if (Test-Path -Path $solution.assetZipPath) {

# Build all dotnet projects into $solution.targetFolder as single exe's. Skip Test projects.
foreach ($sln in (Get-ChildItem -Recurse src\*\*.csproj -Exclude *.Test.*)) {
Write-Host "Start building $($sln.FullName)"
Write-Host "Building $($sln.FullName)"
& dotnet publish $sln.FullName -c Release -r win-x64 /p:PublishSingleFile=true /p:CopyOutputSymbolsToPublishDirectory=false --self-contained false -o $solution.targetFolder
Write-Host "Packing $($sln.FullName)"
& dotnet pack $sln.FullName -c Release -p:PackAsTool=true -o ./artifacts
}

# Package NuGet packages
dotnet pack ./src/DocFxCompanionTools.sln -c Release -p:PackAsTool=true -o ./artifacts
Get-ChildItem ./artifacts

# remove possible generated XML documentation files
Remove-Item "$($solution.targetFolder)\*.xml"
Expand Down
14 changes: 0 additions & 14 deletions src/DocFxCompanionTools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DocLinkChecker", "DocLinkCh
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocLinkChecker", "DocLinkChecker\DocLinkChecker\DocLinkChecker.csproj", "{AEB14801-AC47-4A41-8F37-D026D587A9EC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocLinkChecker.Test", "DocLinkChecker\DocLinkChecker.Test\DocLinkChecker.Test.csproj", "{CA07843C-47DF-459C-93CE-32D26FF0A839}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DocFxTocGenerator", "DocFxTocGenerator", "{7D8D6D5C-86A8-49E7-A3B0-B55FA4FDA2E3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocFxTocGenerator", "DocFxTocGenerator\DocFxTocGenerator\DocFxTocGenerator.csproj", "{665A85C1-3050-4B3D-9402-366C7C575090}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DocFxTocGenerator.Test", "DocFxTocGenerator\DocFxTocGenerator.Test\DocFxTocGenerator.Test.csproj", "{A9EF2D5A-8F18-4EC4-87FB-1EFE2DAD1C30}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DocFxOpenApi", "DocFxOpenApi", "{93989765-5AA6-48AB-8687-008A7577070F}"
ProjectSection(SolutionItems) = preProject
DocFxOpenApi\DocFxOpenApi.csproj = DocFxOpenApi\DocFxOpenApi.csproj
Expand All @@ -34,18 +30,10 @@ Global
{AEB14801-AC47-4A41-8F37-D026D587A9EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEB14801-AC47-4A41-8F37-D026D587A9EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEB14801-AC47-4A41-8F37-D026D587A9EC}.Release|Any CPU.Build.0 = Release|Any CPU
{CA07843C-47DF-459C-93CE-32D26FF0A839}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA07843C-47DF-459C-93CE-32D26FF0A839}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA07843C-47DF-459C-93CE-32D26FF0A839}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA07843C-47DF-459C-93CE-32D26FF0A839}.Release|Any CPU.Build.0 = Release|Any CPU
{665A85C1-3050-4B3D-9402-366C7C575090}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{665A85C1-3050-4B3D-9402-366C7C575090}.Debug|Any CPU.Build.0 = Debug|Any CPU
{665A85C1-3050-4B3D-9402-366C7C575090}.Release|Any CPU.ActiveCfg = Release|Any CPU
{665A85C1-3050-4B3D-9402-366C7C575090}.Release|Any CPU.Build.0 = Release|Any CPU
{A9EF2D5A-8F18-4EC4-87FB-1EFE2DAD1C30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A9EF2D5A-8F18-4EC4-87FB-1EFE2DAD1C30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A9EF2D5A-8F18-4EC4-87FB-1EFE2DAD1C30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A9EF2D5A-8F18-4EC4-87FB-1EFE2DAD1C30}.Release|Any CPU.Build.0 = Release|Any CPU
{8F404B68-0C29-4AE7-BC23-203841FF2825}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F404B68-0C29-4AE7-BC23-203841FF2825}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F404B68-0C29-4AE7-BC23-203841FF2825}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -56,9 +44,7 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{AEB14801-AC47-4A41-8F37-D026D587A9EC} = {B8688D6A-F828-4A54-A5A8-95137FED9902}
{CA07843C-47DF-459C-93CE-32D26FF0A839} = {B8688D6A-F828-4A54-A5A8-95137FED9902}
{665A85C1-3050-4B3D-9402-366C7C575090} = {7D8D6D5C-86A8-49E7-A3B0-B55FA4FDA2E3}
{A9EF2D5A-8F18-4EC4-87FB-1EFE2DAD1C30} = {7D8D6D5C-86A8-49E7-A3B0-B55FA4FDA2E3}
{8F404B68-0C29-4AE7-BC23-203841FF2825} = {D9BD64D8-35E7-4EAE-9A15-E127A48E179B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public ConfigFilesServiceTests(ITestOutputHelper outputHelper)
public void OrderList_GetExistingFile_ShouldBeValid()
{
// arrange
ConfigFilesService service = new(camelCasing: false, _fileService, _logger);
ConfigFilesService service = new(_fileService, _logger);

// act
var mockfile = _fileService.GetOrderFile();
Expand All @@ -58,7 +58,7 @@ public void OrderList_GetExistingFile_ShouldBeValid()
public void OrderList_GetNonExisting_ShouldBeInitialized()
{
// arrange
ConfigFilesService service = new(camelCasing: false, _fileService, _logger);
ConfigFilesService service = new(_fileService, _logger);
string folder = _fileService.AddFolder("temp");

// act
Expand All @@ -79,7 +79,7 @@ public void OrderList_GetNonExisting_ShouldBeInitialized()
public void OrderList_GetExistingWithIndex_ShouldBeOrderedCorrectly()
{
// arrange
ConfigFilesService service = new(camelCasing: false, _fileService, _logger);
ConfigFilesService service = new(_fileService, _logger);
string folder = _fileService.AddFolder("temp");
_fileService.AddFile(folder, ".order",
@"readme
Expand All @@ -105,7 +105,7 @@ public void OrderList_GetExistingWithIndex_ShouldBeOrderedCorrectly()
public void IgnoreList_GetExistingFile_ShouldBeValid()
{
// arrange
ConfigFilesService service = new(camelCasing: false, _fileService, _logger);
ConfigFilesService service = new(_fileService, _logger);

// act
var mockfile = _fileService.GetIgnoreFile();
Expand All @@ -128,7 +128,7 @@ public void IgnoreList_GetExistingFile_ShouldBeValid()
public void IgnoreList_GetNonExisting_ShouldBeInitialized()
{
// arrange
ConfigFilesService service = new(camelCasing: false, _fileService, _logger);
ConfigFilesService service = new(_fileService, _logger);
string folder = _fileService.AddFolder("temp");

// act
Expand All @@ -145,7 +145,7 @@ public void IgnoreList_GetNonExisting_ShouldBeInitialized()
public void OverrideList_GetExistingFile_ShouldBeValid()
{
// arrange
ConfigFilesService service = new(camelCasing: false, _fileService, _logger);
ConfigFilesService service = new(_fileService, _logger);

// act
var mockfile = _fileService.GetOverrideFile();
Expand All @@ -170,7 +170,7 @@ public void OverrideList_GetExistingFile_ShouldBeValid()
public void OverrideList_GetNonExisting_ShouldBeInitialized()
{
// arrange
ConfigFilesService service = new(camelCasing: false, _fileService, _logger);
ConfigFilesService service = new(_fileService, _logger);
string folder = _fileService.AddFolder("temp");

// act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public IndexServiceTests()
{
_fileService.FillDemoSet();
_logger = _mockLogger.Logger;
_config = new(camelCasing: false, _fileService, _logger);
_config = new(_fileService, _logger);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public LiquidServiceTests(ITestOutputHelper outputHelper)
_outputHelper = outputHelper;
_fileService.FillDemoSet();
_logger = _mockLogger.Logger;
_config = new(camelCasing: false, _fileService, _logger);
_config = new(_fileService, _logger);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public TableOfContentsServiceTests()
{
_fileService.FillDemoSet();
_logger = _mockLogger.Logger;
_config = new(camelCasing: false, _fileService, _logger);
_config = new(_fileService, _logger);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ContentInventoryAction(

_fileService = fileService;
_logger = logger;
_configService = new(camelCasing, fileService, logger);
_configService = new(fileService, logger);
_fileDataService = new(camelCasing, fileService, logger);
}

Expand Down Expand Up @@ -162,7 +162,7 @@ public Task<ReturnCode> RunAsync()

private void AddFiles(FolderData folder, string dirPath)
{
string[] patterns = { "*.md", "*.swagger.json" };
string[] patterns = ["*.md", "*.swagger.json"];
string patternsJoined = string.Join(", ", patterns);
EnumerationOptions caseSetting = new EnumerationOptions { MatchCasing = MatchCasing.CaseInsensitive };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public EnsureIndexAction(
/// <returns>0 on success, 1 on warning, 2 on error.</returns>
public Task<ReturnCode> RunAsync()
{
ReturnCode ret = ReturnCode.Normal;
ReturnCode ret;
_logger.LogInformation($"\n*** ENSURE INDEX STAGE.");

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,18 @@ namespace DocFxTocGenerator.ConfigFiles;
/// </summary>
public class ConfigFilesService
{
private readonly bool _camelCasing;
private readonly IFileService _fileService;
private readonly ILogger _logger;
private readonly FileInfoService _fileData;

/// <summary>
/// Initializes a new instance of the <see cref="ConfigFilesService"/> class.
/// </summary>
/// <param name="camelCasing">Use camel casing for titles.</param>
/// <param name="fileService">File service.</param>
/// <param name="logger">Logger.</param>
public ConfigFilesService(bool camelCasing, IFileService fileService, ILogger logger)
public ConfigFilesService(IFileService fileService, ILogger logger)
{
_camelCasing = camelCasing;
_fileService = fileService;
_logger = logger;

_fileData = new(_camelCasing, _fileService, _logger);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<PackageReference Include="Markdig" Version="0.37.0" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0-preview.7.24405.7" />
<PackageReference Include="Microsoft.OpenApi.Readers" Version="1.6.19" />
<PackageReference Include="Microsoft.OpenApi.Readers" Version="1.6.22" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// </copyright>
using System.Text.RegularExpressions;
using Markdig;
using Markdig.Helpers;
using Markdig.Syntax;
using Markdig.Syntax.Inlines;
using Microsoft.Extensions.Logging;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
using System.CodeDom.Compiler;
using System.Xml.Linq;
using DocFxTocGenerator.FileService;
using Microsoft.Extensions.Logging;

Expand Down
22 changes: 15 additions & 7 deletions src/DocLinkChecker/DocLinkChecker/DocLinkChecker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Markdig" Version="0.31.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="7.0.5" />
<None Include="..\README.md" Pack="true" PackagePath=""/>
<PackageReference Include="Markdig" Version="0.38.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="9.0.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
<None Include="..\README.md" Pack="true" PackagePath="" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>

0 comments on commit d034831

Please sign in to comment.