Skip to content

Commit 5db82a9

Browse files
committed
Fixes from NUKE upgrades
1 parent a2b6bae commit 5db82a9

16 files changed

+74
-268
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dotnet_diagnostic.RS0016.severity = error
4040
dotnet_diagnostic.RS0017.severity = error
4141

4242
# we should care more about this one day
43-
dotnet_diagnostic.RS0041.severity = warn
43+
dotnet_diagnostic.RS0041.severity = error
4444

4545
# public api warnings silk.net doesn't care about
4646
dotnet_diagnostic.RS0026.severity = none # Don't add multiple public overloads with optional parameters

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.100-preview.6.21355.2",
3+
"version": "6.0.201",
44
"rollForward": "major"
55
}
66
}

src/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<PropertyGroup>
1919
<Nullable>enable</Nullable>
2020
<SilkDocumentationWarningsAsErrors>CS1591;CS1573</SilkDocumentationWarningsAsErrors>
21+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
2122
</PropertyGroup>
2223
<!-- NuGet -->
2324
<PropertyGroup>

src/benchmarks/Directory.Build.props

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project>
2+
<PropertyGroup>
3+
<NoWarn>1591</NoWarn>
4+
</PropertyGroup>
5+
<Import Project="$(MSBuildThisFileDirectory)../Directory.Build.props" />
6+
</Project>

