Skip to content

Commit

Permalink
upgrade .NET8 (#26)
Browse files Browse the repository at this point in the history
* upgrade .NET8
* fix bigs
  • Loading branch information
philbir authored Mar 27, 2024
1 parent 00e5706 commit 3f657f3
Show file tree
Hide file tree
Showing 29 changed files with 5,434 additions and 5,028 deletions.
77 changes: 37 additions & 40 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,45 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageVersion Include="NuGet.Protocol" Version="6.3.0" />
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.0.1" />
<PackageVersion Include="Microsoft.TeamFoundationServer.Client" Version="19.222.0-preview" />
<PackageVersion Include="Microsoft.TeamFoundationServer.ExtendedClient" Version="19.222.0-preview" />
<PackageVersion Include="Microsoft.VisualStudio.Services.Client" Version="19.222.0-preview" />
<PackageVersion Include="Microsoft.VisualStudio.Services.Release.Client" Version="19.222.0-preview" />
<PackageVersion Include="HotChocolate.Types" Version="13.0.0-preview.52" />
<PackageVersion Include="HotChocolate.Execution" Version="13.0.0-preview.52" />
<PackageVersion Include="HotChocolate.AspNetCore" Version="13.0.0-preview.52" />
<PackageVersion Include="CliWrap" Version="3.6.3" />
<PackageVersion Include="Azure.Identity" Version="1.10.4" />
<PackageVersion Include="Azure.Security.KeyVault.Secrets" Version="4.6.0" />
<PackageVersion Include="CliWrap" Version="3.6.6" />
<PackageVersion Include="coverlet.collector" Version="6.0.2"/>
<PackageVersion Include="coverlet.msbuild" Version="6.0.2"/>
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="HotChocolate.AspNetCore" Version="13.9.0" />
<PackageVersion Include="HotChocolate.Execution" Version="13.9.0" />
<PackageVersion Include="HotChocolate.Types" Version="13.9.0" />
<PackageVersion Include="ICSharpCode.Decompiler" Version="6.2.1.6137" />
<PackageVersion Include="LibGit2Sharp" Version="0.27.2" />
<PackageVersion Include="LiteDB" Version="5.0.16" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" />
<PackageVersion Include="IdentityModel" Version="5.0.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
<PackageVersion Include="NuGet.Configuration" Version="6.3.0" />
<PackageVersion Include="semver" Version="2.2.0" />
<PackageVersion Include="Azure.Identity" Version="1.3.0" />
<PackageVersion Include="Azure.Security.KeyVault.Secrets" Version="4.3.0" />
<PackageVersion Include="Serilog" Version="2.12.0" />
<PackageVersion Include="Serilog.AspNetCore" Version="6.0.1" />
<PackageVersion Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageVersion Include="Yarp.ReverseProxy" Version="1.0.0-preview.11.21223.5" />
<PackageVersion Include="IdentityModel" Version="6.2.0" />
<PackageVersion Include="LibGit2Sharp" Version="0.29.0" />
<PackageVersion Include="LiteDB" Version="5.0.19" />
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="8.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.3" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="7.4.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.3" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="8.0.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Microsoft.TeamFoundationServer.Client" Version="19.225.1" />
<PackageVersion Include="Microsoft.TeamFoundationServer.ExtendedClient" Version="19.225.1" />
<PackageVersion Include="Microsoft.VisualStudio.Services.Client" Version="19.225.1" />
<PackageVersion Include="Microsoft.VisualStudio.Services.Release.Client" Version="19.225.1" />
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NuGet.Configuration" Version="6.9.1" />
<PackageVersion Include="NuGet.Protocol" Version="6.9.1" />
<PackageVersion Include="Octokit" Version="3.0.0" />
<PackageVersion Include="AspNet.Security.OAuth.GitHub" Version="6.0.11" />
<PackageVersion Include="System.IdentityModel.Tokens.Jwt" Version="6.23.1" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.9" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.9" />

<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageVersion Include="FluentAssertions" Version="6.7.0" />
<PackageVersion Include="Snapshooter.Xunit" Version="0.7.1" />
<PackageVersion Include="xunit" Version="2.4.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5"/>
<PackageVersion Include="Moq" Version="4.18.2" />
<PackageVersion Include="coverlet.collector" Version="3.1.2"/>
<PackageVersion Include="coverlet.msbuild" Version="3.1.2"/>
<PackageVersion Include="AspNet.Security.OAuth.GitHub" Version="8.0.0" />
<PackageVersion Include="semver" Version="2.3.0" />
<PackageVersion Include="Serilog" Version="3.1.1" />
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageVersion Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageVersion Include="Snapshooter.Xunit" Version="0.14.1" />
<PackageVersion Include="SonarAnalyzer.CSharp" Version="8.21.0.30542"/>
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7"/>
<PackageVersion Include="Yarp.ReverseProxy" Version="2.1.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "6.0.400"
"version": "8.0.100"
}
}
6 changes: 3 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<Import Project="$(PropsAbove)" Condition="Exists($(PropsAbove))" />

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Boost</RootNamespace>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup>
<Version Condition="$(Version) == ''">0.3.8</Version>
<Version Condition="$(Version) == ''">0.4.0-preview.4</Version>
<Product>Boost</Product>
<Authors>Philippe Birbaum</Authors>
<Company>Swiss Life</Company>
<Copyright>Copyright © 2023 Swiss Life</Copyright>
<Copyright>Copyright © 2024 Swiss Life</Copyright>
<PackageProjectUrl>https://github.com/SwissLife-OSS/Boost</PackageProjectUrl>
<RepositoryUrl>https://github.com/SwissLife-OSS/Boost.git</RepositoryUrl>
<PackageIconUrl>https://github.com/SwissLife-OSS/Boost/raw/main/images/icon_boost.png</PackageIconUrl>
Expand Down
3 changes: 0 additions & 3 deletions src/Tool/Directory.Build.props

