Skip to content

Commit

Permalink
feat: Drop support for .NET 4.6 (#2521)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfloyd committed Aug 4, 2022
1 parent 4d46d5f commit 6e72fda
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 111 deletions.
16 changes: 3 additions & 13 deletions Octokit.Reactive/Octokit.Reactive.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
38 changes: 5 additions & 33 deletions Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,34 +530,6 @@ public async Task UpdatesNameWithRepositoryId()
}
}

[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()
{
Expand Down Expand Up @@ -811,7 +783,7 @@ public async Task UpdatesMergeMethodWithRepositoryId()
Assert.True(editedRepository.AllowAutoMerge);
}
}

[IntegrationTest]
public async Task UpdatesDeleteBranchOnMergeMethod()
{
Expand All @@ -826,7 +798,7 @@ public async Task UpdatesDeleteBranchOnMergeMethod()
Assert.True(repository.DeleteBranchOnMerge);
}
}

[IntegrationTest]
public async Task UpdatesDeleteBranchOnMergeMethodWithRepositoryId()
{
Expand Down Expand Up @@ -1047,7 +1019,7 @@ public async Task ReturnsSpecifiedRepositoryWithLicenseInformation()
Assert.Equal("mit", repository.License.Key);
Assert.Equal("MIT License", repository.License.Name);
}

[IntegrationTest]
public async Task ReturnsRepositoryDeleteBranchOnMergeOptions()
{
Expand Down Expand Up @@ -2099,10 +2071,10 @@ public async Task ReturnsCodeOwnersErrors()
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);
}
Expand Down
6 changes: 3 additions & 3 deletions Octokit.Tests/Clients/RepositoriesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ public void PatchesCorrectUrl()
{
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);

Expand All @@ -1143,7 +1143,7 @@ public void PatchesCorrectUrlWithRepositoryId()
{
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);

Expand All @@ -1155,7 +1155,7 @@ public void PatchesCorrectUrlWithRepositoryId()
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));
Expand Down
6 changes: 3 additions & 3 deletions Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ public void PatchsTheCorrectUrl()
{
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);

Expand All @@ -858,7 +858,7 @@ public void PatchsTheCorrectUrlWithRepositoryId()
{
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);

Expand All @@ -869,7 +869,7 @@ public void PatchsTheCorrectUrlWithRepositoryId()
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));
Expand Down
11 changes: 0 additions & 11 deletions Octokit/Models/Request/RepositoryUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ public class RepositoryUpdate
/// </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>
Expand Down
19 changes: 2 additions & 17 deletions Octokit/Octokit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions build/Context.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions build/Lifetime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public override void Setup(Context 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);
Expand Down
6 changes: 3 additions & 3 deletions build/Tasks/Build.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions build/Tasks/ConventionTests.cs
Original file line number Diff line number Diff line change
@@ -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))]
Expand All @@ -11,7 +11,7 @@ public override void Run(Context 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());
}
}
}
6 changes: 3 additions & 3 deletions build/Tasks/IntegrationTests.cs
Original file line number Diff line number Diff line change
@@ -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))]
Expand All @@ -12,7 +12,7 @@ public override void Run(Context 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());
}
}

Expand Down
6 changes: 3 additions & 3 deletions build/Tasks/Package.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -16,7 +16,7 @@ public override void Run(Context 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,
Expand Down
6 changes: 3 additions & 3 deletions build/Tasks/Restore.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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())
Expand Down
7 changes: 4 additions & 3 deletions build/Tasks/UnitTests.cs
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -11,7 +12,7 @@ public override void Run(Context 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());
}
}
}
2 changes: 1 addition & 1 deletion build/Tasks/ValidateLINQPadSamples.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public override void Run(Context context)
.Combine("Octokit.Reactive")
.Combine("bin")
.Combine(context.Configuration)
.Combine("net46")
.Combine("netstandard2.0")
.MakeAbsolute(context.Environment)
.FullPath;

Expand Down
Loading

0 comments on commit 6e72fda

Please sign in to comment.