Skip to content

Commit

Permalink
feat: target .NET 8.0 (#79)
Browse files Browse the repository at this point in the history
update development dependencies

Co-authored-by: Gregor Dostal <10714600+Gh0stWalk3r@users.noreply.github.com>
  • Loading branch information
Flash0ver and Gh0stWalk3r authored Nov 30, 2023
1 parent 5d8543e commit ee5089b
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"nuke.globaltool": {
"version": "7.0.2",
"version": "7.0.6",
"commands": [
"nuke"
]
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-dotnet@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
Expand All @@ -48,6 +49,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-dotnet@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
Expand All @@ -64,6 +66,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-dotnet@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-dotnet@v3
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
Expand Down
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
## Get latest from `dotnet new gitignore`

# dotenv files
.env

# User-specific files
*.rsuser
Expand Down Expand Up @@ -398,8 +401,8 @@ FodyWeavers.xsd
*.msp

# JetBrains Rider
.idea/
*.sln.iml
.idea

##
## Visual studio for Mac
Expand Down Expand Up @@ -477,6 +480,9 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

# Vim temporary swap files
*.swp

# NUKE
.nuke/temp/
.nuke/build.schema.json
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dotnet tool install --global FlashOWare.Tool --prerelease
## Compatibility
- requires the [.NET 6.0](https://dotnet.microsoft.com/download/dotnet/6.0) SDK
- supports the [.NET 7.0](https://dotnet.microsoft.com/download/dotnet/7.0) SDK
- supports the [.NET 8.0](https://dotnet.microsoft.com/download/dotnet/8.0) SDK

## Documentation
[README.md](./docs/README.md)
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fi

echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"

if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "NUKE_ENTERPRISE_TOKEN" != "" ]]; then
if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then
"$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true
"$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true
fi
Expand Down
2 changes: 2 additions & 0 deletions docs/CHANGELOG-Prerelease.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Prerelease Changelog
[goto Release_Changelog;](./CHANGELOG.md)

## [vNext]
### Package
- **Added** _.NET 8.0_ tool target.

## [1.0.0-prerelease1] - 2023-11-12
### Tool
Expand Down
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ Release Changelog
- with `-?|-h|--help` option to get help and usage information

### Package
- **Added** .NET tool targeting _.NET 6.0_ and _.NET 7.0_.
- **Added** .NET tool targeting _.NET 6.0_ and _.NET 7.0_ and _.NET 8.0_.

[vnext]: https://github.com/FlashOWare/FlashOWare.Tool/commits/main
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Documentation
## Compatibility
- requires the [.NET 6.0](https://dotnet.microsoft.com/download/dotnet/6.0) SDK
- supports the [.NET 7.0](https://dotnet.microsoft.com/download/dotnet/7.0) SDK
- supports the [.NET 8.0](https://dotnet.microsoft.com/download/dotnet/8.0) SDK
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.100",
"version": "8.0.100",
"rollForward": "feature"
}
}
44 changes: 28 additions & 16 deletions src/build/FlashOWare.Tool.Build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
using System;
using System.Linq;
using Nuke.Common;
using Nuke.Common.CI;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.Execution;
using Nuke.Common.Git;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Utilities.Collections;
using static Nuke.Common.EnvironmentInfo;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.DotNet.DotNetTasks;

Expand All @@ -15,13 +20,15 @@
GitHubActionsImage.MacOs12,
GitHubActionsImage.Ubuntu2204,
GitHubActionsImage.WindowsServer2022,
AutoGenerate = false,
OnPushBranches = new[] { "main" },
OnPullRequestBranches = new[] { "main" },
FetchDepth = 1,
InvokedTargets = new[] { nameof(Test), nameof(Pack) })]
[GitHubActions(
"publish",
GitHubActionsImage.Ubuntu2204,
AutoGenerate = false,
OnPushBranches = new[] { "publish" },
FetchDepth = 1,
InvokedTargets = new[] { nameof(Publish) },
Expand All @@ -30,10 +37,24 @@ class Build : NukeBuild
{
public static int Main() => Execute<Build>(x => x.Compile);

[GitRepository] readonly GitRepository GitRepository;

[Solution] readonly Solution Solution;

[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;

[GitRepository] readonly GitRepository GitRepository;
[Parameter] readonly string VersionPrefix;
[Parameter] readonly string VersionSuffix;

[Parameter] readonly string NuGetSource;

[Parameter][Secret] readonly string NuGetApiKey;

AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
AbsolutePath TestResultsDirectory => ArtifactsDirectory / "test-results";
AbsolutePath PackageDirectory => ArtifactsDirectory / "package";
AbsolutePath NuGetConfigFile => RootDirectory / "nuget.config";

Target Clean => _ => _
.Before(Restore)
Expand All @@ -47,20 +68,13 @@ class Build : NukeBuild
ArtifactsDirectory.DeleteDirectory();
});

[Solution] readonly Solution Solution;

[Parameter] readonly string VersionPrefix;
[Parameter] readonly string VersionSuffix;

[Parameter] readonly string NuGetSource;

[Parameter][Secret] readonly string NuGetApiKey;

Target Restore => _ => _
.Executes(() =>
{
DotNetRestore(_ => _
.SetProjectFile(Solution));
.SetProjectFile(Solution)
.SetConfigFile(NuGetConfigFile)
.SetNoCache(IsServerBuild));
});

Target Compile => _ => _
Expand All @@ -70,13 +84,10 @@ class Build : NukeBuild
DotNetBuild(_ => _
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.SetNoRestore(FinishedTargets.Contains(Restore)));
.SetNoRestore(FinishedTargets.Contains(Restore))
.EnableNoLogo());
});

AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
AbsolutePath TestResultsDirectory => ArtifactsDirectory / "test-results";
AbsolutePath PackageDirectory => ArtifactsDirectory / "package";

Target Test => _ => _
.DependsOn(Compile)
.Executes(() =>
Expand All @@ -85,6 +96,7 @@ class Build : NukeBuild
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.SetNoBuild(FinishedTargets.Contains(Compile))
.EnableNoLogo()
.SetResultsDirectory(TestResultsDirectory));
});

Expand Down
11 changes: 8 additions & 3 deletions src/build/FlashOWare.Tool.Build/FlashOWare.Tool.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<NoWarn>CS0649;CS0169;CA1050;CA1822;CA2211;IDE1006</NoWarn>
<NukeRootDirectory>..\..\..</NukeRootDirectory>
<NukeScriptDirectory>..\..\..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="7.0.2" />
<PackageReference Include="Nuke.Common" Version="7.0.6" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/libraries/FlashOWare.Tool.Cli/FlashOWare.Tool.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -13,7 +13,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Locator" Version="1.5.5" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.6.10" />
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="4.5.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public static LanguageVersion DefaultIfNull(this LanguageVersion? langVersion, T
TargetFramework.NetStandard20 => LanguageVersion.CSharp7_3,
TargetFramework.Net60 => LanguageVersion.CSharp10,
TargetFramework.Net70 => LanguageVersion.CSharp11,
TargetFramework.Net80 => (LanguageVersion)1200,
TargetFramework.Latest => LanguageVersion.Latest,
_ => throw new InvalidEnumArgumentException(nameof(tfm), (int)tfm, typeof(TargetFramework)),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -13,10 +13,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.2.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" PrivateAssets="all" />
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/tests/FlashOWare.Tool.Cli.Tests/Testing/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ private static string GetTargetFrameworkMoniker()
return "net6.0";
#elif NET7_0
return "net7.0";
#elif NET8_0
return "net8.0";
#else
#error TFM not implemented.
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ internal enum TargetFramework
NetStandard20,
Net60,
Net70,
Net80,

Latest,
}
Expand All @@ -23,7 +24,8 @@ public static string ToMonikerString(this TargetFramework tfm)
TargetFramework.NetStandard20 => "netstandard2.0",
TargetFramework.Net60 => "net6.0",
TargetFramework.Net70 => "net7.0",
TargetFramework.Latest => "net7.0",
TargetFramework.Net80 => "net8.0",
TargetFramework.Latest => "net8.0",
_ => throw new InvalidEnumArgumentException(nameof(tfm), (int)tfm, typeof(TargetFramework)),
};
}
Expand Down Expand Up @@ -56,6 +58,7 @@ public static string ToTargetFrameworkVersionString(this TargetFramework targetF
TargetFramework.NetStandard20 => throw new NotSupportedException(".NET Standard 2.0 is not supported."),
TargetFramework.Net60 => throw new NotSupportedException(".NET 6.0 is not supported."),
TargetFramework.Net70 => throw new NotSupportedException(".NET 7.0 is not supported."),
TargetFramework.Net80 => throw new NotSupportedException(".NET 8.0 is not supported."),
TargetFramework.Latest => throw new NotSupportedException($"{nameof(TargetFramework)} 'latest' is not supported."),
_ => throw new InvalidEnumArgumentException(nameof(targetFrameworkVersion), (int)targetFrameworkVersion, typeof(TargetFramework)),
};
Expand All @@ -69,6 +72,7 @@ public static bool IsDotNetFramework(this TargetFramework tfm)
TargetFramework.NetStandard20 => false,
TargetFramework.Net60 => false,
TargetFramework.Net70 => false,
TargetFramework.Net80 => false,
TargetFramework.Latest => false,
_ => throw new InvalidEnumArgumentException(nameof(tfm), (int)tfm, typeof(TargetFramework)),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand All @@ -13,10 +13,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="3.2.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" PrivateAssets="all" />
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/tools/FlashOWare.Tool/FlashOWare.Tool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down

0 comments on commit ee5089b

Please sign in to comment.