feat: Drop support for .NET 4.6 (#2521)

This commit is contained in:
Nick Floyd
2022-08-04 12:12:49 -05:00
committed by GitHub
parent 4d46d5fb41
commit 6e72fdaa59
16 changed files with 48 additions and 111 deletions
+3 -13
View File
@@ -6,7 +6,8 @@
<Authors>GitHub</Authors>
<Version>0.0.0-dev</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AssemblyName>Octokit.Reactive</AssemblyName>
<PackageId>Octokit.Reactive</PackageId>
<DebugType>embedded</DebugType>
@@ -19,10 +20,6 @@
<Copyright>Copyright GitHub 2017</Copyright>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion>
</PropertyGroup>
<PropertyGroup>
<NoWarn>1591;1701;1702;1705</NoWarn>
</PropertyGroup>
@@ -41,14 +38,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Reactive" Version="4.4.1" />
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
</ItemGroup>
</Project>
@@ -530,34 +530,6 @@ public class RepositoriesClientTests
}
}
[IntegrationTest]
public async Task UpdatesNameObsolete()
{
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
var update = new RepositoryUpdate(updatedName);
var updatedRepository = await _github.Repository.Edit(repoContext.RepositoryOwner, repoContext.RepositoryName, update);
Assert.Equal(update.Name, updatedRepository.Name);
}
}
[IntegrationTest]
public async Task UpdatesNameWithRepositoryIdObsolete()
{
using (var repoContext = await _github.CreateUserRepositoryContext())
{
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
var update = new RepositoryUpdate(updatedName);
var updatedRepository = await _github.Repository.Edit(repoContext.RepositoryId, update);
Assert.Equal(update.Name, updatedRepository.Name);
}
}
[IntegrationTest]
public async Task UpdatesDescription()
{
@@ -811,7 +783,7 @@ public class RepositoriesClientTests
Assert.True(editedRepository.AllowAutoMerge);
}
}
[IntegrationTest]
public async Task UpdatesDeleteBranchOnMergeMethod()
{
@@ -826,7 +798,7 @@ public class RepositoriesClientTests
Assert.True(repository.DeleteBranchOnMerge);
}
}
[IntegrationTest]
public async Task UpdatesDeleteBranchOnMergeMethodWithRepositoryId()
{
@@ -1047,7 +1019,7 @@ public class RepositoriesClientTests
Assert.Equal("mit", repository.License.Key);
Assert.Equal("MIT License", repository.License.Name);
}
[IntegrationTest]
public async Task ReturnsRepositoryDeleteBranchOnMergeOptions()
{
@@ -2099,10 +2071,10 @@ public class RepositoriesClientTests
using (var repoContext = await _github.CreateUserRepositoryContext())
{
await _github.Repository.Content.CreateFile(repoContext.RepositoryOwner, repoContext.RepositoryName, ".github/codeowners", new CreateFileRequest("Create codeowners", @"* snyrting6@hotmail.com"));
// Sometimes it takes a second to create the file
Thread.Sleep(TimeSpan.FromSeconds(2));
var license = await _github.Repository.GetAllCodeOwnersErrors(repoContext.RepositoryOwner, repoContext.RepositoryName);
Assert.NotEmpty(license.Errors);
}
@@ -1129,7 +1129,7 @@ namespace Octokit.Tests.Clients
{
var connection = Substitute.For<IApiConnection>();
var client = new RepositoriesClient(connection);
var update = new RepositoryUpdate("repo");
var update = new RepositoryUpdate() { Name= "repo" };
client.Edit("owner", "repo", update);
@@ -1143,7 +1143,7 @@ namespace Octokit.Tests.Clients
{
var connection = Substitute.For<IApiConnection>();
var client = new RepositoriesClient(connection);
var update = new RepositoryUpdate("repo");
var update = new RepositoryUpdate() { Name= "repo" };
client.Edit(1, update);
@@ -1155,7 +1155,7 @@ namespace Octokit.Tests.Clients
public async Task EnsuresNonNullArguments()
{
var client = new RepositoriesClient(Substitute.For<IApiConnection>());
var update = new RepositoryUpdate("anyreponame");
var update = new RepositoryUpdate() { Name= "anyreponame" };
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Edit(null, "repo", update));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.Edit("owner", null, update));
@@ -846,7 +846,7 @@ namespace Octokit.Tests.Reactive
{
var github = Substitute.For<IGitHubClient>();
var client = new ObservableRepositoriesClient(github);
var update = new RepositoryUpdate("anyreponame");
var update = new RepositoryUpdate(){ Name= "anyreponame" };
client.Edit("owner", "repo", update);
@@ -858,7 +858,7 @@ namespace Octokit.Tests.Reactive
{
var github = Substitute.For<IGitHubClient>();
var client = new ObservableRepositoriesClient(github);
var update = new RepositoryUpdate("anyreponame");
var update = new RepositoryUpdate(){ Name= "anyreponame" };
client.Edit(1, update);
@@ -869,7 +869,7 @@ namespace Octokit.Tests.Reactive
public async Task EnsuresNonNullArguments()
{
var client = new ObservableRepositoriesClient(Substitute.For<IGitHubClient>());
var update = new RepositoryUpdate("anyreponame");
var update = new RepositoryUpdate() { Name= "anyreponame" };
Assert.Throws<ArgumentNullException>(() => client.Edit(null, "repo", update));
Assert.Throws<ArgumentNullException>(() => client.Edit("owner", null, update));
@@ -16,17 +16,6 @@ namespace Octokit
/// </summary>
public RepositoryUpdate() { }
/// <summary>
/// Creates an object that describes an update to a repository on GitHub.
/// </summary>
/// <param name="name">The name of the repository. This is the only required parameter.</param>
[Obsolete("Use the constructor with no parameters as name is no longer a required field")]
public RepositoryUpdate(string name)
{
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Name = name;
}
/// <summary>
/// Required. Gets or sets the repository name.
/// </summary>
+2 -17
View File
@@ -6,7 +6,7 @@
<Authors>GitHub</Authors>
<Version>0.0.0-dev</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Octokit</AssemblyName>
<PackageId>Octokit</PackageId>
<DebugType>embedded</DebugType>
@@ -19,26 +19,11 @@
<Copyright>Copyright GitHub 2017</Copyright>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<DefineConstants>$(DefineConstants);HAS_TYPEINFO;SIMPLE_JSON_INTERNAL;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_READONLY_COLLECTIONS;SIMPLE_JSON_TYPEINFO</DefineConstants>
<NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">
<DefineConstants>$(DefineConstants);HAS_ENVIRONMENT;HAS_REGEX_COMPILED_OPTIONS;SIMPLE_JSON_INTERNAL;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_READONLY_COLLECTIONS;HAS_SERVICEPOINTMANAGER</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);HAS_TYPEINFO;SIMPLE_JSON_INTERNAL;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_READONLY_COLLECTIONS;SIMPLE_JSON_TYPEINFO</DefineConstants>
<NoWarn>1591;1701;1702;1705</NoWarn>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
<Reference Include="System.Net.Http" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<None Include="images\octokit.png" Pack="true" PackagePath="\" />
</ItemGroup>
+3 -3
View File
@@ -1,6 +1,6 @@
using Cake.Common;
using Cake.Common.Diagnostics;
using Cake.Common.Tools.DotNetCore.Test;
using Cake.Common.Tools.DotNet.Test;
using Cake.Core;
using Cake.Core.IO;
using Cake.Frosting;
@@ -28,9 +28,9 @@ public class Context : FrostingContext
public FilePath GitVersionToolPath { get; set; }
public DotNetCoreTestSettings GetTestSettings()
public DotNetTestSettings GetTestSettings()
{
var settings = new DotNetCoreTestSettings
var settings = new DotNetTestSettings
{
Configuration = Configuration,
NoBuild = true
+2 -2
View File
@@ -51,8 +51,8 @@ public class Lifetime : FrostingLifetime<Context>
new Project { Name = "Octokit.Tests.Integration", Path = "./Octokit.Tests.Integration/Octokit.Tests.Integration.csproj", IntegrationTests = true }
};
context.GitVersionToolPath = ToolInstaller.DotNetCoreToolInstall(context, "GitVersion.Tool", "5.6.5", "dotnet-gitversion");
ToolInstaller.DotNetCoreToolInstall(context, "coverlet.console", "1.7.2", "coverlet");
context.GitVersionToolPath = ToolInstaller.DotNetToolInstall(context, "GitVersion.Tool", "5.6.5", "dotnet-gitversion");
ToolInstaller.DotNetToolInstall(context, "coverlet.console", "1.7.2", "coverlet");
// Calculate semantic version.
context.Version = BuildVersion.Calculate(context);
+3 -3
View File
@@ -1,5 +1,5 @@
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.Build;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Build;
using Cake.Core;
using Cake.Frosting;
@@ -9,7 +9,7 @@ public class Build : FrostingTask<Context>
{
public override void Run(Context context)
{
context.DotNetCoreBuild("./Octokit.sln", new DotNetCoreBuildSettings
context.DotNetBuild("./Octokit.sln", new DotNetBuildSettings
{
Configuration = context.Configuration,
ArgumentCustomization = args => args
+2 -2
View File
@@ -1,6 +1,6 @@
using System.Linq;
using Cake.Common.Diagnostics;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNet;
using Cake.Frosting;
[IsDependentOn(typeof(Build))]
@@ -11,7 +11,7 @@ public sealed class ConventionTests : FrostingTask<Context>
foreach (var project in context.Projects.Where(x => x.ConventionTests))
{
context.Information("Executing Convention Tests Project {0}...", project.Name);
context.DotNetCoreTest(project.Path.FullPath, context.GetTestSettings());
context.DotNetTest(project.Path.FullPath, context.GetTestSettings());
}
}
}
+3 -3
View File
@@ -1,7 +1,7 @@
using System.Linq;
using Cake.Common.Diagnostics;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.Test;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Test;
using Cake.Frosting;
[IsDependentOn(typeof(Build))]
@@ -12,7 +12,7 @@ public sealed class IntegrationTests : FrostingTask<Context>
foreach (var project in context.Projects.Where(x => x.IntegrationTests))
{
context.Information("Executing Integration Tests Project {0}...", project.Name);
context.DotNetCoreTest(project.Path.FullPath, context.GetTestSettings());
context.DotNetTest(project.Path.FullPath, context.GetTestSettings());
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
using Cake.Common.Diagnostics;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.Pack;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Pack;
using Cake.Core;
using Cake.Frosting;
@@ -16,7 +16,7 @@ public sealed class Package : FrostingTask<Context>
if (project.Publish)
{
context.Information("Packing {0}...", project.Name);
context.DotNetCorePack(project.Path.FullPath, new DotNetCorePackSettings()
context.DotNetPack(project.Path.FullPath, new DotNetPackSettings()
{
Configuration = context.Configuration,
NoBuild = true,
+3 -3
View File
@@ -1,5 +1,5 @@
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.Restore;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Restore;
using Cake.Core;
using Cake.Frosting;
@@ -8,7 +8,7 @@ public sealed class Restore : FrostingTask<Context>
{
public override void Run(Context context)
{
context.DotNetCoreRestore(".", new DotNetCoreRestoreSettings
context.DotNetRestore(".", new DotNetRestoreSettings
{
ArgumentCustomization = args => args
.Append("/p:Version={0}", context.Version.GetSemanticVersion())
+4 -3
View File
@@ -1,7 +1,8 @@
using System.Linq;
using Cake.Common.Diagnostics;
using Cake.Common.Tools.DotNetCore;
using Cake.Frosting;
using Cake.Common.Diagnostics;
using Cake.Common.Tools;
using Cake.Common.Tools.DotNet;
[IsDependentOn(typeof(Build))]
public sealed class UnitTests : FrostingTask<Context>
@@ -11,7 +12,7 @@ public sealed class UnitTests : FrostingTask<Context>
foreach (var project in context.Projects.Where(x => x.UnitTests))
{
context.Information("Executing Unit Tests Project {0}...", project.Name);
context.DotNetCoreTest(project.Path.FullPath, context.GetTestSettings());
context.DotNetTest(project.Path.FullPath, context.GetTestSettings());
}
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ public sealed class ValidateLINQPadSamples : FrostingTask<Context>
.Combine("Octokit.Reactive")
.Combine("bin")
.Combine(context.Configuration)
.Combine("net46")
.Combine("netstandard2.0")
.MakeAbsolute(context.Environment)
.FullPath;
+8 -8
View File
@@ -1,6 +1,6 @@
using Cake.Common.IO;
using Cake.Common.Tools.DotNetCore;
using Cake.Common.Tools.DotNetCore.Tool;
using Cake.Common.Tools.DotNet;
using Cake.Common.Tools.DotNet.Tool;
using Cake.Common.Tools.NuGet;
using Cake.Common.Tools.NuGet.Install;
using Cake.Core;
@@ -8,7 +8,7 @@ using Cake.Core.IO;
public static class ToolInstaller
{
private static DirectoryPath ToolsPath { get; } = "./tools";
private static DirectoryPath ToolsPath { get; } = "./tools";
public static void Install(ICakeContext context, string package, string version)
{
context.NuGetInstall(package, new NuGetInstallSettings
@@ -19,7 +19,7 @@ public static class ToolInstaller
});
}
public static FilePath DotNetCoreToolInstall(
public static FilePath DotNetToolInstall(
this ICakeContext context,
string package,
string version,
@@ -42,10 +42,10 @@ public static class ToolInstaller
: ".exe"
)
);
if (!context.DirectoryExists(toolInstallPath) && context.FileExists(toolPath))
{
context.DotNetCoreTool("tool", new DotNetCoreToolSettings
context.DotNetTool("tool", new DotNetToolSettings
{
ArgumentCustomization = args => args
.Append("uninstall")
@@ -56,7 +56,7 @@ public static class ToolInstaller
if (!context.FileExists(toolPath))
{
context.DotNetCoreTool("tool", new DotNetCoreToolSettings
context.DotNetTool("tool", new DotNetToolSettings
{
ArgumentCustomization = args => args
.Append("install")
@@ -73,4 +73,4 @@ public static class ToolInstaller
return toolPath;
}
}
}