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

Dotnet 8 #109

Merged
merged 4 commits into from
Mar 4, 2024
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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"isRoot": true,
"tools": {
"csharpier": {
"version": "0.25.0",
"version": "0.27.3",
"commands": [
"dotnet-csharpier"
]
}
}
}
}
4 changes: 2 additions & 2 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.400
- run: dotnet run -p build/build.csproj
dotnet-version: 8.0.201
- run: dotnet run --project build/build.csproj
1 change: 1 addition & 0 deletions Conduit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "config", "config", "{E0DF0C
Directory.Packages.props = Directory.Packages.props
Directory.Build.props = Directory.Build.props
global.json = global.json
.editorconfig = .editorconfig
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{79EC8D73-8DAD-430E-93CE-C1F29DBC33FA}"
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<AnalysisMode>Recommended</AnalysisMode>
<WarningsAsErrors>true</WarningsAsErrors>
Expand Down
29 changes: 14 additions & 15 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<Project>
<ItemGroup>
<PackageVersion Include="AutoMapper" Version="12.0.1" />
<PackageVersion Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageVersion Include="Bullseye" Version="4.2.1" />
<PackageVersion Include="AutoMapper" Version="13.0.1" />
<PackageVersion Include="Bullseye" Version="5.0.0" />
<PackageVersion Include="Glob" Version="1.1.9" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.10" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.10" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="7.0.10" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.10" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageVersion Include="Serilog" Version="3.0.1" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.2" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.2" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="Serilog" Version="3.1.1" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageVersion Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageVersion Include="MediatR" Version="12.1.1" />
<PackageVersion Include="SimpleExec" Version="11.0.0" />
<PackageVersion Include="MediatR" Version="12.2.0" />
<PackageVersion Include="SimpleExec" Version="12.0.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageVersion Include="xunit" Version="2.5.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.0"/>
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7"/>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/runtime:7.0 AS base
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["build/build.csproj", "build/"]
RUN dotnet restore "build/build.csproj"
Expand Down
12 changes: 3 additions & 9 deletions build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
ForEach("publish", "**/bin", "**/obj"),
dir =>
{
IEnumerable<string> GetDirectories(string d)
{
return Glob.Directories(".", d);
}
IEnumerable<string> GetDirectories(string d) => Glob.Directories(".", d);

void RemoveDirectory(string d)
{
Expand Down Expand Up @@ -53,10 +50,7 @@ void RemoveDirectory(string d)
DependsOn(Build),
() =>
{
IEnumerable<string> GetFiles(string d)
{
return Glob.Files(".", d);
}
IEnumerable<string> GetFiles(string d) => Glob.Files(".", d);

foreach (var file in GetFiles("tests/**/*.csproj"))
{
Expand All @@ -73,7 +67,7 @@ IEnumerable<string> GetFiles(string d)
{
Run(
"dotnet",
$"publish {project} -c Release -f net7.0 -o ./publish --no-restore --no-build --verbosity=normal"
$"publish {project} -c Release -f net8.0 -o ./publish --no-restore --no-build --verbosity=normal"
);
}
);
Expand Down
14 changes: 7 additions & 7 deletions build/packages.lock.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"version": 2,
"dependencies": {
"net7.0": {
"net8.0": {
"Bullseye": {
"type": "Direct",
"requested": "[4.2.1, )",
"resolved": "4.2.1",
"contentHash": "LQ/YuE1TSxCPfn5qGwf7RpS4jGhXEES1ylsHUNbPKdyJqbh+3VRLcxhS2aUHM9wOKaLR7uISuaiHBYc5Idfatw=="
"requested": "[5.0.0, )",
"resolved": "5.0.0",
"contentHash": "bqyt+m17ym+5aN45C5oZRAjuLDt8jKiCm/ys1XfymIXSkrTFwvI/QsbY3ucPSHDz7SF7uON7B57kXFv5H2k1ew=="
},
"Glob": {
"type": "Direct",
Expand All @@ -16,9 +16,9 @@
},
"SimpleExec": {
"type": "Direct",
"requested": "[11.0.0, )",
"resolved": "11.0.0",
"contentHash": "4r/YxcXlD9yk0XGdU07gUFey6ZiWu7LxG76l9d9xTDfObOcLvug1Xa9loQYuqs2nEviyTgicD1Svragh2qzlOA=="
"requested": "[12.0.0, )",
"resolved": "12.0.0",
"contentHash": "ptxlWtxC8vM6Y6e3h9ZTxBBkOWnWrm/Sa1HT+2i1xcXY3Hx2hmKDZP5RShPf8Xr9D+ivlrXNy57ktzyH8kyt+Q=="
}
}
}
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.306",
"version": "8.0.201",
"rollForward": "latestFeature"
}
}
1 change: 0 additions & 1 deletion src/Conduit/Conduit.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<ItemGroup>
<PackageReference Include="AutoMapper" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
Expand Down
16 changes: 8 additions & 8 deletions src/Conduit/Domain/Article.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Conduit.Domain;
public class Article
{
[JsonIgnore]
public int ArticleId { get; set; }
public int ArticleId { get; init; }

public string? Slug { get; set; }

Expand All @@ -19,12 +19,12 @@ public class Article

public string? Body { get; set; }

public Person? Author { get; set; }
public Person? Author { get; init; }

public List<Comment> Comments { get; set; } = new();
public List<Comment> Comments { get; init; } = new();

[NotMapped]
public bool Favorited => ArticleFavorites?.Any() ?? false;
public bool Favorited => ArticleFavorites.Count != 0;

[NotMapped]
public int FavoritesCount => ArticleFavorites?.Count ?? 0;
Expand All @@ -34,12 +34,12 @@ public class Article
ArticleTags.Where(x => x.TagId is not null).Select(x => x.TagId!).ToList();

[JsonIgnore]
public List<ArticleTag> ArticleTags { get; set; } = new();
public List<ArticleTag> ArticleTags { get; init; } = new();

[JsonIgnore]
public List<ArticleFavorite> ArticleFavorites { get; set; } = new();
public List<ArticleFavorite> ArticleFavorites { get; init; } = new();

public DateTime CreatedAt { get; set; }
public DateTime CreatedAt { get; init; }

public DateTime UpdatedAt { get; set; }
}
}
10 changes: 5 additions & 5 deletions src/Conduit/Domain/ArticleFavorite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ namespace Conduit.Domain;

public class ArticleFavorite
{
public int ArticleId { get; set; }
public Article? Article { get; set; }
public int ArticleId { get; init; }
public Article? Article { get; init; }

public int PersonId { get; set; }
public Person? Person { get; set; }
}
public int PersonId { get; init; }
public Person? Person { get; init; }
}
10 changes: 5 additions & 5 deletions src/Conduit/Domain/ArticleTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ namespace Conduit.Domain;

