Skip to content

Commit

Permalink
Merge branch 'main' into feature/codeql
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks-ivanov committed Jul 11, 2024
2 parents 8182c7d + b028b3e commit d8eeb51
Show file tree
Hide file tree
Showing 260 changed files with 1,044 additions and 1,210 deletions.
13 changes: 1 addition & 12 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,7 @@
<!-- default to max warnlevel -->
<AnalysisLevel>preview</AnalysisLevel>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!--
Make sure any documentation comments which are included in code get checked for syntax during the build, but do
not report warnings for missing comments.
Cleanup issue: https://github.com/microsoft/vstest/issues/4236
CS1570: XML comment on '<construct>' has badly formed XML
CS1572: XML comment on 'construct' has a param tag for 'parameter', but there is no parameter by that name
CS1573: Parameter 'parameter' has no matching param tag in the XML comment for 'parameter' (but other parameters do)
CS1574: XML comment on 'construct' has syntactically incorrect cref attribute 'name'
CS1591: Missing XML comment for publicly visible type or member 'Type_or_Member'
-->
<NoWarn>$(NoWarn);CA1416;RS0037;CS1570;CS1572;CS1573;CS1574;CS1591</NoWarn>
<NoWarn>$(NoWarn);CA1416;RS0037</NoWarn>
</PropertyGroup>

<!-- The TFMs to build and test against. -->
Expand Down
6 changes: 5 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>

<PropertyGroup>
<!-- Temporary workaround for Arcade issue in net9-preview5 -->
<_NetFrameworkHostedCompilersVersion Condition="'$(_NetFrameworkHostedCompilersVersion)' == ''">4.11.0-3.24280.3</_NetFrameworkHostedCompilersVersion>
</PropertyGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />

