diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index b5c9263..581038b 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -7,6 +7,12 @@ "commands": [ "nuke" ] + }, + "hexagrams.oidccli": { + "version": "0.1.0", + "commands": [ + "dotnet-oidccli" + ] } } } \ No newline at end of file diff --git a/.github/workflows/continuous.yml b/.github/workflows/continuous.yml index ec75fa6..43220bd 100644 --- a/.github/workflows/continuous.yml +++ b/.github/workflows/continuous.yml @@ -40,8 +40,8 @@ jobs: .nuke/temp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('global.json', 'src/**/*.csproj') }} - - name: 'Run: Pack' - run: ./build.cmd Pack + - name: 'Run: Install' + run: ./build.cmd Install - name: 'Publish: packages' uses: actions/upload-artifact@v3 with: @@ -61,8 +61,8 @@ jobs: .nuke/temp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('global.json', 'src/**/*.csproj') }} - - name: 'Run: Pack' - run: ./build.cmd Pack + - name: 'Run: Install' + run: ./build.cmd Install - name: 'Publish: packages' uses: actions/upload-artifact@v3 with: @@ -82,8 +82,8 @@ jobs: .nuke/temp ~/.nuget/packages key: ${{ runner.os }}-${{ hashFiles('global.json', 'src/**/*.csproj') }} - - name: 'Run: Pack' - run: ./build.cmd Pack + - name: 'Run: Install' + run: ./build.cmd Install - name: 'Publish: packages' uses: actions/upload-artifact@v3 with: diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index b96dc6c..d630db2 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -85,6 +85,7 @@ "Clean", "Compile", "Format", + "Install", "Pack", "Push", "Restore", @@ -105,6 +106,7 @@ "Clean", "Compile", "Format", + "Install", "Pack", "Push", "Restore", diff --git a/build/Build.CI.GitHubActions.cs b/build/Build.CI.GitHubActions.cs index 2c65934..929622b 100644 --- a/build/Build.CI.GitHubActions.cs +++ b/build/Build.CI.GitHubActions.cs @@ -1,5 +1,5 @@ -using Nuke.Common.CI.GitHubActions; using Hexagrams.Nuke.Components; +using Nuke.Common.CI.GitHubActions; [GitHubActions( "continuous", @@ -10,7 +10,7 @@ OnPullRequestBranches = new[] { "main" }, OnPushBranches = new[] { "main", "release/v*" }, PublishArtifacts = true, - InvokedTargets = new[] { nameof(IPack.Pack) }, + InvokedTargets = new[] { nameof(Install) }, CacheKeyFiles = new[] { "global.json", "src/**/*.csproj" })] [GitHubActions( "release", diff --git a/build/Build.cs b/build/Build.cs index dac181b..45868be 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,12 +1,14 @@ using System.Collections.Generic; using System.Linq; +using Hexagrams.Nuke.Components; using Nuke.Common; using Nuke.Common.CI; +using Nuke.Common.IO; using Nuke.Common.ProjectModel; using Nuke.Common.Tooling; using Nuke.Common.Tools.DotNet; -using Hexagrams.Nuke.Components; -using Nuke.Common.IO; +using static Nuke.Common.ControlFlow; +using static Nuke.Common.Tools.DotNet.DotNetTasks; // ReSharper disable RedundantExtendsListEntry // ReSharper disable InconsistentNaming @@ -37,17 +39,28 @@ partial class Build : NukeBuild, public IEnumerable ExcludedFormatPaths => Enumerable.Empty(); - Target ICompile.Compile => _ => _ + Target ICompile.Compile => t => t .Inherit() .DependsOn(x => x.VerifyFormat); - Configure ICompile.PublishSettings => _ => _ - .When(!ScheduledTargets.Contains(((IPush)this).Push), _ => _ + Configure ICompile.PublishSettings => t => t + .When(!ScheduledTargets.Contains(((IPush)this).Push), s => s .ClearProperties()); - Target IPush.Push => _ => _ + Target IPush.Push => t => t .Inherit() .Consumes(this.FromComponent().Pack) .Requires(() => this.FromComponent().GitRepository.Tags.Any()) .WhenSkipped(DependencyBehavior.Execute); + + Target Install => t => t + .Description("Tests tool package installation by building and re-installing the tool locally.") + .DependsOn() + .Executes(() => + { + const string packageName = "Hexagrams.OidcCli"; + + SuppressErrors(() => DotNet($"tool uninstall {packageName}")); + DotNet($"tool install --add-source {this.FromComponent().PackagesDirectory} {packageName}"); + }); } diff --git a/build/_build.csproj b/build/_build.csproj index 013f7c4..17b5377 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -2,12 +2,15 @@ Exe - net7.0 + net8.0 CS0649;CS0169 .. .. 1 + + + true diff --git a/global.json b/global.json index acce767..c19a2e0 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "7.0.200", + "version": "8.0.100", "rollForward": "latestMinor" } } diff --git a/src/Tool/Hexagrams.OidcCli.Tool.csproj b/src/Tool/Hexagrams.OidcCli.Tool.csproj index b81dd1d..2f2ce50 100644 --- a/src/Tool/Hexagrams.OidcCli.Tool.csproj +++ b/src/Tool/Hexagrams.OidcCli.Tool.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 enable enable diff --git a/src/Tool/Program.cs b/src/Tool/Program.cs index 619a228..94af84f 100644 --- a/src/Tool/Program.cs +++ b/src/Tool/Program.cs @@ -1,7 +1,7 @@ using System.CommandLine; +using Hexagrams.OidcCli.Tool; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Hexagrams.OidcCli.Tool; var serviceProvider = BuildServiceProvider(); diff --git a/src/Tool/SystemBrowser.cs b/src/Tool/SystemBrowser.cs index a4f7e43..5fd03f7 100644 --- a/src/Tool/SystemBrowser.cs +++ b/src/Tool/SystemBrowser.cs @@ -13,14 +13,9 @@ namespace Hexagrams.OidcCli.Tool; /// Opens the default system browser for the purposes of performing an OpenID Connect Authorization Code /// exchange. Listens on http://127.0.0.1 with the specified port. /// -public class SystemBrowser : IBrowser +public class SystemBrowser(int port) : IBrowser { - public SystemBrowser(int port) - { - Port = port; - } - - public int Port { get; } + public int Port { get; } = port; public async Task InvokeAsync(BrowserOptions options, CancellationToken cancellationToken) {