Skip to content

Commit 436076f

Browse files
authored
Fix broken tests and VS solutions caused by source code reorganization and other build infra cleanup
Changes: * Fix broken tests and VS solutions caused by source code reorganization * Add a check to validate generated code and solutions on PRs * backport some source code reorg to src/Identity * Fix startvs.cmd if you've already run build.ps1 * Add PR checks for tests on Linux/macOS * Skip broken Nginx tests * Add conditions to skip IIS tests on non-Windows platforms
1 parent a10aff3 commit 436076f

File tree

569 files changed

+786
-1254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

569 files changed

+786
-1254
lines changed

.azure/pipelines/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,13 @@ jobs:
1616
beforeBuild:
1717
- powershell: "& ./src/Servers/IIS/tools/UpdateIISExpressCertificate.ps1"
1818
displayName: Setup IISExpress test certificates
19+
- template: jobs/default-build.yml
20+
parameters:
21+
jobName: macOs_Build
22+
jobDisplayName: "Build and test : macOS"
23+
agentOs: macOS
24+
- template: jobs/default-build.yml
25+
parameters:
26+
jobName: Linux_Build
27+
jobDisplayName: "Build and test : Linux"
28+
agentOs: Linux

.azure/pipelines/pr-validation-temp.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,11 @@ jobs:
2828
jobDisplayName: "Build only : Linux"
2929
agentOs: Linux
3030
buildArgs: '/p:SkipTests=true'
31+
- job: Code_check
32+
displayName: Code check
33+
workspace:
34+
clean: all
35+
pool:
36+
vmImage: vs2017-win2016
37+
steps:
38+
- powershell: ./eng/scripts/CodeCheck.ps1 -ci

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
<PropertyGroup>
4040
<StandardTestTfms>netcoreapp2.1;net461</StandardTestTfms>
41+
<!-- Projects which reference Microsoft.AspNetCore.Mvc.Testing should import this targets file to ensure dependency .deps.json files are copied into test output. -->
42+
<MvcTestingTargets>$(MSBuildThisFileDirectory)src\Mvc\src\Microsoft.AspNetCore.Mvc.Testing\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Testing.targets</MvcTestingTargets>
4143
</PropertyGroup>
4244

4345
<Import Project="eng\Dependencies.props" />

build/repo.props

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,10 @@
6363
<ProjectToExclude Include="
6464
$(RepositoryRoot)src\Servers\HttpSys\samples\TestClient\TestClient.csproj;
6565
$(RepositoryRoot)src\Middleware\WebSockets\samples\TestServer\TestServer.csproj;
66+
$(RepositoryRoot)src\Identity\samples\NativeWPFClient\NativeWPFClient.csproj;
6667
"
6768
Condition=" '$(MSBuildRuntimeType)' == 'Core' " />
6869

69-
70-
<!-- Exclude the WPF samples for now because they use classic .csproj, which is not yet supported in our build. -->
71-
<ProjectToExclude Include="$(RepositoryRoot)src\Identity\Identity\samples\NativeWPFClient\NativeWPFClient.csproj;" />
72-
7370
<!-- Exclude the websockets samples for now because they use classic .csproj, which is not yet supported in our build. -->
7471
<ProjectToExclude Include="
7572
$(RepositoryRoot)src\Middleware\WebSockets\samples\**\*.csproj;

