Skip to content

Support ASP.NET Core 3.0 #280

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

Merged
merged 28 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
121c568
First sweep. Seems to build at least.
benmccallum Oct 18, 2019
b2f3db2
Various fixes
benmccallum Oct 18, 2019
6a0c47d
Getting closer to all tests passing.
benmccallum Oct 18, 2019
b08091c
Samples.Server.Tests all passing.
benmccallum Oct 18, 2019
874fc9e
Trying to get ws tests working
benmccallum Oct 18, 2019
4b7fff5
chore: Remove whitespace from line ending
benmccallum Oct 25, 2019
e4aa346
refactor: Add existing as links
benmccallum Oct 25, 2019
0fb477e
chore: Remove CodeGeneration tooling refs from sample projs
benmccallum Oct 25, 2019
e2db50b
feat: Remove old UIs since they are delivered by middleware now
benmccallum Oct 25, 2019
a7328b7
refactor: Simplify AddGraphAuthorization overloads
benmccallum Oct 25, 2019
7cf3a8d
feat: Don't target netcoreapp3.0 for Core project unnecessarily
benmccallum Oct 25, 2019
b9d6127
refactor: Return tests to using TestServer
benmccallum Oct 25, 2019
0ed84ec
refactor: Use existing Program and Startup for samples project, with …
benmccallum Oct 25, 2019
e83b4a3
feat: Simplify code target blocks
benmccallum Oct 25, 2019
b10f9bb
fix: Try fix appveyor build :crosses-fingers:
benmccallum Oct 25, 2019
b619c8e
fix: Try this
benmccallum Oct 25, 2019
b77d1da
feat: Upgrade cake
benmccallum Oct 25, 2019
42ba825
feat: Log nuget version in appveyor build process
benmccallum Nov 5, 2019
0d29301
refactor: Formatting build.cake
benmccallum Nov 5, 2019
bdd139b
Perhaps this is it...
benmccallum Nov 5, 2019
365d209
refactor: Don't even need a 3.0-only project. Multi-target the SUT pr…
benmccallum Nov 5, 2019
031f123
feat: Don't use 2.2.x version of websockets pkg in 3.0
benmccallum Nov 5, 2019
19fe3c3
refactor:
benmccallum Nov 5, 2019
8797c80
fix: WebSockets tests on 3.0 need to use TestStartup's Configure method
benmccallum Nov 5, 2019
49ffa20
Merge branch 'develop' into feature/asp-net-core-3.0-support
benmccallum Nov 5, 2019
208dfde
chore: Remove commented out framework stuff in build.cake and use con…
benmccallum Nov 5, 2019
8f925d2
Final round of feedback changes
benmccallum Nov 6, 2019
9daf8d0
Merge branch 'develop' into feature/asp-net-core-3.0-support
sungam3r Nov 6, 2019
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
35 changes: 22 additions & 13 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>

<PropertyGroup Label="Сommon properties">
<LangVersion>latest</LangVersion>
<PackageProjectUrl>https://github.com/graphql-dotnet/server</PackageProjectUrl>
Expand All @@ -11,38 +11,47 @@
<Company>graphql-dotnet</Company>
</PropertyGroup>

<PropertyGroup>
<IsNetCore30OnwardsTarget>$(TargetFramework.Equals('netcoreapp3.0'))</IsNetCore30OnwardsTarget>
</PropertyGroup>

<PropertyGroup Label="Package dependency versions">
<MicrosoftAspNetCoreVersion>2.2.0</MicrosoftAspNetCoreVersion>
<MicrosoftAspNetCoreHttpAbstractionsVersion>2.2.0</MicrosoftAspNetCoreHttpAbstractionsVersion>
<MicrosoftAspNetCoreHttpVersion>2.2.2</MicrosoftAspNetCoreHttpVersion>
<MicrosoftAspNetCoreTestHostVersion>2.2.0</MicrosoftAspNetCoreTestHostVersion>
<MicrosoftAspNetCoreWebSocketsVersion>2.2.1</MicrosoftAspNetCoreWebSocketsVersion>
<MicrosoftAspNetCoreAuthorizationVersion>2.2.0</MicrosoftAspNetCoreAuthorizationVersion>
<MicrosoftAspNetCoreHostingAbstractionsVersion>2.2.0</MicrosoftAspNetCoreHostingAbstractionsVersion>

