From 8cf4d5840e2578b3c70d0dadd9bdfd2a44735081 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sun, 9 Feb 2020 12:34:34 -0400 Subject: [PATCH] upgrade project tooling to .NET Core 3.1 (#2089) --- .config/dotnet-tools.json | 12 ++++++++++++ .github/workflows/netcore.yml | 2 +- Directory.Build.targets | 9 +++++++++ .../Octokit.Tests.Conventions.csproj | 2 +- .../Octokit.Tests.Integration.csproj | 6 +++--- Octokit.Tests/Octokit.Tests.csproj | 4 ++-- Octokit/Octokit.csproj | 2 -- appveyor.yml | 4 ++-- build.ps1 | 7 +++++++ build.sh | 5 ++++- build/.vscode/launch.json | 4 ++-- build/Build.csproj | 2 +- build/Context.cs | 2 +- build/Tasks/CodeCoverage.cs | 4 ++-- global.json | 5 +++++ 15 files changed, 52 insertions(+), 18 deletions(-) create mode 100644 .config/dotnet-tools.json create mode 100644 Directory.Build.targets create mode 100644 global.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000000..5e9a36e70e --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "sourcelink": { + "version": "3.1.1", + "commands": [ + "sourcelink" + ] + } + } +} \ No newline at end of file diff --git a/.github/workflows/netcore.yml b/.github/workflows/netcore.yml index e547219f15..87366f2a1a 100644 --- a/.github/workflows/netcore.yml +++ b/.github/workflows/netcore.yml @@ -22,7 +22,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v1.4.0 with: - dotnet-version: 2.1.803 + dotnet-version: 3.1.101 - name: Build with dotnet run: ./build.sh --linksources=true --verbosity=verbose shell: bash diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000000..f42ed479c9 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,9 @@ + + + true + $([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)')) + + + + + diff --git a/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj b/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj index 629a9c39f2..7f870ff27a 100644 --- a/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj +++ b/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj @@ -4,7 +4,7 @@ Convention-based tests for Octokit Octokit.Tests.Conventions GitHub - netcoreapp2.1;net452 + netcoreapp3.1;net452 $(NoWarn);CS4014;CS1998 Octokit.Tests.Conventions Octokit.Tests.Conventions diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj index 7e6c0b750e..29e43af0e7 100644 --- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj +++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj @@ -4,7 +4,7 @@ Integration tests for Octokit Octokit.Tests.Integration GitHub - netcoreapp2.1;net452 + netcoreapp3.1;net452 $(NoWarn);CS4014;CS1998 Octokit.Tests.Integration Octokit.Tests.Integration @@ -19,7 +19,7 @@ false - + $(DefineConstants);GITHUBJWT_HELPER_AVAILABLE @@ -45,7 +45,7 @@ - + diff --git a/Octokit.Tests/Octokit.Tests.csproj b/Octokit.Tests/Octokit.Tests.csproj index e59d0f2e50..f5dcb2c732 100644 --- a/Octokit.Tests/Octokit.Tests.csproj +++ b/Octokit.Tests/Octokit.Tests.csproj @@ -4,7 +4,7 @@ Tests for Octokit Octokit.Tests GitHub - netcoreapp2.1;net452 + netcoreapp3.1;net452 $(NoWarn);CS4014;CS1998 Octokit.Tests Octokit.Tests @@ -32,7 +32,7 @@ - + $(DefineConstants);NO_SERIALIZABLE;HAS_TYPEINFO diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 004eacccdd..1d63045313 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -53,8 +53,6 @@ - - diff --git a/appveyor.yml b/appveyor.yml index be9bafff9e..4235f56e5e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -image: Visual Studio 2017 +image: Visual Studio 2019 branches: only: @@ -16,4 +16,4 @@ test: off artifacts: - path: 'packaging\octokit*.nupkg' - name: OctokitPackages \ No newline at end of file + name: OctokitPackages diff --git a/build.ps1 b/build.ps1 index 9826e3b2f6..c9d1cbf897 100644 --- a/build.ps1 +++ b/build.ps1 @@ -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 diff --git a/build.sh b/build.sh index db1aeb14a7..4393a1eed8 100755 --- a/build.sh +++ b/build.sh @@ -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 -- "$@" \ No newline at end of file +dotnet run -- "$@" diff --git a/build/.vscode/launch.json b/build/.vscode/launch.json index b097db5239..1c67c5f4c1 100644 --- a/build/.vscode/launch.json +++ b/build/.vscode/launch.json @@ -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 @@ -25,4 +25,4 @@ "processId": "${command:pickProcess}" } ,] -} \ No newline at end of file +} diff --git a/build/Build.csproj b/build/Build.csproj index 0a9bb56631..02360e683f 100644 --- a/build/Build.csproj +++ b/build/Build.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.0 + netcoreapp3.1 diff --git a/build/Context.cs b/build/Context.cs index c6111a0850..dc5685f624 100644 --- a/build/Context.cs +++ b/build/Context.cs @@ -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; diff --git a/build/Tasks/CodeCoverage.cs b/build/Tasks/CodeCoverage.cs index 1d9f0b81b8..e972a12116 100644 --- a/build/Tasks/CodeCoverage.cs +++ b/build/Tasks/CodeCoverage.cs @@ -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 }); diff --git a/global.json b/global.json new file mode 100644 index 0000000000..c685cffc7a --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "3.1.101" + } +}