src/infrastructure/Silk.NET.NUKE/Build.CodeSigning.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
partial class Build
1616
{
17-
[Parameter("Code-signing service username")] readonly string SignUsername;
18-
[Parameter("Code-signing service password")] readonly string SignPassword;
17+
[Parameter("Code-signing service username")] readonly string? SignUsername;
18+
[Parameter("Code-signing service password")] readonly string? SignPassword;
1919
bool CanCodeSign => !string.IsNullOrWhiteSpace(SignUsername) && !string.IsNullOrWhiteSpace(SignPassword);
2020

2121
Target SignPackages => CommonTarget
@@ -29,7 +29,7 @@ partial class Build
2929
{
3030
if (!CanCodeSign)
3131
{
32-
ControlFlow.Fail("SignClient username and/or password not specified.");
32+
Assert.Fail("SignClient username and/or password not specified.");
3333
}
3434

3535
var outputs = Enumerable.Empty<Output>();

src/infrastructure/Silk.NET.NUKE/Build.Core.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Nuke.Common;
88
using Nuke.Common.Tooling;
99
using Nuke.Common.Tools.DotNet;
10+
using Serilog;
1011
using static Nuke.Common.IO.FileSystemTasks;
1112
using static Nuke.Common.Tools.DotNet.DotNetTasks;
1213
using static Nuke.Common.Tooling.ProcessTasks;
@@ -57,7 +58,7 @@ partial class Build
5758
}
5859
else
5960
{
60-
Logger.Warn("Skipping gradlew clean as the \"native\" feature-set has not been specified.");
61+
Log.Warning("Skipping gradlew clean as the \"native\" feature-set has not been specified.");
6162
}
6263

6364
return outputs;

src/infrastructure/Silk.NET.NUKE/Build.Generation.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
using System.IO;
55
using Nuke.Common;
6+
using Nuke.Common.Tooling;
67
using Nuke.Common.Tools.DotNet;
8+
using Serilog;
79
using static Nuke.Common.Tools.DotNet.DotNetTasks;
810

911
partial class Build
@@ -16,18 +18,18 @@ partial class Build
1618
(
1719
() =>
1820
{
19-
var project = OriginalSolution.GetProject("Silk.NET.BuildTools");
21+
var project = OriginalSolution.NotNull()!.GetProject("SilkTouch");
2022
if (project == default)
2123
{
22-
Logger.Error("Couldn't find BuildTools in the solution file.");
24+
Log.Error("Couldn't find SilkTouch in the solution file.");
2325
return;
2426
}
2527

2628
DotNetRun
2729
(
2830
s => s.SetProjectFile(project)
2931
.SetConfiguration("Release")
30-
.SetApplicationArguments(Path.Combine(RootDirectory, "generator.json"))
32+
.SetProcessWorkingDirectory(RootDirectory)
3133
);
3234
}
3335
)

src/infrastructure/Silk.NET.NUKE/Build.Native.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using Nuke.Common.Tools.Git;
1818
using Octokit;
1919
using Octokit.Internal;
20+
using Serilog;
2021
using static Nuke.Common.IO.CompressionTasks;
2122
using static Nuke.Common.IO.FileSystemTasks;
2223
using static Nuke.Common.IO.HttpTasks;
@@ -29,7 +30,7 @@ partial class Build
2930
{
3031
[Nuke.Common.Parameter("Build native code")] readonly bool Native;
3132

32-
[CanBeNull] string AndroidHomeValue;
33+
string? AndroidHomeValue;
3334

3435
static string JobsArg => string.IsNullOrWhiteSpace(GitHubActions.Instance?.Job)
3536
? $" -j{Environment.ProcessorCount}"
@@ -47,7 +48,7 @@ string AndroidHome
4748
var utils = RootDirectory / "build" / "utilities";
4849
DotNet($"build \"{utils / "android_probe.proj"}\" /t:GetAndroidJar");
4950
AndroidHomeValue = (AbsolutePath) File.ReadAllText(utils / "android.jar.gen.txt") / ".." / ".." / "..";
50-
Logger.Info($"Android Home: {AndroidHomeValue}");
51+
Log.Information($"Android Home: {AndroidHomeValue}");
5152
return AndroidHomeValue;
5253
}
5354
}
@@ -62,7 +63,7 @@ string AndroidHome
6263
{
6364
if (!Native)
6465
{
65-
Logger.Warn("Skipping gradlew build as the --native parameter has not been specified.");
66+
Log.Warning("Skipping gradlew build as the --native parameter has not been specified.");
6667
return Enumerable.Empty<Output>();
6768
}
6869

@@ -79,7 +80,7 @@ string AndroidHome
7980
{
8081
if (!Directory.Exists(from))
8182
{
82-
ControlFlow.Fail
83+
Assert.Fail
8384
($"\"{from}\" does not exist (did you forget to recursively clone the repo?)");
8485
}
8586

@@ -498,13 +499,13 @@ void PrUpdatedNativeBinary(string name)
498499
Git("reset --hard", RootDirectory);
499500
if (GitCurrentCommit(RootDirectory) != curCommit) // might get "nothing to commit", you never know...
500501
{
501-
Logger.Info("Checking for existing branch...");
502+
Log.Information("Checking for existing branch...");
502503
var exists = StartProcess("git", $"checkout \"{newBranch}\"", RootDirectory)
503504
.AssertWaitForExit()
504505
.ExitCode == 0;
505506
if (!exists)
506507
{
507-
Logger.Info("None found, creating a new one...");
508+
Log.Information("None found, creating a new one...");
508509
Git($"checkout -b \"{newBranch}\"");
509510
}
510511

src/infrastructure/Silk.NET.NUKE/Build.NuGet.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@
99
using Nuke.Common;
1010
using Nuke.Common.Tooling;
1111
using Nuke.Common.Tools.DotNet;
12+
using Serilog;
1213
using static Nuke.Common.Tools.DotNet.DotNetTasks;
1314

1415
partial class Build
1516
{
16-
[Parameter("The API key used to push packages and symbols packages to NuGet")] readonly string NugetApiKey;
17+
[Parameter("The API key used to push packages and symbols packages to NuGet")] readonly string? NugetApiKey;
1718
[Parameter("NuGet -NoServiceEndpoint")] readonly bool NugetNoServiceEndpoint;
1819
[Parameter("NuGet feed")] readonly string NugetFeed = "https://api.nuget.org/v3/index.json";
19-
[Parameter("NuGet username")] readonly string NugetUsername;
20-
[Parameter("NuGet password")] readonly string NugetPassword;
20+
[Parameter("NuGet username")] readonly string? NugetUsername;
21+
[Parameter("NuGet password")] readonly string? NugetPassword;
2122
static string PackageDirectory => RootDirectory / "build" / "output_packages";
2223

2324
static IEnumerable<string> Packages => Directory.GetFiles(PackageDirectory, "*.nupkg")
@@ -40,7 +41,7 @@ async Task<IEnumerable<Output>> PushPackages()
4041
.Select(x => x.Select(v => v.Value).ToList())
4142
.ToList();
4243
var first = true;
43-
Logger.Info($"Searching for packages in \"{RootDirectory / "build" / "output_packages"}\"...");
44+
Log.Information($"Searching for packages in \"{RootDirectory / "build" / "output_packages"}\"...");
4445
foreach (var files in allFiles)
4546
{
4647
if (first)
@@ -60,7 +61,7 @@ async Task<IEnumerable<Output>> PushPackages()
6061
{
6162
if (NugetUsername is null || NugetPassword is null)
6263
{
63-
ControlFlow.Fail
64+
Assert.Fail
6465
(
6566
"Both \"NugetUsername\" and \"NugetPassword\" must be specified if either are used."
6667
);

src/infrastructure/Silk.NET.NUKE/Build.PublicApi.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Nuke.Common.Tooling;
1111
using Octokit;
1212
using Octokit.Internal;
13+
using Serilog;
1314
using static Nuke.Common.Tools.Git.GitTasks;
1415
using static Nuke.Common.Tooling.ProcessTasks;
1516
using static Nuke.Common.Tools.DotNet.DotNetTasks;
@@ -136,13 +137,13 @@ void MakePr()
136137
Git("reset --hard", RootDirectory);
137138
if (GitCurrentCommit(RootDirectory) != curCommit) // might get "nothing to commit", you never know...
138139
{
139-
Logger.Info("Checking for existing branch...");
140+
Log.Information("Checking for existing branch...");
140141
var exists = StartProcess("git", $"checkout \"{newBranch}\"", RootDirectory)
141142
.AssertWaitForExit()
142143
.ExitCode == 0;
143144
if (!exists)
144145
{
145-
Logger.Info("None found, creating a new one...");
146+
Log.Information("None found, creating a new one...");
146147
Git($"checkout -b \"{newBranch}\"");
147148
}
148149

0 commit comments

Comments
 (0)