Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
dotnet-version: |
8.x
9.x
10.x

- name: Restore dependencies
run: dotnet restore
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
dotnet-version: |
8.x
9.x
10.x

- name: Restore dependencies
run: dotnet restore
Expand Down
8 changes: 4 additions & 4 deletions src/ProjectDiff.Core/ProjectDiff.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>ProjectDiff.Core</RootNamespace>
Expand All @@ -16,14 +16,14 @@
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.11.48"/>

<PackageReference Include="LibGit2Sharp" Version="0.31.0"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.8"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SolutionPersistence" Version="1.0.52"/>
<PackageReference Include="Microsoft.Build.Prediction" Version="1.2.31"/>
<PackageReference Include="MinVer" Version="6.0.0">
<PackageReference Include="Microsoft.Build.Prediction" Version="1.2.36" />
<PackageReference Include="MinVer" Version="6.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
37 changes: 29 additions & 8 deletions src/dotnet-proj-diff/ProjectDiffTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,42 @@

namespace ProjectDiff.Tool;

public static class ProjectDiffTool
public class ProjectDiffTool
{
public static CommandLineConfiguration BuildCli(IConsole console, TextWriter? stderr = null, TextWriter? stdout = null)
private readonly RootCommand _command;
private readonly TextWriter? _stderr;
private readonly TextWriter? _stdout;

public ProjectDiffTool(RootCommand command, TextWriter? stderr, TextWriter? stdout)
{
_command = command;
_stderr = stderr;
_stdout = stdout;
}

public static ProjectDiffTool BuildCli(IConsole console, TextWriter? stderr = null, TextWriter? stdout = null)
{
var cli = new ProjectDiffCommand(console);


return new ProjectDiffTool(cli, stderr, stdout);
}

public async Task<int> InvokeAsync(IReadOnlyList<string> args, CancellationToken cancellationToken = default)
{
var cli = new CommandLineConfiguration(new ProjectDiffCommand(console));
if (stderr is not null)
var parseResult = _command.Parse(args);

var config = new InvocationConfiguration();
if (_stderr is not null)
{
cli.Error = stderr;
config.Error = _stderr;
}

if (stdout is not null)
if (_stdout is not null)
{
cli.Output = stdout;
config.Output = _stdout;
}

return cli;
return await parseResult.InvokeAsync(config, cancellationToken);
}
}
13 changes: 7 additions & 6 deletions src/dotnet-proj-diff/dotnet-proj-diff.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackAsTool>true</PackAsTool>
Expand All @@ -16,19 +16,20 @@
<PackageReference Include="Microsoft.Build" Version="17.11.48" ExcludeAssets="runtime"/>
<PackageReference Include="Microsoft.Build.Framework" Version="17.11.48" ExcludeAssets="runtime"/>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.11.48" ExcludeAssets="runtime"/>
<PackageReference Include="Microsoft.NET.StringTools" Version="17.11.48" ExcludeAssets="runtime"/>

<PackageReference Include="Microsoft.Build.Locator" Version="1.9.1"/>
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="9.0.8"/>
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.8" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.11.2" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="10.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="10.0.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MinVer" Version="6.0.0">
<PackageReference Include="MinVer" Version="6.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta6.25358.103"/>
<PackageReference Include="System.CommandLine" Version="2.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 8 additions & 7 deletions test/ProjectDiff.Tests/ProjectDiff.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand All @@ -12,17 +12,18 @@
<PackageReference Include="Microsoft.Build" Version="17.11.48" ExcludeAssets="runtime"/>
<PackageReference Include="Microsoft.Build.Framework" Version="17.11.48" ExcludeAssets="runtime"/>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.11.48" ExcludeAssets="runtime"/>
<PackageReference Include="Microsoft.NET.StringTools" Version="17.11.48" ExcludeAssets="runtime"/>

<PackageReference Include="coverlet.collector" Version="6.0.4"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1"/>
<PackageReference Include="System.Collections.Immutable" Version="9.0.8"/>
<PackageReference Include="System.IO.Pipelines" Version="9.0.8" />
<PackageReference Include="Verify.XunitV3" Version="30.7.3"/>
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageReference Include="System.Collections.Immutable" Version="10.0.1" />
<PackageReference Include="System.IO.Pipelines" Version="10.0.1" />
<PackageReference Include="Verify.XunitV3" Version="31.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.v3" Version="3.0.1" />
<PackageReference Include="xunit.v3" Version="3.2.1" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 0 additions & 9 deletions test/ProjectDiff.Tests/Tool/ProjectDiffTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,6 @@ public async Task DetectsAddedProjectsWithDirectoryScan()
await VerifyJson(output);
}

[Fact]
public void BuildingCliIsValid()
{
var console = new TestConsole(Directory.GetCurrentDirectory());
var cli = ProjectDiffTool.BuildCli(console);
cli.ThrowIfInvalid();
}


private static async Task<string> ExecuteAndReadStdout(
TestRepository repository,
params string[] args
Expand Down
Loading