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

upgrade project tooling to .NET Core 3.1 #2089

Merged
merged 7 commits into from
Feb 9, 2020
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
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"sourcelink": {
"version": "3.1.1",
"commands": [
"sourcelink"
]
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/netcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup .NET Core
uses: actions/[email protected]
with:
dotnet-version: 2.1.803
dotnet-version: 3.1.101
- name: Build with dotnet
run: ./build.sh --linksources=true --verbosity=verbose
shell: bash
9 changes: 9 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project>
<PropertyGroup>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm already using Microsoft.NETFramework.ReferenceAssemblies in this project, and this workaround was due to an upgrade issue that I uncovered related to .NET Core 3.1 and Sourcelink.

The details are over here, if you wanted to follow along: shiftkey/dotnetcore-sourcelink-test-bug#1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat 👍
Thanks for sharing.

</PropertyGroup>
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>Convention-based tests for Octokit</Description>
<AssemblyTitle>Octokit.Tests.Conventions</AssemblyTitle>
<Authors>GitHub</Authors>
<TargetFrameworks>netcoreapp2.1;net452</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net452</TargetFrameworks>
<NoWarn>$(NoWarn);CS4014;CS1998</NoWarn>
<AssemblyName>Octokit.Tests.Conventions</AssemblyName>
<PackageId>Octokit.Tests.Conventions</PackageId>
Expand Down
6 changes: 3 additions & 3 deletions Octokit.Tests.Integration/Octokit.Tests.Integration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>Integration tests for Octokit</Description>
<AssemblyTitle>Octokit.Tests.Integration</AssemblyTitle>
<Authors>GitHub</Authors>
<TargetFrameworks>netcoreapp2.1;net452</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net452</TargetFrameworks>
<NoWarn>$(NoWarn);CS4014;CS1998</NoWarn>
<AssemblyName>Octokit.Tests.Integration</AssemblyName>
<PackageId>Octokit.Tests.Integration</PackageId>
Expand All @@ -19,7 +19,7 @@
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<DefineConstants>$(DefineConstants);GITHUBJWT_HELPER_AVAILABLE</DefineConstants>
</PropertyGroup>

Expand All @@ -45,7 +45,7 @@
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="GitHubJwt" Version="0.0.4" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests/Octokit.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>Tests for Octokit</Description>
<AssemblyTitle>Octokit.Tests</AssemblyTitle>
<Authors>GitHub</Authors>
<TargetFrameworks>netcoreapp2.1;net452</TargetFrameworks>
<TargetFrameworks>netcoreapp3.1;net452</TargetFrameworks>
<NoWarn>$(NoWarn);CS4014;CS1998</NoWarn>
<AssemblyName>Octokit.Tests</AssemblyName>
<PackageId>Octokit.Tests</PackageId>
Expand Down Expand Up @@ -32,7 +32,7 @@
<PackageReference Include="NSubstitute" Version="4.2.1" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<DefineConstants>$(DefineConstants);NO_SERIALIZABLE;HAS_TYPEINFO</DefineConstants>
</PropertyGroup>

Expand Down
2 changes: 0 additions & 2 deletions Octokit/Octokit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<DotNetCliToolReference Include="dotnet-sourcelink-git" Version="2.8.3" />
<DotNetCliToolReference Include="dotnet-sourcelink" Version="2.8.3" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: Visual Studio 2017
image: Visual Studio 2019

branches:
only:
Expand All @@ -16,4 +16,4 @@ test: off

artifacts:
- path: 'packaging\octokit*.nupkg'
name: OctokitPackages
name: OctokitPackages
7 changes: 7 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ $Arguments = @{
dryrun=$WhatIf;
}.GetEnumerator() | %{"--{0}=`"{1}`"" -f $_.key, $_.value };

Write-Host "Restoring global tools..."
Invoke-Expression "dotnet tool restore"
if($LASTEXITCODE -ne 0) {
Pop-Location;
exit $LASTEXITCODE;
}

# Start Cake
Push-Location
Set-Location build
Expand Down
5 changes: 4 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
echo "new limit: `ulimit -n`"
fi

echo "Restoring global tools"
dotnet tool restore

cd build
echo "Preparing Cake.Frosting build runner..."
dotnet restore

echo "Executing Cake.Frosting build runner..."
echo "dotnet run -- $@"
dotnet run -- "$@"
dotnet run -- "$@"
4 changes: 2 additions & 2 deletions build/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/Build.dll",
"program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/Build.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
Expand All @@ -25,4 +25,4 @@
"processId": "${command:pickProcess}"
}
,]
}
}
2 changes: 1 addition & 1 deletion build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion build/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public DotNetCoreTestSettings GetTestSettings()

if (!this.IsRunningOnWindows())
{
var testFramework = "netcoreapp2.1";
var testFramework = "netcoreapp3.1";

this.Information($"Running tests against {testFramework} only as we're not on Windows.");
settings.Framework = testFramework;
Expand Down
4 changes: 2 additions & 2 deletions build/Tasks/CodeCoverage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ public override void Run(Context context)
context.Information("Executing Code Coverage for Project {0}...", project.Name);

var dotNetCoreCoverage = context.CodeCoverage
.CombineWithFilePath(project.Name + "-netcoreapp2.1.xml");
.CombineWithFilePath(project.Name + "-netcoreapp3.1.xml");
coverageFiles.Add(dotNetCoreCoverage);

context.Coverlet(project, new CoverletToolSettings()
{
Configuration = context.Configuration,
Framework = "netcoreapp2.1",
Framework = "netcoreapp3.1",
Output = dotNetCoreCoverage.FullPath
});

Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "3.1.101"
}
}