Skip to content

Commit 81a2caa

Browse files
committed
Adds experimental package for Minimal APIs template
- Update SDK, Arcade and ./eng bits - Add initial template project for 'dotnet new api' - Contributes to dotnet/aspnetcore#34010
1 parent d8e2894 commit 81a2caa

35 files changed

+653
-180
lines changed

eng/common/SetupNugetSources.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,10 @@ if ($dotnet5Source -ne $null) {
158158
AddPackageSource -Sources $sources -SourceName "dotnet5-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet5-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password
159159
}
160160

161+
$dotnet6Source = $sources.SelectSingleNode("add[@key='dotnet6']")
162+
if ($dotnet6Source -ne $null) {
163+
AddPackageSource -Sources $sources -SourceName "dotnet6-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal/nuget/v2" -Creds $creds -Username $userName -Password $Password
164+
AddPackageSource -Sources $sources -SourceName "dotnet6-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal-transport/nuget/v2" -Creds $creds -Username $userName -Password $Password
165+
}
166+
161167
$doc.Save($filename)

eng/common/SetupNugetSources.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,30 @@ if [ "$?" == "0" ]; then
129129
PackageSources+=('dotnet5-internal-transport')
130130
fi
131131

132+
# Ensure dotnet6-internal and dotnet6-internal-transport are in the packageSources if the public dotnet6 feeds are present
133+
grep -i "<add key=\"dotnet6\"" $ConfigFile
134+
if [ "$?" == "0" ]; then
135+
grep -i "<add key=\"dotnet6-internal\"" $ConfigFile
136+
if [ "$?" != "0" ]; then
137+
echo "Adding dotnet6-internal to the packageSources."
138+
PackageSourcesNodeFooter="</packageSources>"
139+
PackageSourceTemplate="${TB}<add key=\"dotnet6-internal\" value=\"https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal/nuget/v2\" />"
140+
141+
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
142+
fi
143+
PackageSources+=('dotnet6-internal')
144+
145+
grep -i "<add key=\"dotnet6-internal-transport\">" $ConfigFile
146+
if [ "$?" != "0" ]; then
147+
echo "Adding dotnet6-internal-transport to the packageSources."
148+
PackageSourcesNodeFooter="</packageSources>"
149+
PackageSourceTemplate="${TB}<add key=\"dotnet6-internal-transport\" value=\"https://pkgs.dev.azure.com/dnceng/internal/_packaging/dotnet6-internal-transport/nuget/v2\" />"
150+
151+
sed -i.bak "s|$PackageSourcesNodeFooter|$PackageSourceTemplate${NL}$PackageSourcesNodeFooter|" $ConfigFile
152+
fi
153+
PackageSources+=('dotnet6-internal-transport')
154+
fi
155+
132156
# I want things split line by line
133157
PrevIFS=$IFS
134158
IFS=$'\n'