<MicrosoftExtensionsLoggingVersion>2.2.0</MicrosoftExtensionsLoggingVersion>
<MicrosoftExtensionsOptionsVersion>2.2.0</MicrosoftExtensionsOptionsVersion>
<MicrosoftExtensionsDependencyInjectionVersion>2.2.0</MicrosoftExtensionsDependencyInjectionVersion>
<MicrosoftExtensionsDependencyInjectionAbstractionsVersion>2.2.0</MicrosoftExtensionsDependencyInjectionAbstractionsVersion>

<MicrosoftNETTestSdkVersion>16.2.0</MicrosoftNETTestSdkVersion>
<MicrosoftAspNetCoreTestHostVersion Condition="'$(IsNetCore30OnwardsTarget)' == 'False'">2.2.0</MicrosoftAspNetCoreTestHostVersion>
<MicrosoftAspNetCoreTestHostVersion Condition="'$(IsNetCore30OnwardsTarget)' == 'True'">3.0.0</MicrosoftAspNetCoreTestHostVersion>

<MicrosoftExtensionsLoggingVersion Condition="'$(IsNetCore30OnwardsTarget)' == 'False'">2.2.0</MicrosoftExtensionsLoggingVersion>
<MicrosoftExtensionsLoggingVersion Condition="'$(IsNetCore30OnwardsTarget)' == 'True'">3.0.0</MicrosoftExtensionsLoggingVersion>
<MicrosoftExtensionsOptionsVersion Condition="'$(IsNetCore30OnwardsTarget)' == 'False'">2.2.0</MicrosoftExtensionsOptionsVersion>
<MicrosoftExtensionsOptionsVersion Condition="'$(IsNetCore30OnwardsTarget)' == 'True'">3.0.0</MicrosoftExtensionsOptionsVersion>
<MicrosoftExtensionsDependencyInjectionVersion Condition="'$(IsNetCore30OnwardsTarget)' == 'False'">2.2.0</MicrosoftExtensionsDependencyInjectionVersion>
<MicrosoftExtensionsDependencyInjectionVersion Condition="'$(IsNetCore30OnwardsTarget)' == 'True'">3.0.0</MicrosoftExtensionsDependencyInjectionVersion>
<MicrosoftExtensionsDependencyInjectionAbstractionsVersion Condition="'$(IsNetCore30OnwardsTarget)' == 'False'">2.2.0</MicrosoftExtensionsDependencyInjectionAbstractionsVersion>
<MicrosoftExtensionsDependencyInjectionAbstractionsVersion Condition="'$(IsNetCore30OnwardsTarget)' == 'True'">3.0.0</MicrosoftExtensionsDependencyInjectionAbstractionsVersion>

<MicrosoftNETTestSdkVersion>16.3.0</MicrosoftNETTestSdkVersion>
<CastleCoreVersion>4.4.0</CastleCoreVersion>
<NSubstituteVersion>3.1.0</NSubstituteVersion>
<NewtonsoftJsonVersion>12.0.2</NewtonsoftJsonVersion>
<GraphQLVersion>3.0.0-preview-1294</GraphQLVersion>
<MoqVersion>4.12.0</MoqVersion>
<MoqVersion>4.13.1</MoqVersion>
<ShouldlyVersion>3.0.2</ShouldlyVersion>

<xunitVersion>2.4.1</xunitVersion>
<xunitrunnervisualstudioVersion>2.4.1</xunitrunnervisualstudioVersion>

<SerilogVersion>2.8.0</SerilogVersion>
<SerilogAspNetCoreVersion>2.1.1</SerilogAspNetCoreVersion>
<SerilogSinksConsoleVersion>3.1.1</SerilogSinksConsoleVersion>

<SystemThreadingTasksDataflowVersion>4.9.0</SystemThreadingTasksDataflowVersion>
<SystemThreadingTasksExtensionsVersion>4.5.3</SystemThreadingTasksExtensionsVersion>
<SystemReactiveVersion>4.1.5</SystemReactiveVersion>
</PropertyGroup>