eng/ProjectReferences.props

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Routing" ProjectPath="$(RepositoryRoot)src\Http\Routing\src\Microsoft.AspNetCore.Routing.csproj" />
3636
<ProjectReferenceProvider Include="Microsoft.AspNetCore.WebUtilities" ProjectPath="$(RepositoryRoot)src\Http\WebUtilities\src\Microsoft.AspNetCore.WebUtilities.csproj" />
3737
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Html.Abstractions" ProjectPath="$(RepositoryRoot)src\Html\Abstractions\src\Microsoft.AspNetCore.Html.Abstractions.csproj" />
38-
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" ProjectPath="$(RepositoryRoot)src\Identity\EF\src\Microsoft.AspNetCore.Identity.EntityFrameworkCore.csproj" />
39-
<ProjectReferenceProvider Include="Microsoft.Extensions.Identity.Core" ProjectPath="$(RepositoryRoot)src\Identity\Extensions\Core\src\Microsoft.Extensions.Identity.Core.csproj" />
40-
<ProjectReferenceProvider Include="Microsoft.Extensions.Identity.Stores" ProjectPath="$(RepositoryRoot)src\Identity\Extensions\Stores\src\Microsoft.Extensions.Identity.Stores.csproj" />
41-
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity" ProjectPath="$(RepositoryRoot)src\Identity\Identity\Core\src\Microsoft.AspNetCore.Identity.csproj" />
42-
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.Specification.Tests" ProjectPath="$(RepositoryRoot)src\Identity\Identity\Specification.Tests\src\Microsoft.AspNetCore.Identity.Specification.Tests.csproj" />
43-
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.UI" ProjectPath="$(RepositoryRoot)src\Identity\Identity\UI\src\Microsoft.AspNetCore.Identity.UI.csproj" />
38+
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity" ProjectPath="$(RepositoryRoot)src\Identity\Core\src\Microsoft.AspNetCore.Identity.csproj" />
39+
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" ProjectPath="$(RepositoryRoot)src\Identity\EntityFrameworkCore\src\Microsoft.AspNetCore.Identity.EntityFrameworkCore.csproj" />
40+
<ProjectReferenceProvider Include="Microsoft.Extensions.Identity.Core" ProjectPath="$(RepositoryRoot)src\Identity\Extensions.Core\src\Microsoft.Extensions.Identity.Core.csproj" />
41+
<ProjectReferenceProvider Include="Microsoft.Extensions.Identity.Stores" ProjectPath="$(RepositoryRoot)src\Identity\Extensions.Stores\src\Microsoft.Extensions.Identity.Stores.csproj" />
42+
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.Specification.Tests" ProjectPath="$(RepositoryRoot)src\Identity\Specification.Tests\src\Microsoft.AspNetCore.Identity.Specification.Tests.csproj" />
43+
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Identity.UI" ProjectPath="$(RepositoryRoot)src\Identity\UI\src\Microsoft.AspNetCore.Identity.UI.csproj" />
4444
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Connections.Abstractions" ProjectPath="$(RepositoryRoot)src\Servers\Connections.Abstractions\src\Microsoft.AspNetCore.Connections.Abstractions.csproj" />
4545
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.HttpSys" ProjectPath="$(RepositoryRoot)src\Servers\HttpSys\src\Microsoft.AspNetCore.Server.HttpSys.csproj" />
4646
<ProjectReferenceProvider Include="Microsoft.AspNetCore.Server.IISIntegration" ProjectPath="$(RepositoryRoot)src\Servers\IIS\IISIntegration\src\Microsoft.AspNetCore.Server.IISIntegration.csproj" />

eng/scripts/CodeCheck.ps1

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#requires -version 5
2+
<#
3+
.SYNOPSIS
4+
This script runs a quick check for common errors, such as checking that Visual Studio solutions are up to date or that generated code has been committed to source.
5+
#>
6+
param(
7+
[switch]$ci
8+
)
9+
10+
$ErrorActionPreference = 'Stop'
11+
Set-StrictMode -Version 1
12+
Import-Module -Scope Local -Force "$PSScriptRoot/common.psm1"
13+
14+
$repoRoot = Resolve-Path "$PSScriptRoot/../../"
15+
16+
[string[]] $errors = @()
17+
18+
try {
19+
#
20+
# Solutions
21+
#
22+
23+
Write-Host "Checking that solutions are up to date"
24+
25+
Get-ChildItem "$repoRoot/*.sln" -Recurse | % {
26+
Write-Host " Checking $(Split-Path -Leaf $_)"
27+
$slnDir = Split-Path -Parent $_
28+
$sln = $_
29+
& dotnet sln $_ list `
30+
| ? { $_ -ne 'Project(s)' -and $_ -ne '----------' } `
31+
| % {
32+
$proj = Join-Path $slnDir $_
33+
if (-not (Test-Path $proj)) {
34+
$errors += "Missing project. Solution references a project which does not exist: $proj. [$sln] "
35+
}
36+
}
37+
}
38+
39+
#
40+
# Generated code check
41+
#
42+
43+
Write-Host "Re-running code generation"
44+
45+
Invoke-Block {
46+
[string[]] $generateArgs = @()
47+
if ($ci) {
48+
$generateArgs += '-ci'
49+
}
50+
& $repoRoot/build.cmd /t:GenerateProjectList @generateArgs
51+
}
52+
53+
Write-Host "git diff"
54+
& git diff --ignore-space-at-eol --exit-code
55+
if ($LastExitCode -ne 0) {
56+
$status = git status -s | Out-String
57+
$status = $status -replace "`n","`n "
58+
$errors += "Generated code is not up to date."
59+
}
60+
}
61+
finally {
62+
foreach ($err in $errors) {
63+
Write-Host -f Red "error : $err"
64+
}
65+
66+
if ($errors) {
67+
exit 1
68+
}
69+
}