eng/common/build.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Param(
2525
[switch] $prepareMachine,
2626
[string] $runtimeSourceFeed = '',
2727
[string] $runtimeSourceFeedKey = '',
28+
[switch] $excludePrereleaseVS,
2829
[switch] $help,
2930
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
3031
)
@@ -65,6 +66,7 @@ function Print-Usage() {
6566
Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
6667
Write-Host " -warnAsError <value> Sets warnaserror msbuild parameter ('true' or 'false')"
6768
Write-Host " -msbuildEngine <value> Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
69+
Write-Host " -excludePrereleaseVS Set to exclude build engines in prerelease versions of Visual Studio"
6870
Write-Host ""
6971

7072
Write-Host "Command line arguments not listed above are passed thru to msbuild."

eng/common/cross/build-android-rootfs.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ __AndroidPackages+=" libandroid-glob"
106106
__AndroidPackages+=" liblzma"
107107
__AndroidPackages+=" krb5"
108108
__AndroidPackages+=" openssl"
109-
__AndroidPackages+=" openldap"
110109

111110
for path in $(wget -qO- http://termux.net/dists/stable/main/binary-$__AndroidArch/Packages |\
112111
grep -A15 "Package: \(${__AndroidPackages// /\\|}\)" | grep -v "static\|tool" | grep Filename); do

eng/common/cross/build-rootfs.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@ __UbuntuPackages+=" libcurl4-openssl-dev"
5555
__UbuntuPackages+=" libkrb5-dev"
5656
__UbuntuPackages+=" libssl-dev"
5757
__UbuntuPackages+=" zlib1g-dev"
58-
__UbuntuPackages+=" libldap2-dev"
5958

6059
__AlpinePackages+=" curl-dev"
6160
__AlpinePackages+=" krb5-dev"
6261
__AlpinePackages+=" openssl-dev"
6362
__AlpinePackages+=" zlib-dev"
64-
__AlpinePackages+=" openldap-dev"
6563

6664
__FreeBSDBase="12.1-RELEASE"
6765
__FreeBSDPkg="1.12.0"
@@ -70,13 +68,15 @@ __FreeBSDPackages+=" icu"
7068
__FreeBSDPackages+=" libinotify"
7169
__FreeBSDPackages+=" lttng-ust"
7270
__FreeBSDPackages+=" krb5"
73-
__FreeBSDPackages+=" libslapi-2.4"
7471

7572
__IllumosPackages="icu-64.2nb2"
7673
__IllumosPackages+=" mit-krb5-1.16.2nb4"
7774
__IllumosPackages+=" openssl-1.1.1e"
7875
__IllumosPackages+=" zlib-1.2.11"
79-
__IllumosPackages+=" openldap-client-2.4.49"
76+
77+
# ML.NET dependencies
78+
__UbuntuPackages+=" libomp5"
79+
__UbuntuPackages+=" libomp-dev"
8080

8181
__UseMirror=0
8282

eng/common/dotnet-install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ case $cpuname in
7070
;;
7171
esac
7272

73-
dotnetRoot="$repo_root/.dotnet"
73+
dotnetRoot="${repo_root}.dotnet"
7474
if [[ $architecture != "" ]] && [[ $architecture != $buildarch ]]; then
7575
dotnetRoot="$dotnetRoot/$architecture"
7676
fi

eng/common/generate-locproject.ps1

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $ErrorActionPreference = "Stop"
1414

1515
Import-Module -Name (Join-Path $PSScriptRoot 'native\CommonLibrary.psm1')
1616

17-
$exclusionsFilePath = "$SourcesDirectory\Localize\LocExclusions.json"
17+
$exclusionsFilePath = "$SourcesDirectory\eng\Localize\LocExclusions.json"
1818
$exclusions = @{ Exclusions = @() }
1919
if (Test-Path -Path $exclusionsFilePath)
2020
{
@@ -25,8 +25,15 @@ Push-Location "$SourcesDirectory" # push location for Resolve-Path -Relative to
2525

2626
# Template files
2727
$jsonFiles = @()
28-
$jsonFiles += Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\en\..+\.json" } # .NET templating pattern
29-
$jsonFiles += Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern
28+
$jsonTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "\.template\.config\\localize\\.+\.en\.json" } # .NET templating pattern
29+
$jsonTemplateFiles | ForEach-Object {
30+
$null = $_.Name -Match "(.+)\.[\w-]+\.json" # matches '[filename].[langcode].json
31+
32+
$destinationFile = "$($_.Directory.FullName)\$($Matches.1).json"
33+
$jsonFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru
34+
}
35+
36+
$jsonWinformsTemplateFiles = Get-ChildItem -Recurse -Path "$SourcesDirectory" | Where-Object { $_.FullName -Match "en\\strings\.json" } # current winforms pattern
3037

3138
$xlfFiles = @()
3239

@@ -44,7 +51,7 @@ $langXlfFiles | ForEach-Object {
4451
$xlfFiles += Copy-Item "$($_.FullName)" -Destination $destinationFile -PassThru
4552
}
4653

47-
$locFiles = $jsonFiles + $xlfFiles
54+
$locFiles = $jsonFiles + $jsonWinformsTemplateFiles + $xlfFiles
4855

4956
$locJson = @{
5057
Projects = @(
@@ -92,14 +99,14 @@ Write-Host "LocProject.json generated:`n`n$json`n`n"
9299
Pop-Location
93100

94101
if (!$UseCheckedInLocProjectJson) {
95-
New-Item "$SourcesDirectory\Localize\LocProject.json" -Force # Need this to make sure the Localize directory is created
96-
Set-Content "$SourcesDirectory\Localize\LocProject.json" $json
102+
New-Item "$SourcesDirectory\eng\Localize\LocProject.json" -Force # Need this to make sure the Localize directory is created
103+
Set-Content "$SourcesDirectory\eng\Localize\LocProject.json" $json
97104
}
98105
else {
99-
New-Item "$SourcesDirectory\Localize\LocProject-generated.json" -Force # Need this to make sure the Localize directory is created
100-
Set-Content "$SourcesDirectory\Localize\LocProject-generated.json" $json
106+
New-Item "$SourcesDirectory\eng\Localize\LocProject-generated.json" -Force # Need this to make sure the Localize directory is created
107+
Set-Content "$SourcesDirectory\eng\Localize\LocProject-generated.json" $json
101108

102-
if ((Get-FileHash "$SourcesDirectory\Localize\LocProject-generated.json").Hash -ne (Get-FileHash "$SourcesDirectory\Localize\LocProject.json").Hash) {
109+
if ((Get-FileHash "$SourcesDirectory\eng\Localize\LocProject-generated.json").Hash -ne (Get-FileHash "$SourcesDirectory\eng\Localize\LocProject.json").Hash) {
103110
Write-PipelineTelemetryError -Category "OneLocBuild" -Message "Existing LocProject.json differs from generated LocProject.json. Download LocProject-generated.json and compare them."
104111

105112
exit 1

eng/common/internal-feed-operations.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ function SetupCredProvider {
4545
# Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable
4646
# feeds successfully
4747

48-
$nugetConfigPath = "$RepoRoot\NuGet.config"
48+
$nugetConfigPath = Join-Path $RepoRoot "NuGet.config"
4949

5050
if (-Not (Test-Path -Path $nugetConfigPath)) {
5151
Write-PipelineTelemetryError -Category 'Build' -Message 'NuGet.config file not found in repo root!'
52-
ExitWithExitCode 1
52+
ExitWithExitCode 1
5353
}
5454

5555
$endpoints = New-Object System.Collections.ArrayList
@@ -85,7 +85,7 @@ function SetupCredProvider {
8585

8686
#Workaround for https://github.com/microsoft/msbuild/issues/4430
8787
function InstallDotNetSdkAndRestoreArcade {
88-
$dotnetTempDir = "$RepoRoot\dotnet"
88+
$dotnetTempDir = Join-Path $RepoRoot "dotnet"
8989
$dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*)
9090
$dotnet = "$dotnetTempDir\dotnet.exe"
9191
$restoreProjPath = "$PSScriptRoot\restore.proj"

eng/common/internal-feed-operations.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function SetupCredProvider {
3939
# Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable
4040
# feeds successfully
4141

42-
local nugetConfigPath="$repo_root/NuGet.config"
42+
local nugetConfigPath="{$repo_root}NuGet.config"
4343

4444
if [ ! "$nugetConfigPath" ]; then
4545
Write-PipelineTelemetryError -category 'Build' "NuGet.config file not found in repo's root!"

eng/common/msbuild.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Param(
55
[bool] $nodeReuse = $true,
66
[switch] $ci,
77
[switch] $prepareMachine,
8+
[switch] $excludePrereleaseVS,
89
[Parameter(ValueFromRemainingArguments=$true)][String[]]$extraArgs
910
)
1011

eng/common/post-build/sourcelink-validation.ps1

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ param(
1414
$global:RepoFiles = @{}
1515

1616
# Maximum number of jobs to run in parallel
17-
$MaxParallelJobs = 6
17+
$MaxParallelJobs = 16
18+
19+
$MaxRetries = 5
1820

1921
# Wait time between check for system load
2022
$SecondsBetweenLoadChecks = 10
@@ -29,7 +31,10 @@ $ValidatePackage = {
2931
# Ensure input file exist
3032
if (!(Test-Path $PackagePath)) {
3133
Write-Host "Input file does not exist: $PackagePath"
32-
return 1
34+
return [pscustomobject]@{
35+
result = 1
36+
packagePath = $PackagePath
37+
}
3338
}
3439

3540
# Extensions for which we'll look for SourceLink information
@@ -59,7 +64,10 @@ $ValidatePackage = {
5964

6065
# We ignore resource DLLs
6166
if ($FileName.EndsWith('.resources.dll')) {
62-
return
67+
return [pscustomobject]@{
68+
result = 0
69+
packagePath = $PackagePath
70+
}
6371
}
6472

6573
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, $TargetFile, $true)
@@ -91,36 +99,49 @@ $ValidatePackage = {
9199
$Status = 200
92100
$Cache = $using:RepoFiles
93101

94-
if ( !($Cache.ContainsKey($FilePath)) ) {
95-
try {
96-
$Uri = $Link -as [System.URI]
97-
98-
# Only GitHub links are valid
99-
if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) {
100-
$Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode
102+
$totalRetries = 0
103+
104+
while ($totalRetries -lt $using:MaxRetries) {
105+
if ( !($Cache.ContainsKey($FilePath)) ) {
106+
try {
107+
$Uri = $Link -as [System.URI]
108+
109+
# Only GitHub links are valid
110+
if ($Uri.AbsoluteURI -ne $null -and ($Uri.Host -match 'github' -or $Uri.Host -match 'githubusercontent')) {
111+
$Status = (Invoke-WebRequest -Uri $Link -UseBasicParsing -Method HEAD -TimeoutSec 5).StatusCode
112+
}
113+
else {
114+
# If it's not a github link, we want to break out of the loop and not retry.
115+
$Status = 0
116+
$totalRetries = $using:MaxRetries
117+
}
101118
}
102-
else {
119+
catch {
120+
Write-Host $_
103121
$Status = 0
104122
}
105123
}
106-
catch {
107-
write-host $_
108-
$Status = 0
109-
}
110-
}
111124

112-
if ($Status -ne 200) {
113-
if ($NumFailedLinks -eq 0) {
114-
if ($FailedFiles.Value -eq 0) {
115-
Write-Host
125+
if ($Status -ne 200) {
126+
$totalRetries++
127+
128+
if ($totalRetries -ge $using:MaxRetries) {
129+
if ($NumFailedLinks -eq 0) {
130+
if ($FailedFiles.Value -eq 0) {
131+
Write-Host
132+
}
133+
134+
Write-Host "`tFile $RealPath has broken links:"
135+
}
136+
137+
Write-Host "`t`tFailed to retrieve $Link"
138+
139+
$NumFailedLinks++
116140
}
117-
118-
Write-Host "`tFile $RealPath has broken links:"
119141
}
120-
121-
Write-Host "`t`tFailed to retrieve $Link"
122-
123-
$NumFailedLinks++
142+
else {
143+
break
144+
}
124145
}
125146
}
126147
}
@@ -136,7 +157,7 @@ $ValidatePackage = {
136157
}
137158
}
138159
catch {
139-
160+
Write-Host $_
140161
}
141162
finally {
142163
$zip.Dispose()
@@ -220,6 +241,7 @@ function ValidateSourceLinkLinks {
220241
# Process each NuGet package in parallel
221242
Get-ChildItem "$InputPath\*.symbols.nupkg" |
222243
ForEach-Object {
244+
Write-Host "Starting $($_.FullName)"
223245
Start-Job -ScriptBlock $ValidatePackage -ArgumentList $_.FullName | Out-Null
224246
$NumJobs = @(Get-Job -State 'Running').Count
225247

@@ -267,6 +289,10 @@ function InstallSourcelinkCli {
267289
try {
268290
InstallSourcelinkCli
269291

292+
foreach ($Job in @(Get-Job)) {
293+
Remove-Job -Id $Job.Id
294+
}
295+
270296
ValidateSourceLinkLinks
271297
}
272298
catch {

0 commit comments

Comments
 (0)