This file was deleted.

2 changes: 0 additions & 2 deletions src/Tool/src/Boost.Abstractions/Boost.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AssemblyName>Boost.Abstractions</AssemblyName>
<RootNamespace>Boost</RootNamespace>
<PackageId>Boost.Tool.Abstractions</PackageId>
<IsPackable>true</IsPackable>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/Tool/src/Boost.AzureDevOps/Boost.AzureDevOps.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>Boost.AzureDevOps</RootNamespace>
<PackageId>Boost.Tool.AzureDevOps</PackageId>
<IsPackable>true</IsPackable>
Expand Down
3 changes: 0 additions & 3 deletions src/Tool/src/Boost.Core/Boost.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<AssemblyName>Boost.Core</AssemblyName>
<RootNamespace>Boost</RootNamespace>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
<PackageId>Boost.Tool.Core</PackageId>
Expand Down
34 changes: 21 additions & 13 deletions src/Tool/src/Boost.Core/GraphQL/Git/GitMutations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Microsoft.AspNetCore.SignalR;

namespace Boost.Core.GraphQL;


[ExtendObjectType(RootTypes.Mutation)]
public partial class GitMutations
{
Expand Down Expand Up @@ -48,21 +48,29 @@ await hubContext.Clients.All.SendAsync("consoleData",

int indexCount = 0;

foreach (WorkRoot wr in settings.WorkRoots)
try
{
var count = await repositoryIndexer.IndexWorkRootAsync(
wr,
handler,
cancellationToken);
foreach (WorkRoot wr in settings.WorkRoots)
{
var count = await repositoryIndexer.IndexWorkRootAsync(
wr,
handler,
cancellationToken);

indexCount += count;
}
indexCount += count;
}

await hubContext.Clients.All.SendAsync("consoleData",
new ShellMessage(session.Next(), "end", $"Scan completed: {indexCount}")
{
Tags = new string[] { "success" }
});
await hubContext.Clients.All.SendAsync("consoleData",
new ShellMessage(session.Next(), "end", $"Scan completed: {indexCount}")
{
Tags = new string[] { "success" }
});
}
catch (Exception ex)
{
await hubContext.Clients.All.SendAsync("consoleData",
new ShellMessage(session.Next(), "error", ex.Message) { Tags = new[] { "error" } });
}

return indexCount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using HotChocolate.Types;

namespace Boost.Core.GraphQL;


public class GitRemoteRepositoryType : ObjectType<GitRemoteRepository>
{
protected override void Configure(IObjectTypeDescriptor<GitRemoteRepository> descriptor)
Expand Down Expand Up @@ -37,7 +37,7 @@ class Resolvers
{
public Task<ConnectedService> GetConnectedServiceAsync(
[Parent] GitRemoteRepository repository,
[DataLoader] ConnectedServiceByIdDataLoader byIdDataLoader,
ConnectedServiceByIdDataLoader byIdDataLoader,
CancellationToken cancellationToken)
{
return byIdDataLoader.LoadAsync(repository.ServiceId, cancellationToken);
Expand Down
4 changes: 2 additions & 2 deletions src/Tool/src/Boost.Core/GraphQL/Git/LocalGitRepositoryType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using HotChocolate.Types;

namespace Boost.Core.GraphQL;


public class LocalGitRepositoryType : ObjectType<GitLocalRepository>
{
protected override void Configure(IObjectTypeDescriptor<GitLocalRepository> descriptor)
Expand Down Expand Up @@ -42,7 +42,7 @@ class Resolvers
{
public async Task<ConnectedService?> GetConnectedServiceAsync(
[Parent] GitLocalRepository repository,
[DataLoader] ConnectedServiceByIdDataLoader byIdDataLoader,
ConnectedServiceByIdDataLoader byIdDataLoader,
CancellationToken cancellationToken)
{
if (repository.RemoteServiceId.HasValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static IServiceCollection AddGraphQLServices(
.ModifyRequestOptions(m => m.IncludeExceptionDetails = true)
.AddQueryType(d => d.Name(RootTypes.Query))
.AddMutationType(d => d.Name(RootTypes.Mutation))
.ConfigureSchema( x => x.AddType(new UuidType("Uuid", defaultFormat: 'N')))
.ConfigureSchema(x => { })
.AddBoostTypes();

configure?.Invoke(builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
using System.Reflection;

namespace Boost.Infrastructure;


public class BoostApplicationContext : IBoostApplicationContext
{
public DirectoryInfo WorkingDirectory
=> GetWorkingDirectory();

public string? Version =>
Assembly.GetEntryAssembly()
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
.InformationalVersion;

Assembly.GetEntryAssembly()
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
.InformationalVersion.Split('+')[0];
private DirectoryInfo GetWorkingDirectory()
{
if (Debugger.IsAttached)
Expand Down
4 changes: 2 additions & 2 deletions src/Tool/src/Boost.Core/Security/IdentityService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using IdentityModel.Client;

namespace Boost.Security;


public class IdentityService : IIdentityService
{
private readonly IHttpClientFactory _httpClientFactory;
Expand Down Expand Up @@ -120,7 +120,7 @@ public async Task<RequestTokenResult> RequestTokenAsync(

private async Task SaveTokenAsync(TokenRequestData request, TokenModel? accessToken, CancellationToken cancellationToken)
{
var model = new TokenStoreModel($"R-{request.RequestId:N}", DateTime.UtcNow);
var model = new TokenStoreModel($"R_{request.RequestId:N}", DateTime.UtcNow);
model.RequestId = request.RequestId;

model.Tokens.Add(new TokenInfo(TokenType.Access, accessToken!.Token!)
Expand Down
9 changes: 4 additions & 5 deletions src/Tool/src/Boost.Core/Security/TokenAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Security.Claims;

namespace Boost.Security;


public class TokenAnalyzer : ITokenAnalyzer
{
static IList<ClaimCategoryMap> _categoryMap;
Expand Down Expand Up @@ -50,12 +50,11 @@ static TokenAnalyzer()
ValidTo = jwt.ValidTo.ToLocalTime(),
Claims = GetClaims(jwt.Claims)
.OrderBy(x => x.Category)
.ThenBy(x => x.Type)
.ThenBy(x => x.Type),
ExpiresIn = (int)(jwt.ValidTo - DateTime.UtcNow).TotalMinutes,
Subject = jwt.Subject
};

model.ExpiresIn = (int)(jwt.ValidTo - DateTime.UtcNow).TotalMinutes;
model.Subject = jwt.Subject;

return model;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Boost.Core.Settings;

namespace Boost.Security;


public class UserDataAuthTokenStoreReader : IAuthTokenStoreReader
{
private readonly IAuthTokenStore _authTokenStore;
Expand Down Expand Up @@ -87,9 +87,9 @@ private static TokenStoreHeader ToTokenHeader(
TokenStoreModel authData,
CancellationToken cancellationToken)
{
if (authData.Name.StartsWith("R-"))
if (authData.Name.StartsWith("R_"))
{
if (Guid.TryParse(authData.Name.Split("-").Last(), out Guid parsed))
if (Guid.TryParse(authData.Name.Split("_").Last(), out Guid parsed))
{
return await _identityRequestStore.GetByIdAsync(parsed, cancellationToken);
}
Expand Down
7 changes: 3 additions & 4 deletions src/Tool/src/Boost.Core/Web/AuthApp/AuthWebServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
using Serilog;

namespace Boost.AuthApp;


public class AuthWebServer : IAuthWebServer
{
Dictionary<RunningWebServerInfo, IHost> _hosts
= new Dictionary<RunningWebServerInfo, IHost>();
readonly Dictionary<RunningWebServerInfo, IHost> _hosts = new();

public async Task<RunningWebServerInfo> StartAsync(
StartWebServerOptions serverOptions,
Expand Down Expand Up @@ -93,7 +92,7 @@ public async Task<RunningWebServerInfo> StartAsync(
{
options.SaveTokens = authData.SaveTokens;
options.Filename = (authData.RequestId != null) ?
$"R-{authData.RequestId}" :
$"R_{authData.RequestId:N}" :
$"S-{serverOptions.Id.ToString("N").Substring(0, 8)}";
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private async Task<AuthenticateResult> ReadFileTicket()
{
try
{
byte[] data = await File.ReadAllBytesAsync(path);
var data = await File.ReadAllBytesAsync(path);
AuthenticationTicket? ticket = _ticketSerializer.Deserialize(data);

if (ticket is { })
Expand Down Expand Up @@ -123,7 +123,7 @@ private TokenStoreModel CreateStoreModel(

if (name.StartsWith("R"))
{
model.RequestId = Guid.Parse(name.Split("-").Last());
model.RequestId = Guid.Parse(name.Split("_").Last());
}

if (ticket.Properties.Items.ContainsKey(".Token.expires_at") &&
Expand Down
Loading

0 comments on commit 3f657f3

Please sign in to comment.