eng/scripts/common.psm1

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
$ErrorActionPreference = 'Stop'
2+
# Update the default TLS support to 1.2
3+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
4+
5+
function Invoke-Block([scriptblock]$cmd, [string]$WorkingDir = $null) {
6+
if ($WorkingDir) {
7+
Push-Location $WorkingDir
8+
}
9+
10+
try {
11+
12+
$cmd | Out-String | Write-Verbose
13+
& $cmd
14+
15+
# Need to check both of these cases for errors as they represent different items
16+
# - $?: did the powershell script block throw an error
17+
# - $lastexitcode: did a windows command executed by the script block end in error
18+
if ((-not $?) -or ($lastexitcode -ne 0)) {
19+
if ($error -ne $null)
20+
{
21+
Write-Warning $error[0]
22+
}
23+
throw "Command failed to execute: $cmd"
24+
}
25+
}
26+
finally {
27+
if ($WorkingDir) {
28+
Pop-Location
29+
}
30+
}
31+
}
32+
33+
function SaveXml([xml]$xml, [string]$path) {
34+
Write-Verbose "Saving to $path"
35+
$ErrorActionPreference = 'stop'
36+
37+
$settings = New-Object System.XML.XmlWriterSettings
38+
$settings.OmitXmlDeclaration = $true
39+
$settings.Encoding = New-Object System.Text.UTF8Encoding( $true )
40+
$writer = [System.XML.XMLTextWriter]::Create($path, $settings)
41+
$xml.Save($writer)
42+
$writer.Close()
43+
}
44+
45+
function LoadXml([string]$path) {
46+
Write-Verbose "Reading from $path"
47+
48+
$ErrorActionPreference = 'stop'
49+
$obj = new-object xml
50+
$obj.PreserveWhitespace = $true
51+
$obj.Load($path)
52+
return $obj
53+
}
54+
55+
function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) {
56+
if ($RemotePath -notlike 'http*') {
57+
Copy-Item $RemotePath $LocalPath
58+
return
59+
}
60+
61+
$retries = 10
62+
while ($retries -gt 0) {
63+
$retries -= 1
64+
try {
65+
Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath
66+
return
67+
}
68+
catch {
69+
Write-Verbose "Request failed. $retries retries remaining"
70+
}
71+
}
72+
73+
Write-Error "Download failed: '$RemotePath'."
74+
}

korebuild-lock.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version:2.1.3-rtm-15850
2-
commithash:725f1523b274d40570f4c923c4712a01f2ef3387
1+
version:2.1.7-build-20181213.1
2+
commithash:69f12b27418b4925734d427b2c3e36c53f265c12

src/Azure/Azure.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Static
3939
EndProject
4040
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.HttpsPolicy", "..\Middleware\HttpsPolicy\src\Microsoft.AspNetCore.HttpsPolicy.csproj", "{A3789DA9-2E0E-41D6-BDDD-11DA4D3DD72D}"
4141
EndProject
42-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IISIntegration", "..\Servers\IIS\src\Microsoft.AspNetCore.Server.IISIntegration\Microsoft.AspNetCore.Server.IISIntegration.csproj", "{9631D314-7B0C-4CEC-8650-0259A8F4C77A}"
42+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IISIntegration", "..\Servers\IIS\IISIntegration\src\Microsoft.AspNetCore.Server.IISIntegration.csproj", "{9631D314-7B0C-4CEC-8650-0259A8F4C77A}"
4343
EndProject
4444
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.Kestrel.Https", "..\Servers\Kestrel\Https\src\Microsoft.AspNetCore.Server.Kestrel.Https.csproj", "{01B31C53-7BAB-4DA7-A55D-C67D9B1FB4A2}"
4545
EndProject

src/Azure/AzureAD/test/FunctionalTests/Microsoft.AspNetCore.Authentication.AzureAD.FunctionalTests.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,5 @@
1717
<Reference Include="Microsoft.Extensions.Logging.Testing" />
1818
</ItemGroup>
1919

20-
21-
<Import Project="$(RepositoryRoot)src\Mvc\src\Microsoft.AspNetCore.Mvc.Testing\build\netstandard2.0\Microsoft.AspNetCore.Mvc.Testing.targets" />
20+
<Import Project="$(MvcTestingTargets)" Condition="'$(MvcTestingTargets)' != ''" />
2221
</Project>

0 commit comments

Comments
 (0)