public class ArticleTag
{
public int ArticleId { get; set; }
public Article? Article { get; set; }
public int ArticleId { get; init; }
public Article? Article { get; init; }

public string? TagId { get; set; }
public Tag? Tag { get; set; }
}
public string? TagId { get; init; }
public Tag? Tag { get; init; }
}
18 changes: 9 additions & 9 deletions src/Conduit/Domain/Comment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ namespace Conduit.Domain;
public class Comment
{
[JsonPropertyName("id")]
public int CommentId { get; set; }
public int CommentId { get; init; }

public string? Body { get; set; }
public string? Body { get; init; }

public Person? Author { get; set; }
public Person? Author { get; init; }

[JsonIgnore]
public int AuthorId { get; set; }
public int AuthorId { get; init; }

[JsonIgnore]
public Article? Article { get; set; }
public Article? Article { get; init; }

[JsonIgnore]
public int ArticleId { get; set; }
public int ArticleId { get; init; }

public DateTime CreatedAt { get; set; }
public DateTime CreatedAt { get; init; }

public DateTime UpdatedAt { get; set; }
}
public DateTime UpdatedAt { get; init; }
}
10 changes: 5 additions & 5 deletions src/Conduit/Domain/FollowedPeople.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ namespace Conduit.Domain;

public class FollowedPeople
{
public int ObserverId { get; set; }
public Person? Observer { get; set; }
public int ObserverId { get; init; }
public Person? Observer { get; init; }

public int TargetId { get; set; }
public Person? Target { get; set; }
}
public int TargetId { get; init; }
public Person? Target { get; init; }
}
14 changes: 7 additions & 7 deletions src/Conduit/Domain/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Conduit.Domain;
public class Person
{
[JsonIgnore]
public int PersonId { get; set; }
public int PersonId { get; init; }

public string? Username { get; set; }

Expand All @@ -18,17 +18,17 @@ public class Person
public string? Image { get; set; }

[JsonIgnore]
public List<ArticleFavorite> ArticleFavorites { get; set; } = new();
public List<ArticleFavorite> ArticleFavorites { get; init; } = new();

[JsonIgnore]
public List<FollowedPeople> Following { get; set; } = new();
public List<FollowedPeople> Following { get; init; } = new();

[JsonIgnore]
public List<FollowedPeople> Followers { get; set; } = new();
public List<FollowedPeople> Followers { get; init; } = new();

[JsonIgnore]
public byte[] Hash { get; set; } = Array.Empty<byte>();
public byte[] Hash { get; set; } = [];

[JsonIgnore]
public byte[] Salt { get; set; } = Array.Empty<byte>();
}
public byte[] Salt { get; set; } = [];
}
6 changes: 3 additions & 3 deletions src/Conduit/Domain/Tag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace Conduit.Domain;

public class Tag
{
public string? TagId { get; set; }
public string? TagId { get; init; }

public List<ArticleTag> ArticleTags { get; set; } = new();
}
public List<ArticleTag> ArticleTags { get; init; } = new();
}
2 changes: 1 addition & 1 deletion src/Conduit/Features/Articles/ArticleEnvelope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

namespace Conduit.Features.Articles;

public record ArticleEnvelope(Article Article);
public record ArticleEnvelope(Article Article);
Loading