Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to .NET 8 #1

Merged
merged 2 commits into from
Nov 27, 2023
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
6 changes: 6 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"commands": [
"nuke"
]
},
"hexagrams.oidccli": {
"version": "0.1.0",
"commands": [
"dotnet-oidccli"
]
}
}
}
12 changes: 6 additions & 6 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"Clean",
"Compile",
"Format",
"Install",
"Pack",
"Push",
"Restore",
Expand All @@ -105,6 +106,7 @@
"Clean",
"Compile",
"Format",
"Install",
"Pack",
"Push",
"Restore",
Expand Down
4 changes: 2 additions & 2 deletions build/Build.CI.GitHubActions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Nuke.Common.CI.GitHubActions;
using Hexagrams.Nuke.Components;
using Nuke.Common.CI.GitHubActions;

[GitHubActions(
"continuous",
Expand All @@ -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",
Expand Down
25 changes: 19 additions & 6 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -37,17 +39,28 @@ partial class Build : NukeBuild,

public IEnumerable<AbsolutePath> ExcludedFormatPaths => Enumerable.Empty<AbsolutePath>();

Target ICompile.Compile => _ => _
Target ICompile.Compile => t => t
.Inherit<ICompile>()
.DependsOn<IFormat>(x => x.VerifyFormat);

Configure<DotNetPublishSettings> ICompile.PublishSettings => _ => _
.When(!ScheduledTargets.Contains(((IPush)this).Push), _ => _
Configure<DotNetPublishSettings> ICompile.PublishSettings => t => t
.When(!ScheduledTargets.Contains(((IPush)this).Push), s => s
.ClearProperties());

Target IPush.Push => _ => _
Target IPush.Push => t => t
.Inherit<IPush>()
.Consumes(this.FromComponent<IPush>().Pack)
.Requires(() => this.FromComponent<IHasGitRepository>().GitRepository.Tags.Any())
.WhenSkipped(DependencyBehavior.Execute);

Target Install => t => t
.Description("Tests tool package installation by building and re-installing the tool locally.")
.DependsOn<IPack>()
.Executes(() =>
{
const string packageName = "Hexagrams.OidcCli";

SuppressErrors(() => DotNet($"tool uninstall {packageName}"));
DotNet($"tool install --add-source {this.FromComponent<IPack>().PackagesDirectory} {packageName}");
});
}
5 changes: 4 additions & 1 deletion build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<!-- Required to make GitVersion tooling work until this is fixed by NUKE -->
<!-- https://github.com/nuke-build/nuke/issues/818 -->
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.200",
"version": "8.0.100",
"rollForward": "latestMinor"
}
}
2 changes: 1 addition & 1 deletion src/Tool/Hexagrams.OidcCli.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Tool/Program.cs
Original file line number Diff line number Diff line change
@@ -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();

Expand Down
9 changes: 2 additions & 7 deletions src/Tool/SystemBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <c>http://127.0.0.1</c> with the specified port.
/// </summary>
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<BrowserResult> InvokeAsync(BrowserOptions options, CancellationToken cancellationToken)
{
Expand Down