<!--
Expand Down
12 changes: 6 additions & 6 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.24306.4">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="9.0.0-beta.24352.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>7507f80c8db285bbc9939c1dff522a761cf4edc0</Sha>
<Sha>4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.24306.4">
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.24352.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>7507f80c8db285bbc9939c1dff522a761cf4edc0</Sha>
<Sha>4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DiaSymReader.Pdb2Pdb" Version="1.1.0-beta2-19575-01">
Expand All @@ -62,9 +62,9 @@
<Uri>https://github.com/dotnet/symreader-converter</Uri>
<Sha>c5ba7c88f92e2dde156c324a8c8edc04d9fa4fe0</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="9.0.0-beta.24306.4">
<Dependency Name="Microsoft.DotNet.XliffTasks" Version="9.0.0-beta.24352.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>7507f80c8db285bbc9939c1dff522a761cf4edc0</Sha>
<Sha>4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
17 changes: 9 additions & 8 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@
<MicrosoftCodeCoverageVersion>17.9.0</MicrosoftCodeCoverageVersion>
<!-- These versions are used for running unit tests, and running acceptance tests. They are also used as the default version for projects
in TestAssets.sln to allow running and debugging tests in that solution directly in VS without having to run them via AcceptanceTests. -->
<MSTestTestFrameworkVersion>3.3.1</MSTestTestFrameworkVersion>
<MSTestTestAdapterVersion>3.3.1</MSTestTestAdapterVersion>
<MSTestTestFrameworkVersion>3.4.3</MSTestTestFrameworkVersion>
<MSTestTestAdapterVersion>3.4.3</MSTestTestAdapterVersion>
<MSTestAssertExtensionVersion>1.0.3-preview</MSTestAssertExtensionVersion>
<!-- This is the newest version of XUnit that still supports netcoreapp3.1 that we also use to run tests -->
<XUnitFrameworkVersion>2.4.2</XUnitFrameworkVersion>
<XUnitAdapterVersion>2.4.5</XUnitAdapterVersion>
<XUnitConsoleRunnerVersion>2.4.2</XUnitConsoleRunnerVersion>
Expand All @@ -81,19 +82,19 @@
These versions need to be "statically" readable because we read this file as xml in our build and tests.
-->
<!-- <MSTestFrameworkLatestVersion></MSTestFrameworkLatestVersion> is not here, because we don't build MSTest locally, so we don't have access to the latest version. -->
<MSTestFrameworkLatestPreviewVersion>[3.3.1]</MSTestFrameworkLatestPreviewVersion>
<MSTestFrameworkLatestStableVersion>[3.3.1]</MSTestFrameworkLatestStableVersion>
<MSTestFrameworkRecentStableVersion>[3.2.2]</MSTestFrameworkRecentStableVersion>
<MSTestFrameworkLatestPreviewVersion>[3.4.3]</MSTestFrameworkLatestPreviewVersion>
<MSTestFrameworkLatestStableVersion>[3.4.3]</MSTestFrameworkLatestStableVersion>
<MSTestFrameworkRecentStableVersion>[3.3.1]</MSTestFrameworkRecentStableVersion>
<MSTestFrameworkMostDownloadedVersion>[2.2.10]</MSTestFrameworkMostDownloadedVersion>
<MSTestFrameworkPreviousStableVersion>[2.2.10]</MSTestFrameworkPreviousStableVersion>
<MSTestFrameworkLegacyStableVersion>[1.4.0]</MSTestFrameworkLegacyStableVersion>
<!-- Versions that are used to restore previous versions of console, translation layer, and test.sdk for compatibility tests.
See Invoke-TestAssetsBuild in scripts/build.ps1. Exact versions are used to avoid Nuget substituting them by closest match, if we make a typo.
These versions need to be "statically" readable because we read this file as xml in our build and tests. -->
<!-- <VSTestConsoleLatestVersion></VSTestConsoleLatestVersion> is not here, NETTestSdkVersion is used instead, because that is the version of the locally built latest package. -->
<VSTestConsoleLatestPreviewVersion>[17.10.0-release-24177-07]</VSTestConsoleLatestPreviewVersion>
<VSTestConsoleLatestStableVersion>[17.9.0]</VSTestConsoleLatestStableVersion>
<VSTestConsoleRecentStableVersion>[17.8.0]</VSTestConsoleRecentStableVersion>
<VSTestConsoleLatestPreviewVersion>[17.10.0]</VSTestConsoleLatestPreviewVersion>
<VSTestConsoleLatestStableVersion>[17.10.0]</VSTestConsoleLatestStableVersion>
<VSTestConsoleRecentStableVersion>[17.9.0]</VSTestConsoleRecentStableVersion>
<VSTestConsoleMostDownloadedVersion>[17.6.2]</VSTestConsoleMostDownloadedVersion>
<VSTestConsolePreviousStableVersion>[16.11.0]</VSTestConsolePreviousStableVersion>
<VSTestConsoleLegacyStableVersion>[15.9.2]</VSTestConsoleLegacyStableVersion>
Expand Down
143 changes: 82 additions & 61 deletions eng/common/SetupNugetSources.ps1
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
# This script adds internal feeds required to build commits that depend on internal package sources. For instance,
# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables
# disabled internal Maestro (darc-int*) feeds.
#
# Optionally, this script also adds a credential entry for each of the internal feeds if supplied. This credential
# is added via the standard environment variable VSS_NUGET_EXTERNAL_FEED_ENDPOINTS. See
# https://github.com/microsoft/artifacts-credprovider/tree/v1.1.1?tab=readme-ov-file#environment-variables for more details
#
# Optionally, this script also adds a credential entry for each of the internal feeds if supplied.
#
# See example call for this script below.
#
# - task: PowerShell@2
# displayName: Setup Internal Feeds
# displayName: Setup Private Feeds Credentials
# condition: eq(variables['Agent.OS'], 'Windows_NT')
# inputs:
# filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
# arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config
# - task: NuGetAuthenticate@1
#
# arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
# env:
# Token: $(dn-bot-dnceng-artifact-feeds-rw)
#
# Note that the NuGetAuthenticate task should be called after SetupNugetSources.
# This ensures that:
# - Appropriate creds are set for the added internal feeds (if not supplied to the scrupt)
# - The credential provider is installed
# - The credential provider is installed.
#
# This logic is also abstracted into enable-internal-sources.yml.

[CmdletBinding()]
param (
[Parameter(Mandatory = $true)][string]$ConfigFile,
[string]$Password
$Password
)