</Project>
5 changes: 3 additions & 2 deletions GraphQL.Server.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2036
# Visual Studio Version 16
VisualStudioVersion = 16.0.29411.108
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Transports.Subscriptions.WebSockets", "src\Transports.Subscriptions.WebSockets\Transports.Subscriptions.WebSockets.csproj", "{4DF1CB8E-30AA-4281-9056-D49FDBF4C496}"
EndProject
Expand All @@ -13,6 +13,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{0FD61587
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
build.cake = build.cake
Directory.Build.props = Directory.Build.props
GitVersion.yml = GitVersion.yml
nuget.config = nuget.config
EndProjectSection
Expand Down
7 changes: 2 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
os: Visual Studio 2017
os: Visual Studio 2019

version: 0.0.0-{build}
pull_requests:
Expand All @@ -17,10 +17,7 @@ test: off
skip_branch_with_pr: false

install:
- ps: Install-Product node LTS
- ps: choco install dotnetcore-sdk --no-progress --confirm --version 2.2.104
- node --version
- npm --version
- ps: choco install dotnetcore-sdk --no-progress --confirm --version 3.0.100
- dotnet --version

on_failure:
Expand Down
45 changes: 22 additions & 23 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
var artifactsDir = Directory(Argument<string>("artifactsDir", "./artifacts"));
var publishDir = Directory(Argument<string>("publishDir", "./publish"));
var framework = Argument<string>("framework", "netstandard2.0");
var runtime = Argument<string>("runtime", "win-x64");
var sln = "./GraphQL.Server.Transports.sln";
var projectFiles = new [] {
Expand All @@ -30,15 +29,14 @@ Task("Publish")
{
var settings = new DotNetCorePublishSettings
{
Framework = framework,
Configuration = configuration,
OutputDirectory = publishDir,
Runtime = runtime
};

foreach(var projectFile in projectFiles)
{
DotNetCorePublish(projectFile, settings);
DotNetCorePublish(projectFile, settings);
}
});

Expand All @@ -57,9 +55,9 @@ Task("Pack")
MSBuildSettings = buildSettings
};

foreach(var projectFile in projectFiles)
foreach (var projectFile in projectFiles)
{
DotNetCorePack(projectFile, settings);
DotNetCorePack(projectFile, settings);
}
});

Expand All @@ -70,13 +68,12 @@ Task("Build")
{
var settings = new DotNetCoreBuildSettings
{
Framework = framework,
Configuration = configuration
};

foreach(var projectFile in projectFiles)
foreach (var projectFile in projectFiles)
{
DotNetCoreBuild(projectFile, settings);
DotNetCoreBuild(projectFile, settings);
}
});

Expand All @@ -92,32 +89,34 @@ Task("Clean")
Task("Restore")
.Does(()=>
{
foreach(var projectFile in projectFiles)
foreach (var projectFile in projectFiles)
{
DotNetCoreRestore(projectFile);
DotNetCoreRestore(projectFile);
}
});

Task("SetVersion")
.Does(()=> {
var versionInfo = GitVersion(new GitVersionSettings {
RepositoryPath = "."
});
version = versionInfo.NuGetVersion;
Information($"Version: {version}, FullSemVer: {versionInfo.FullSemVer}");
.Does(()=>
{
var versionInfo = GitVersion(new GitVersionSettings {
RepositoryPath = "."
});
version = versionInfo.NuGetVersion;
Information($"Version: {version}, FullSemVer: {versionInfo.FullSemVer}");

if(AppVeyor.IsRunningOnAppVeyor) {
AppVeyor.UpdateBuildVersion(version);
}
});
if (AppVeyor.IsRunningOnAppVeyor) {
AppVeyor.UpdateBuildVersion(version);
}
});

Task("Test")
.Does(()=> {
.Does(()=>
{
var projectFiles = GetFiles("./tests/**/*.csproj");
foreach(var file in projectFiles)
foreach (var file in projectFiles)
{
DotNetCoreTest(file.FullPath);
}
});
});

RunTarget(target);
77 changes: 49 additions & 28 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ Specifies the amount of information to be displayed.
Shows description about tasks.
.PARAMETER DryRun
Performs a dry run.
.PARAMETER Experimental
Uses the nightly builds of the Roslyn script engine.
.PARAMETER Mono
Uses the Mono Compiler rather than the Roslyn script engine.
.PARAMETER SkipToolPackageRestore
Skips restoring of packages.
.PARAMETER ScriptArgs
Expand All @@ -49,13 +45,28 @@ Param(
[switch]$ShowDescription,
[Alias("WhatIf", "Noop")]
[switch]$DryRun,
[switch]$Experimental,
[switch]$Mono,
[switch]$SkipToolPackageRestore,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
)

