From e9f5d997843035e37a41e21098a8ec31f69d808d Mon Sep 17 00:00:00 2001 From: Ryan Gribble Date: Sun, 18 Mar 2018 06:34:55 +1000 Subject: [PATCH] update test apps and cake.frosting build to netcoreapp2.0 but keep libraries targeting netstandard1.1 --- .travis.yml | 9 +- Octokit.Reactive/Octokit.Reactive.csproj | 9 +- .../Octokit.Tests.Conventions.csproj | 4 +- .../Octokit.Tests.Integration.csproj | 4 +- Octokit.Tests/Octokit.Tests.csproj | 8 +- Octokit/Octokit.csproj | 6 +- appveyor.yml | 2 +- build.ps1 | 16 +-- build.sh | 5 +- build/.vscode/launch.json | 19 ++- build/.vscode/tasks.json | 13 +- build/Build.csproj | 2 +- build/Context.cs | 2 +- build/Tasks/Build.cs | 2 +- script/cibuild.ps1 | 127 ------------------ 15 files changed, 49 insertions(+), 179 deletions(-) delete mode 100644 script/cibuild.ps1 diff --git a/.travis.yml b/.travis.yml index 9745633faa..d9f978c4d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,15 +5,14 @@ matrix: - os: linux dist: trusty sudo: required - dotnet: 1.0.4 + dotnet: 2.0.3 - os: osx - osx_image: xcode8 - dotnet: 1.0.4 + osx_image: xcode8.3 + dotnet: 2.0.3 before_script: - if test "$TRAVIS_OS_NAME" == "osx"; then export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/; else export FrameworkPathOverride=/usr/lib/mono/4.5/; fi script: - git fetch --unshallow --tags - - dotnet --info - - ./build.sh --linksources=true + - ./build.sh --linksources=true --verbosity=verbose diff --git a/Octokit.Reactive/Octokit.Reactive.csproj b/Octokit.Reactive/Octokit.Reactive.csproj index baad918d5d..74412737fd 100644 --- a/Octokit.Reactive/Octokit.Reactive.csproj +++ b/Octokit.Reactive/Octokit.Reactive.csproj @@ -33,6 +33,9 @@ + + + @@ -40,10 +43,4 @@ - - - - - - diff --git a/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj b/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj index 6c7a859b78..9ec5bb01ea 100644 --- a/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj +++ b/Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj @@ -4,13 +4,11 @@ Convention-based tests for Octokit Octokit.Tests.Conventions GitHub - netcoreapp1.0;net452 + netcoreapp2.0;net452 $(NoWarn);CS4014;CS1998 Octokit.Tests.Conventions Octokit.Tests.Conventions true - 1.6.0 - 1.0.4 false false false diff --git a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj index 0a690798d5..4d28bd722d 100644 --- a/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj +++ b/Octokit.Tests.Integration/Octokit.Tests.Integration.csproj @@ -4,13 +4,11 @@ Integration tests for Octokit Octokit.Tests.Integration GitHub - netcoreapp1.0;net452 + netcoreapp2.0;net452 $(NoWarn);CS4014;CS1998 Octokit.Tests.Integration Octokit.Tests.Integration true - 1.6.0 - 1.0.4 false false false diff --git a/Octokit.Tests/Octokit.Tests.csproj b/Octokit.Tests/Octokit.Tests.csproj index ea1d63455e..d53e8befbe 100644 --- a/Octokit.Tests/Octokit.Tests.csproj +++ b/Octokit.Tests/Octokit.Tests.csproj @@ -4,13 +4,11 @@ Tests for Octokit Octokit.Tests GitHub - netcoreapp1.0;net452 + netcoreapp2.0;net452 $(NoWarn);CS4014;CS1998 Octokit.Tests Octokit.Tests true - 1.6.0 - 1.0.4 false false false @@ -31,10 +29,10 @@ - + - + $(DefineConstants);NO_SERIALIZABLE;HAS_TYPEINFO diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index d46a35000a..3ea8f869e4 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -37,9 +37,9 @@ - - - + + + diff --git a/appveyor.yml b/appveyor.yml index f806456db8..afa12b1369 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ init: build_script: - dotnet --info - - ps: .\build.ps1 -LinkSources + - ps: .\build.ps1 -LinkSources -Verbosity Verbose test: off diff --git a/build.ps1 b/build.ps1 index 8bc9e1839c..2cceda4763 100644 --- a/build.ps1 +++ b/build.ps1 @@ -26,15 +26,15 @@ Param( [string]$Configuration = "Release", [switch]$LinkSources, [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] - [string]$Verbosity = "Verbose", + [string]$Verbosity = "Normal", [switch]$WhatIf, [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] [string[]]$ScriptArgs ) -$DotNetChannel = "preview"; -$DotNetVersion = "1.0.1"; -$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.1/scripts/obtain/dotnet-install.ps1"; +$DotNetChannel = "2.0"; +$DotNetVersion = "2.0.3"; +$DotNetInstallerUri = "https://dot.net/v1/dotnet-install.ps1"; $NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" # Make sure tools folder exists @@ -65,7 +65,7 @@ if (Get-Command dotnet -ErrorAction SilentlyContinue) { $FoundDotNetCliVersion = dotnet --version; } -if($FoundDotNetCliVersion -ne $DotNetVersion) { +if($FoundDotNetCliVersion -lt $DotNetVersion) { $InstallPath = Join-Path $PSScriptRoot ".dotnet" if (!(Test-Path $InstallPath)) { mkdir -Force $InstallPath | Out-Null; @@ -106,14 +106,14 @@ $Arguments = @{ # Start Cake Push-Location Set-Location build -Write-Host "Restoring packages..." +Write-Host "Preparing Cake.Frosting build runner..." Invoke-Expression "dotnet restore" if($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE; } -Write-Host "Running build..." -Invoke-Expression "dotnet run -- $Arguments" +Write-Host "Running Cake.Frosting build runner..." +Invoke-Expression "dotnet run $Arguments" if($LASTEXITCODE -ne 0) { Pop-Location; exit $LASTEXITCODE; diff --git a/build.sh b/build.sh index ad542461c5..af97dec198 100755 --- a/build.sh +++ b/build.sh @@ -7,5 +7,8 @@ if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then fi cd build +echo "Preparing Cake.Frosting build runner..." dotnet restore -dotnet run -- "$@" \ No newline at end of file + +echo "Executing Cake.Frosting build runner..." +dotnet run "$@" \ No newline at end of file diff --git a/build/.vscode/launch.json b/build/.vscode/launch.json index 46d477c672..b097db5239 100644 --- a/build/.vscode/launch.json +++ b/build/.vscode/launch.json @@ -1,15 +1,20 @@ { - "version": "0.2.0", - "configurations": [ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ { "name": ".NET Core Launch (console)", "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceRoot}\\bin\\Debug\\netcoreapp1.0\\build.dll", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/Build.dll", "args": [], - "cwd": "${workspaceRoot}", - "externalConsole": false, + "cwd": "${workspaceFolder}", + // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window + "console": "internalConsole", "stopAtEntry": false, "internalConsoleOptions": "openOnSessionStart" }, @@ -17,7 +22,7 @@ "name": ".NET Core Attach", "type": "coreclr", "request": "attach", - "processId": "${command.pickProcess}" + "processId": "${command:pickProcess}" } - ] + ,] } \ No newline at end of file diff --git a/build/.vscode/tasks.json b/build/.vscode/tasks.json index 9cd37c150c..eb37628fe7 100644 --- a/build/.vscode/tasks.json +++ b/build/.vscode/tasks.json @@ -1,15 +1,14 @@ { - "version": "0.1.0", - "command": "dotnet", - "isShellCommand": true, - "args": [], + "version": "2.0.0", "tasks": [ { - "taskName": "build", + "label": "build", + "command": "dotnet", + "type": "process", "args": [ - "${workspaceRoot}\\project.json" + "build", + "${workspaceFolder}/Build.csproj" ], - "isBuildCommand": true, "problemMatcher": "$msCompile" } ] diff --git a/build/Build.csproj b/build/Build.csproj index 725a902448..00ec86fa0a 100644 --- a/build/Build.csproj +++ b/build/Build.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp1.1 + netcoreapp2.0 diff --git a/build/Context.cs b/build/Context.cs index 0fbaedb524..12f6cb437f 100644 --- a/build/Context.cs +++ b/build/Context.cs @@ -36,7 +36,7 @@ public DotNetCoreTestSettings GetTestSettings() if (!this.IsRunningOnWindows()) { - var testFramework = "netcoreapp1.0"; + var testFramework = "netcoreapp2.0"; this.Information($"Running tests against {testFramework} only as we're not on Windows."); settings.Framework = testFramework; diff --git a/build/Tasks/Build.cs b/build/Tasks/Build.cs index 3d679aed00..68035fc0bd 100644 --- a/build/Tasks/Build.cs +++ b/build/Tasks/Build.cs @@ -13,7 +13,7 @@ public override void Run(Context context) Configuration = context.Configuration, ArgumentCustomization = args => args .Append("/p:Version={0}", context.Version.GetSemanticVersion()) - .AppendIfTrue(context.LinkSources, "/p:SourceLinkCreate=true") + .Append("/p:SourceLinkCreate={0}", context.LinkSources.ToString().ToLower()) }); } } \ No newline at end of file diff --git a/script/cibuild.ps1 b/script/cibuild.ps1 deleted file mode 100644 index 71feefbbf3..0000000000 --- a/script/cibuild.ps1 +++ /dev/null @@ -1,127 +0,0 @@ -<# -.SYNOPSIS - Builds and tests Octokit -.DESCRIPTION - Janky runs this script after checking out a revision and cleaning its - working tree. -.PARAMETER Clean - When true, all untracked (and ignored) files will be removed from the work - tree. Defaults to false. -#> - -Param( - [switch] - $Clean = $false -) - -Set-StrictMode -Version Latest - -try { - # Make the output width reeeeeaaaaaly wide so our output doesn't get hard-wrapped. - # - $Host.UI.RawUI.BufferSize = New-Object Management.Automation.Host.Size -ArgumentList 5000, 25 -} catch { - # Most likely we were run in a cmd.exe terminal which won't allow setting - # the BufferSize to such a strange size. -} - -$rootDirectory = Split-Path (Split-Path $MyInvocation.MyCommand.Path) - -Push-Location $rootDirectory - -function Die-WithOutput($exitCode, $output) { - Write-Output $output - Write-Output "" - exit $exitCode -} - -function Dump-Error($output) { - $exitCode = $LastExitCode - - $errors = $output | Select-String ": error" - if ($errors) { - $output = "Likely errors:", $errors, "", "Full output:", $output - } - - Die-WithOutput $exitCode $output -} - -function Run-Command([scriptblock]$Command, [switch]$Fatal, [switch]$Quiet) { - $output = "" - if ($Quiet) { - $output = & $Command 2>&1 - } else { - & $Command - } - - if (!$Fatal) { - return - } - - $exitCode = 0 - if ($LastExitCode -ne 0) { - $exitCode = $LastExitCode - } elseif (!$?) { - $exitCode = 1 - } else { - return - } - - $error = "Error executing command ``$Command``." - if ($output) { - $error = "$error Output:", $output - } - Die-WithOutput $exitCode $error -} - -if ($Clean) { - Write-Output "Cleaning work tree..." - Write-Output "" - - Run-Command -Quiet -Fatal { git clean -xdf } -} - - -Write-Output "Installing FAKE..." -Write-Output "" -.\tools\nuget\nuget.exe "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-Version" "2.18.1" - -Write-Output "Building Octokit..." -Write-Output "" -$output = & .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=BuildApp" "buildMode=Release" -if ($LastExitCode -ne 0) { - Dump-Error($output) -} - -Write-Output "Running unit tests..." -Write-Output "" -$output = & .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=UnitTests" "buildMode=Release" -if ($LastExitCode -ne 0) { - Dump-Error($output) -} - - -Write-Output "Running convention tests..." -Write-Output "" -$output = & .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=ConventionTests" "buildMode=Release" -if ($LastExitCode -ne 0) { - Dump-Error($output) -} - -Write-Output "Running integration tests..." -Write-Output "" -$output = & .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=IntegrationTests" "buildMode=Release" -if ($LastExitCode -ne 0) { - Dump-Error($output) -} - -Write-Output "Creating NuGet packages..." -Write-Output "" -$output = & .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=CreatePackages" "buildMode=Release" -if ($LastExitCode -ne 0) { - Dump-Error($output) -} - -$exitCode = 0 - -exit $exitCode