$ErrorActionPreference = "Stop"
Expand All @@ -35,23 +34,12 @@ Set-StrictMode -Version 2.0

. $PSScriptRoot\tools.ps1

$feedEndpoints = $null

# If a credential is provided, ensure that we don't overwrite the current set of
# credentials that may have been provided by a previous call to the credential provider.
if ($Password -and $null -ne $env:VSS_NUGET_EXTERNAL_FEED_ENDPOINTS) {
$feedEndpoints = $env:VSS_NUGET_EXTERNAL_FEED_ENDPOINTS | ConvertFrom-Json
} elseif ($Password) {
$feedEndpoints = @{ endpointCredentials = @() }
}

# Add source entry to PackageSources
function AddPackageSource($sources, $SourceName, $SourceEndPoint, $pwd) {
function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $pwd) {
$packageSource = $sources.SelectSingleNode("add[@key='$SourceName']")

if ($null -eq $packageSource)
if ($packageSource -eq $null)
{
Write-Host "`tAdding package source" $SourceName
$packageSource = $doc.CreateElement("add")
$packageSource.SetAttribute("key", $SourceName)
$packageSource.SetAttribute("value", $SourceEndPoint)
Expand All @@ -61,33 +49,63 @@ function AddPackageSource($sources, $SourceName, $SourceEndPoint, $pwd) {
Write-Host "Package source $SourceName already present."
}

if ($pwd) {
$feedEndpoints.endpointCredentials = AddCredential -endpointCredentials $feedEndpoints.endpointCredentials -source $SourceEndPoint -pwd $pwd
}
AddCredential -Creds $creds -Source $SourceName -Username $Username -pwd $pwd
}

# Add a new feed endpoint credential
function AddCredential([array]$endpointCredentials, $source, $pwd) {
$endpointCredentials += @{
endpoint = $source;
password = $pwd
# Add a credential node for the specified source
function AddCredential($creds, $source, $username, $pwd) {
# If no cred supplied, don't do anything.
if (!$pwd) {
return;
}
return $endpointCredentials

# Looks for credential configuration for the given SourceName. Create it if none is found.
$sourceElement = $creds.SelectSingleNode($Source)
if ($sourceElement -eq $null)
{
$sourceElement = $doc.CreateElement($Source)
$creds.AppendChild($sourceElement) | Out-Null
}

# Add the <Username> node to the credential if none is found.
$usernameElement = $sourceElement.SelectSingleNode("add[@key='Username']")
if ($usernameElement -eq $null)
{
$usernameElement = $doc.CreateElement("add")
$usernameElement.SetAttribute("key", "Username")
$sourceElement.AppendChild($usernameElement) | Out-Null
}
$usernameElement.SetAttribute("value", $Username)

# Add the <ClearTextPassword> to the credential if none is found.
# Add it as a clear text because there is no support for encrypted ones in non-windows .Net SDKs.
# -> https://github.com/NuGet/Home/issues/5526
$passwordElement = $sourceElement.SelectSingleNode("add[@key='ClearTextPassword']")
if ($passwordElement -eq $null)
{
$passwordElement = $doc.CreateElement("add")
$passwordElement.SetAttribute("key", "ClearTextPassword")
$sourceElement.AppendChild($passwordElement) | Out-Null
}

$passwordElement.SetAttribute("value", $pwd)
}

function InsertMaestroInternalFeedCredentials($Sources, $pwd) {
$maestroInternalSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]")
function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $pwd) {
$maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]")

ForEach ($PackageSource in $maestroInternalSources) {
Write-Host "`tAdding credential for Maestro's feed:" $PackageSource.Key
$feedEndpoints.endpointCredentials = AddCredential -endpointCredentials $feedEndpoints.endpointCredentials -source $PackageSource.value -pwd $pwd
Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds."

ForEach ($PackageSource in $maestroPrivateSources) {
Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key
AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -pwd $pwd
}
}

function EnableInternalPackageSources($DisabledPackageSources) {
$maestroInternalSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]")
ForEach ($DisabledPackageSource in $maestroInternalSources) {
Write-Host "`tEnsuring internal source '$($DisabledPackageSource.key)' is enabled by deleting it from disabledPackageSource"
function EnablePrivatePackageSources($DisabledPackageSources) {
$maestroPrivateSources = $DisabledPackageSources.SelectNodes("add[contains(@key,'darc-int')]")
ForEach ($DisabledPackageSource in $maestroPrivateSources) {
Write-Host "`tEnsuring private source '$($DisabledPackageSource.key)' is enabled by deleting it from disabledPackageSource"
# Due to https://github.com/NuGet/Home/issues/10291, we must actually remove the disabled entries
$DisabledPackageSources.RemoveChild($DisabledPackageSource)
}
Expand All @@ -105,46 +123,49 @@ $doc.Load($filename)

# Get reference to <PackageSources> or create one if none exist already
$sources = $doc.DocumentElement.SelectSingleNode("packageSources")
if ($null -eq $sources) {
if ($sources -eq $null) {
$sources = $doc.CreateElement("packageSources")
$doc.DocumentElement.AppendChild($sources) | Out-Null
}

$creds = $null
if ($Password) {
# Looks for a <PackageSourceCredentials> node. Create it if none is found.
$creds = $doc.DocumentElement.SelectSingleNode("packageSourceCredentials")
if ($creds -eq $null) {
$creds = $doc.CreateElement("packageSourceCredentials")
$doc.DocumentElement.AppendChild($creds) | Out-Null
}
}

# Check for disabledPackageSources; we'll enable any darc-int ones we find there
$disabledSources = $doc.DocumentElement.SelectSingleNode("disabledPackageSources")
if ($null -ne $disabledSources) {
if ($disabledSources -ne $null) {
Write-Host "Checking for any darc-int disabled package sources in the disabledPackageSources node"
EnableInternalPackageSources -DisabledPackageSources $disabledSources
EnablePrivatePackageSources -DisabledPackageSources $disabledSources
}

if ($Password) {
InsertMaestroInternalFeedCredentials -Sources $sources -pwd $Password
}
$userName = "dn-bot"

# Insert credential nodes for Maestro's private feeds
InsertMaestroPrivateFeedCredentials -Sources $sources -Creds $creds -Username $userName -pwd $Password

# 3.1 uses a different feed url format so it's handled differently here
$dotnet31Source = $sources.SelectSingleNode("add[@key='dotnet3.1']")
if ($null -ne $dotnet31Source) {
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v3/index.json" -pwd $Password
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v3/index.json" -pwd $Password
if ($dotnet31Source -ne $null) {
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password
AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password
}

$dotnetVersions = @('5','6','7','8')

foreach ($dotnetVersion in $dotnetVersions) {
$feedPrefix = "dotnet" + $dotnetVersion;
$dotnetSource = $sources.SelectSingleNode("add[@key='$feedPrefix']")
if ($dotnetSource) {
AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedprefix-internal/nuget/v3/index.json" -pwd $Password
AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/v3/index.json" -pwd $Password
if ($dotnetSource -ne $null) {
AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal/nuget/v2" -Creds $creds -Username $userName -pwd $Password
AddPackageSource -Sources $sources -SourceName "$feedPrefix-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/internal/_packaging/$feedPrefix-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password
}
}

$doc.Save($filename)

# If any credentials were added or altered, update the VSS_NUGET_EXTERNAL_FEED_ENDPOINTS environment variable
if ($null -ne $feedEndpoints) {
# ci is set to true so vso logging commands will be used.
$ci = $true
Write-PipelineSetVariable -Name 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' -Value $($feedEndpoints | ConvertTo-Json) -IsMultiJobVariable $false
Write-PipelineSetVariable -Name 'NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED' -Value "False" -IsMultiJobVariable $false
}
2 changes: 1 addition & 1 deletion eng/common/SetupNugetSources.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# This script adds internal feeds required to build commits that depend on intenral package sources. For instance,
# This script adds internal feeds required to build commits that depend on internal package sources. For instance,
# dotnet6-internal would be added automatically if dotnet6 was found in the nuget.config file. In addition also enables
# disabled internal Maestro (darc-int*) feeds.
#
Expand Down
Loading

0 comments on commit d8eeb51

Please sign in to comment.