# Attempt to set highest encryption available for SecurityProtocol.
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
# will typically produce a message for PowerShell v2 (just an info
# message though)
try {
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
# installed (.NET 4.5 is an in-place upgrade).
# PowerShell Core already has support for TLS 1.2 so we can skip this if running in that.
if (-not $IsCoreCLR) {
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
}
} catch {
Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
}

[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
function MD5HashFile([string] $filePath)
{
Expand Down Expand Up @@ -85,7 +96,7 @@ function GetProxyEnabledWebClient
{
$wc = New-Object System.Net.WebClient
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$wc.Proxy = $proxy
return $wc
}
Expand All @@ -110,15 +121,16 @@ $MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
# Make sure tools folder exists
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
Write-Verbose -Message "Creating tools directory..."
New-Item -Path $TOOLS_DIR -Type directory | out-null
New-Item -Path $TOOLS_DIR -Type Directory | Out-Null
}

# Make sure that packages.config exist.
if (!(Test-Path $PACKAGES_CONFIG)) {
Write-Verbose -Message "Downloading packages.config..."
try {
Write-Verbose -Message "Downloading packages.config..."
try {
$wc = GetProxyEnabledWebClient
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
} catch {
Throw "Could not download packages.config."
}
}
Expand Down Expand Up @@ -146,24 +158,30 @@ if (!(Test-Path $NUGET_EXE)) {
}

# Save nuget.exe path to environment to be available to child processed
$ENV:NUGET_EXE = $NUGET_EXE
$env:NUGET_EXE = $NUGET_EXE
$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
"mono `"$NUGET_EXE`""
} else {
"`"$NUGET_EXE`""
}

# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent) {
Push-Location
Set-Location $TOOLS_DIR

# Check for changes in packages.config and remove installed tools if true.
[string] $md5Hash = MD5HashFile($PACKAGES_CONFIG)
[string] $md5Hash = MD5HashFile $PACKAGES_CONFIG
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
Write-Verbose -Message "Missing or changed package.config hash..."
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
Remove-Item -Recurse
Remove-Item -Recurse -Force
}

Write-Verbose -Message "Restoring tools from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""

$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""

if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet tools."
Expand All @@ -172,7 +190,7 @@ if(-Not $SkipToolPackageRestore.IsPresent) {
{
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
}
Write-Verbose -Message ($NuGetOutput | out-string)
Write-Verbose -Message ($NuGetOutput | Out-String)

Pop-Location
}
Expand All @@ -183,13 +201,13 @@ if (Test-Path $ADDINS_PACKAGES_CONFIG) {
Set-Location $ADDINS_DIR

Write-Verbose -Message "Restoring addins from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""

if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet addins."
}

Write-Verbose -Message ($NuGetOutput | out-string)
Write-Verbose -Message ($NuGetOutput | Out-String)

Pop-Location
}
Expand All @@ -200,13 +218,13 @@ if (Test-Path $MODULES_PACKAGES_CONFIG) {
Set-Location $MODULES_DIR

Write-Verbose -Message "Restoring modules from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
$NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""

if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet modules."
}

Write-Verbose -Message ($NuGetOutput | out-string)
Write-Verbose -Message ($NuGetOutput | Out-String)

Pop-Location
}
Expand All @@ -216,20 +234,23 @@ if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe at $CAKE_EXE"
}

$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
"mono `"$CAKE_EXE`""
} else {
"`"$CAKE_EXE`""
}


# Build Cake arguments
$cakeArguments = @("$Script");
if ($Target) { $cakeArguments += "-target=$Target" }
# Build an array (not a string) of Cake arguments to be joined later
$cakeArguments = @()
if ($Script) { $cakeArguments += "`"$Script`"" }
if ($Target) { $cakeArguments += "-target=`"$Target`"" }
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
if ($ShowDescription) { $cakeArguments += "-showdescription" }
if ($DryRun) { $cakeArguments += "-dryrun" }
if ($Experimental) { $cakeArguments += "-experimental" }
if ($Mono) { $cakeArguments += "-mono" }
$cakeArguments += $ScriptArgs

# Start Cake
Write-Host "Running build script..."
&$CAKE_EXE $cakeArguments
Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
exit $LASTEXITCODE
Loading